User:JMCF125/OpenRC

From ArchWiki
Jump to: navigation, 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

There are 2 conflicting ways of installing OpenRC. Both have packages with the exact name of openrc. apg's tries to mantain compatibility with systemd, while artoo's is more suited for those who would like to remove systemd entirely or use it only as a udev provider. For details on init components, see Init.

apg

OpenRC and accompanying packages are available in the AUR.

Install either the openrcAUR or openrc-gitAUR package. openrc-sysvinitAUR or busybox are used as the init process. Service files are available from the openrc-arch-services-gitAUR package.

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: openrc-sysvinitAUR removes systemd-sysvcompat (Discuss in User talk:JMCF125/OpenRC#)

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 packages in the unnoficial user repository openrc-eudev. The source PKGBUILDs of these repositories are at github.

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

A guide is available at [1].

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.

Configuration

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

For general information on configuring OpenRC, see:

For more information specific to Arch Linux, refer to [2].

Preparation

See Init#Configuration.

Services

OpenRC services are enabled by issuing rc-update add service_name runlevel as root. It is recommended to at least enable the following services:

Service name Runlevel Description
udev sysinit Device hot-plugging
alsa default ALSA state
acpid default ACPI events
dbus default Messaging bus
dcron default Scheduling
syslog-ng default System logs

See also Native services and Daemons.

Network

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

apg

The network is configured through newnet. 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. See Network configuration for general networking information.

Note: You may also use NetworkManager, dhcpcd or netcfgAUR by enabling the respective services. netcfg mimics the netctl behaviour (see [3] 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)

artoo

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-openrc 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 an article in the Gentoo Handbook for details.

For having a graphical network manager, networkmanager-openrc' can be installed. Other options are available, such as connman-openrc.

Boot logs

To enable boot logging, uncomment the rc_logger="YES" line in rcdir/rc.conf. When enabled, boot logs are stored in /var/log/rc.log. artoo enables it by default.

Hostname

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

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

Kernel modules

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 rcdir/conf.d/keymaps and rcdir/conf.d/consolefont. You can also configure the settings through the /etc/locale.conf file, which is sourced via /etc/profile.d/locale.sh.

See [4] 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

By default, sysctl --system is called to load the sysctl configuration. [5] This includes the /etc/sysctl.conf file, which was removed from Arch. [6]

To prevent a missing file error, create the file:

# touch /etc/sysctl.conf


Using OpenRC with a desktop environment

If using OpenRC with a desktop environment, ConsoleKit may help. Install the service to rcdir/init.d, and enable it:

# rc-update add consolekit default

See ConsoleKit for more information.


See also