4 systemd
Luca Matteo Spoljarevic edited this page 2026-03-25 17:29:30 +01:00

How to generate a systemd file to automatically start the service

Arch Linux

Rootless

Since I have currently only tested this on Arch Linux, I'll give you a short insight to it. For more information please look at the Arch Wiki here.

First, let's install everything we need. For that, just run the following command. This will install podman itself, podman-compose if you'll ever use compose files and podlet which will handle the quadlets.

sudo pacman -S podman podman-compose podlet

Then, we need to create a .container file under ~/.config/containers/systemd/. The Arch Wiki has a good overview on how such file can look, please refer to this when creating your own.

Note that if you clone this Repository, you can just symlink it to the config directory and it will work. Personally I used this command for it:

mkdir -p /mnt/storage/git/spoljarevic/.config/containers/systemd && \
ln -s /mnt/storage/git/spoljarevic/Quadlets/rootless/containers/systemd/ \
/mnt/storage/git/spoljarevic/.config/containers/systemd

Where the config folder under /mnt/storage was already linked to my home directory.

After you have .container files inside your config directory (whichever way you choose), it's time to let systemd know about it. Execute the following command to validate the Quadlet file:

/usr/lib/podman/quadlet -dryrun -user

On a Raspberry Pi with Debian installed, you'll need to execute this command:

/usr/libexec/podman/quadlet -dryrun -user 2>&1

Perfect, a systemd file was now created.

To inform our system about it, please execute the following command.

systemctl --user daemon-reload

Now everything you need to do is run this command to start the service (It will start whenever the user logs in).

systemctl --user start yourquadlet.service