Manjaro OpenRC, an alternative to systemd

OpenRC, an alternative to systemd

From Manjaro
Revision as of 21:52, 21 June 2014 by imported>Viking60 (→‎Removing services)

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

It can be used as 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.

Installation

Method A

OpenRC is available in the Unstable branch of the Manjaro repositories. Users of that branch can install OpenRC in the following way:

1) Remove systemd-sysvcompat

sudo pacman -R systemd-sysvcompat

2) Install sysvinit

sudo pacman -S sysvinit

3) Install the openrc-base package

sudo pacman -S openrc-base

The output of the above command looks like the following:

$ sudo pacman -S openrc-base
:: There are 10 members in group openrc-base:
:: Repository community
   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...
:: openrc-core and systemd-sysvcompat are in conflict. Remove systemd-sysvcompat? [y/N] y

Packages (12): systemd-sysvcompat-212-3 [removal]  sysvinit-2.88-15
               cronie-openrc-20140614-1  cryptsetup-openrc-20140614-1
               dbus-openrc-20140614-1  device-mapper-openrc-20140614-1
               dhcpcd-openrc-20140614-1  glibc-openrc-20140614-1
               inetutils-openrc-20140614-1  lvm2-openrc-20140614-1
               mdadm-openrc-20140614-1  openrc-core-0.12.4-16

Total Download Size:    0.22 MiB
Total Installed Size:   1.19 MiB

:: Proceed with installation? [Y/n] 

Method B

OpenRC is currently available from the AUR, and from a binary repository courtesy Archbang and artoo.

To use the binary repos, add the following near the end of the /etc/pacman.conf file:

[openrc]
SigLevel = Optional TrustAll
Server = http://archbang.org/repos/$repo/$arch

[aur-nosystemd]
SigLevel = Optional TrustAll
Server = http://archbang.org/repos/$repo/$arch

And then run sudo pacman -Syu to synchronise the reposotories.

The main package to install is openrc-base. It installs a binary init sysvinit (sysvinit), and the OpenRC base scripts and configuration. (When installing from the AUR the package is openrc-core rather than openrc-base. You may also need to install sysvinit manually if the build fails.)

To install the openrc-base package, use:

sudo pacman -S openrc-base

This package conflicts with systemd-sysvcompat, which will be removed. The output looks like:

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

Packages (3): systemd-sysvcompat-212-3 [removal]  sysvinit-2.88-15
             openrc-base-0.12.4-12

Total Download Size:    0.24 MiB
Total Installed Size:   0.96 MiB
Net Upgrade Size:       0.95 MiB

:: Proceed with installation? [Y/n]

Common

After installing the openrc-base package, 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 the openrc-base package, you may get messages like:

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

Running these commands adds the services to the specified runlevels. For example if you run:

sudo rc-update add cronie default

Then the cronie service would be added to the default runelevel and would automatically be started at boot.

Removing services

While we start services with

rc-update add <service> default 

there might be the need to stop a service from time to time; like this:

sudo rc-update del tor default 

You will need to do this after having removed an OpenRC package, or simply because you want to stop a service.

To check what services are running, and that you successfully have stopped the service, you can type:

rc-status

Additional packages

Display Manager

To boot to a graphical display manager, install the displaymanager-openrc package, and edit the /etc/conf.d/xdm file to specify your display manager. For example, to use lightdm, I changed the line

DISPLAYMANAGER="xdm"

to

DISPLAYMANAGER="lightdm"

Note:

lightdm and a lightdm-greeter should be installed and configured to use lightdm as display manager.

An alternative to lightdm that I find simpler is LXDM. However the version in the repos does not automatically start a ck-session on login; alternative lxdm-consolekit from the AUR can be used.

Audio (ALSA)

The alsa-utils-openrc package can be installed. After installing it run:

sudo rc-update add alsasound default

to automatically start Alsa at boot.

Network Manager

By default dhcpcd is enabled. However if you use Wifi to connect, or need a graphical network applet, then networkmanager-openrc can be installed.

The networkmanager-openrc replaces the normal networkmanager package in the repos. Also, it requires consolekit and polkit-consolekit, which replaces the normal polkit from the repos.

If networkmanager-openrc from the AB repos doesnt work for you and conlicts with existing packages, try out networkmanager-openrc from the AUR.

Consolekit

You may also wish to install consolekit-openrc, which supports multi-user setups, mounting of partitions by unauthorised users, etc. See the Gentoo-Wiki for more details.

Only caveat of installing consolekit is that it requires polkit-consolekit, which conflicts with the normal polkit; so if you boot to systemd you wont be able to mount partitions if you are not in the storage group.

However using the command line, or as root user, one can mount any partition or perform most functions that are made available to the normal user via polkit. See the Arch-wiki for more details.

openrc-desktop

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

$ sudo pacman -S openrc-desktop
:: There are 6 members in group openrc-desktop:
:: Repository community
   1) acpid-openrc  2) alsa-utils-openrc  3) avahi-openrc  4) consolekit-openrc
   5) displaymanager-openrc  6) gpm-openrc

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

Packages (6): acpid-openrc-20140614-1  alsa-utils-openrc-20140614-1
              avahi-openrc-20140614-1  consolekit-openrc-20140614-1
              displaymanager-openrc-20140614-1  gpm-openrc-20140614-1

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

:: Proceed with installation? [Y/n] 

Others

For acpi support acpid-openrc can be installed and enabled.

For running the ps command, the procps-ng-nosystemd / procps-ng-eudev package can be installed. To suspend and hibernate via the command line, pm-utils can be installed. You may also need the upower-nosystemd-pm-utils / upower-eudev-pm-utils package if suspend and hibernate does not work. Also see the troubleshooting section for enabling swap.

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

Step 1) Install eudev-openrc

sudo pacman -S eudev-openrc

The output looks like the following:

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

Packages (4): eudev-1.7-3  libsystemd-212-3 [removal]  systemd-212-3 [removal]
              eudev-openrc-20140614-1

Total Download Size:    0.83 MiB
Total Installed Size:   6.46 MiB
Net Upgrade Size:       -10.81 MiB 

:: Proceed with installation? [Y/n] 

Step 2) Install dbus-eudev / dbus-nosystemd

sudo pacman -S dbus-eudev

The output looks like the following:

$ sudo pacman -S dbus-eudev
[sudo] password for aaditya: 
resolving dependencies...
looking for inter-conflicts...
:: dbus-eudev and dbus are in conflict (dbus-core). Remove dbus? [y/N] y

Packages (3): dbus-1.8.2-1 [removal]  libdbus-1.8.4-1  dbus-eudev-1.8.4-1

Total Download Size:    0.52 MiB
Total Installed Size:   1.85 MiB
Net Upgrade Size:       0.10 MiB

:: Proceed with installation? [Y/n] 

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

Note the optional dependencies for eudev:

Optional dependencies for eudev
    eudev-openrc: eudev postmount script [pending]
    dbus-eudev: dbus without systemd
    upower-pm-utils-eudev: upower without systemd
    udisks2-eudev: udisks2 without systemd
    libpulse-eudev: libpulse without systemd
    cups-eudev: cups without systemd
    procps-ng-eudev: procps-ng without systemd

These can be installed to get required functionalities. I installed the upower-pm-utils-eudev, udisks2-eudev, and procps-ng-eudev packages.

After uninstalling systemd, I could not login to my xfce4-session, as it was complied for systemd. Hence I had to install xfce4-session-consolekit from the AUR to get it working.

I also had to downgrade xfce4-power-manager to version 1.2.0-5 to get it working.

Additionally, if not already done, 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

The output looks like the following:

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

Packages (5): consolekit-0.4.6-4  js185-1.0.0-2  polkit-0.112-2 [removal]
              polkit-consolekit-0.112-2  consolekit-openrc-20140614-1

Total Download Size:    1.90 MiB
Total Installed Size:   10.67 MiB
Net Upgrade Size:       9.08 MiB 

:: Proceed with installation? [Y/n] 

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 = 

Possible issues

I had to rebuild gvfs as my unmounted partitions were not being displayed.

Also had to rebuild xmms as it was not working.

Had to install libpulse-eudev / libpulse-nosystemd in order to get VLC Player to work.

Troubleshooting

When booting, you may get errors like:

tmpfiles: ignoring invalid entry on line 32 of `/usr/lib/tmpfiles.d//legacy.conf'
tmpfiles: ignoring invalid entry on line 33 of `/usr/lib/tmpfiles.d//legacy.conf'
tmpfiles: ignoring invalid entry on line 34 of `/usr/lib/tmpfiles.d//legacy.conf'
tmpfiles: ignoring invalid entry on line 11 of `/usr/lib/tmpfiles.d//systemd-nologin.conf'
tmpfiles: ignoring invalid entry on line 18 of `/usr/lib/tmpfiles.d//x11.conf'

To correct, I removed the lines referenced in the above files. These errors have been fixed by the developers on github, and should be available in the next release.

The boot logs for OpenRC are stored in /var/log/rc.log

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.

I added the following entry to my /etc/fstab

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

Also, systemd used to set a tmpfs by default; to set it manually via /etc/fstab, I added the following lines:

tmpfs		/tmp		tmpfs   nodev,nosuid          	0  	0

See the Arch Wiki for more details.

Further Reading

The Arch Wiki

OpenRC on Arch Linux

Using OpenRC on Arch / Archbang / Manjaro Linux

Support

Following is a link to this page's forum counterpart where you can post any related feedback: [1]

Cookies help us deliver our services. By using our services, you agree to our use of cookies.