OpenRC

Warning: OpenRC is actually unstable and untested, install it at your own risks. It shouldn't break if you follow the instructions.

OpenRC is a dependency based init system maintained by the Gentoo developers, that works with the system provided init program, normally sysvinit. It is not a replacement for sysvinit.

It is an alternative to systemd for users that like more control over their system, and do not want all the features that systemd provides and automatically activates.

Warning

Warning: Please read the whole warning

Usually, when you install a software requring an unit file, it's provided for systemd. OpenRC isn't officially, therefore you will need to add "-openrc" to obtain the daemon for OpenRC. For example, if you install openvpn, You also need to install : openvpn-openrc.

The whole OpenRC suite is packaged in the PCR, in order to install OpenRC, you need to enable the PCR.

For the current session when you install OpenRC, the command poweroff will probably not work. After a hard reboot, the command poweroff works fine again. Close your softwares, do sync, and you can shut down your computer manually.

Netctl is working with systemd, it will not work anymore with OpenRC. In this page, we will assume you already have an alternative, in our case, it is networkmanager.

With OpenRC, you need to remove plymouth, it will not work if you have plymouth.

Make sure your user is on the audio group, you won't have sound otherwise:

usermod -aG audio <your-user>

Same for video, your games might be laggy otherwise:

usermod -aG video <your-user>

You can reinstall systemd when you want, its dependencies will be reinstalled as well.

Basic installation

OpenRC is available in the PCR. It can be installed as:

pacman -S openrc-base

The output of the above command looks like the following:

$ sudo pacman -S openrc-base
:: There are 11 members in group openrc-base:
:: Repository pcr
   1) cronie-openrc  2) cryptsetup-openrc  3) dbus-openrc  4) device-mapper-openrc  5) dhcpcd-openrc
   6) glibc-openrc  7) inetutils-openrc  8) lvm2-openrc  9) mdadm-openrc  10) netifrc  11) udev-openrc

Enter a selection (default=all):
resolving dependencies...
looking for inter-conflicts...
:: cronie-openrc and systemd-sysvcompat are in conflict. Remove systemd-sysvcompat? [y/N] y
:: dbus-openrc and dbus are in conflict (dbus-core). Remove dbus? [y/N] y

Packages (15): dbus-1.10.0-4 [removal]  openrc-0.18.3-1  systemd-sysvcompat-227-1 [removal]  sysvinit-2.88-16
               cronie-openrc-20151014-1  cryptsetup-openrc-20151014-1  dbus-openrc-1.10.0-3
               device-mapper-openrc-20151014-1  dhcpcd-openrc-20151014-1  glibc-openrc-20151014-1
               inetutils-openrc-20151014-1  lvm2-openrc-20151014-1  mdadm-openrc-20151014-1  netifrc-0.3.1-3
               udev-openrc-30-3

Total Download Size:    0,38 MiB
Total Installed Size:   2,33 MiB
Net Upgrade Size:       1,35 MiB

:: Proceed with installation? [Y/n]

After installing the openrc-base package group, OpenRC should boot by default instead of systemd. Note that it will boot to a command line, as the service for a graphical display manager has not yet been installed.

On installing openrc-base, one may get messages like:

run 'rc-update add cronie default'
run 'rc-update add dbus default'

Running these command(s) adds the service(s) to the specified runlevels. For example on running:

sudo rc-update add dbus default

The dbus service would be added to the default runelevel and would automatically be started at boot.

dbus (system message bus) and cronie (for cron) are some common services that can be enabled.

openrc-desktop

The openrc-desktop package group can be used to install most of the above desktop related packages in one go. For example:

$ sudo pacman -S openrc-desktop
:: There are 11 members in group openrc-desktop:
:: Repository pcr
   1) acpid-openrc  2) alsa-utils-openrc  3) avahi-openrc  4) cgmanager-openrc  5) consolekit-openrc
   6) cronie-openrc  7) dbus-openrc  8) dhcpcd-openrc  9) displaymanager-openrc  10) gpm-openrc  11) udev-openrc

Enter a selection (default=all): 
resolving dependencies...
looking for inter-conflicts...

Packages (11): acpid-openrc-20151020-1  alsa-utils-openrc-20151020-1  avahi-openrc-20151020-1
               cgmanager-openrc-20151020-1  consolekit-openrc-20151020-1  cronie-openrc-20151020-1
               dbus-openrc-1.10.0-3  dhcpcd-openrc-20151020  displaymanager-openrc-20151020-1  gpm-openrc-20151020-1
               udev-openrc-30-3

Total Installed Size:   0.12 MiB
Net Upgrade Size:       0.00 MiB

:: Proceed with installation? [Y/n] 

Replacing systemd with eudev (advanced users)

With OpenRC being used as init system, the role of systemd is reduced to that of a udev provider, and for compatibility reasons.

eudev, developed by the Gentoo folks, can be used as replacement. Note that removing systemd could cause some incompatibilities with existing software.

The steps to install eudev are as follows:

sudo pacman -S eudev eudev-systemdcompat

The output looks like the following:

$ sudo pacman -S eudev eudev-systemdcompat
resolving dependencies...
looking for conflicting packages...
:: eudev and libsystemd are in conflict (libgudev.so). Remove libsystemd? [y/N] y
:: eudev-systemdcompat and systemd are in conflict. Remove systemd? [y/N] y
warning: dependency cycle detected:
warning: eudev-systemdcompat will be installed before its eudev dependency

Packages (4) libsystemd-226-3 [removal]  systemd-226-3.parabola1 [removal]  eudev-3.1.4-1  eudev-systemdcompat-226-1

 Total Download Size:     1,18 MiB
 Total Installed Size:    7,81 MiB
 Net Upgrade Size:      -21,17 MiB
 
 :: Proceed with installation? [Y/n] 

After the above steps systemd would be uninstalled and replaced by eudev and its counterparts.

Configuration

Daemons often required

Once you migrate to OpenRC, you might need to add dbus, or lvm2 etc. There is the procedure for lvm2-openrc :

sudo rc-update add lvm boot

For cryptsetup-openrc :

sudo rc-update add dmcrypt boot

For dbus-openrc :

sudo rc-update add dbus default

For alsa-utils-openrc :

sudo rc-update add alsasound default

For cronie-openrc :

sudo rc-update add cronie default

On each package containing an openrc daemon, you will have have this message :

      ==> rc 'rc-update add ... default'

Hostname

OpenRC has its configuration in /etc/conf.d/, in order to have your hostname, copy it as follow:

# cp /etc/hostname /etc/conf.d/hostname

NetworkManager settings

NetworkManager is installed with the package networkmanager-openrc, you need to enable the software at boot:

sudo rc-update add networkmanager default


In order to not change the computer's hostname when you're connecting to Internet (provided by dhcp), uncomment the part [keyfile] in the file /etc/NetworkManager/NetworkManager.conf as follow :

# Static hostname
[keyfile]
hostname=**Votre hostname**

Keymap

As the hostname, you need to setup the keymap in the file /etc/conf.d/keymaps :

keymap="us"

If you have an advanced usage of your keymap, you can watch the other functionnalities, documented in the comments.

Launch X11 without root access

As logind only functions if the system is booted with systemd as PID 1, Xorg.wrap can't start X without root rights and fails. [source]

The solution is to CREATE a file with contents in /etc/X11/Xwrapper.config :

# Xorg.wrap configuation file
needs_root_rights = yes 

Login display manager

With OpenRC, the DM is launched differently. For example, with slim, you need to mention slim in the file /etc/conf.d/xdm comme suit :

DISPLAYMANAGER="slim"

Enable the daemon xdm :

sudo rc-update add xdm default

Note that some DMs like xfce4-session doesn't work well.


Adaptation between systemctl and rc-update

Add or delete a service

You can add a service using this way :

sudo rc-update add <service>

And delete it as follow :

sudo rc-update del <service>

Services currently running

In order to have a summary of all the daemons running, stopped etc, you can run this command :

sudo rc-status

Stop/Start/Restart a service

To restart a service, you need to use rc-service :

sudo rc-service networkmanager restart


Usual issues

Sysctl.conf is missing

You can encouter an issue if /etc/sysctl.conf is missing. To fix this, you need to create the file:

sudo touch /etc/sysctl.conf

/usr/lib/rc/cache doesn't exist

If you have this error when you shutdown the computer:

WARNING: /usr/lib/rc/cache is not writable!

The solution is to create the folder:

sudo mkdir /usr/lib/rc/cache

Swap isn't enabled

Systemd used to mount the swap automatically, you need to manually add the swap in /etc/fstab as follow :

# /dev/sda2
UUID=0c3e9434-bc5c-461c-a5e4-4e9fe5f9a149	swap	swap	sw	0	0

tmpfs isn't present

As the swap, systemd automatically mounts the tmpfs. Add it manually in /etc/fstab :

tmpfs		/tmp		tmpfs   nodev,nosuid          	0  	0