Bug 1514028 - do not populate /etc/resolv.conf when networking is disabled
Summary: do not populate /etc/resolv.conf when networking is disabled
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-16 14:03 UTC by Remi Collet
Modified: 2018-06-29 09:38 UTC (History)
12 users (show)

Fixed In Version: mock-1.4.11-1.fc27 mock-1.4.11-1.fc28 mock-1.4.11-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-16 19:32:39 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Remi Collet 2017-11-16 14:03:05 UTC
Since update from 1.4.6-1.fc25 to 1.4.7-2.fc25, mock is unusable

Terribly slow.... ~100 times slower.

Ex, in a %check:
- with previous version, lot of units are executed each second.
- with new version, 10-15" for each unit test

Downgrading to 1.4.6-1.fc25 solves the issue.

Comment 1 Remi Collet 2017-11-16 14:47:23 UTC
In a spec file

time strace php somestuff

With 1.4.6

real	0m0.434s
user	0m0.277s
sys	0m0.163s

With 1.4.7

real	0m20.195s
user	0m0.130s
sys	0m0.056s

It hangs (various time) on 

socket(AF_INET6, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET6, sin6_port=htons(53), inet_pton(AF_INET6, "fe80::4a83:c7ff:fe35:8c10", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = -1 EINVAL (Invalid argument)
close(3)                                = 0
socket(AF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.1.1")}, 16) = 0
poll([{fd=3, events=POLLOUT}], 1, 0)    = 1 ([{fd=3, revents=POLLOUT}])
sendmmsg(3, [{msg_hdr={msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\333\366\1\0\0\1\0\0\0\0\0\0 ca64236f7c8944c9944"..., iov_len=55}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, msg_len=55}, {msg_hdr={msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\340\n\1\0\0\1\0\0\0\0\0\0 ca64236f7c8944c9944"..., iov_len=55}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, msg_len=55}], 2, MSG_NOSIGNAL) = 2
poll([{fd=3, events=POLLIN}], 1, 5000

Comment 2 Remi Collet 2017-11-16 14:50:11 UTC
192.168.1.1 is the dns server.

Comment 3 Remi Collet 2017-11-16 14:52:07 UTC
Poor workaround:

config_opts['rpmbuild_networking'] = True

Comment 4 Miroslav Suchý 2017-11-22 08:47:04 UTC
Can you please provide reproducer?

Yes, networking is off. This has been always the default. Previously with old chroot, it was done using cheating (just remove /etc/resolv.conf) so connection using ip adresses worked.
With nspawn the isolation is better. And all build systems (koji, copr) switch off networking by default to provide reproducible builds.
So it is recommended to not use any networking related stuff during build.

Comment 5 Remi Collet 2017-11-22 08:49:16 UTC
> Can you please provide reproducer?

Try to build any php package with a test suite.

Ex: php-zendframework-zend-serializer

Comment 6 Remi Collet 2017-11-22 08:50:39 UTC
> So it is recommended to not use any networking related stuff during build.

I don't use any networking, and indeed i WANT networking to be off

Enable it is only a workaround to this issue.

Comment 7 Remi Collet 2017-11-22 09:55:30 UTC
Hmmm.. not all PHP packages are affected

But can be reproduced with glpi package from rawhide.

Comment 8 Remi Collet 2017-11-22 10:33:38 UTC
> it was done using cheating (just remove /etc/resolv.conf) 

But keeping the host resolv.conf seems a bad idea when no network available, an empty file will be better.

Comment 9 Remi Collet 2017-11-22 10:55:00 UTC
Notice: config_opts['use_host_resolv'] = False doesn't seems to work.

# cat /var/lib/mock/fedora-27-x86_64/root/etc/resolv.conf
nameserver fe80::4a83:c7ff:fe35:8c10%enp2s0
nameserver 192.168.1.1

Comment 10 Fedora End Of Life 2017-12-12 10:04:09 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 11 Miroslav Suchý 2017-12-19 11:02:55 UTC
I disabled copying resolv.conf when network is disabled in commit 782e150

However this is not enough. Once we call first command in systemd-nspawn. E.g.,
sudo '/usr/bin/systemd-nspawn' '-q' '-M' '7ffd9feeb1684e71860ebda7431195db' '-D' '/var/lib/mock/fedora-26-x86_64/root' '-a' '--setenv=TERM=vt100' '--setenv=SHELL=/bin/bash' '--setenv=HOME=/builddir' '--setenv=HOSTNAME=mock' '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin' '--setenv=PS1=<mock-chroot> \\s-\\v\\$ ' '--setenv=LANG=cs_CZ.UTF-8' '/usr/sbin/userdel' '-r' '-f' 'mockbuild'

then nspawn will unconditionally copy host resolv.conf

https://github.com/systemd/systemd/blob/master/src/nspawn/nspawn.c#L1425

We can pass --private-network but that will reintroduce:
https://github.com/rpm-software-management/mock/issues/113

Michal, any suggestions?

Comment 12 Michal Sekletar 2017-12-20 13:49:54 UTC
(In reply to Miroslav Suchý from comment #11)

> Michal, any suggestions?

What about bind mounting empty file over /etc/resolv.conf when networking is disabled? This should mitigate the issue and should be fairly easy to implement. Right?

Comment 13 Miroslav Suchý 2017-12-21 07:43:16 UTC
But then nspawn will either bindmount host resolv.conf over my empty bindmount or just copy there the content (line 1466).

Comment 14 Michal Sekletar 2017-12-28 18:22:34 UTC
(In reply to Miroslav Suchý from comment #13)
> But then nspawn will either bindmount host resolv.conf over my empty
> bindmount or just copy there the content (line 1466).

I meant to add --bind option to nspawn itself. I think if you explicitly bind mount empty file on /etc/resolv.conf than nspawn shouldn't revert that by doing implicit bind mount (or copy) of actual resolv.conf from the host.

Comment 15 Elliott Sales de Andrade 2018-03-04 08:49:41 UTC
Ping? It's very annoying that I can't build things like git-lfs due to test timeouts, but then they magically work on koji.

Comment 16 Miroslav Suchý 2018-03-13 10:29:12 UTC
The work on the bindmount single file is in process. Once done, I can do something about this. I guess that ETA for this can be several weeks (6-8).

Comment 17 Fedora End Of Life 2018-05-03 09:10:36 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 18 Todd Zullinger 2018-05-30 17:27:27 UTC
I filed a preliminary PR for this at https://github.com/rpm-software-management/mock/pull/190.  There are some issues with it as noted in the PR, but they should be relatively easy to resolve.

I tried to use the new bind mount of a file in mock, but systemd-nspawn overrode that, so I had to use the nspawn --bind option.  (It seems like it would be nicest if systemd-nspawn could just not override the resolv.conf when networking was not configured.)

Comment 19 Miroslav Suchý 2018-06-06 11:51:03 UTC
Merged.

Comment 20 Fedora Update System 2018-06-12 21:03:52 UTC
mock-1.4.11-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-cb4e456696

Comment 21 Fedora Update System 2018-06-12 21:04:02 UTC
mock-1.4.11-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-4f5f46b079

Comment 22 Fedora Update System 2018-06-12 21:04:11 UTC
mock-1.4.11-1.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-ee1a74616a

Comment 23 Fedora Update System 2018-06-13 04:32:08 UTC
mock-1.4.11-1.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-ee1a74616a

Comment 24 Fedora Update System 2018-06-13 22:12:42 UTC
mock-1.4.11-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-4f5f46b079

Comment 25 Fedora Update System 2018-06-14 13:47:43 UTC
mock-1.4.11-1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-cb4e456696

Comment 26 Fedora Update System 2018-06-16 19:32:39 UTC
mock-1.4.11-1.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 27 Fedora Update System 2018-06-16 20:16:39 UTC
mock-1.4.11-1.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 28 Fedora Update System 2018-06-29 09:38:29 UTC
mock-1.4.11-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.