"The configuration file contains legacy configuration keys." in New LXD Installation

I recently installed LXD on a Fedora 26 Server vm, and any time I run an lxc exec command, I receive the warning
The configuration file contains legacy configuration keys. Please update your configuration file!
I have reviewed the discussion on LXD Issues #3845, #3848, and #3916, but was unable to find a solution. As far as I understand, this warning is generally received when liblxc is upgraded to 2.1 and a container built with the old libraries tries to use the new ones, and can be fixed by restarting the container. However, as far as I know my containers were built using the newest libraries, but the warning still appears.

Additional information:

  • I have LXD version 2.18 and have never had a previous version
  • I installed LXD from the ganto/lxd COPR repo following the instructions here
  • I tried restarting LXD by running sudo systemctl restart lxd, but this did not resolve the issue
  • I tried restarting my container by running lxc restart CONTAINER, but this did not resolve the issue
  • I tried restarting my container by running lxc stop CONTAINER and lxc start CONTAINER separately, but this did not resolve the issue
  • I have launched multiple containers using multiple images, all of which displayed this issue.
    Images used:
    • ubuntu:17.04
    • ubuntu:16.04
    • ubuntu:14.04
    • images:fedora/26
  • I am not using any raw.lxc keys
  • Output of lxc config show --expanded CONTAINER: pastebin.com/raw/CAn0MNpv
  • Output of lxc profile show default: pastebin.com/raw/29ywj47M
  • Output of lxc info: pastebin.com/raw/CdzaL7iT

Any help or advice would be appreciated!

Note: I did not create an Issue on the LXD repo because I think this is likely user error and not a bug in LXD, but if this would be more appropriately discussed on GitHub, please let me know.

What do you have in /usr/share/lxc/config/common.conf.d/?

/usr/share/lxc/config/common.conf.d contains one file, 00-lxcfs.conf, which contains two lines:
lxc.hook.mount = /usr/share/lxcfs/lxc.mount.hook lxc.hook.post-stop = /usr/share/lxcfs/lxc.reboot.hook

Ok, that should be fine.

Can you post the content of /var/log/lxd/CONTAINER/lxc.conf?

/var/log/lxd/CONTAINER/lxc.conf contains
lxc.cap.drop = sys_time sys_module sys_rawio mac_admin mac_override lxc.mount.auto = proc:rw sys:rw lxc.autodev = 1 lxc.pts = 1024 lxc.mount.entry = /dev/fuse dev/fuse none bind,create=file,optional lxc.mount.entry = /dev/net/tun dev/net/tun none bind,create=file,optional lxc.mount.entry = /proc/sys/fs/binfmt_misc proc/sys/fs/binfmt_misc none rbind,create=dir,optional lxc.mount.entry = /sys/fs/fuse/connections sys/fs/fuse/connections none rbind,create=dir,optional lxc.mount.entry = /sys/fs/pstore sys/fs/pstore none rbind,create=dir,optional lxc.mount.entry = /sys/kernel/debug sys/kernel/debug none rbind,create=dir,optional lxc.mount.entry = /sys/kernel/security sys/kernel/security none rbind,create=dir,optional lxc.mount.entry = /dev/mqueue dev/mqueue none rbind,create=dir,optional lxc.include = /usr/share/lxc/config/common.conf.d/ lxc.logfile = /var/log/lxd/test/lxc.log lxc.loglevel = warn lxc.arch = linux64 lxc.hook.pre-start = /usr/bin/lxd callhook /var/lib/lxd 14 start lxc.hook.post-stop = /usr/bin/lxd callhook /var/lib/lxd 14 stop lxc.tty = 0 lxc.utsname = test lxc.mount.entry = /var/lib/lxd/devlxd dev/lxd none bind,create=dir 0 0 lxc.seccomp = /var/lib/lxd/security/seccomp/test lxc.id_map = u 0 100000 65536 lxc.id_map = g 0 100000 65536 lxc.rootfs = /var/lib/lxd/containers/test/rootfs lxc.network.0.type = veth lxc.network.0.flags = up lxc.network.0.link = lxdbr0 lxc.network.0.hwaddr = 00:16:3e:34:45:61 lxc.network.0.name = eth0 lxc.mount.entry = /var/lib/lxd/shmounts/test dev/.lxd-mounts none bind,create=dir 0 0

This config is indeed pre-2.1, so LXC is right to complain about it.

So just to confirm, you’re getting this using LXD 2.18 and even after you restart LXD and restarted the container?

If that’s all the case, then the only thing I can think of which would explain this behavior is if the go-lxc which was used to build your LXD binary was outdated, causing the version check for 2.1 to fail and having LXD generate a 2.0.x config even though you do have 2.1 installed.

Yes, I’ve restarted the daemon with sudo systemctl restart lxd and restarted the container with lxc restart CONTAINER. Running lxc --version reports 2.18 and dnf lists the package version as 2.18-3.fc26.

So, you believe the binary in the COPR repository may have been built with outdated tools (Go bindings, I assume)? I’ll try uninstalling the LXD I got from that repo and installing from the release tarball and see if that resolves the issue.

That’d be my guess. Unfortunately go-lxc can’t always do dynamic version detection for the LXC library. Some of the version checks, such as the one used to generate the config keys depends on what version of liblxc was installed on the machine that built go-lxc and LXD.

If that’s the issue, then it should be as simple as having the fedora RPM be rebuilt using liblxc1 at version 2.1.0, go-lxc would then build against the 2.1.0 header file and that issue should disappear.

We’re currently adding new code to liblxc1 to allow for dynamic detection in the near future, so that those painful rebuilds become a thing of the past.