OpenRC
OpenRC is an rc system maintained by the Gentoo developers. OpenRC is dependency based and works with the system provided init program, normally sysvinit. It is not a replacement for sysvinit.
Contents
Quick migration from systemd
TL;DR: This is a step-by-step guide for a quick migration from systemd, which should be quite fail-safe. It follows the artoo's method. However, you are strongly advised to read the rest of the wiki page and make an educated decision on which method you should follow.
- Append the unofficial [pfkernel] repository to
/etc/pacman.conf
and refresh the package database withpacman -Sy
- Save a list of your running daemons:
systemctl list-units | grep service | grep running | awk '{print $1}' > daemons.list
(Note: all commands below must be executed as root or with sudo
. Answer 'yes' to all pacman questions.)
- Remove systemd and family:
pacman -Rdd systemd libsystemd
- Install openrc and family:
pacman -S openrc-core eudev eudev-openrc eudev-systemdcompat
(This will also pull sysvinit
. eudev-systemdcompat
provides systemd
and libsystemd
dependencies for packages that are linked against systemd)
- Remove some systemd cruft:
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
- Optional packages (mandatory for desktop users; do install):
pacman -S consolekit polkit-consolekit upower-pm-utils udisks2-nosystemd
- Install the openrc scripts for your daemons from the previous step:
pacman -S 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
(edit accordingly)
To enable sshd
, run rc-update add sshd default
. Do this for each daemon you want.
- Edit
/etc/rc.conf
to your liking and/etc/conf.d/hostname
to set your hostname. 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 runrc-update add xdm default
. - Add your users to the groups you want them having access to:
usermod -a -G video,audio,power,disk,storage,optical,lp,scanner <USER>
(USER can play video, audio, shutdown/reboot/hibernate, access non-system partitions, automount removable or non-persistent storage devices, burn DVDs, print and scan. You should check first which groups USER already belongs to: id USER
.
If you prefer to perform the installation from the AUR instead of the [pfkernel] repository, don't add the [pfkernel] repo to /etc/pacman.conf
and replace above pacman -S
commands with yaourt -Sa
. Since yaourt can't build packages as root anymore, you must run it as a regular user.
- You should now reboot. However, since systemd is no longer present, this is not possible from the command line. Run
sync
,sysctl kernel.sysrq=1
and pressAlt-SysRq-S
,Alt-SysRq-U
andAlt-SysRq-B
to reboot (in some machines reboot is not possible with the latter, so you must pressAlt-SysRq-O
to poweroff). Your system should boot into the login prompt or load your display manager without problem.
- Keep reading for additional configuration steps.
Installation
OpenRC and accompanying packages are available in the AUR.
apg's way
You can choose to install either openrcAUR or openrc-gitAUR. You will also need to install openrc-arch-services-gitAUR (provides service files for use with openrc on arch) and openrc-sysvinitAUR (a slightly patched version of traditional sysvinit). For the sake of compatibility with initscripts, openrc-sysvinitAUR installs the sysvinit init binary as /usr/bin/init-openrc
.
The packages will be installed under /etc/openrc
instead of the default location of /etc
, so that users can switch to initscripts or systemd when desired.
artoo's way
Here you will need to install openrc-coreAUR and the packages in openrc-base.
Some other packages of note are displaymanager-openrcAUR and alsa-utils-openrcAUR (both grouped under the openrc-desktop group), and networkmanager-openrcAUR.
For the list of packages, look at the openrc packages maintained by artoo in the AUR.
A summary as well as the source for these package groups can be found at github.
eudev can also be used as udev provider instead of systemd.
Difference between the approaches
apg's version:
- uses a special directory
/etc/openrc
so that initscripts-forkAUR can be used instead of OpenRC. - uses
newnet
for network configuration. - follows a monolithic pattern, with one package that contains the base openrc system, and another containing the rc scripts
artoo's version:
- uses the default
/etc
directory to maintain compatibility with the Gentoo version (thus initscripts-forkAUR cannot be used.). - uses
netifrc
for network (Gentoo default). - are split packages, which are greater in number, but allow more control in modifying the individual components.
Configuration
For more information on configuring OpenRC, man pages are available; you can also visit the gentoo guide and the gentoo wiki.
See also Init#Troubleshooting.
Booting
apg's way
For booting with OpenRC add init=/usr/bin/init-openrc
to the kernel line in your bootloader configuration. If you want to switch back to systemd, change it to init=/usr/lib/systemd/systemd
.
The /etc/openrc/conf.d
directory, and the /etc/openrc/rc.d
file is used for configuration.
It is worth noting that the udev service is not enabled by default. In order to enable it, do:
# rc-update add udev sysinit
artoo's way
OpenRC is booted by default.
To boot with systemd, add init=/usr/lib/systemd/systemd
to the kernel line in your bootloader configuration.
The files in the /etc/conf.d
directory are used for configuration.
Here udev is enabled by default.
Network
See Network configuration for a detailed look at networking in general.
apg's way
There are multiple ways to get a network up and running. One way is by configuring the /etc/openrc/conf.d/network
file. Both the ip
(iproute2) and the ifconfig
(net-tools) commands are supported.
Below is an example configuration using ip
.
ip_eth0="192.168.1.2/24" defaultiproute="via 192.168.1.1" ifup_eth0="ip link set \$int mtu 1500"
The network service is added to the boot runlevel by default, so no further action is required.
You can also use NetworkManager, dhcpcd or netcfgAUR by enabling the respective services.
artoo's way
dhcpcd is enabled by default.
For network configuration, look at the /etc/conf.d/net
file. By default it uses netifrc, which defaults to dhcpcd if not specified differently in /etc/conf.d/net
The dhcpcd-openrcAUR package provides a specific dhcpcd script, not to be confused with netifrc default. It will start /etc/init.d/dhcpcd
To use a static route you need to create a symlink of net.lo
that reflects your device's name:
ln -s /etc/init.d/net.lo /etc/init.d/net.eth0
See [1] for details.
For having a graphical network manager, networkmanager-openrcAUR can be installed. Other options are available, like connman via connman-openrcAUR.
Other option is netcfgAUR which mimetizes the netctl behaviour (see 1 if you want to enable profiles connection on booting - requires wpa_actiond
). You could consult the official documentation or old wiki documentation (be aware of consulting version later than 2012-05-13)
Logging
apg's way
artoo's way
Different loggers are available, like syslog-ng-openrcAUR, metalog-openrcAUR, and rsyslog-openrcAUR. These loggers may conflict with each other, hence using only a single logger is recommended.
Boot logging
apg's way
OpenRC's boot logging is disabled by default. To enable it, uncomment the following line in /etc/openrc/rc.conf
#rc_logger="YES"
artoo's way
Boot logging is enabled by default. To disable it, comment out the rc_logger="YES" line in /etc/rc.conf
/var/log/rc.log
Hostname
OpenRC sets the hostname from /etc/openrc/conf.d/hostname
(apg's way) or /etc/conf.d/hostname
(artoo's way).
It looks like the following:
# Set to the hostname of this machine hostname="myhostname"
Module autoloading
OpenRC does not use /etc/modules-load.d/ folder, instead it uses /etc/openrc/conf.d/modules
(apg's way) or /etc/conf.d/modules
(artoo's way).
It looks like the following:
# You should consult your kernel documentation and configuration # for a list of modules and their options. modules="vboxdrv acpi_cpufreq"
Locale
Keyboard layout can be configured via /etc/conf.d/keymaps
and /etc/conf.d/consolefont
(artoo's way). You can also configure the settings through the /etc/locale.conf
file, which is sourced via /etc/profile.d/locale.sh
.
See [2] and Locale for details.
Troubleshooting
Error while unmounting /tmp
When shutting the system down, you might get an error message such as
* Unmounting /tmp ... * in use but fuser finds nothing [ !! ]
This can be fixed by adding
no_umounts="/tmp"
to /etc/openrc/conf.d/localmount
Disabling IPv6 does not work
If you have OpenRC installed under the /etc/openrc
sysconf directory.
One fix for this is to put
# Disable ipv6 net.ipv6.conf.all.disable_ipv6 = 1
in a file (with a .conf extension) under /etc/openrc/sysctl.d
During shutdown remounting root as read-only fails
If the above happens, edit the /etc/openrc/init.d/mount-ro
file and put:
telinit u
after the following line:
# Flush all pending disk writes now sync; sync
Error about /etc/sysctl.conf not found
It can be created by running as root:
touch /etc/sysctl.conf
Using OpenRC with a Desktop Environment
If using OpenRC with a desktop environment, consolekit-openrcAUR and related consolekit packages in the AUR may help.
For more info on consolekit, have a look at the Gentoo wiki and the Manjaro wiki.
Xfce
The xfce4-session package has been compiled with logind support; xfce4-session-consolekitAUR from the AUR can be used.
For a login manager, lxdm-consolekitAUR (from the AUR), or lightdm (from the repos) could be used.
Mate
Install mate-session-manager-upowerAUR and mate-power-manager-upowerAUR from the AUR.
KDE
The kdebase-workspace package needs to be recompiled for use with consolekit (kdebase-workspace-consolekitAUR is available from the AUR).
ALSA
You have to enable alsa
: rc-update add alsasound default
Using OpenRC with 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 is a fork of udev started by the Gentoo project, with the goal of isolation from any particular flavor of system initialization, such as systemd or sysvinit.
Installation
eudevAUR is available in the AUR. It basically serves a drop-in replacement for the udev provided by systemd.
Three packages are needed in order to install eudev: eudev-systemdcompatAUR, eudevAUR, and eudev-openrcAUR.
The eudev-systemdcompat package conflicts with systemd and libsystemd, and requires the eudevAUR package. upower-pm-utilsAUR is an optional dependency.
makepkg -di(-d to ignore build dependencies), which pulls in eudev as package dependency.
After that eudev-openrcAUR can be installed from the local repo created earlier.
upower-pm-utilsAUR can be installed for suspend / hibernate support.Troubleshooting
If your unmounted partitions are not being displayed, then that is probably due to gvfs being compiled for systemd; using gvfs-nosystemdAUR from the AUR may fix it (probably not required if using eudev-systemdcompatAUR).
Some packages from the offical repos, like xfce4-power-manager, are compiled with the newer upower; for use with upower-pm-utilsAUR, they need to be compiled against it (xfce4-power-manager-upower0AUR and xfce4-power-manager-pmuAUR are available in the AUR).
Your net devices will follow the pre-systemd pattern: from example wlp1s0
should be renamed to wlan0
. You have to set your net configuration properly.
Your files in /etc/sysctl.d/
might disappear after removing the systemd
package. OpenRC reads /etc/sysctl.conf
.
If you own an ATI Radeon card and experience freezes with X (blank screen, non-resposive keyboard etc), appending nomodeset
to the kernel boot command line should help. This is especially true with the closed source driver (catalystAUR).