OpenRC

From ArchWiki
Revision as of 22:21, 1 April 2015 by Nous (talk | contribs) (→‎See also: Separate sf repo and installation info)
Jump to navigation Jump to search
Warning: Arch Linux only has official support for systemd. When using OpenRC, please mention so in support requests.

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

Installation

OpenRC and accompanying packages are available in the AUR. For details on init components, see Init.

apg

Install either openrcAUR or openrc-gitAUR. openrc-sysvinitAUR is used as init process. Services are contained in the openrc-arch-services-gitAUR package.

To maintain compability with initscripts-forkAUR, configuration files are installed to /etc/openrc/. The sysvinit init binary is installed to /usr/bin/init-openrc for compability with systemd-sysvcompat or similar packages.

artoo

This method uses openrc-coreAUR. Complementary services are available from the openrc-base, openrc-desktop and openrc-misc package bases.

A mirror of the above package groups is available at github. There are two unofficial repositories with precompile packages from the github sources: [openrc-eudev] and [pfkernel].

Configuration files are installed to /etc, similar to Gentoo.

Configuration

Note: In the following section, rcdir represents /etc/openrc for apg, /etc for artoo.

For more information on configuring OpenRC, see OpenRC manuals, OpenRC migration and the gentoo wiki. See Init#Configuration for generic configuration.

Enabling services

See Init#Migrate running daemons and install respective services as described in #Installation. OpenRC services are enabled by issuing the rc-update command. For example, to enable ALSA:

# rc-update add alsasound default

To enable udev (disabled by default in apg):

# rc-update add udev sysinit

See also Gentoo services and Daemons list.

Booting

apg

For booting with OpenRC add init=/usr/bin/init-openrc to the kernel parameters. To switch back to systemd, remove the parameter again.

The /etc/openrc/conf.d directory, and the /etc/openrc/rc.d file is used for configuration.

artoo

OpenRC is booted by default. To boot with systemd, add init=/usr/lib/systemd/systemd to the kernel line in your bootloader configuration.

The /etc/conf.d directory is used for configuration.

Network

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: Section lacks overview (Discuss in Talk:OpenRC#)

See Network configuration for a detailed look at networking in general.

apg

The network is configured through newnet. [1] Modify 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 may also use NetworkManager, dhcpcd or netcfgAUR by enabling the respective services.

artoo

For network configuration, look at the /etc/conf.d/net file. By default it uses netifrc [2], 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 [3] 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 mimics the netctl behaviour (see [4] 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

See Init#System logging. Relevant service files are included in openrc-arch-services-gitAUR (apg), syslog-ng-openrcAUR, metalog-openrcAUR, and rsyslog-openrcAUR (artoo). It is recommended to only use a single logger as different loggers may conflict.

To enable boot logging, uncomment the rc_logger="YES" line in rcdir/rc.conf. apg disables it by default.

Tip: Boot logs are stored in /var/log/rc.log

Hostname

OpenRC sets the hostname from rcdir/conf.d/hostname. The file looks as follows:

# Set to the hostname of this machine
hostname="myhostname"

Module autoloading

OpenRC uses rcdir/conf.d/modules instead of /etc/modules-load.d. For example:

/etc/openrc/conf.d/modules
# 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 [5] 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 rcdir/conf.d/localmount

Note: This problem occurs only if your tmp is mounted as a tmpfs.

Disabling IPv6 does not work

One option is to add:

# Disable ipv6
net.ipv6.conf.all.disable_ipv6 = 1

in a file with a .conf extension under rcdir/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

/etc/sysctl.conf not found

Create the file:

# touch /etc/sysctl.conf

Using OpenRC with a desktop environment

Merge-arrows-2.pngThis article or section is a candidate for merging with Init#Configuration.Merge-arrows-2.png

Notes: Find out which steps exactly require consolekit, and merge these if generic (Discuss in Talk:OpenRC#)

If using OpenRC with a desktop environment, consolekit-openrcAUR and related consolekit packages in the AUR may help. See ConsoleKit for details.

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 could be used.

Mate

Install eudev-dummyAUR, mate-session-manager-upowerAUR and mate-power-manager-upowerAUR from the AUR.

If you use mdm-display-managerAUR as a login manager and have trouble logging in, edit /etc/pam.d/mdm, comment out session optional pam_systemd.so and restart mdm. Additionally append session optional pam_ck_connector.so nox11 if you have consolekitAUR installed.

KDE

The kdebase-workspace package needs to be recompiled for use with consolekit (kdebase-workspace-consolekitAUR is available from the AUR).

See also