Creating an OpenSUSE LXC container on Ubuntu 12.04   May 5th, 2014

I thought it would be good to create an OpenSUSE container on my Ubuntu LXC machine.

I am using the existing OpenSUSE template in /usr/lib/lxc/templates/lxc-opensuse, and some SUSE packages built by Thomas-Karl Pietrowski for Ubuntu from, and the build scripts from

This is how you do it (tested with Ubuntu 12.04):

apt-get install python-software-properties
add-apt-repository ppa:thopiekar/zypper 
apt-get update
apt-get install rpm zypper libsolv-tools
wget -O obs-build.tar.gz
tar xzf obs-build.tar.gz
mkdir -p /usr/lib/build
mv obs-build-master/* /usr/lib/build
# small fixes for the template to avoid some errors
sed -i 's/--non-interactive --gpg-auto-import-keys/--gpg-auto-import-keys/g' /usr/lib/lxc/templates/lxc-opensuse
sed -i 's#chpasswd#/usr/sbin/chpasswd#g' /usr/lib/lxc/templates/lxc-opensuse
lxc-create -t opensuse -n demoOpenSuse
lxc-start -n demoOpenSuse
# login with root and password root

Things still to be done:

The creation of the image is interactive, since there seems to be unknown keys:
File ‘content’ from repository ‘repo-oss’ is signed with an unknown key ”. Continue? [yes/no] (no): y
File ‘repomd.xml’ from repository ‘update’ is signed with an unknown key ”. Continue? [yes/no] (no): y

/usr/lib/lxc/templates/lxc-opensuse: line 110: patch: command not found

If there are problems with the root password, try this:
echo “root:root2” | chroot /var/lib/lxc/demoOpenSuse/rootfs /usr/sbin/chpasswd

I think the network is not established yet.

But hopefully this is a start…

Tags: , ,
This entry was posted on Monday, May 5th, 2014 at 10:00 pm and is filed under Software Development. You can follow any responses to this entry through the RSS 2.0 feed.Both comments and pings are currently closed.

No Responses