?!(WIP)!?

OpenRC

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.

Features

OpenRC provides a number of interesting features:

  1. Compatible with UNIX philosophy
  2. Portable for non-GNU/Linux systems
  3. Cgroups support
  4. Parallel service initialization
  5. Dependency based initialization
  6. Automatic dependency calculation
  7. Enables limiting/unlimited resources for each service
  8. Sections of split configurations; init.d and conf.d
  9. Well explained and explanatory configuration files
  10. Startup scripts is extensible and customizable
  11. Designed to be 100% compatible with virtualization environments
  12. Modular architecture suitable and separate optional components; Cron, syslog
  13. Expressive and flexible network handling, including VPN
  14. Verbose mode to debug service activity

Configuration

Configuring OpenRC is a simple task, this article offers some steps to optimize the use of this initialization system.

Boot logs

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.

Hostname

To add or edit a host name, edit or create the file /etc/conf.d/hostname and add:

hostname="desired_name"

Keyboard

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

Login manager

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

Kernel modules

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.

Silent boot

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

Runlevels

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. There are two types of runlevels:


!?(WIP)!?!?

OpenRC

Since Hyperbola has announced the end of systemd support, migration to OpenRC is required.

What is OpenRC?

OpenRC is a dependency based init system maintained by the Gentoo developers, that works with the system provided init program, normally SysVinit.

Warning

Please read the whole warning

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.

Groups

Before Arch migrated to systemd, users had to be manually added to some groups in order to be able to access the corresponding devices. Read more about here.

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

# gpasswd -a <your-user> audio

In the case of some graphical environments, such as KDE, you´ll need to edit /etc/pulse/client.conf and remove the autospawn = no line, and it should look something like this:

...
; default-sink =
; default-source =
; default-server =
; default-dbus-server =

; autospawn = yes
; daemon-binary = /usr/bin/pulseaudio
; extra-arguments = --log-target=syslog

; cookie-file =

; enable-shm = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB 

; auto-connect-localhost = no
; auto-connect-display = no
This is just in the case you use PulseAudio. For more information refer to this topic from the Manjaro forum.
For security reasons, we have plans to use sndio as PulseAudio replacement. Since it requires a hard transition, it will be made for the next version, aka Milky Way v0.4. We will make an announcement when it is ready.

Same for video, your games might be laggy otherwise:

# gpasswd -a <your-user> video

For networking:

# gpasswd -a <your-user> network

For webcam:

# gpasswd -a <your-user> optical

Also for storage:

# gpasswd -a <your-user> storage
# gpasswd -a <your-user> disk

And for CUPS:

# gpasswd -a <your-user> sys
First try these features before adding your user to these groups, for example, in some cases adding your user to the optical group may not be necessary.

Migration

Since OpenRC is included by default and systemd is blacklisted by your-freedom, one may get messages on migrating like:

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

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

# rc-update add cronie default

The cronie service would be added to the default runlevel and would automatically be started at boot.

cronie (for cron) and haveged (for entropy harvesting) are some common services that can be enabled.

Also you need to install polkit to gain enough desktop privileges for operations like shutdown, mounting usb device:

# pacman -S polkit
Currently, NetworkManager and any display manager such as GDM or LightDM runs the elogind service in Hyperbola automatically, however if you will use the xinit program to start the X Window System server or Weston/Sway to start Wayland and use netifrc instead of NetworkManager, you need add the elogind service to a runlevel (eg. default) to be started at boot automatically.
For security reasons, we have plans to use ConsoleKit as elogind replacement. Since it requires a hard transition, it will be made for the next version, aka Milky Way v0.4. We will make an announcement when it is ready.

Configuration

Services often required

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'
Make sure what services you was using in systemd to re-enable them in OpenRC:
$ ls -ls /etc/systemd/system/multi-user.target.wants/

Sometimes, there are target files such as remote-fs.target which are useless in OpenRC.

Hostname

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"

NetworkManager settings

You need to enable the software at boot:

# 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**

For NetworkManager to work correctly in OpenRC, make sure that /etc/hostname has the same localhost as in /etc/conf.d/hostname. Optionally, you can safely remove /etc/hostname

For security reasons, we have plans to remove NetworkManager. Since it requires a hard transition, it will be made for the next version, aka Milky Way v0.4. We will make an announcement when it is ready, so we recommend you use netifrc as alternative.

Kepmap

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
This only applies for CLI, is you are using X11, this won't affect your graphical environment.

Login display manager

Unlike another distros with OpenRC support, the DM is launched directly.

For example, with lightdm, you just need enable the service.

# rc-update add lightdm default

Adaptation between systemctl and rc-update

Add or delete a service

You can add a service using this way:

# rc-update add <service> <runlevel>

And delete it as follow:

# rc-update del <service> <runlevel>

Services currently running

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

# rc-status --all -v

Stop/Start/Restart a service

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

# rc-service <service> restart

Troubleshooting

Consistent network device naming is not disabled

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 /etc/udev/rules.d/80-net-name-slot.rules

Sysctl.conf is missing

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

# touch /etc/sysctl.conf

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

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

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

The system can't shutdown correctly

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 for xfce4, replace exec ck-launch-session startxfce4 to startxfce4.

Acknowledgement

This wiki article is based on ParabolaWiki.

1)
for more details go to: OpenRC History