Prebuilt EndeavourOS systemd container

Hi,

Although it is very easy to create a systemd container with EOS, I decided to offer a prebuilt minimal container that can be imported into your system with a single command.

The container will be installed in the default location which is /var/lib/machines.
If that directory is on a BTRFS filesystem, a subvolume with the machine will be created.

To install quick&fast:

sudo machinectl pull-tar --verify=checksum https://github.com/torvic9/eos-systemd-container/raw/master/eos-container.tar.xz

Optionally, to bind-mount your pacman cache read-only:

sudo cp /var/lib/machines/eos-container/eos-container.nspawn /etc/systemd/nspawn

To boot the container:
sudo machinectl start eos-container

To login into the container:
sudo machinectl login eos-container

Or, alternatively:
sudo systemd-nspawn -bUM eos-container

It comes with a preconfigured user account:
Username: eos
Password: eos1 (same as for root)

To bind-mount other directories from the host, edit /etc/systemd/nspawn/eos-container.nspawn.

Feedback is welcome!


EDIT: you can also use this container on a different distro as long as it runs systemd. It’s not EndeavourOS specific.

7 Likes

Your post totally introduced me to this concept. I’ve been using docker containers for a good while now, didn’t realize systemd has something comparable.

What are some use cases for this vs docker?

1 Like

I have no clue about Docker :smile: never seriously used it.

As for use cases, it can be used to build packages in a clean environment, or simply as a testbed, if you want to try out “dangerous” things.

It’s a powerful tool, supports cloning, ephemeral boot (i.e. changes will be lost on shutdown), resource management, can be started on host boot automatically, also has SSH support if I remember correctly.

The cool thing is that it is available OOTB on every EndeavourOS installation as part of systemd.

2 Likes

podman can work even better as it can pretty easily run “rootless”; it’s almost a drop-in replacement for docker.

2 Likes

Not quite “rootless”, but: https://wiki.archlinux.org/index.php/Systemd-nspawn#Using_machinectl_without_root_permissions

(But completely without root is not possible with systemd I think.)

1 Like

https://forum.garudalinux.in/t/avatar-by-sgs/66/82?u=sgs

Oops! That page doesn’t exist or is private.

(Yet another Arch/Manjaro based distro, this time by Librewish? The girls also have moved over there it seems :smirk: )

1 Like

Girls come and go. :wink:

Maybe without /82?u=sgs

Nope, sorry, I think you have to be a member to access some categories.

Good to know, thanks. Plasmafox 2.0

torvic-plasmafox

Avatar are top secrewt :wink:

3 Likes

Thanks! However I do feel like the time of Plasmafox is up soon… I’m starting to lose interest and it is very time consuming especially when you don’t know what you’re doing :slight_smile:

2 Likes

I change the settings, could you please test again the link above.

Yes, it works now.

1 Like