Argent SystemD Services
Argent SystemD Services
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. It also looks up .local names, but never announces yours, see below |
sys-apps/systemd
|
avahi-daemon.service and .socket |
announces your computer as hostname.local, and 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
|
systemd-timesyncd.service |
keeps your clock right, over the network | sys-apps/systemd
|
virtualbox-guest-additions.service |
VirtualBox guest tools, only if you installed Argent 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
The sound is a user service
PipeWire and WirePlumber run only as a user service, for the user who is logged in on the desktop. Never ever as a system service, and never ever for root:
- don't enable them with
systemctl enable(without--user), there is no system-wide PipeWire on Argent - don't enable them for
root: PipeWire refuses to run as root (ConditionUser=!root), and WirePlumber then fails withBound to unit pipewire.service, but unit isn't active - don't run programs that play sound as root, run them as your user
On Argent they are already enabled for every user the installer creates. For a user you add later, enable them once, as that user:
systemctl --user enable --now pipewire.socket pipewire-pulse.socket wireplumber.service
To check that the sound works for your user:
systemctl --user status pipewire wireplumber
wpctl status
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
argentlive.service, fromapp-misc/argent-live: only on the live ISO, it prepares the live user, the login screen and the sound for the live session. It is not installed on your systemargent-config-vbox.service, fromapp-misc/argent-config-files: runsmodprobe vboxvideobeforesddm, so the live login screen works in VirtualBox. It is enabled on the live ISO, runs only inside VirtualBox, and the installer disables it on your installed system
The live ISO also enables connman, dkms, dm-event and lvm2-lvmetad when they are there, see the avasile page (--makeiso).
What the installer changes
The live ISO needs some services that your installed system doesn't. At the end of the installation, the installer (Calamares) fixes that for you:
- enables
systemd-timesyncd.service, so your clock stays right - removes the leftover link of
argentlive.service, which is removed together withapp-misc/argent-live - disables
argent-config-vbox.service - removes
app-emulation/virtualbox-guest-additionsandapp-emulation/virtualbox-guest-modules, unless you are installing inside VirtualBox, where you need them
Installed from an older ISO?
If you installed Argent from an ISO older than 1.5.3-RC9, do these by hand, once, as root:
timedatectl set-ntp true
rm -f /etc/systemd/system/multi-user.target.wants/argentlive.service
systemctl disable argent-config-vbox.service
And, only if your Argent is not running inside VirtualBox:
epkg remove app-emulation/virtualbox-guest-additions app-emulation/virtualbox-guest-modules
Without that last one, you get a popup at every login: VBoxClient: the VirtualBox kernel service is not running. Exiting.
Older ISOs also enabled PipeWire for root, which PipeWire never allows. It only shows as wireplumber.service: Bound to unit pipewire.service, but unit isn't active in the log when root logs in, your sound is not affected. To clean it up:
rm -rf /root/.config/systemd/user/default.target.wants/pipewire.service /root/.config/systemd/user/pipewire.service.wants /root/.config/systemd/user/sockets.target.wants/pipewire*.socket /root/.config/systemd/user/pipewire-session-manager.service
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 keeps your clock in sync with systemd-timesyncd, the installer turns it on. timedatectl shows you if your clock is synced:
timedatectl
If it says NTP service: inactive, turn it on:
timedatectl set-ntp true
SSD TRIM: fstrim.timer
Here comes the old defrag times to modern 2020s.
An SSD or NVMe drive must be told which blocks the filesystem doesn't use anymore, that's what TRIM does. Without it, the drive thinks it is always full: over the months writes get slower, and the desktop freezes for a moment whenever a program saves something. A live ISO doesn't pass through this, because it writes only to RAM, so that's why you feel a much proper experience on a LIVE medium than installed over time.
But we at Argent don't turn TRIM on for you yet, though. We just want to let you know that sys-apps/util-linux brings fstrim.timer, which trims every mounted filesystem listed in /etc/fstab, once a week.
To see if it's on:
systemctl list-timers fstrim.timer
To see if your drive supports TRIM (DISC-GRAN and DISC-MAX are not zero):
lsblk --discard
The first time, trim by hand, as root:
fstrim -v /
On a drive that was never trimmed this can take a minute or more, the desktop may freeze for a few seconds, and some laptops make a high-pitched whine while the drive works. That's normal (we think?), it stops when fstrim is done. It only manages free space, your files are safe. At the end it tells you how much it trimmed, for example /: 368.8 GiB (395969245184 bytes) trimmed.
Then turn on the weekly timer:
systemctl enable --now fstrim.timer
By default it runs every Monday at 00:00, plus a random delay of up to 100 minutes. If the computer is off then, it runs at the next boot.
To pick another day, for example Thursday at 00:00:
systemctl edit fstrim.timer
[Timer] OnCalendar= OnCalendar=Thu *-*-* 00:00:00
The empty OnCalendar= line clears the Monday default, without it the timer runs on both days. Then:
systemctl restart fstrim.timer
systemctl list-timers fstrim.timer
NEXT must show the next Thursday. To see what each run trimmed:
journalctl -u fstrim.service
Don't add discard to the mount options in /etc/fstab instead: then every file you delete is trimmed right away, and on many SATA SSDs the disk pauses on every delete. Once a week is enough.
Your Argent current network settings: avahi and systemd-resolved
Two services on Argent know about names on your local network:
- avahi announces your computer on the network as
hostname.local, and finds printers, network shares and other computers. CUPS, KDE and PipeWire all use it - systemd-resolved is the DNS of your system, every program asks it to turn names into addresses. It also looks up
.localnames, sossh nas.localorhttp://printer.localwork
Both of them can announce your computer's name, but only one of them should. When both do it, they see each other's announcement as a conflict, and systemd-resolved starts renaming your computer on the network, over and over: gent, gent9, gent11, gent15, ... hundreds of times per boot.
So on Argent, avahi is the only one that announces, and systemd-resolved only looks names up. It's set in:
/etc/systemd/resolved.conf.d/00-argent.conf
[Resolve] MulticastDNS=resolve LLMNR=no
MulticastDNS=resolve: look up.localnames, but never announce oursLLMNR=no: no LLMNR, the Windows style name announcing, which renames itself the same way. Windows is dropping it anyway
This file comes with app-misc/argent-config-files. To check that it's active:
resolvectl status
It must say -LLMNR mDNS=resolve. If you just upgraded and it doesn't, restart it:
systemctl restart systemd-resolved
To see if your computer was renamed on the network during this boot:
journalctl -b | grep -i "hostname conflict"
Don't disable avahi-daemon: without it, nobody announces your computer, and your printers are not found anymore.
KDE Connect has its own name announcing built in, and it can fight with avahi the same way (KDE bug 487719). If you installed KDE Connect and your computer gets renamed to hostname-2.local, that's the reason.
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 has priority 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, except systemd-resolved, see above.
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.