Running Solus in a Docker Container


I love Gentoo. I’m a Gentoo die-hard. But I also have been very attracted to Solus in the last year or so. It’s advancing rapidly, has an elegant package manager (eat me, apt), and is actually a pleasure to package software for. This mean, of course, I have to get Solus running on my Gentoo box. 🙂

In my experience, forget installing things directly in Gentoo, like LSI (Linux Steam Integration) and solbuild. The stuff just doesn’t work, or isn’t flexible enough, on other distros.

Enter docker

Docker can help to make best use of the resources my system has to offer when building software while maintaining a clear boundary between my main system and the target system. Solus doesn’t have an official docker container like other distros. That’s unfortunate, but I understand they have to do what’s best with the limited resources they have. This situation, however, can be circumvented with a little help from VirtualBox.

Create a virtual machine and install Solus.

Installing Solus in a virtual machine.
Installing Solus in a virtual machine.

Attach the drive from that VM to a VM running another distro (or a different instance of the same on; whatever).

Attaching Solus.vdi to an Elementary OS VM.

Mount and archive the entire root filesystem for Solus.

root@elementary:/home/herb@ mkdir /mnt/tmp
root@elementary:/home/herb@ mount /dev/sdb2 /mnt/tmp
root@elementary:/home/herb@ cd /mnt/tmp
root@elementary:/home/herb@ tar -cvpf /home/herb/Solus.tar . --xattrs

Sftp the file up to your main system (or use shared folders). Once it’s there, import the .tar file into into docker.

Crystal user herb on 2 in /tmp
$ docker import Solus.tar solus:20170418

Launch a container based off of the new image:

Crystal user herb on 2 in /tmp
$ docker run -ti -v /tmp/.X11-unix:/tmp/.X11-unix --privileged -e DISPLAY=:0 solus:20170418 /bin/bash
root@9756dcf265d4 / #

A quick breakdown…

  • -v /tmp/.X11-unix:/tmp/.X11-unix allows your container to open windows on your host X server. Anymore I just mount the whole /tmp directory to ease transferring files between containers, but be careful with this if your /tmp is a tmpfs and you don’t have a lot of memory.
  • --privileged will allow your container to use hardware accelerated graphic if you install the same graphics driver your host is using inside the container.

Never Quite So Easy

There is a gotcha with Solus in particular. Pretty much anything you do that’s the slightest little bit involved, like running eopkg, will result in strange dbus errors like the following:

Program terminated.
Cannot connect to COMAR: 
  org.freedesktop.DBus.Error.FileNotFound: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory

To alleviate this, start up the dbus daemon.

root@9756dcf265d4 / # dbus-daemon --system

Nope, Not the Only One

Another issue is with sudo.

root@9756dcf265d4 / # sudo su
sudo: pam_open_session: System error
sudo: policy plugin failed session initialization

Fix this by opening /etc/pam.d/system-session in a text editor and commenting out the pam_systemd.so line (which makes sense as systemd isn’t running inside a docker container).

# Begin /etc/pam.d/system-session

session   required    pam_unix.so
#session   required    pam_systemd.so

# End /etc/pam.d/system-session

Honest Appraisal

It’s not the cleanest way of creating a docker image, for sure. The general philosophy with docker is to start with as little as possible and build up from there, but sometimes we just don’t have that luxury.


Leave a Reply