Re: How to make DNS resolving fail early in mock?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Miro Hrončok wrote:
> Hi, since our Koji builds have disabled internet access, I want to do the
> 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://1.1.1.1/
> 
>  * 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
affected chroot.

Assuming your issue is due to the resolv.conf, it's filed as
https://bugzilla.redhat.com/1514028.  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:

touch /etc/mock/empty
echo "config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/etc/mock/empty', '/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.

-- 
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
No one ever went broke underestimating the taste of the American
public.
    -- H. L. Mencken

Attachment: signature.asc
Description: PGP signature

_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx/message/NW3NAM2Y62QQVPS33CP33DIXLRRZOUBK/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux