Description of problem: lxc-net.service should provide a bridge device and a dhcp server for linux containers but it fails to start during the boot process thus blocking containers to start. Version-Release number of selected component (if applicable): lxc-2.0.0-1.fc24.x86_64 lxc-libs-2.0.0-1.fc24.x86_64 lxc-templates-2.0.0-1.fc24.x86_64 Steps to Reproduce: 1. Install lxc and set-up one container inside of the fresh installation of Fedora 24 (beta/KDE/x64_86); 2. enable lxc-net service (systemctl enable lxc-net.service); 3. make the container starts on boot: lxc.start.auto = 1 lxc.group = onboot 4. reboot Actual results: Jun 06 23:52:35 localhost lxc-net[1082]: dnsmasq: directory /etc/resolv.conf for resolv-file is missing, cannot poll Jun 06 23:52:35 localhost dnsmasq[1194]: directory /etc/resolv.conf for resolv-file is missing, cannot poll Jun 06 23:52:35 localhost dnsmasq[1194]: FAILED to start up Container didn't start because lxc-net.service failed to start up. Expected results: To have containers up and running after booting Fedora. Additional info: /etc/resolv.conf is created by NetworkManager during the boot sequence (/etc/resolv.conf -> /var/run/NetworkManager/resolv.conf), hence I assume that this is an issue of service ordering in systemd, but I don't see how exactly. lxc-net.service is waiting for network-online.target and network-online.target is depending on NetworkManager-wait-online.service, i.e. when NetworkManager is ready.
I would also note that the machine where I encounter this issue is a laptop which usually acquire network connection after I log in. Working workaround is to put "NetworkManager.service" as a dependency in lxc-net.service: [Unit] After=network-online.target NetworkManager.service Then it works as expected.
In theory, having After=network-online.target should already be enough, to ensure (as the name says) that the network is online. But (afaict) network-online.target currently only works reliably if systemd-networkd is used. On the other hand, depending on NetworkManager as you proposed is also not an option, as not everyone is using NM. So, this is something we cannot fix in lxc. Someone has to repair the network-online.target for NM.
Can you please explain more what would be expected behaviour of network-online for this case so that I can open a new bug report?
So, network-online depends on, and is scheduled after NetworkManager-wait-online (reversely, by setting Before in NM-wait-online). The NM-wait-online service calls /usr/bin/nm-online -s --timeout 30, and the man page says for -s: "Wait for NetworkManager startup to complete, rather than waiting for network connectivity specifically." To me, this looks reasonable. However, there must be a reason it doesn't work for you. Is NetworkManager-wait-online enabled?
Wait, I've read some of the systemd docs again. For network-online to have effect, we might need to add a Wants= dependency to lxc-net. Also, ignore my comment about NetworkManager-wait-online being enabled, that shouldn't be necessary. Could you try and see if adding Wants=network-online.target to the [Unit] section of lxc-net helps?
Yep, that works. Thanks. Thus, this is my lxc-net.service: [Unit] Description=LXC network bridge setup Wants=network-online.target Before=lxc.service [Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/libexec/lxc/lxc-net start ExecStop=/usr/libexec/lxc/lxc-net stop [Install] WantedBy=multi-user.targe
lxc-2.0.6-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-b4dd1db1e7
lxc-2.0.6-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-868350fe5a
lxc-2.0.6-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-e5ff0ed40c
lxc-2.0.6-2.fc25 has been pushed to the Fedora 25 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-2016-868350fe5a
lxc-2.0.6-2.fc23 has been pushed to the Fedora 23 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-2016-e5ff0ed40c
lxc-2.0.6-2.fc24 has been pushed to the Fedora 24 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-2016-b4dd1db1e7
lxc-2.0.6-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.
lxc-2.0.6-2.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
lxc-2.0.6-2.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.