- SystemD
- Linux
- Hosting
- Minimalism
It's 2023, should I use systemd?¶
I came across this video and had some thoughts.
Pros vs Cons¶
Pros¶
- Widespread, easy, default in a lot of cases
- required for some applications (find examples)
- Extremely widespread unit files for starting, reloading, shutting off complex services, et al.
- Creates a socket in applications it launches to be able to describe the system and also tell the application how to act(reduce memory or be killed, etc)
Cons¶
- Overkill for a lot of things, even more so now that containerization rules.
- THE BUGS!
What bugs?¶
The worst bug for me usually happens when shutting a system off. I might mount an NFS share, and now that VM doesn't ever want to freaking shut off. It can take over 15 minutes. If some application is in a bad state systemd might again wait forever. I can't pin down exactly what happens but shutdowns on all the systemd systems I've used have always taken a stupid long time for things that frankly shouldn't take that long.
Containerization¶
- Services on the vm shouldn't any longer run on the vm directly. There should maybe be a docker service, or a podman root service maybe, or a service that launches rootless containers per user that has configured stuff on boot. All the tasks that used to happen with systemd in the domain of mounting filesystems are now in the domain of the container manager (eg: docker|podman|k3s|k8s)
- The only application service that should be launched is (docker|podman|k3s|k8s)
- Docker and all the containerization solutions can mount endpoints (not just volumes, also NFS mounts, cdroms, etc) and should no longer be managed by systemd on the host os level ever.
Where¶
To use it¶
- For applications that need it
- Wherever you want dynamic events to be generated to be reacted upon with hardware changes. (EG: Hypervisor host where hdd's can be hotswapped and usb devices plugged in, or a desktop system where plugging and unplugging things is common)
Not to use it¶
- When it's not needed.
My VM's dont change often, and when they do I usually change it via terraform which is going to restart the VM anyway allowing cloud-init to rerun to resize the drive if that's necessary (memory and cpu increases are just automatic, no action necessary). i'm not plugging USB sticks into my vm's ever. I see no good reason to run systemd in any of my vm's still. On the host machines yes, on the vm's, not really no. Even if an application needs it to comm with dependencies, it can be run inside of podman easily.