lxc - ubuntu xenial - reboot

lxc - ubuntu xenial - reboot

  • Written by
    Walter Doekes
  • Published on

The current Ubuntu/Xenial guest image on our new LXD container host contained too many packages.

It held the lxd package and a bunch of lxc packages. They are not needed on the container guest. At some point before or after removing them, for some reason the ZFS container got unmounted.

This went unnoticed until I tried a reboot:

guest# reboot

lxd# lxc exec guest /bin/bash
error: Container is not running.

lxd# lxc start guest
error: Error calling
  'lxd forkstart guest /var/lib/lxd/containers /var/log/lxd/guest/lxc.conf':
  err='exit status 1'
Try `lxc info --show-log guest` for more info

lxd# lxc info --show-log guest
...
  lxc 20160323093357.449 ERROR    lxc_conf - conf.c:mount_rootfs:806 -
    No such file or directory - failed to get real path for
    '/var/lib/lxd/containers/guest/rootfs'

lxd# zfs list -o name,mounted | grep guest
data/containers/guest  no

lxd# zfs mount data/containers/guest

Now the guest was able to start again.

Next up, the Ubuntu/Xenial refused to reboot because the dhclient would hang during shutdown. A quick workaround was to append this last line to /etc/network/interfaces.d/eth0.cfg:

# The primary network interface
auto eth0
iface eth0 inet dhcp
  pre-down /usr/bin/pkill -9 dhclient

Now the reboot worked as intended.

Interestingly, when trying to reproduce both issues on the 23rd of March, I couldn’t with the latest Ubuntu/Xenial image. It looks like at least one of the issues got fixed. Good job, LXC people!


Back to overview Newer post: lxcfs - proc uptime Older post: renaming / lxd managed lxc container