Arch lxc-auto.service causes boot delay

I am not sure if this is a bug in NetworkManager or i fits the right place to ask but here goes:

I recently migrated to arch and took my 16.04 containers with me. This worked like a charm.

However, after I enabled lxc-auto.service (& lxc.service) i had a considerable increase in boot-time. +20 sec to be exact. Now, as far as i can see this is because they are calling for network-online.target, which is understandable.

So, what happens in Ubuntu that’s different? I dont know of any ways to delay systemd services, but why is it halting the rest of the boot process?

What’s that lxc-auto.service? We have no such thing upstream. The only services that we ship are:

  • lxc.service
  • lxc@.service
  • lxc-net.service
[anders@idea ~]$ cat /etc/systemd/system/multi-user.target.wants/lxc.service 
[Unit]
Description=LXC Container Initialization and Autoboot Code
After=network.target lxc-net.service
Wants=lxc-net.service
Documentation=man:lxc-autostart man:lxc

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/lib/lxc/lxc-apparmor-load
ExecStart=/usr/lib/lxc/lxc-containers start
ExecStop=/usr/lib/lxc/lxc-containers stop
# Environment=BOOTUP=serial
# Environment=CONSOLETYPE=serial
Delegate=yes
StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target
[anders@idea ~]$ cat /etc/systemd/system/multi-user.target.wants/lxc-auto.service 
[Unit]
Description=Autostart LXC Container
After=network.target

[Service]
Type=forking
ExecStart=/usr/bin/lxc-autostart
ExecStop=/usr/bin/lxc-autostart -s
Delegate=true
TasksMax=32768

[Install]
WantedBy=multi-user.target
[anders@idea ~]$ cat /etc/systemd/system/multi-user.target.wants/lxc.service 

Well, I did not make these :slight_smile:

What version of LXD is that?

It could very well be that the Arch packager did some changes on top of what upstream ships for systemd units. Ubuntu and Debian ship the exact units that are upstream.

Its LXC.

[anders@idea ~]$ sudo pacman -Ss lxc |grep installed
community/lxc 1:2.0.8-2 [installed]

Oops, typo :slight_smile:
Right, so upstream 2.0.8 only ships with:

  • lxc.service
  • lxc@.service
  • lxc-net.service

So anything else you have is coming as the result of a change by your distro’s packager.

https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/lxc

Indeed suggests that lxc-auto.service is added and lxc.service is modified compared to what we ship upstream, explaining why your system doesn’t behave the same way as it did on Ubuntu (where we ship the unmodified systemd units from upstream).

The upstream unit for lxc.service is:

[Unit]
Description=LXC Container Initialization and Autoboot Code
After=network.target lxc-net.service
Wants=lxc-net.service
Documentation=man:lxc-autostart man:lxc

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=@LIBEXECDIR@/lxc/lxc-apparmor-load
ExecStart=@LIBEXECDIR@/lxc/lxc-containers start
ExecStop=@LIBEXECDIR@/lxc/lxc-containers stop
# Environment=BOOTUP=serial
# Environment=CONSOLETYPE=serial
Delegate=yes
StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target

So no mention of network-online in there.

No, I’m sorry to report the problem is with NetworkManager it self.

From what I understand network-online.target is the “new” network.target.

Thanks for looking in to this!