Argent SystemD Services
Systemd on Argent
Argent runs on systemd, the Gentoo profile is default/linux/amd64/23.0/desktop/plasma/systemd. There is no OpenRC: our make.conf disables the openrc and sysvinit USE flags, and /etc/init.d is not even installed (INSTALL_MASK).
So everything the Gentoo and systemd documentation says applies to Argent too:
- Gentoo wiki: systemd
- the man pages that come with systemd, on your system:
man systemctl,man journalctl,man systemd.unit,man systemd.service,man systemd.timer
The tools you will use, all part of systemd:
systemctl: start, stop, enable, disable and look at servicesjournalctl: read the logssystemd-analyze: boot time, and what slows it downcoredumpctl: programs that crashedtimedatectl,hostnamectl,localectl,resolvectl,loginctl: time, hostname, keyboard and language, DNS, sessions
This page explains what Argent runs, and how you manage it.
What runs on a fresh Argent
System services
These are enabled on an installed Argent:
| Service | What it does | Package |
|---|---|---|
sddm.service |
the login screen, also known as display-manager.service |
x11-misc/sddm
|
NetworkManager.service |
the network (wired, wireless, VPN) | net-misc/networkmanager
|
NetworkManager-dispatcher.service |
runs scripts when the network changes | net-misc/networkmanager
|
NetworkManager-wait-online.service |
makes network-online.target wait for the network |
net-misc/networkmanager
|
ModemManager.service |
mobile broadband modems | net-misc/modemmanager
|
systemd-resolved.service |
DNS, /etc/resolv.conf points to it |
sys-apps/systemd
|
avahi-daemon.service and .socket |
finds printers and other machines on your network (mDNS) | net-dns/avahi
|
cups.service, .socket and .path |
printing | net-print/cups
|
lvm2-monitor.service |
LVM monitoring | sys-fs/lvm2
|
argent-config-vbox.service |
loads the VirtualBox video driver before the login screen | app-misc/argent-config-files
|
virtualbox-guest-additions.service |
VirtualBox guest tools, it starts only inside VirtualBox | app-emulation/virtualbox-guest-additions
|
getty@tty1.service |
the text console on tty1 | sys-apps/systemd
|
The default target is graphical.target, so Argent boots straight to the login screen.
Some services are not enabled, but still run: they are started on demand, by D-Bus, when a program asks for them. For example polkit, udisks2 (disks), upower (battery) and power-profiles-daemon (power profiles). Leave them alone.
User services
Every user who logs in gets their own systemd, with their own services. On Argent:
- the sound:
pipewire.service,pipewire-pulse.serviceandwireplumber.service, enabled for each user. PipeWire replaces PulseAudio - the whole Plasma desktop runs as user services:
plasma-plasmashell.service,plasma-kwin_wayland.service,plasma-powerdevil.serviceand so on
To see them, as your user (not root):
systemctl --user list-units --type=service
Timers
Argent has no cron daemon, systemd timers do that job. Out of the box there is only systemd-tmpfiles-clean.timer, which cleans temporary files daily. To see all of them:
systemctl list-timers --all
Argent's own services
argent-config-vbox.service, fromapp-misc/argent-config-files: runsmodprobe vboxvideobeforesddm, so the login screen works in VirtualBoxargentlive.service: only on the live ISO, it prepares the live session. It is not installed on your system
The live ISO also enables connman, dkms, dm-event and lvm2-lvmetad when they are there, see the avasile page (--makeiso).
Managing services
Everything below needs root, except the --user commands, which you run as your own user.
To see how a service is doing, with its last log lines:
systemctl status NetworkManager
To start, stop or restart it now:
systemctl start cups
systemctl stop cups
systemctl restart cups
To start it at every boot (enable), or not anymore (disable). --now also starts or stops it right away:
systemctl enable --now sshd
systemctl disable --now sshd
To make sure a service never starts, not even when something else asks for it:
systemctl mask ModemManager
systemctl unmask ModemManager
To see what is enabled, and what failed:
systemctl list-unit-files --state=enabled
systemctl --failed
For your own user services, add --user, as your user:
systemctl --user restart pipewire
Installing a package with a service
On Gentoo, and so on Argent, installing a package never enables its service. That's why systemctl status shows preset: disabled next to almost everything. You install, then you enable:
epkg install net-misc/openssh
systemctl enable --now sshd
The same when you remove a package: disable its service first.
systemctl disable --now sshd
epkg remove net-misc/openssh
Time synchronization
Argent doesn't enable time synchronization by default. timedatectl shows you if your clock is synced:
timedatectl
To turn it on (it uses systemd-timesyncd, already installed with systemd):
timedatectl set-ntp true
Logs
The logs are kept by systemd-journald, in /var/log/journal, so they survive a reboot.
The logs of one service:
journalctl -u NetworkManager
Follow them live:
journalctl -u NetworkManager -f
Everything since the last boot, or from the boot before:
journalctl -b
journalctl -b -1
Only the errors since the last boot:
journalctl -b -p err
How much space the logs take, and how to shrink them:
journalctl --disk-usage
journalctl --vacuum-size=200M
Where the unit files live
| Directory | What is there | Yours? |
|---|---|---|
/usr/lib/systemd/system/ |
system services installed by packages | no, overwritten at every upgrade |
/etc/systemd/system/ |
the enable links, your overrides, your own services | yes |
/usr/lib/systemd/user/ |
user services installed by packages | no |
/etc/systemd/user/ |
user services for all users | yes |
~/.config/systemd/user/ |
user services only for you | yes |
What is in /etc wins over what is in /usr/lib. So never edit a file in /usr/lib/systemd, the next epkg upgrade puts it back. Override it in /etc instead.
After you change any unit file by hand, tell systemd:
systemctl daemon-reload
Changing an installed service
systemctl edit opens an editor with an empty override (a "drop-in"). You write only what you want to change, and it is saved in /etc/systemd/system/<service>.d/override.conf, so it survives upgrades:
systemctl edit cups
For example, to restart cups whenever it crashes:
[Service] Restart=on-failure RestartSec=5s
To see the service together with your changes:
systemctl cat cups
To throw your changes away and go back to the package's version:
systemctl revert cups
Adding your own service
Say you have a script, /usr/local/bin/my-backup.sh, that you want systemd to run. Create /etc/systemd/system/my-backup.service:
[Unit] Description=My backup After=network-online.target Wants=network-online.target [Service] Type=oneshot ExecStart=/usr/local/bin/my-backup.sh [Install] WantedBy=multi-user.target
Then:
systemctl daemon-reload
systemctl enable --now my-backup.service
For something that keeps running (a server, a daemon), use Type=simple and add Restart=on-failure. man systemd.service has all the options.
Running it on a schedule
Instead of cron, a timer with the same name as the service. Create /etc/systemd/system/my-backup.timer:
[Unit] Description=My backup, every night [Timer] OnCalendar=*-*-* 02:00:00 Persistent=true [Install] WantedBy=timers.target
Persistent=true means that if the machine was off at 02:00, the backup runs at the next boot. Then enable the timer, not the service:
systemctl daemon-reload
systemctl disable my-backup.service
systemctl enable --now my-backup.timer
systemctl list-timers
A service for your user only
The same, but in ~/.config/systemd/user/, with WantedBy=default.target, and with --user, as your user:
systemctl --user daemon-reload
systemctl --user enable --now my-sync.service
It starts when you log in, and stops when you log out.
Configuring systemd itself
systemd's own settings are in /etc/systemd/: journald.conf, logind.conf, resolved.conf, system.conf, sleep.conf, ... On Argent they are all left at the systemd defaults.
Don't edit those files, add a drop-in next to them. For example, to keep the logs under 500 MB, create /etc/systemd/journald.conf.d/100-my.conf:
[Journal] SystemMaxUse=500M
systemctl restart systemd-journald
Every file has its man page: man journald.conf, man logind.conf, man resolved.conf, ...
When something goes wrong
What failed:
systemctl --failed
Why it failed:
systemctl status <service>
journalctl -u <service> -b
What crashed:
coredumpctl list
coredumpctl info <PID>
Why the boot is slow:
systemd-analyze
systemd-analyze blame
systemd-analyze critical-chain
If you ask for help on our channels, bring the output of systemctl --failed and journalctl -b -p err.