LXC
Create LXC Container
Tested on Ubuntu 14.04
Install LXC container:
# sudo apt-get install lxc qemu-user-static sudo apt-get install lxc qemu-user-static debootstrap rsync binfmt-support
Create ARM container:
sudo lxc-create -t ubuntu -n my_arm -- --release trusty --arch armhf # -r trusty -a armhf
Templates are found here: (-t)
/usr/share/lxc/templates/
Start container: (login: ubuntu/ubuntu)
sudo lxc-start -d -n my_arm
Connect to container:
lxc-console -n my_arm
Login:
user: ubuntu pass: ubuntu
See arm kernel type:
$ uname -a Linux my_arm 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13 19:36:28 UTC 2015 armv7l armv7l armv7l GNU/Linux
Install build environment within container: (optional)
sudo apt-get install build-essential git
Escape console:
ctrl+a q
References:
- Ever wanted an armhf container on your x86 machine? It’s now possible with LXC in Ubuntu Precise | Stéphane Graber's website - https://www.stgraber.org/2012/02/03/ever-wanted-an-armel-or-armhf-container-on-an-x86-machine-its-now-possible-with-lxc-in-ubuntu-precise/
- Cross-architecture Linux containers in Debian | Kranz Korner - https://dktrkranz.wordpress.com/2013/11/19/cross-architecture-linux-containers-in-debian/
Rename Container
Shutdown container:
lxc-shutdown -n my_arm
Rename folder:
sudo mv /var/lib/lxc/my_arm /var/lib/lxc/new_arm
Change in config file:
sudo vim /var/lib/lxc/new_arm/config
lxc.utsname = new_arm lxc.rootfs = /var/lib/lxc/new_arm/rootfs lxc.mount = /var/lib/lxc/new_arm/fstab
References:
- Rename LXC Container - Bonus Bits Wiki - http://www.bonusbits.com/main/HowTo:Rename_LXC_Container