Main menu:

August 2012
« Jun   Sep »


Moving to Systemd

ArchLinux is slowly adding systemd units to all packages that contain services/daemons. With the merge of udev into systemd, the switch is inevitable. This was scary at first but proved to be much less painful than expected. I have always been a huge fan of ArchLinux’s rc.conf and rc.d usage because service management was easy but whatever decreases the gap between distributions is a good thing.
I did a pacman -Syu and installed systemd 189-3 package and did “mkinitcpio -p linux”. This recreated the initramfs image with the updated udev.
I created /etc/hostname and added my computer’s hostname to it. Then I created /etc/locale.conf and added the following to it:


I also created /etc/timezone and added Asia/Beirut inside it.
I cleaned up /etc/rc.conf from everything but the Daemons line and rebooted to make sure the current initscripts does indeed read the systemd config files.
on next boot, I added init=/bin/systemd to the kernel line and rebooted. Everything started correctly and it seems systemd reads the rc.conf daemons line and starts the corresponding systemd services and when it doesn’t find any, it starts the rc.d services instead. This means my /run/daemons/ only contained adsl and alsa.

I created a /etc/systemd/system/adsl.service with the following content:

Description=ADSL Deamon



I enabled the adsl service by running systemctl enable adsl.serivce and started it using systemctl start adsl

Edit(1): Manually adding adsl.service is no longer required as the adsl.service file above is now in the official Arch Linux rp-pppoe package.

I have two NIC cards and pppoe initializes eth0 but I still needed to start eth1.
eth1 is the interface I connect to my other computer. I created the file /etc/conf.d/network with the following content:


and /etc/systemd/system/network.service with the following content:

Description=Network Connectivity

ExecStart=/sbin/ip link set dev ${interface} up
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
ExecStop=/sbin/ip addr flush dev ${interface}
ExecStop=/sbin/ip link set dev ${interface} down

Afterwards, I ran systemctl enable network.service

Then I did systemctl enable for every service in the rc.conf daemons line as those will be needed when initscripts is uninstalled.
Next step was a reboot to make sure all daemons were running correctly. This worked like a charm and everything was good after a reboot.
I decided to pacman -S systemd-sysvcompat which removed sysvinit and initscripts packages. I rebooted to make sure everything is ok and then I removed the .pacsav files from /etc/
Finally I added quiet to the kernel line and removed the init=/bin/systemd part.
The whole operation took less than 2 hours and that included reading ArchLinux wiki article

Edit(2): I found out I can completely remove the syslog-ng package. I created a /var/log/journal package, uninstalled syslog-ng, added SystemMaxUse=100M to /etc/systemd/journald.conf and rebooted. System logs are now stored in /var/log/journal/ and are limited to 100 Mega Bytes of disk space. They can be viewed with the journalctl command.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.