Kranz Korner

Random bits from a FLOSS geek

Archive for November 2013

Cross-architecture Linux containers in Debian

with 4 comments

I wanted to create a Deb-o-Matic environment to testbuild packages for a different architecture. Taking inspiration on Stéphane’s excellent blog post, I tried to replicate the creation of a cross-architecture Linux container in Debian. Here are the steps I made:

Load binfmt_misc module:
# modprobe binfmt_misc

Install the required packages:
# apt-get install lxc debootstrap rsync qemu-user-static binfmt-support

Mount the cgroup virtual filesystem:
# mkdir /cgroup
# echo "none /cgroup cgroup defaults 0 0" >> /etc/fstab
# mount -a

I needed a specific template to create a cross-architecture container. I used the excellent one by Laurent Vivier. Download it, rename it as lxc-cross-debian, mark it executable, and store it under /usr/share/lxc/templates.

Create the cross-architecture container, an armhf one in this case:
# lxc-create -t cross-debian -n debian-armhf -- --arch armhf --suite sid --interpreter-path /usr/bin/qemu-arm-static

After a while, the container was created and I enjoyed my brand new armhf test machine 🙂


Written by Luca Falavigna

19/11/2013 at 09:53

Posted in Planet Debian