Migration




IMPORTANT NEWS!


Some say it's really hard to migrate from systemd to openrc


But they're wrong!

In fact, removing systemd and installing openrc is just one pacman command away. What's slightly more time consuming is configuring afterwards the system for OpenRC, but not that much. This may be a serious procedure as it involves the init system, but by no means difficult. Just pay attention to the steps and keep an eye at the output of your commands.

For our convenience

An aptly-maintained unofficial repository exists, split in [arch-openrc] and [arch-nosystemd], with the latter containing packages recompiled without systemd. The "old" [openc-eudev] repository will no longer be updated and is only mentioned here for the sake of completeness (and perhaps you can use it to downgrade some broken package or find one no longer in the AUR). All our repositories are kindly mirrored by HEAnet.

For clarity, I've broken down the procedure in simple, easy to follow steps. A summary of the steps will be given at the end of the article, of course with the long pacman one-liner.

A word of caution

Do not just copy/paste these lines; read carefully and understand what you are about to do. While you won't get an unbootable system if you just copy/paste these, you might end up with reduced or weird functionality, especially in your desktop environment. Some decisions are required from your part, according to your setup. Do read the configuration section afterwards.
If you would rather prefer the previous tabled, side-by-side version of this page, you can still access it here (might be seriously out-of-date).

1. Setup the repositories. Append the [arch-openrc] and [arch-nosystemd] repositories to /etc/pacman.conf (all commands below need root privileges). # cat << EOF >> /etc/pacman.conf [arch-openrc] SigLevel=Never Server=http://downloads.sourceforge.net/project/archopenrc/\$repo/\$arch Server=ftp://ftp.heanet.ie/mirrors/sourceforge/a/ar/archopenrc/\$repo/\$arch Server=http://archbang.org/archopenrc/\$repo/\$arch [arch-nosystemd] SigLevel=Never Server=http://downloads.sourceforge.net/project/archopenrc/\$repo/\$arch Server=ftp://ftp.heanet.ie/mirrors/sourceforge/a/ar/archopenrc/\$repo/\$arch Server=http://archbang.org/archopenrc/\$repo/\$arch EOF The 'SigLevel=Never' directives are only required for the new repositories and only until the openrc-keyring is installed. # pacman -Syy openrc-keyring openrc-mirrorlist # pacman-key --populate openrc You can now remove the [arch-openrc] and [arch-nosystemd] sections and use our mirrorlist: # sed -e :a -e '$d;N;2,11ba' -e 'P;D' -i /etc/pacman.conf # remove the last 11 previously added lines # pacman -Sw repo-openrc # pacman -Udd /var/cache/pacman/pkg/repo-openrc-*.any.pkg.tar.xz # this workaround is needed due to systemd-conflicting deps # cat << EOF >> /etc/pacman.conf [openrc-eudev] SigLevel=PackageOptional Server=http://downloads.sourceforge.net/project/archopenrc/\$repo/\$arch Server=ftp://ftp.heanet.ie/mirrors/sourceforge/a/ar/archopenrc/\$repo/\$arch EOF 2. Save a list of your running daemons. # systemctl list-units --state=running | grep -v systemd | awk '{print $1}' | grep service > daemon.list 3. Refresh the package database once more to update [openrc-eudev]. Then you can list the repos packages with 'pacman -Sl '. The ones ending in -openrc are start/stop scripts for various daemons. Compare with the list from step 2.
Then, install and populate our keyring and fetch the basic packages in cache (not really mandatory, but the internet might collapse in the middle of the update and leave you without init).
# pacman -Sy # pacman -Sl arch-openrc arch-nosystemd # pacman -Sw sysvinit openrc eudev udev-openrc eudev-systemd libeudev-systemd dbus-openrc dbus-nosystemd procps-ng-nosystemd syslog-ng-nosystemd 4. Remove systemd and family (answer 'yes' to all pacman questions below). If you do this you MUST also complete step 5, otherwise you're left without init system. If you're doing this remotely (e.g. through ssh), please keep another ssh session open, just in case the first one freezes (has happened to me once). # pacman -Rdd systemd libsystemd 5. Install openrc and family (eudev-systemd provides systemd and libsystemd dependencies for packages that are linked against libsystemd).
Some systems, especially of pre-2012 installations might have leftover sysvinit configuration files. In such a case, either remove or rename them. Or you can keep calm and use '--force' to overwrite them. # pacman -S sysvinit openrc eudev udev-openrc eudev-systemd libeudev-systemd


Under no circumstances proceed to reboot without having successfully completed steps 4 and 5; if you encounter errors, re-read the instructions carefully. They're proven time and again. If you still can't make it work, follow the "Revert to systemd" instructions at the bottom of this page and ask for help, here or at the IRC.

Normally however, steps 4 and 5 complete without error and your system is ready to boot with init/OpenRC.
Still, it's recommended to install some additional packages and perform some configuration before rebooting.

6. Additional necessary packages:
* procps-ng-nosystemd
because procps-ng's binaries are hardlinked to libsystemd and won't work.
* dbus-openrc because, well, dbus.
* netirc for a network configuration backend (networkmanager-openrc and connman-openrc are also available)
* util-linux-nosystemd because an upstream util-linux binary I don't remember depended on some systemd-cruft.
# pacman -S --needed dbus-openrc procps-ng-nosystemd netifrc 7. Install the openrc scripts for your daemons from step 2 (edit for your setup). This will also install the respective daemons' packages, if missing. # pacman -S --needed acpid-openrc alsa-utils-openrc autofs-openrc consolekit consolekit-openrc cgmanager-openrc cronie-openrc dbus-openrc cups-openrc displaymanager-openrc fuse-openrc haveged-openrc hdparm-openrc openssh-openrc samba-openrc syslog-ng-openrc 8. The following steps concern system-wide settings; for desktop configuration we'll elaborate in Configuration. First, enable the necessary daemons. # for daemon in acpid alsasound autofs dbus consolekit cronie cupsd xdm fuse haveged hdparm smb sshd atd; do rc-update add $daemon default; done 9. Edit /etc/rc.conf to your liking.

If you want to boot into X, edit /etc/conf.d/xdm and replace 'xdm' with your display manager (e.g. 'lxdm' or 'mdm') and enable xdm.

OpenRC reads /etc/conf.d/modules instead of systemd's /etc/modules-load.d/. Read the kernel modules section of the Gentoo wiki if you have a less simple setup or module autoloading doesn't work as expected.
# vi /etc/rc.conf # vi /etc/conf.d/xdm # rc-update add xdm default # vi /etc/conf.d/modules 10. Copy all sysctl settings into /etc/sysctl.conf and edit. Alternatively, install procps-ng-nosystemd, but before creating /etc/sysctl.conf because it's provided by the package.

Save your hostname where OpenRC can find it.

Edit your keyboard, console font and locale settings.
# cat /etc/sysctl.d/*.conf >> /etc/sysctl.conf # vi /etc/sysctl.conf # echo "hostname="`hostname` >| /etc/conf.d/hostname # vi /etc/conf.d/keymaps # vi /etc/conf.d/consolefont # vi /etc/locale.conf 11. Edit /etc/conf.d/net, especially if this is a remote box. Assuming the main network interface is eth0, set its IP and default route and make a symlink of /etc/init.d/net.lo -> /etc/init.d/net.eth0 (net.lo is a template and the symlink is mandatory). And make sure you tell OpenRC to start the interface at boot. This needs netifrc to work.
Also, depending on your configuration (i.e. persistent or traditional device naming), your NIC might not have the same name upon reboot with OpenRC; this is fine and easily fixable if you have physical access to your machine, but on remote ones you'd better disable predictable device naming (# ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules). Alternatively, create and enable 2 NIC profiles and see which one gets picked-up. In the codeblock below, net.eth0 and net.enp0s3 are just examples, run 'ls /sys/class/net' to see yours.
# vi /etc/conf.d/net # cd /etc/init.d # ln -s net.lo net.eth0 OR ln -s net.lo net.enp0s3 # rc-update add net.eth0 boot OR rc-update add net.enp0s3 boot 12. If you have an LVM setup, you need lvm2-openrc and device-mapper-openrc, otherwise your logical volumes will be inactive after reboot. # pacman -S lvm2-openrc device-mapper-openrc # rc-update add lvm boot # rc-update add device-mapper boot 13. Remove some systemd-only users (optional). # for user in systemd-journal systemd-journal-gateway systemd-timesync systemd-network systemd-bus-proxy systemd-journal-remote systemd-journal-upload; do userdel $user; done 14. Make sure you remove any 'init=/usr/lib/systemd/systemd' or similar directives in your bootloader config, if any. The linux kernel by default launches /sbin/init. Also, remove any 'x-systemd' directives from /etc/fstab. # vi /boot/grub/grub.cfg # vi /etc/fstab 15. Packages for desktop users. Read Configuration for better explanation, this step is here for the sake of completeness.

Make sure that a graphical authentication agent is installed and autostarted on login. Cinnamon, GNOME, KDE, LXDE, LXQt, MATE and Xfce have an authentication agent already. See this section of Polkit if unsure.

Finally, become member of some groups (for suspend/hibernation functionality and for accessing soundcards, removable drives, cd/dvd-roms). Membership in audio group might not be necessary, or even a privilege escalation, depending on your setup; input group might also be redundant; YMMV. If your desktop is MATE or LXQT, you should install upower-pm-utils; otherwise upstream upower works fine.
# pacman -S --needed consolekit polkit-consolekit udisks2-nosystemd desktop-privileges xorg-xwrapper upower|upower-pm-utils # pacman -S --needed polkit-gnome|polkit-kde|mate-polkit|lxsession|lxqt-policykit # also xfce-polkit-git or polkit-efl-git from the AUR # usermod -a -G video,audio,input,power,storage,optical,lp,scanner $USER 16. You can now reboot into openrc. However, since systemd's executables are no longer present, this is not possible at this point with the regular commands. Umount all filesystems manually and force remount / read-only. You can also use SysRq; sync filesystems, remount read-only and reboot. # umount -a # mount -f / -o remount,ro # echo s >| /proc/sysrq-trigger # echo u >| /proc/sysrq-trigger # echo b >| /proc/sysrq-trigger 17. Enjoy your systemd-free box. Additional configuration may be needed, especially with regards to a window manager or a desktop environment. Read the information and the linked articles in Configuration for more information. OpenRC 0.13.8 is starting up Arch Linux (x86_64) * Mounting /proc ... [ ok ] * Mounting /run ... * /run/openrc: creating directory * /run/lock: creating directory * /run/lock: correcting owner * Caching service dependencies ... ...

About the pacman one-liner

You still want to do it in one step? It can be done, but I'll break it down in two. You see, as some packages depend on systemd, pacman will refuse to remove them if you simply 'pacman -S sysvinit openrc eudev udev-openrc'. The '-dd' switch is needed to convice pacman not to care about dependencies (effectively allowing systemd to be removed), but that will also instruct pacman not to fetch any dependencies for your newly installed openrc; it will only install the openrc packages explicitly specified in the command line and it's possible that you forget some important ones. I've forgotten sysvinit once... which of course resulted in unbootable system, whereas sysvinit would normally be pulled in as a dependency of openrc.
Therefore, the Correct(TM) approach is to remove systemd and family with '-Rdd' and let 'pacman -S' install openrc and family all-inclusive:

# pacman -Rdd systemd libsystemd systemd-sysvcompat # pacman -S sysvinit openrc eudev udev-openrc eudev-systemd dbus-openrc procps-ng-nosystemd syslog-ng-nosystemd udisks2-nosystemd consolekit polkit-consolekit upower-pm-utils udisks2-nosystemd desktop-privileges xorg-xwrapper acpid-openrc alsa-utils-openrc autofs-openrc consolekit consolekit-openrc cronie-openrc dbus-openrc cups-openrc displaymanager-openrc fuse-openrc haveged-openrc hdparm-openrc openssh-openrc samba-openrc syslog-ng-openrc avahi-openrc All you have to do now is to complete configuring your system as shown in the comprehensive steps above and in Configuration.

Revert to systemd

If, perchance, you're not satisfied with the result you can always roll-back to systemd by executing the above two pacman commands inverted.

# pacman -Rs sysvinit openrc eudev udev-openrc eudev-systemd dbus-openrc procps-ng-nosystemd syslog-ng-nosystemd udisks2-nosystemd consolekit polkit-consolekit upower-pm-utils udisks2-nosystemd desktop-privileges xorg-xwrapper acpid-openrc alsa-utils-openrc autofs-openrc consolekit consolekit-openrc cronie-openrc dbus-openrc cups-openrc displaymanager-openrc fuse-openrc haveged-openrc hdparm-openrc openssh-openrc samba-openrc syslog-ng-openrc avahi-openrc # pacman -S systemd libsystemd systemd-sysvcompat

But why would you want to do such a bad thing?