Using OpenRC on Arch / Archbang / Manjaro Linux.

With the increasing complexity of systemd, I decided to look for alternatives. After some searching and experimentation, I settled upon OpenRC.

OpenRC is a dependency based rc system that works with the system provided init program, normally sysvinit.

Before proceeding furthur, let me list some of the resources available:

1) Manjaro Linux wiki

2) Manjaro Linux forum (new) (old)

3) Arch Linux wiki

4) Arch Linux forum

5) Archbang wiki

6) OpenRC AUR packages

7) PKGBUILDs by artoo: https://github.com/manjaro/packages-openrc

8) Pacman repos for openrc and related stuff, built from above pkgbuilds:

[openrc-eudev]
SigLevel = PackageOptional
Server = http://downloads.sourceforge.net/project/archopenrc/$repo/$arch

9) systemd-free.org (much more up to date than this blog).

Setting Up OpenRC

Step 1)
Add the repos mentioned in the resources section to /etc/pacman.conf

[openrc-eudev]
SigLevel = PackageOptional
Server = http://downloads.sourceforge.net/project/archopenrc/$repo/$arch

Install the openrc-base package group:

sudo pacman -S openrc-base

This installs the binary init system (sysvinit), and the base OpenRC scripts and configuration.

The sysvinit package conflicts with the systemd-sysvcompat, so it will be necessary to remove it in order to install OpenRC.

The output of the command looks like the following:

$ sudo pacman -S openrc-base
:: There are 10 members in group openrc-base:
:: Repository openrc-eudev
   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) openrc-core

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

Packages (13): cronie-1.4.11-2  systemd-sysvcompat-212-3 [removal]
               sysvinit-2.88-16  cronie-openrc-20141002-1
               cryptsetup-openrc-20141002-1  dbus-openrc-20141002-1
               device-mapper-openrc-20141002-1  dhcpcd-openrc-20141002-1
               glibc-openrc-20141002-1  inetutils-openrc-20141002-1
               lvm2-openrc-20141002-1  mdadm-openrc-20141002-1
               openrc-core-0.13.1-3

Total Download Size:    0.32 MiB
Total Installed Size:   1.24 MiB
Net Upgrade Size:       1.24 MiB

:: Proceed with installation? [Y/n]

On installing openrc-base, OpenRC should boot by default instead of systemd.

Note-

If on booting you get an error like “/etc/sysctl.conf not found”, it can be corrected by creating /etc/sysctl.conf with the command sudo touch /etc/sysctl.conf

On shutdown if you get a message like “Warning: /usr/lib/rc/cache is not writable!”, then this directory can be created as sudo mkdir /usr/lib/rc/cache

The boot logs are stored in /var/log/rc.log by default.

Step 2)
Some common services that could be enabled are dbus, which is a system message bus, and cronie, which provides the cron service, by running:

sudo rc-update add dbus default
sudo rc-update add cronie default

For networking dhcpcd is enabled by default via netifrc, for more details have a look here.

dhcpcd worked out of the box on my Arch install in a VM, but on my main laptop I use a Wifi connection, so I installed networkmanager-openrc from the openrc repo.

Nowadays I am using wicd-openrc (available in the repo) as an alternative to networkmanager.

By default, a graphical Display Manager is not enabled; for that one would need to install displaymanager-openrc, configure one’s display manager in /etc/conf.d/xdm, and enable and start the xdm service.

I then installed alsa-utils-openrc for ALSA (audio) support, and acpid-openrc for acpi support.

Note that after installing these packages, the services wont be enabled unless you addded to a runlevel, which is suggested when installing these packages:

installed acpid-openrc (20140527-1)
==> run 'rc-update add acpid default'

(need to be root when doing that)

For example,
sudo rc-update add acpid default

consolekit can be installed to perform root actions like shutting down or restarting system as non-root user from your Desktop Environment.

Consolekit can be installed in the following way:

sudo pacman -S consolekit-openrc polkit-consolekit cgmanager-openrc

The output looks like the following:

$ sudo pacman -S consolekit-openrc polkit-consolekit cgmanager-openrc
resolving dependencies...
looking for inter-conflicts...
:: polkit-consolekit and polkit are in conflict. Remove polkit? [y/N] y

Packages (9): cgmanager-0.37-2  consolekit-1.0.0-3  libnih-1.0.3-2  openrc-core-0.17-2  polkit-0.112-2 [removal]  cgmanager-openrc-20150911-1
              consolekit-openrc-20150911-1  polkit-consolekit-0.113-1

Total Download Size:    0.92 MiB
Total Installed Size:   4.44 MiB
Net Upgrade Size:       2.84 MiB

:: Proceed with installation? [Y/n]

After installing the consolekit service needs to be started and enabled. To enable the consolekit service, sudo rc-update add consolekit can be used.

Consolekit supports multi-user setups, mounting of partitions by unauthorised users, shutting down the system as normal user, etc. See https://wiki.gentoo.org/wiki/ConsoleKit for more details.

To check that consolekit is running and a ck-session was started, the following command can be used:

ck-list-sessions

The output looks like the following:

 Session1:
    unix-user = '1000'
    realname = 'Aaditya Bagga'
    seat = 'Seat1'
    session-type = ''
    active = TRUE
    x11-display = ':0'
    x11-display-device = '/dev/tty7'
    display-device = ''
    remote-host-name = ''
    is-local = TRUE
    on-since = '2014-06-15T13:29:58.652929Z'
    login-session-id = ''

Consolekit sessions are usually started by the display manager when logging in, or via the command line like:

ck-launch-session startxfce4

To get all the desktop related packages in one go (the openrc-desktop package group can be installed as:

sudo pacman -S openrc-desktop

The output of the command looks like the following:

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

Enter a selection (default=all): 
warning: cronie-openrc-20141002-1 is up to date -- reinstalling
warning: dbus-openrc-20141002-1 is up to date -- reinstalling
warning: dhcpcd-openrc-20141002-1 is up to date -- reinstalling
resolving dependencies...
looking for inter-conflicts...
:: polkit-consolekit and polkit are in conflict. Remove polkit? [y/N] y

Packages (14): acpid-2.0.23-1  consolekit-0.4.6-5  js185-1.0.0-2
               polkit-0.112-2 [removal]  polkit-consolekit-0.112-2
               acpid-openrc-20141002-1  alsa-utils-openrc-20141002-1
               avahi-openrc-20141002-1  consolekit-openrc-20141002-1
               cronie-openrc-20141002-1  dbus-openrc-20141002-1
               dhcpcd-openrc-20141002-1  displaymanager-openrc-20141002-1
               gpm-openrc-20141002-1

Total Download Size:    1.96 MiB
Total Installed Size:   10.94 MiB
Net Upgrade Size:       9.31 MiB

:: Proceed with installation? [Y/n] 

The services for the above packages can be enabled after installing. I also installed pm-utils for suspending and hibernating my laptop.

If you were using systemd on a GPT partitioned hard disk, then you may need to enable swap via /etc/fstab. This is so because systemd handled swap automatically on GPT partitions, and gave error if it was mounted via fstab.

Also, systemd used to set a tmpfs by default; to set it manually via /etc/fstab, see https://wiki.archlinux.org/index.php/Fstab#tmpfs

With systemd cron jobs are implemented via systemd timers; for OpenRC a set of cronjobs can be obtained from https://github.com/notfoss/archlinux-cronjobs

Some commonly used services are ssh and cups, to install and enable them have a look here.

Some things that are not working for me are:

  • Partition mounting by clicking on unmounted partition (may work for you if you are in the storage group)
    This was due to my login manager (lxdm) not automatically starting a ck-session. I was advised by artoo to use lightdm as it has runtime detection; using lightdm worked. A patched version of lxdm also works. I have put it in the openrc repo and the AUR as lxdm-consolekit.

My System

Operating System: Manjaro Linux
Desktop Environment: Xfce
Display Manager: lxdm

Note

To boot with systemd instead, when the GRUB menu is encountered while booting, press e to edit, and at the end of the line that starts with linux, add:

init=/usr/lib/systemd/systemd

Part 2) Going full monty:
Removing systemd and installing eudev

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 incompatibilities with existing software, hence its advertised as being for advanced / minimalistic users.

Step 1) Install eudev and eudev-systemdcompat

sudo pacman -S eudev eudev-systemdcompat

The output looks like the following:

$ sudo pacman -S eudev eudev-systemdcompat
resolving dependencies...
looking for inter-conflicts...
:: eudev and libsystemd are in conflict (libgudev-1.0.so). Remove libsystemd? [y/N] y
:: eudev-systemdcompat and systemd are in conflict. Remove systemd? [y/N] y

Packages (5): eudev-1.10-1  libsystemd-212-3 [removal]  systemd-212-3 [removal]
              eudev-systemdcompat-216-2

Total Download Size:    0.90 MiB
Total Installed Size:   6.63 MiB
Net Upgrade Size:       -10.64 MiB

:: Proceed with installation? [Y/n] 

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

Possible issues

I had to rebuild gvfs as my unmounted partitions were not being displayed (seems to have been solved due to using eudev-systemdcompat).

Some packages now use certain systemd components like systemd-tmpfiles and systemd-sysusers while installing, to maintain compatibility the openrc-systemdcompat package from the repo can be installed.

Further Reading
Blog article by x33a (notfoss): http://blog.notfoss.com/posts/openrc-on-arch-linux/

Update 07/08/14
ISOs available, based on Manjaro Linux.
Details: https://forum.manjaro.org/index.php?board=50.0

Update 02/10/14
Old pacman repo and instructions and replaced with new repo and new instructions.

Update 26/01/15
I have decided to scale back on the efforts of maintaining the repo mentioned at the beginning of the post, people who want to keep more up to date can consider updating their packages by building from the sources mentioned in the beginning.

Update 07/03/15
New repo setup in association with nous from Arch Linux; it succeeds the earlier repo.

[openrc-eudev]
SigLevel = PackageOptional
Server = http://downloads.sourceforge.net/project/archopenrc/$repo/$arch

Update 15/02/16
nous has been maintaining the openrc-eudev repo from some time now (systemd-free.org).


Advertisement

13 thoughts on “Using OpenRC on Arch / Archbang / Manjaro Linux.

  1. Hi there, very well put together, thank you. I’m wondering, are the benefits just less complexity or is there an improvement in speed noticeable as well?

  2. Hi joe,

    Besides less complexity, OpenRC has the benefit that it allows more control.

    Systemd used to perform so many services automatically, like renaming network devices, backlight, setting swap, etc; and more recently, even for cronjobs like updatedb and such.. https://forum.manjaro.org/index.php?topic=13943.0

    This list of things done automatically seemed to grow with each version of systemd, and I did not find it easy to disable this functionality.

    Using OpenRC, the system does seem slightly snappier, but as I am on a reasonably modern system, perhaps it would be more noticeable on older systems.

    Theoretically speaking, OpenRC should be faster as its performing a lot less things than what systemd tries to do.

  3. Nice writeup Aaditya.

    One thing I would like to point is that the errors, such as:

    > tmpfiles: ignoring invalid entry on line 32 of `/usr/lib/tmpfiles.d//legacy.conf’

    have been fixed in the git version of OpenRC: https://github.com/OpenRC/openrc/issues/17

    Unfortunately, there hasn’t been a stable release for about 6 months, let’s see when the fix makes it to the stable version.

  4. @ joe holzer,

    from my experience (and on a prehistoric machine), OpenRC isn’t as fast as systemd. But it takes about 30 seconds to boot into my i3wm session, so it isn’t noticably slow either.

    I tried playing around with parallel launching of services, but that didn’t seem to make a difference at all.

  5. I personally don’t understand today’s hype about boot times, but its only my
    view. I think it reflects the zeitgeist, I am not really fond of.
    Half a minute for example is acceptable to me, if I don’t have a monolithic lindows monster starting up maybe 10 seconds faster.
    Anyway, I am happy my packages have some use for frustrated systemd heretics.

  6. Hi,
    How to have dnsmasq starting with this setup? I have no such script in /etc/init.d/ ?
    And no info around openrc + dnsmasq?

  7. hi, while updating through pacman, i get this error,

    : systemd and eudev-systemdcompat are in conflict (systemd-tools). Remove eudev-systemdcompat? [y/N] n
    error: unresolvable package conflicts detected
    error: failed to prepare transaction (conflicting dependencies)
    :: systemd and eudev-systemdcompat are in conflict

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s