OpenRC is a init system for Operational Systems GNU/Linux, GNU/Hurd and Unix, compatible with Posix. Created by the Gentoo GNU/Linux developers team. Its purpose is to turn on/off and manage the services of the Operating System.
OpenRC emerged at the end of 2007 1), when Roy Marples retired as a Gentoo GNU/Linux developer. However, he wanted to keep the baselayout-2 project as an independent project. The Gentoo Project Board has allowed it to continue to maintain it, so the project name should be modified, with OpenRC under the BSD license.
In 2010 OpenRC was retained by the developers of Gentoo GNU/Linux, after Roy Marples decided that it would not keep the project. William Hubbs and several other developers took over the OpenRC from this point, with 0.8.x being the first release made by the new team. In 2011 OpenRC returned to stable Gentoo GNU/Linux tree.
In 2013, the OpenRC team became independent from Gentoo GNU/Linux again and changed the primary development to the Github.
OpenRC provides a number of interesting features:
Configuring OpenRC is a simple task, this article offers some steps to optimize the use of this initialization system.
Open the configuration file /etc/rc.conf and uncomment the reference line rc_logger=“YES”. The log files will be stored in /var/log/rc.log.
To add or edit a host name, edit or create the file /etc/conf.d/hostname and add:
hostname="desired_name"
Modify the key map for use in the console edit the file /etc/conf.d/consolefont. See the full list of all the options available at /usr/share/kbd/keymaps
keymap="en_UK"
To configure the keyboard compatible with a graphic interface edit the file /etc/conf.d/keymaps. See the full list of all the options available at /usr/share/kbd/keymaps.
keymap="en_UK"
After editing the files, run the command:
# rc-service keymaps restart
To enable the login manager, edit the /etc/conf.d/xdm. In the following example we take the slim as a base.
DISPLAYMANAGER="slim"
Enable the xdm daemon:
# rc-update add xdm default
For the automatic loading of any module of the Kernel Linux-Libre edit the file /etc/conf.d/modules.
modules="module_name"
This is only necessary after installation of an application or driver, made by the system administrator, by default all native modules of Kernel Linux-Libre are loaded automatically.
To hide OpenRC messages during system startup, edit the file /etc/inittab and set the option to the OpenRC command:
--quiet
For more information:
$ openrc -h
OpenRC, as well as sysvinit and init (BSD), has a concept of task execution levels (Runlevels), to define them OpenRC uses names instead of numbers as it is done in the conventional way. This allows, for example, to have a default runlevel with “everything” enabled, and a “powersaving” runlevel where some services are disabled.
The rc-status helper will print all currently active runlevels and the state of services in them:
# rc-status * Caching service dependencies ... [ ok ] Runlevel: default modules [ started ] lvm [ started ]
All runlevels are represented as folders in /etc/runlevels/ with symlinks to the actual service scripts.
Calling openrc with an argument (openrc default) will switch to that runlevel; this will start and stop services as needed.
Managing runlevels is usually done through the rc-update helper, but could of course be done by hand if desired. e.g. rc-update add nginx default - add nginx to the default runlevel with the need of root-privileges.
The default startup uses the runlevels sysinit, boot, and default, in that order. Shutdown uses the shutdown runlevel. The defined runlevel nonetwork is used only for non-network services.
Since Hyperbola has announced the end of systemd support, OpenRC is our main used init system and with release 0.4 we have also included further support for Runit.
OpenRC is a dependency based init system maintained by the Gentoo developers, that works with the system provided init program, normally SysVinit.
netctl works with systemd only, therefore it will not work anymore from Milky Way v0.2 since OpenRC is the main init system of Hyperbola. We will assume you already have an alternative, in our case, it is netifrc.
Users have to be manually added to some groups in order to be able to access the corresponding devices. Make sure your user is on the audio group, you won't have sound otherwise:
# passwd -a <your-user> audio
Same for video, your games and other output might be not that performant otherwise:
# passwd -a <your-user> video
For networking:
# passwd -a <your-user> network
For webcam:
# passwd -a <your-user> optical
Also for storage:
# passwd -a <your-user> storage
# passwd -a <your-user> disk
And for CUPS:
# passwd -a <your-user> sys
Once you migrate to OpenRC, you might need to add lvm2 etc.
There is the procedure for lvm2:
# rc-update add lvm boot
For cryptsetup:
# rc-update add dmcrypt boot
For alsa-utils:
# rc-update add alsasound default
For cronie:
# rc-update add cronie default
On each package containing an OpenRC service, you will have have this message :
==> rc 'rc-update add ... default'
OpenRC has its configuration in /etc/conf.d/, in order to have your hostname, edit /etc/conf.d/hostname:
# nano -w /etc/conf.d/hostname
And replace localhost with the name that you want:
# Set to the hostname of this machine hostname="localhost"
You need to enable the daemon dhcpcd at runlevel default:
# rc-update add dhcpcd default
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 functionalities, documented in the comments. You can find all the available keymaps in /usr/share/kbd/keymaps. Then run:
# rc-service keymaps restart
Unlike another distros with OpenRC support, the DM is launched directly.
For example, with wdm, you just need enable the service.
# rc-update add wdm default
You can add a service using this way:
# rc-update add <service> <runlevel>
And delete it as follow:
# rc-update del <service> <runlevel>
In order to have a summary of all the services running, stopped etc, you can run this command:
# rc-status --all -v
To restart a service, you need to use rc-service:
# rc-service <service> restart
To disable consistent network device naming, disable the assignment of fixed names, so that the unpredictable kernel names are used again, by masking udev's rule file for the default policy. This “masking” can be done by making a symbolic link to /dev/null. As root, issue a command as follows:
# ln -s /dev/null /lib/udev/rules.d/80-net-name-slot.rules
You can encounter an issue if /etc/sysctl.conf is missing. To fix this, you need to create the file:
# touch /etc/sysctl.conf
If you have this error when you shutdown the computer:
WARNING: /usr/libexec/rc/cache is not writable!
The solution is to create the folder:
# mkdir /usr/libexec/rc/cache
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
Add it in /etc/fstab:
tmpfs /tmp tmpfs nodev,nosuid 0 0
Begin with OpenRC 0.28 SysVinit is replaced with openrc-init, shutdown is replaced with openrc-shutdown. If you use startx to start your desktop, you also need to modify ~/.xinitrc when you have issues with your window-manager starting correctly.
This wiki article is based on ParabolaWiki.