View on GitHub

Distrobox

Use any linux distribution inside your terminal

Download this project as a .zip file Download this project as a tar.gz file

Using an immutable distribution

If you are on an immutable distribution (Silverblue/Kionite, MicroOS) chances are that installing lots and lots of packages on the base system is not advisable.

One way is to use a distrobox for them.

Prepare the container

To run libvirt/qemu/kvm we need a systemd container and we need a rootful container to be able to use it, see this tip to have a list of compatible images. We will use in this example AlmaLinux 8:

:~> distrobox create --root --init --image quay.io/almalinux/8-init:8 --name libvirtd-container
:~> distrobox enter --root libvirtd-container

Let it initalize, then we can install all the packages we need:

:~> distrobox enter --root libvirtd-container
:~$ # We're now inside the container
:~$ sudo dnf groupinstall Virtualization Host --allowerasing 
...
:~$ sudo systemctl enable --now libvirtd

Now we need to allow host to connect to the guest’s libvirt session, we will use ssh for it:

:~$ # We're now inside the container
:~$ sudo dnf install openssh-server
:-$ echo "ListenAddress 127.0.0.1
Port 2222" | sudo tee -a /etc/ssh/sshd_config
:-$ sudo systemctl enable --now sshd
:-$ sudo systemctl restart sshd
:~$ sudo su -
:~# passwd

Now set a password for root user.

Connect from the host

You can now install VirtManager, you can either use a normal (non root) distrobox, and export the app

Now you will need to Add a connection:

image

Then set it like this:

image

Optionally you can set it to autoconnect.

Now you can simply double click the connection to activate it, you’ll be prompted with a password, insert the one you used in the passwd step previously:

image

And you should be good to go!

image