Skip to content
BinaryPatrick
Go back

Troubleshooting LXC Boot Hang

Edit page

Recently I was troubleshooting slow bootup times with an LXC container I’d created. The container previously was running well, but after an update seemed to be running slowly. I restored it from a backup but still experienced slowness so, I investigated. The first really helpful step I found to take was to log out the bootup sequence of the container.

lxc-start -n <container-id> -F --logfile=lxc.log --logpriority=debug

This command follows the boot process and logs out every step. Doing so I was able to find the hung systemd service

[  OK  ] Started containerd container runtime.
[FAILED] Failed to start Wait for network to be configured by ifupdown.
See 'systemctl status ifupdown-wait-online.service' for details.
[  OK  ] Reached target Network is Online.
         Starting Docker Application Container Engine...

I ran the following to determine which exact service was causing the hangup.

systemd-analyze blame

From here it looked like an issue with some service waiting for network-online.target so I checked which services were dependent

systemctl show -p WantedBy network-online.target

The issue seemed like /etc/systemd/system/systemd-networkd-wait-online.service was hung and did not return. This resulted in basically waiting 2 minutes until the timeout. Instead I made the service more specific. I used ip link to get the name of my ethernet adapter. Then I could check it specifically using -i eth0.

sudo nano /etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service
[Unit]
Description=Wait for Network to be Configured
Documentation=man:systemd-networkd-wait-online.service(8)
DefaultDependencies=no
Conflicts=shutdown.target
BindsTo=systemd-networkd.service
After=systemd-networkd.service
Before=network-online.target shutdown.target

[Service]
Type=oneshot
ExecStart=/lib/systemd/systemd-networkd-wait-online -i eth0
RemainAfterExit=yes

[Install]
WantedBy=network-online.target

Additional Reading


Edit page
Share this post on:

Previous Post
Adding a Figurine Login Message
Next Post
Using Prune to Manage Archives