fgrehm/vagrant-lxc

Container start fails with lxc 2.1 due to deprecated configuration keys

dkerkow opened this issue ยท 9 comments

Environment:

  • Ubuntu 16.04
  • LXC 2.1 from ppa:ubuntu-lxc/lxd-stable
  • Vagrant 2.0
  • Vagrant Plugins:
    • lxc (0.6.0)
    • vagrant-aws (0.7.2)
    • vagrant-digitalocean (0.9.1)
    • vagrant-lxc (1.2.3)
    • vagrant-share (1.1.9, system)

Vagrant LXC refused to work yesterday after LXC got updated to 2.1 from the ppa:ubuntu-lxc/lxd-stable. Downgrading to 2.0.8 and Removing the PPA using ppa-purge fixed it for me, but this will probably strike back when LXC 2.1 hits more and more distros.

Looks like some config keys were changed/deprecated in LXC 2.1, causing lxc-start and other tools to print deprecation warnings and exit with an error. There is even a script for updating configs, but this needs to be fixed in vagrant-lxc I guess. See for LXC 2.1 release announcement for reference.

From what Im seeing on my side (I'm not using funky network configs), the only option making it crash is lxc.kmsg = 0. The config is generated on the box itself though, using fgrehm boxes (which is no longer maintained). obnoxxx seems to be new maintainer of the fork, but it seems to be using kmsg as well (https://github.com/obnoxxx/vagrant-lxc-base-boxes/blob/master/conf/ubuntu-xenial#L9).

Reading the lxc2.1 announcement though, there seems to be some important changes to the network attributes, so I think this issue deserve to stay open (at least until someone test it with the network changes).

For people who just want to move on, open up you config file ~/.vagrant.d/boxes/your-box-name/your-box-version/lxc/lxc-config and comment lxc.kmsg = 0.

Note : when installing lxc with ubuntu 17.10, 2.1 is installed.

I'm seeing similar failure on VM creation running on Ubuntu 17.10 which comes with LXC 2.1... Downstream bug for our setup at https://phabricator.wikimedia.org/T178541

In addition to the "lxc.kmsg = 0" line I also had to comment out "lxc.pivotdir = lxc_putold".

I also ran into this bug: lxc/lxc#1902

To work around, I used

config.vm.provider "lxc" do |lxc, override|
  lxc.backingstore = "dir"

LXC 2.1 changed many configuration keys. It's mostly just naming changes, so it should be easily fixable. But yes, until then, we can say that vagrant-lxc is not compatible with LXC v2.1+. I'll update the readme.

Hey guys, I have created a new box with updated lxc-config here.

I'm planning on tackling this soon for an upcoming 1.3 release and thinking that the simplest approach would be to rely on the lxc-update-config supplied with LXC 2.1. We would continue to generate config with old keys and run lxc-update-config on the end result when LXC >= 2.1.

Any thoughts?

Open question: do we still have the same failure with LXC 2.1.1? Me, when I start the container directly through LXC, I get a warning about keys being deprecated, but otherwise, the machine starts fine. Also, in the v2.1.1 changelog I see:

conf: Ignore lxc.kmsg and lxc.pivotdir

which makes me think that the root cause for this issue is fixed.

So I went ahead with my plan of using lxc-update-config in the commit referenced above. That should normally resolve LXC 2.1+ config-related issues. Closing.