LXC config error after update

Posted: 2018-07-19 21:46:48 by Alasdair Keyes

Direct Link | RSS feed

At some point in the recent past Linux Mint 18.3/Ubuntu 16.04 Xenial had updated lxc containers to a more recent version and when running lxc-ls I was greeted with the following error for all of my containers.

# lxc-ls
Failed to load config for mydevcontainer1
Failed to load config for mydevcontainer2
Failed to load config for mydevcontainer3
Failed to load config for mydevcontainer4

It appears support for an older container config version has been discontinued and it was unable to read the old versions, a bit of Googling found the answer was to use lxc-update-config helper utility.

# lxc-update-config -c /var/lib/lxc/mydevcontainer/config
# lxc-start -n mydevcontainer

For those with a lot of containers, the following one liner will resolve them all for you in one fell swoop

lxc-ls 2>&1 | grep "Failed to load config for" | awk '{print $NF}' | xargs -i lxc-update-config -c /var/lib/lxc/'{}'/config

If you found this useful, please feel free to donate via bitcoin to 1NT2ErDzLDBPB8CDLk6j1qUdT6FmxkMmNz

© Alasdair Keyes

IT Consultancy Services

I'm now available for IT consultancy and software development services - Cloudee LTD.

Happy user of Digital Ocean (Affiliate link)


Validate HTML 5