Home Troubleshooting LXC Boot Hang

Troubleshooting LXC Boot Hang

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...

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

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

systemd-analyze blame

Between the two, I found a service I had created for a specific network adapter that I had since deleted. This was causing my issue, once I unregister the service and it booted normally. An easy solution once I had visibility into an otherwise vexing problem.

Additional Reading

This post is licensed under CC BY 4.0 by the author.