Skip to content

Instantly share code, notes, and snippets.

@mowings
Last active September 29, 2019 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mowings/694812c3a58787bdb0b55f8a4e9bd1d6 to your computer and use it in GitHub Desktop.
Save mowings/694812c3a58787bdb0b55f8a4e9bd1d6 to your computer and use it in GitHub Desktop.
Getting lxc 2.x running on ubuntu 18

I won't lie -- it's ugly

Go grab the latest 2x source release from github. Be sure you have automake and libcap-dev installed before starting. Be sure you fully delete and 3x stuff if you installed it. This includes shared libraries.

Follow the instructions for building and installing. The catch, here, is that everything is going to be installed and run under /usr/local. You may need to run ldconfig after installation to pick up the shared lib directorues, and many programs that automate lxc operations will not be expecting stuff to be installed under /usr/local.

In particular, what used to be /var/lib/lxc will now be under /usr/local/var/lib/lxc, so you may need a symlink. We also had some automation that created templates. That code had to be changed to create them under /usr/local/shared/lxc/templates (you could also probably symlink the default directory. You may see other issues.

You will also need to set up systemd units for lxc-net and lxc. The simplest way to do this is to snag these files from annother system running 2.x. You should get:

/lib/systemd/system/lxc.service
/lib/systemd/system/lxc-net.service

/usr/lib/x86_64-linux-gnu/lxc/* # get all of these files

You will need to modify the bindir var at the top of lxc-containers to point to /usr/local/bin

You will also need to copy /etc/defaults/lxc, /etc/defaults/lxc-net and /etc/lxc over

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment