Switching My Laptop To Systemd
I hear rumours that Arch Linux is probably switching to systemd as its default init system at some stage. Or at least that is what has been reported on by some Linux “news” sites based on a post to the developmental mailing list proposing we start the migration. I personally would have waited for something more official before reporting, especially because there is a lot that needs done before that can happen.
Anyway… with that upcoming change, I decided it was time for me to finally install systemd and see how hard the transition would be. The answer? Not that hard at all, although I made it rather difficult for myself as you will read.
I figured the first step in moving towards using systemd was to deal all the configuration files. I tend to ignore updating configuration files unless something stops working, so my /etc/rc.conf was full of LOTS of old settings. Following the archlinux(7) man page, I altered /etc/hostname, /etc/locale.conf, /etc/vconsole.conf and /etc/timezone and removed all their parts from rc.conf. I also deleted the network section (which has been useless forever given I use NetworkManager) and the modules section (as the modules are all autoloaded these days). That left the DAEMONS line. I rebooted to see whether everything was still OK at this stage and I struck failure #1. The console went all funny during boot-up, changing characters into weird symbols and losing colour. So my vconsole.conf was obviously bad. From its man page: “FONT= defaults to latarcyrheb-sun16“. What I did not realize was that means you still have to add a FONT= line.
Now to actually install systemd. A simple pacman -S systemd, adding init=/bin/systemd to my grub kernel line and I was ready to go. I want my nice looking LXDM at boot-up, so I enabled that service with systemctl enable lxdm.service. And reboot!
Booting when fine, I logged in and everything was happy… which confused me. I had not enabled all the other services to replace the daemons I start in rc.conf. It turns out that some work has been done by the relevant Arch Linux developers to help people transition to systemd and it will still load modules and daemons specified in rc.conf. But I want a pure systemd boot-up so I need to disable that. Unfortunately, I could find no sensible way to achieve that. I could either comment out DAEMONS from rc.conf – but that makes reverting to using the old initscripts require more than altering the kernel line – or I could be heavy handed and delete the service files from the initscripts package. I did the latter.
So systemd booting attempt #2. Prior to rebooting, I enabled the NetworkManager service as I like having access to the internet while playing with my system. Reboot and all is fine. Sort of… I have internet access, so Network Manager is running, but where is my applet? I need that applet to easily access the range of networks my laptop goes on and VPNs etc. My strategy for solving things like this goes: #1 – run from a terminal and see if there is an error message; #2 – run as root and see if that works. Running nm-applet as root worked. I figured this was maybe LXDM not being completely systemd friendly yet and something not being launched properly, so I edited /etc/dbus-1/system.d/org.freedesktop.NetworkManager.conf and gave my user more permissions. And all is fine again…
Until I try getting sound. I was in the middle of watching Fight Club when I embarked on this adventure and despite having seen it before, sound is still important. Looking in the alsa package file list I see a couple of service files. I try starting them and I get a message: They are not meant to be enabled using systemctl. Lets try running alsamixer – nothing – and as root? It works… Poop.
Now remember how I said that I do not deal with configuration file updates. My system is littered with .pacnew files. Obviously I am missing permissions due to logging in with LXDM. And sure enough, /etc/pam.d/lxdm had an update and that involved adding pam_systemd.so. Sounds important. Fix that, revert my changes for NetworkManager and reboot. Internet and sound. Great success!
On to enabling all my other daemons. No need to deal with dbus or netfs as they are handled automatically and the new logging is fine by me so syslog-ng can go. I enable ntpd.service and then attempt to start crond.service… Fail. Looking in the cronie package, I see a cronie.service file that works. Strange thing is, there is a crond.service file and it is a symlink to the cronie.service. I have not idea why the symlinked version can not be enabled, but I strike the same thing again for cupds.
The only other daemon left is my custom fan control. For that, I need to write my own service file. It is a very simple daemon, so has a very simple service file:
Description=Allan's MacBook Pro Fan Control Daemon
Much better than the 70 line monstrosity for the the old rc.d script.
The final daemons I used to launch manually were php-fpm, mysqld and nginx to run WordPress locally when I want to draft a blog post. I heard that you could easily customize service files so I wanted to add a dependency on php-fpm and mysqld to nginx so I only need to launch one thing. That was as simple as creating /etc/systemd/system/nginx.service with:
Everything was running, so now it is time to remove initscipts and sysvinit. And a final reboot to ensure everything is still fine… but I can not longer shut down from within XFCE. Of course, removing sysvinit gets rid of the shutdown binary, but that is replaced by installing systemd-sysvcompat. That also provides a /sbin/init symlink so I can remove the addition to my GRUB kernel line. Finally reboot and almost all is fine. I am a picky bastard and so could not accept there being some bootup output not cleared from my tty1. Adding “quiet” to the kernel line removes all that output and I am happy.
I have not been using systemd long enough to give it a proper review. But I can say it works, at least for me. Also, shut down is now amazingly fast. I know that may not sound that important, but I do shut down my laptop in a rush at the end of the work day to run for the train. So saving time there is good for me. There was essentially no difference in boot-up speed for me. But NetworkManager is now fully up and running and connected to the network by the time I get logged into XFCE now. It is also what takes the most time to launch, so I wonder if that is holding up the process somehow. The only thing that annoyed me was not being able to disable the rc.conf parsing services, but I am informed there is a patch for that on the arch-projects mailing list. That should make it a lot easier for people switch back and forward between using SysVinit and systemd when doing this transition.
PS. I know I capitalized systemd in the title when it should not be… but I like my post titles with capitals.