I’m writing this for myself in hopes that it benefits somebody else. The guides that I’ve found on LXC have been either unholy scatterbrained or just out of date.
Starting from scratch.
If you’re fairly new to arch as I am, keep in mind that if you hit your head on anything especially involving networking, reboot your system. You may have had a system upgrade and had not yet rebooted.
Do not expect to understand LXC before you’ve thoroughly read this man page. http://lxc.sourceforge.net/man/lxc.html . It’s short.
Get the stuff you need
pacman -Syy lxc bridge-utils
Set up your bridge
Edit /etc/network.d/bridge as
INTERFACE="br0" CONNECTION="bridge" DESCRIPTION="Bridge" IP='dhcp' BRIDGE_INTERFACES="eth0"
Now issue these commands
systemctl disable dhcpcd@eth0 # For boot time systemctl stop dhcpcd@eth0 # For right now systemctl enable netcfg@br0 # for boot time systemctl start netcfg@br0 # for right now systemctl enable dhcpcd@br0 # for boot time systemctl start dhcpcd@br0 # for right now
For whatever reason this ^ isn’t working on startup for me. I’ll revisit this.
Install a Debian Container
You need yaourt to install debootstrap
Follow the steps in this section here:
debootstrap lets you install a fresh debian system to a directory
yaourt -S debootstrap
Fix the create script
The create script doesn’t work. Edit /usr/share/lxc/templates/lxc-debian to change
arch=’amd64′ # or whatever your architecture may be.
Now make it.
lxc-create -t debian -n mysupercoolcontainer
Wait! Stuff is still broke!
You can’t start your container until you weirdly remount your /, (per these comments https://bugs.archlinux.org/task/31211)
mount / –make-rprivate # Don’t sue me, I haven’t researched what this is, it might break everything.
Now start your container
lxc-start -n mysupercoolcontainer -d # -d makes it run as a daemon instead of forcing a console on your terminal.
Get in there
lxc-console -n mysupercoolcontainer # You’re in, you know what to do.