nspawn: resolv.conf might not be created initially (#4799)

This might happen that resolv.conf is missing in a minimal rootfs and in this
case the following warning is emitted:

 Failed to mount n/a on /mnt/etc/resolv.conf (MS_BIND ""): No such file or directory

This patch fixes this case.
This commit is contained in:
Franck Bui 2016-12-07 21:36:39 +01:00 committed by Lennart Poettering
parent e332833f07
commit 5367354dae

View file

@ -1299,6 +1299,8 @@ static int setup_resolv_conf(const char *dest) {
* advantage that the container will be able to follow the host's DNS server configuration changes
* transparently. */
(void) touch(where);
r = mount_verbose(LOG_WARNING, "/usr/lib/systemd/resolv.conf", where, NULL, MS_BIND, NULL);
if (r >= 0)
return mount_verbose(LOG_ERR, NULL, where, NULL,