Miro Hrončok wrote:
Hi, since our Koji builds have disabled internet access, I want to do
same, so I have more Koji consistent builds.
I have the following in /etc/mock/site-defaults.cfg:
config_opts['use_host_resolv'] = True # or False, no difference
config_opts['rpmbuild_networking'] = False
The internet doesn't work (desired), but has large timeouts (undesired).
This is especially tedious when building Python packages that use
intershpinx and they try to fetch stuff from the internet during build (it
fails, but that's OK). For each such request, the build is prolonged for ~1
minute. I have Python packages that try to download (and fail) 10+
intershpinx inventories during build. That's 10+ minutes waiting for
something that'll fail anyway. I've been adding hacks to sphinx calls to
make intersphinx timeout sooner, but it's unnecessary clutter in the spec.
So I decided to test this. I've added the following to the spec:
time curl http://example.com/
Here are the times:
* my mock: real 0m56.595s Could not resolve host
* Koji: real 0m0.030s Could not resolve host
This seems to be just about resolving hosts. See with IP address:
time curl http://188.8.131.52/
* my mock: real 2m10.953s Connection timed out
* Koji: real 2m11.337s Connection timed out
Is there a trick to make resolving fail early?
Most likely this is due to systemd-nspawn copying
/etc/resolv.conf from the host to the chroot (despite the
mock use_host_resolv setting). Take a look for that in an
Assuming your issue is due to the resolv.conf, it's filed as
. Support was added in
mock-1.4.10 to bind mount a file as well as a directory.
The plan is to use that support to bind mount an empty
resolv.conf in the chroot when use_host_resolv is true, to
override the host copy that systemd-nspawn populates.
It should be possible to manually override the resolv.conf
now by bind mounting an empty file on /etc/resolv.conf in
the chroot. I've been meaning to play with this, but have
not made time to do it until just now.
I thought something like this would work:
'/etc/resolv.conf'))" >> /etc/mock/site-defaults.cfg
But testing this briefly, the host resolv.conf still ends up
in the chroot. I'm probably overlooking something obvious.
At least, I hope I am.
No one ever went broke underestimating the taste of the American
-- H. L. Mencken