Systemd
Various systemd things I don't do often and occasionally forget.
Disabling the GUI
Sometimes, servers come with pre-installed GUI packages. These aren't necessary all the time, and they often drain system resources unnecessarily. To disable the extra services from running at startup, we can tell systemd to start only the multi-user subset.
sudo systemctl set-default multi-user.target
On the other hand, if the GUI is needed again for whatever reason, we can revert that change like so.
sudo systemctl set-default graphical.target
I'm not sure if this works everywhere. I mostly deal with Debian and its derivations.
Special considerations for a Raspberry Pi
After turning off the GUI mode on one of my Raspberry Pis, I noticed that it started writing quite
a lot to the SD card. After some diagnosis, I found the rpi-connect service was in a constant
crashloop that was generating about 100KiB/s of syslogs.
To turn the service off, you can run the following.
rpi-connect off
And to make it permanent.
systemctl --user mask rpi-connect-wayvnc.service
Creating directories inside tmpfs on startup
Create a file inside /etc/tmpfiles.d with a corresponding name, and a .conf suffix.
An entry for a directory looks like this inside the file.
d /tmpfs/whatever 0755 user user -
To create the entry immediately without restarting, run the following.
sudo systemd-tmpfiles --create /etc/tmpfiles.d/whatever.conf