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:

[Unit]
Description=Allan's MacBook Pro Fan Control Daemon
 
[Service]
ExecStart=/usr/bin/mbpfan
 
[Install]
WantedBy=multi-user.target

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:

.include /usr/lib/systemd/system/nginx.service
 
[Unit]
Requires=mysqld.service php-fpm.service

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.

12 thoughts on “Switching My Laptop To Systemd

  1. I have also made the change to pure systemd and it was painless.

    systemd-sysvcompat just sets up lots of symlinks to keep up with the old commands
    For instance, shutdown/reboot etc are just symlink to systemctl targets.

    As for Arch, I believe in keeping with its “bleeding edge” and simplistic policies, the move to systemd is inevitable and for the good.

    PS: Thanks Allan for all the hard work you’ve put into my precious distro. šŸ˜€

  2. Allan, you could look at the output of
    systemd-analyze blame

    To checkout what takes the most time to start. This is for me one of the nice features of systemd, the easy method of maintaing and creating service files. There is also a nice option to show the status of a service, which also showed why it failed, much easier then debugging with sysvinit.

  3. I also am in the process of switching to a pure systemd system, though It’s my nature to be wary of removing packages, so I still haven’t removed some of them that you mentioned above. Nonetheless, the transition was, for me, also painless. Till I switched to systemd, I hadn’t even broken up my rc.conf into separate files. While it may be a little annoying to have to look for a specific config file and not just have them all loaded into one, I think it still follows the Arch philosophy of K.I.S.S., as well as the unix philosophy of having one thing do one job, not a whole bunch of jobs.

    Thanks for the great posts! (And keep breaking things. It keeps us on our toes. hehe)

  4. I switched to systemd too and I’m very happy of the new situation, also because while doing it I also decided to add e4rat in combination with systemd and results are even better. I also love the quicker shutdown.
    I only have one OT question: why if I type “man 7 archlinux” i get “no manual for archlinux in section 7?” (quick translation from italian)

      • Ok, than why not add it to systemd or systemd-sysvcompact package?
        I think it may be worthy and useful when configuring systemd files.

  5. For me I change in 2 steps
    1-2 week setup all using new configs and make so mostest close to a systemd withold initscripts that is possible
    2-5 week install systemd maintain initscripts and set services and others
    5 week remove initscripts and use a pure systemd and install arch-wiki-lite (prevent a problem in internet conectiond and wikia search) and solve minor problems

    systemd isnot bad and Lenhart put in the systemd bloog (opinter) the word “ponyhof” and for me is a +1 XD
    Actually the readahead-systemd implementation in my system is uselles, boot mor fast withold them (2-5 week)
    and finaly if you not install and remove services and programs relly in daemons like a crazy-man a one time settup is enough

    bbut…I not discover the reall diference in enable .socket or they .service (example cupsd.docket or cupsd.service)

  6. Thanks for your review.

    However, I am curious why didn;t vconsole.conf work for you w/o FONTS. Are you using (early) KMS? What is your locale.conf?

    I have tested 2 machines: (1) i915 inside initramfs (early KMS) and my vconsole.conf only containing KEYMAP=us; (2) radeon loaded by udev (late KMS) and no vconsole.conf (forgot to create at install). On both machines locale.conf is
    LANG=en_US.UTF-8
    LC_COLLATE=C
    The bootup and tty’s look OK, i.e. no wierd characters.

  7. Wow, you had to fix so much stuff to make systemd workā€¦ :-/ At least your report is more consistent with (my) reality than all the people saying it ā€œjust worksā€. I also have the ā€œno ALSAā€ problem, and Iā€™m not using any login managerā€¦ So maybe I have the same ā€œpamā€ problem. No idea what to do though.