mariadb server | php use datetime class | vk | Auto Post Friends Timeline token


Migration from initscripts to systemd on Archlinux

...not the easiest thing, but it was worth it!

systemd is a system and service manager for Linux. It is a replacement for sysvinit. It provides an improved way of booting up the system (allowing more work to be done in parallel at system startup) and also to manage services. "systemd" appears a remarkable adoption from many Linux distributions. Some of them are Fedora, Mandriva, openSUSE, ArchLinux. In Debian and Gentoo systemd is available, but not enabled by default. Inclusion in Red Hat Enterprise Linux 7 is also planned.

In short, except Ubuntu who has developed its own startup manager, almost all the rest distributions will use systemd as system and service manager.

Archlinux included systemd since October 2012. From now, initscripts will be dropped from various packages. Any users still using them should switch to systemd.

This is just a practical guide for migration to systemd in Archlinux. In order to be useful, you have to read carefully the basics about systemd at:

systemd setup

First make a copy of your rc.conf

sudo cp /etc/rc.conf /data/tmp/rc.conf.bak

systemd must be installed during a system upgrade. Partial upgrades are unsupported in Archlinux.

Full system update:

sudo pacman -Syu

Then remove sysvinit and install systemd-sysvcompat

sudo pacman -Rns sysvinit initscripts
sudo pacman -S systemd-sysvcompat

systemd should have been installed during system upgrade, otherwise last command should be:

sudo pacman -S systemd systemd-sysvcompat

Configuration files needed by systemd

systemd needs some configuration files to hold information, which /etc/rc.conf kept until now to your system:

As root:

nano /etc/hostname

Add a line with your hostname, in my case:


nano /etc/timezone

Add a line with your timezone, in my case:


nano /etc/vconsole.conf

Add appropriate values, in my case:


nano /etc/locale.conf

Add appropriate values, in my case:


Add modules definitions in /etc/modules-load.d/, in my case:

nano /etc/modules-load.d/nfsd.conf
nano /etc/modules-load.d/vboxdrv.conf
nano /etc/modules-load.d/vboxnetadp.conf
nano /etc/modules-load.d/vboxnetflt.conf

There is a helper tool which can perform the above task for you. Find it on Github: arch-linux-SysV-to-systemd-migrationscript. This script will parse your /etc/rc.conf and generate the above config files.

Create service files

At this time, only a part of information existed in /etc/rc.conf has been migrated using the "systemd" way. Another task is to tranform DAEMONS array members to systemd services. In my case DEAMONS array was:

DAEMONS=(syslog-ng network crond sshd !hwclock ntpd apcupsd rpcbind nfs-common alsa dbus samba cupsd webmin exim httpd mysqld)

For each DEAMONS element you have to create a service file at /etc/systemd/system/ folder. Fortunately, these files exist at /usr/lib/systemd/system/

For example to start Apache at boot, give:

systemctl enable httpd.service

Archlinux will create the appropriate symbolic links. Example:

ls -la /etc/systemd/system/


drwxr-xr-x 2 root root 4096 Apr  4 22:50 .
drwxr-xr-x 6 root root 4096 Apr  4 18:26 ..
lrwxrwxrwx 1 root root   39 Apr  4 14:50 apcupsd.service -> /usr/lib/systemd/system/apcupsd.service
lrwxrwxrwx 1 root root   44 Apr  4 15:12 avahi-daemon.service -> /usr/lib/systemd/system/avahi-daemon.service
lrwxrwxrwx 1 root root   46 Apr  4 15:13 avahi-dnsconfd.service -> /usr/lib/systemd/system/avahi-dnsconfd.service
lrwxrwxrwx 1 root root   33 Apr  4 18:26 cups.path -> /usr/lib/systemd/system/cups.path
lrwxrwxrwx 1 root root   36 Apr  4 14:55 exim.service -> /usr/lib/systemd/system/exim.service
lrwxrwxrwx 1 root root   37 Apr  4 14:37 httpd.service -> /usr/lib/systemd/system/httpd.service
lrwxrwxrwx 1 root root   38 Apr  4 14:55 mysqld.service -> /usr/lib/systemd/system/mysqld.service
lrwxrwxrwx 1 root root   35 Apr  4 22:50 network.service -> /etc/systemd/system/network.service
lrwxrwxrwx 1 root root   36 Apr  4 14:53 nfsd.service -> /usr/lib/systemd/system/nfsd.service
lrwxrwxrwx 1 root root   36 Apr  4 15:10 ntpd.service -> /usr/lib/systemd/system/ntpd.service
lrwxrwxrwx 1 root root   40 Mar 22 14:34 -> /usr/lib/systemd/system/
lrwxrwxrwx 1 root root   39 Apr  4 14:53 rpcbind.service -> /usr/lib/systemd/system/rpcbind.service
lrwxrwxrwx 1 root root   36 Apr  4 14:53 sshd.service -> /usr/lib/systemd/system/sshd.service
lrwxrwxrwx 1 root root   41 Apr  4 14:54 syslog-ng.service -> /usr/lib/systemd/system/syslog-ng.service
lrwxrwxrwx 1 root root   38 Apr  4 14:54 webmin.service -> /usr/lib/systemd/system/webmin.service

Static IP Ethernet network

systemd network.service must be created manually. An example is provided in ArchWiki here: Static Ethernet network

sudo nano /etc/conf.d/network
sudo nano /etc/systemd/system/network.service
Description=Network Static IP

ExecStart=/sbin/ip link set dev eth0 up
ExecStart=/sbin/ip addr add dev eth0
ExecStart=/sbin/ip route add default via

ExecStop=/sbin/ip addr flush dev eth0
ExecStop=/sbin/ip link set dev eth0 down



Reboot your system. If everything has gone well, you will notice a faster system startup.

systemd basic commands

With UNIT we mean the unit/service name (for example: mysqld.service)

  • Enable (run on startup):
    systemctl enable UNIT
  • Disable:
    systemctl disable UNIT
  • Get UNIT status:
    systemctl status UNIT
  • List units/services:
    systemctl list-unit-files
  • Start manually:
    systemctl start UNIT
  • Stop manually:
    systemctl stop UNIT
  • Restart manually:
    systemctl restart UNIT
  • Reload UNIT configuration:
    systemctl reaload UNIT
  • Analyse boot process:


    Startup finished in 4496ms (kernel) + 19558ms (userspace) = 24054ms
  • Analyse boot process (details):
    systemd-analyze blame | less
  • Analyse boot process (graph):
    systemd-analyze plot > /path/to/result.svg
  • Reboot:
    systemctl reboot
  • Halt:
    systemctl halt
  • Poweroff:
    systemctl poweroff

Click the image below to see systemd-analyze plot in my system as SVG file:

systemadm: systemd System Manager graphic GUI

systemadm is the official graphical frontend for systemctl. You may install it from AUR using:

yaourt systemd-ui-git
(click the thumb for full image)

Well, it seems that systemd will become the default init and service manager for the most Linux distributions. What do you think? Leave us a comment.

Sign-up for our free email newsletter. Get updates when new tutorials and tips are published. You can unsubscribe anytime with a click.

Your comments are welcomed!

This site actively encourages commenting on any post. Comments are not pre-moderated, but this community does not tolerate direct or indirect attacks, name-calling or insults. Please, read terms of use and Comment Policy at privacy policy.

Debian 7 Wheezy RC1 LAMP Server Setup Step by Step Improve your Pinterest Experience in Any Browser