Mixed configurations

Ubuntu 14.04, everything from official repos, nothing self compiled etc. lxc configurations and containers are from year 2015. Now since last upgrade at september 2017 it warns at every operation “The configuration file contains legacy configuration keys. Please update your configuration file!”, but everything works. Now I tried to upgrade configurations but after using lxc-update-config to update configuration it will not accept this new configuration, cannot stop or start (lxc-start -n name, lxc-stop -n name). For example "…lxc_file_for_each_line: 58 Failed to parse config: lxc.net.0.ipv4… ". Restoring previous configurations and everything is OK again, but this warning about old configuration is of-course back.

Sounds like you have a some kind of mix of versions going on on that system.
What do you get with:

dpkg -l | grep lxc
snap list

ii liblxc1 2.1.0-0ubuntu1~ubuntu14.04.1~ppa1 amd64 Linux Containers userspace tools (library)
ii lxc 2.1.0-0ubuntu1~ubuntu14.04.1~ppa1 all Transitional package for lxc1
ii lxc-common 2.1.0-0ubuntu1~ubuntu14.04.1~ppa1 amd64 Linux Containers userspace tools (common tools)
ii lxc-templates 2.1.0-0ubuntu1~ubuntu14.04.1~ppa1 amd64 Linux Containers userspace tools (templates)
ii lxc1 2.1.0-0ubuntu1~ubuntu14.04.1~ppa1 amd64 Linux Containers userspace tools
ii lxcfs 2.0.7-0ubuntu5~ubuntu14.04.1~ppa1 amd64 FUSE based filesystem for LXC
ii lxctl 0.3.1+debian-3 all Utility to manage LXC
ii python3-lxc 2.1.0-0ubuntu1~ubuntu14.04.1~ppa1 amd64 Linux Containers userspace tools (Python 3.x bindings)

The program ‘snap’ is currently not installed.

That’s odd, 2.1.0 should definitely be able to understand the new syntax (lxc.net.0.ipv4.*).
I wonder if you’re hitting a bug in lxc-update-config, one we might have fixed already but that didn’t make it to the stable packages yet.

Would you mind sharing your container config after running lxc-update-config?

For one thing, lxc.net.0.ipv4 isn’t valid, it should be lxc.net.0.ipv4.address so I wonder if we’re looking at a few issues in the updater.

@brauner

lxc-update-config -c .local/share/lxc/alus/config

diff -Nura .local/share/lxc/alus/config.backup .local/share/lxc/alus/config

--- .local/share/lxc/alus/config.backup 2018-02-18 19:14:29.735857863 +0200
+++ .local/share/lxc/alus/config        2018-02-18 19:14:30.043865964 +0200
@@ -8,10 +8,10 @@
 lxc.arch = x86_64

 # Container specific configuration
-lxc.id_map = u 0 100000 65536
-lxc.id_map = g 0 100000 65536
-lxc.rootfs = /home/kasutaja/.local/share/lxc/test/rootfs
-lxc.utsname = test
+lxc.idmap = u 0 100000 65536
+lxc.idmap = g 0 100000 65536
+lxc.rootfs.path = /home/kasutaja/.local/share/lxc/test/rootfs
+lxc.uts.name = test
 lxc.mount.entry = /home/kasutaja/data data none bind 0 0
 lxc.mount.entry = /home/kasutaja/media media none bind 0 0
 lxc.mount.entry = /home/kasutaja/sdc1 sdc1 none bind 0 0
@@ -24,19 +24,19 @@
 #lxc.cgroup.cpuset.cpus = 2
 lxc.cgroup.cpuset.cpus = 7
 lxc.cgroup.cpu.shares = 75
-#lxc.aa_profile = unconfined
+#lxc.apparmor.profile = unconfined

 # Network configuration
-lxc.network.type = veth
-lxc.network.flags = up
-lxc.network.link = lxcbr0
-lxc.network.hwaddr = 00:16:3e:1d:e7:09
-lxc.network.mtu = 1500
-lxc.tty = 1
-lxc.network.ipv4 = 10.29.231.9/24
-lxc.network.ipv4.gateway = 10.29.231.1
-lxc.network.ipv6 = 2001:470:7cdf:231::9/64
-lxc.network.ipv6.gateway = 2001:470:7cdf:231::1
+lxc.net.0.type = veth
+lxc.net.0.flags = up
+lxc.net.0.link = lxcbr0
+lxc.net.0.hwaddr = 00:16:3e:1d:e7:09
+lxc.net.0.mtu = 1500
+lxc.tty.max = 1
+lxc.net.0.ipv4 = 10.29.231.9/24
+lxc.net.0.ipv4.gateway = 10.29.231.1
+lxc.net.0.ipv6 = 2001:470:7cdf:231::9/64
+lxc.net.0.ipv6.gateway = 2001:470:7cdf:231::1

 lxc.start.auto = 1
 lxc.start.delay = 5

Right, so that’s indeed buggy.

You’ll need to replace lxc.net.0.ipv4 by lxc.net.0.ipv4.address and lxc.net.0.ipv6 by lxc.net.0.ipv6.address.

Ok, after this manual fix it works now. No new errors and old warnings.