Difference between revisions of "OpenRC"

From ArchWiki
Jump to navigation Jump to search
m (→‎Mate: it's 'required', that's why login fails in non-systemd setups)
(update Pkg/AUR templates)
Tag: wiki-scripts
 
(81 intermediate revisions by 14 users not shown)
Line 1: Line 1:
[[Category:Boot process]]
+
[[Category:Init]]
 
[[ja:OpenRC]]
 
[[ja:OpenRC]]
 +
[[ru:OpenRC]]
 
{{Related articles start}}
 
{{Related articles start}}
{{Related|eudev}}
 
 
{{Related|init}}
 
{{Related|init}}
{{Related|init Rosetta}}
 
{{Related|SysVinit}}
 
 
{{Related articles end}}
 
{{Related articles end}}
 
{{Warning|Arch Linux only has official support for [[systemd]]. When using OpenRC, please mention so in support requests.}}
 
{{Warning|Arch Linux only has official support for [[systemd]]. When using OpenRC, please mention so in support requests.}}
Line 12: Line 10:
  
 
== Installation ==
 
== Installation ==
 +
 +
{{Warning|{{aur|openrc}} depends (implicitly) on {{aur|sysvinit}}, which conflicts with {{pkg|systemd-sysvcompat}}. Therefore the system boots with plain sysvinit by default (not OpenRC or systemd), be sure to add a correct {{ic|1=init=''some-init''}} kernel parameter.}}
  
 
OpenRC and accompanying packages are available in the [[AUR]]. For details on init components, see [[Init]].
 
OpenRC and accompanying packages are available in the [[AUR]]. For details on init components, see [[Init]].
  
=== apg ===
+
Install either the {{AUR|openrc}} or {{AUR|openrc-git}} package. From version 0.25 onward, OpenRC provides its own init at {{ic|/usr/bin/openrc-init}}.
 +
Optionally, you can use other inits from, e.g., {{Pkg|busybox}} or {{AUR|openrc-sysvinit}}. Note that when {{ic|openrc-init}} is used, it must be paired with {{ic|openrc-shutdown}}, and ''not'' the {{ic|shutdown}} or {{ic|reboot}} commands from other packages, otherwise you will encounter errors.
  
Install either {{AUR|openrc}} or {{AUR|openrc-git}}. {{AUR|openrc-sysvinit}} is used as init process. Services are contained in the {{AUR|openrc-arch-services-git}} package.
+
A basic set of service files are available from the {{AUR|openrc-arch-services-git}} package.
 +
Other packages may have service files provided outside this package; a search on the AUR is recommended.
  
To maintain compability with {{AUR|initscripts-fork}}, configuration files are installed to {{ic|'''/etc/openrc/'''}}. The sysvinit init binary is installed to {{ic|/usr/bin/init-openrc}} for compability with {{Pkg|systemd-sysvcompat}} or similar packages.
+
To maintain compatibility with {{AUR|initscripts-fork}}, configuration files are installed to {{ic|/etc/openrc/}}.
  
=== artoo ===
+
=== Booting ===
 
 
This method uses {{AUR|openrc-core}}. Complementary services are available from the [https://aur.archlinux.org/packages/?O=0&C=0&SeB=b&K=openrc-base&outdated=&SB=n&SO=a&PP=50&do_Search=Go openrc-base], [https://aur.archlinux.org/pkgbase/openrc-desktop/ openrc-desktop] and [https://aur.archlinux.org/packages/?O=0&C=0&SeB=b&K=openrc-misc&outdated=&SB=n&SO=a&PP=50&do_Search=Go openrc-misc] [[PKGBUILD#pkgbase|package bases]].
 
 
 
A mirror of the above package groups is available at [https://github.com/udeved/pkgbuilds github]. There are two unofficial repositories with precompile packages from the github sources: [https://wiki.archlinux.org/index.php/Unofficial_user_repositories#openrc-eudev <nowiki>[openrc-eudev]</nowiki>] and [https://wiki.archlinux.org/index.php/Unofficial_user_repositories#pfkernel <nowiki>[pfkernel]</nowiki>].
 
  
Configuration files are installed to {{ic|'''/etc'''}}, similar to Gentoo.
+
For booting with OpenRC set the {{ic|init}} option in the [[kernel parameters]].<br>
 +
To use OpenRC's built-in init, set {{ic|<nowiki>init=/usr/bin/openrc-init</nowiki>}}.
 +
To use [[SysVinit]], provided by {{AUR|openrc-sysvinit}}, set {{ic|<nowiki>init=/usr/bin/init-openrc</nowiki>}}.<br>
 +
Note that when using {{ic|openrc-init}}, the {{ic|/etc/inittab}} file is not used.
  
 
== Configuration ==
 
== Configuration ==
  
{{Note|In the following section, ''rcdir'' represents {{ic|/etc/openrc}} for '''apg''', {{ic|/etc}} for '''artoo'''.}}
+
The {{Ic|1=/etc/openrc/conf.d}} directory, and the {{Ic|1=/etc/openrc/rc.d}} file is used for configuration.
  
For more information on configuring OpenRC, see [http://www.calculate-linux.org/main/en/openrc_manuals OpenRC manuals], [http://www.gentoo.org/doc/en/openrc-migration.xml OpenRC migration] and the [http://wiki.gentoo.org/wiki/OpenRC gentoo wiki]. See [[Init#Configuration]] for generic configuration.
+
For general information on configuring OpenRC, see:
  
=== Enabling services ===
+
* [http://www.calculate-linux.org/main/en/openrc_manuals OpenRC manuals]
 +
* [http://www.gentoo.org/doc/en/openrc-migration.xml OpenRC migration]
 +
* [http://wiki.gentoo.org/wiki/OpenRC gentoo wiki].
  
Save a list of running daemons:
+
For instructions when migrating from [[systemd]], see [[Init#Configuration]].
  
$ systemctl list-units --state=running "*.service" > daemons.list
+
=== Services ===
  
Install respective services as described in [[#Installation]]. OpenRC services are enabled by issuing the {{ic|rc-update}} command. For example, to enable [[ALSA]]:
+
OpenRC services are enabled by issuing {{ic|rc-update add ''service_name'' ''runlevel''}} as root. It is recommended to at least enable the following services:
 +
{| class="wikitable"
 +
! Service name
 +
! [https://wiki.gentoo.org/wiki/OpenRC#Named_runlevels 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
 +
|}
  
# rc-update add alsasound default
+
{{Warning|If using {{ic|<nowiki>init=/usr/bin/openrc-init</nowiki>}} in your kernel parameters, you'll need to manually enable [[getty]] services, otherwise you'll be left with no interactive TTYs[https://github.com/OpenRC/openrc/blob/master/agetty-guide.md]}}
 +
If necessary, create services for each wanted [[getty]] by creating symbolic links to {{ic|/etc/openrc/init.d/getty}}. E.g. for {{ic|/dev/tty1}}:
  
To enable [[udev]] (disabled by default in '''apg'''):
+
# ln -s /etc/openrc/init.d/agetty{,.tty1}
 +
# rc-update add agetty.tty1 default
  
  # rc-update add udev sysinit
+
   
 
+
See also [https://wiki.gentoo.org/wiki/Systemd#Native_services Native services] and [[Daemons]].
See also [https://wiki.gentoo.org/wiki/Systemd#Native_services Gentoo services] and [[Daemons list]].
 
 
 
=== Booting ===
 
 
 
==== apg ====
 
 
 
For booting with OpenRC add {{Ic|1=init=/usr/bin/init-openrc}} to the [[kernel parameters]]. To switch back to systemd, remove the parameter again.
 
 
 
The {{Ic|1=/etc/openrc/conf.d}} directory, and the {{Ic|1=/etc/openrc/rc.d}} file is used for configuration.
 
 
 
==== artoo ====
 
 
 
OpenRC is booted by default. To boot with systemd, add {{Ic|1=init=/usr/lib/systemd/systemd}} to the kernel line in your bootloader configuration.
 
 
 
The {{Ic|1=/etc/conf.d}} directory is used for configuration.
 
  
 
=== Network ===
 
=== Network ===
 
{{Style|Section lacks overview}}
 
 
See [[Network configuration]] for a detailed look at networking in general.
 
 
==== apg ====
 
  
 
The network is configured through {{ic|newnet}}. [https://github.com/funtoo/openrc/blob/master/README.newnet] Modify the {{ic|/etc/openrc/conf.d/network}} file; both the {{ic|ip}} ({{Pkg|iproute2}}) and the {{ic|ifconfig}} ({{Pkg|net-tools}}) commands are supported. Below is an example configuration using {{ic|ip}}.
 
The network is configured through {{ic|newnet}}. [https://github.com/funtoo/openrc/blob/master/README.newnet] Modify the {{ic|/etc/openrc/conf.d/network}} file; both the {{ic|ip}} ({{Pkg|iproute2}}) and the {{ic|ifconfig}} ({{Pkg|net-tools}}) commands are supported. Below is an example configuration using {{ic|ip}}.
Line 81: Line 94:
 
</nowiki>}}
 
</nowiki>}}
  
The network service is added to the boot runlevel by default, so no further action is required.
+
The network service is added to the boot runlevel by default, so no further action is required. See [[Network configuration]] for general networking information.
 
 
You may also use [[NetworkManager]], [[dhcpcd]] or {{AUR|netcfg}} by enabling the respective services.
 
  
==== artoo ====
+
{{Note|1=You may also use [[NetworkManager]], [[dhcpcd]] or {{AUR|netcfg}} by enabling the respective services. ''netcfg'' mimics the [[netctl]] behaviour (see [https://bbs.archlinux.org/viewtopic.php?pid=1489283#p1489283] if you want to enable profiles connection on booting - requires {{ic|wpa_actiond}}). See [https://www.archlinux.org/netcfg/features.html netcfg features].}}
  
For network configuration, look at the {{ic|/etc/conf.d/net}} file. By default it uses {{ic|netifrc}} [http://wiki.gentoo.org/wiki/Netifrc], which defaults to [[dhcpcd]] if not specified differently in {{ic|/etc/conf.d/net}}
+
=== Boot logs ===
  
The {{AUR|dhcpcd-openrc}} package provides a specific dhcpcd script, not to be confused with netifrc default. It will start {{ic|/etc/init.d/dhcpcd}}
+
To enable boot logging, uncomment the {{ic|1=rc_logger="YES"}} line in {{ic|/etc/openrc/rc.conf}}. When enabled, boot logs are stored in {{ic|/var/log/rc.log}}.
 
 
To use a static route you need to create a symlink of {{ic|net.lo}} that reflects your device's name:
 
 
 
ln -s /etc/init.d/net.lo /etc/init.d/net.eth0
 
 
 
See [https://wiki.gentoo.org/wiki/Handbook:X86/Networking/Modular] for details.
 
 
 
For having a graphical network manager, {{AUR|networkmanager-openrc}} can be installed. Other options are available, like [[connman]] via {{AUR|connman-openrc}}.
 
 
 
Other option is {{AUR|netcfg}} which mimics the [[netctl]] behaviour (see [https://bbs.archlinux.org/viewtopic.php?pid=1489283#p1489283] if you want to enable profiles connection on booting - requires {{ic|wpa_actiond}}). You could consult the [https://www.archlinux.org/netcfg/features.html official documentation] or [https://wiki.archlinux.org/index.php?title=Netcfg&oldid=243178 old wiki documentation] (be aware of consulting version later than [https://www.archlinux.org/news/netcfg-282-release/ 2012-05-13])
 
 
 
=== Logging ===
 
 
 
See [[Init#System logging]]. Relevant service files are included in {{AUR|openrc-arch-services-git}} ('''apg'''), {{AUR|syslog-ng-openrc}}, {{AUR|metalog-openrc}}, and {{AUR|rsyslog-openrc}} (artoo). It is recommended to only use a single logger as different loggers may conflict.
 
 
 
To enable boot logging, uncomment the {{ic|1=rc_logger="YES"}} line in {{ic|''rcdir''/rc.conf}}. '''apg''' disables it by default.
 
 
 
{{Tip|Boot logs are stored in {{ic|/var/log/rc.log}}}}
 
  
 
=== Hostname ===
 
=== Hostname ===
  
OpenRC sets the hostname from {{ic|''rcdir''/conf.d/hostname}}. The file looks as follows:
+
OpenRC sets the hostname from {{ic|/etc/openrc/conf.d/hostname}}. The file looks as follows:
  
 
{{bc|# Set to the hostname of this machine
 
{{bc|# Set to the hostname of this machine
 
hostname<nowiki>=</nowiki>"myhostname"}}
 
hostname<nowiki>=</nowiki>"myhostname"}}
  
=== Module autoloading ===
+
=== Kernel modules ===
  
OpenRC uses {{ic|''rcdir''/conf.d/modules}} instead of {{ic|/etc/modules-load.d}}. For example:
+
OpenRC uses {{ic|/etc/openrc/conf.d/modules}} instead of {{ic|/etc/modules-load.d}}. For example:
  
{{hc|1=|/etc/openrc/conf.d/modules|2=
+
{{hc|/etc/openrc/conf.d/modules|2=
 
# You should consult your kernel documentation and configuration
 
# You should consult your kernel documentation and configuration
 
# for a list of modules and their options.
 
# for a list of modules and their options.
Line 129: Line 122:
 
=== Locale ===
 
=== Locale ===
  
Keyboard layout can be configured via {{ic|/etc/conf.d/keymaps}} and {{ic|/etc/conf.d/consolefont}} ('''artoo's''' way). You can also configure the settings through the {{ic|/etc/locale.conf}} file, which is sourced via {{ic|/etc/profile.d/locale.sh}}.  
+
Keyboard layout can be configured via {{ic|/etc/openrc/conf.d/keymaps}} and {{ic|/etc/openrc/conf.d/consolefont}}. You can also configure the settings through the {{ic|/etc/locale.conf}} file, which is sourced via {{ic|/etc/profile.d/locale.sh}}.  
  
 
See [http://wiki.gentoo.org/wiki/Localization/HOWTO#Keyboard_layout_for_the_console] and [[Locale]] for details.
 
See [http://wiki.gentoo.org/wiki/Localization/HOWTO#Keyboard_layout_for_the_console] and [[Locale]] for details.
 +
 +
== Usage ==
 +
 +
This section draws a parallel between [[systemd]] and other [[init]] systems.
 +
 +
You can omit the {{ic|.service}} and {{ic|.target}} extensions, especially if temporarily editing the [[kernel parameters]].
 +
 +
{| class="wikitable" width="100%"
 +
! systemd !! SysVinit !! OpenRC !! Description
 +
|-
 +
| {{ic|systemctl list-units}} || {{ic|rc.d list}} || {{ic|rc-status}} || List running services status
 +
|-
 +
| {{ic|systemctl --failed}} || || {{ic|rc-status --crashed}} || Check failed services
 +
|-
 +
| {{ic|systemctl --all}} || || {{ic|rc-update -v show}} || Display all available services.
 +
|-
 +
| {{ic|systemctl (start, stop, restart, status) daemon.service}} || {{ic|rc.d (start, stop, restart) daemon}} || {{ic|rc-service daemon (start, stop, restart, status)}} || Change service state.
 +
|-
 +
| {{ic|systemctl (enable, disable) daemon.service}} || {{ic|chkconfig daemon (on, off)}} || {{ic|rc-update (add, del) daemon}} || Turn service on or off.
 +
|-
 +
| {{ic|systemctl daemon-reload}} || {{ic|chkconfig daemon --add}} || || Create or modify configuration.
 +
|}
 +
 +
== Tips and tricks ==
 +
 +
=== Quiet booting ===
 +
 +
To hide boot messages from OpenRC, you can edit {{ic|/etc/inittab}} and add {{ic|--quiet}} to every openrc command. For further information check with {{ic|$ openrc -h}}.
  
 
== Troubleshooting ==
 
== Troubleshooting ==
Line 146: Line 167:
 
  no_umounts="/tmp"
 
  no_umounts="/tmp"
  
to {{ic|''rcdir''/conf.d/localmount}}
+
to {{ic|/etc/openrc/conf.d/localmount}}
  
 
{{Note|This problem occurs only if your tmp is mounted as a tmpfs.}}
 
{{Note|This problem occurs only if your tmp is mounted as a tmpfs.}}
Line 157: Line 178:
 
  net.ipv6.conf.all.disable_ipv6 = 1
 
  net.ipv6.conf.all.disable_ipv6 = 1
  
in a file with a {{ic|.conf}} extension under {{ic|''rcdir''/sysctl.d}}
+
in a file with a {{ic|.conf}} extension under {{ic|/etc/openrc/sysctl.d}}
  
 
=== During shutdown remounting root as read-only fails ===
 
=== During shutdown remounting root as read-only fails ===
Line 172: Line 193:
 
=== /etc/sysctl.conf not found ===
 
=== /etc/sysctl.conf not found ===
  
Create the file:
+
By default, {{ic|sysctl --system}} is called to load the sysctl configuration. [https://github.com/OpenRC/openrc/blob/master/init.d/sysctl.Linux.in#L17] This includes the {{ic|/etc/sysctl.conf}} file, which was removed from Arch. [https://www.archlinux.org/news/deprecation-of-etcsysctlconf/]
 +
 
 +
To prevent a missing file error, create the file:
  
 
  # touch /etc/sysctl.conf
 
  # touch /etc/sysctl.conf
 +
 +
=== opentmpfiles-setup failed to start ===
 +
 +
On booting openrc you may see lines like these :
 +
 +
* Setting up tmpfiles.d entries ...
 +
chattr: Operation not supported while setting flags on /var/log/journal
 +
chattr: No such file or directory while trying to stat /var/log/journal/%m
 +
chattr: Operation not supported while setting flags on /var/log/journal/remote
 +
[ !! ]
 +
ERROR: opentmpfiles-setup failed to start
 +
 +
This is caused by {{ic|/usr/lib/tmpfiles.d/journal-nocow.conf}} using options that are only valid if journal is on a btrfs filesystem.
 +
 +
See https://github.com/OpenRC/opentmpfiles/issues/2 for details
 +
 +
A workaround is to create an empty /etc/tmpfiles.d/journal-nocow.conf to override the settings.
  
 
== Using OpenRC with a desktop environment ==
 
== Using OpenRC with a desktop environment ==
  
{{Merge|Init#Configuration|Find out which steps exactly require consolekit, and merge these if generic}}
+
If using ''OpenRC'' with a [[desktop environment]], ConsoleKit may help. Install the [https://gist.github.com/ad73f9087f39d7cadd8e service] to {{ic|/etc/openrc/init.d}}, and enable it:
 
 
If using ''OpenRC'' with a desktop environment, {{AUR|consolekit-openrc}} and related [https://aur.archlinux.org/packages/?O=0&K=consolekit consolekit] packages in the AUR may help. See [[ConsoleKit]] for details.
 
  
=== Xfce ===
+
# rc-update add consolekit default
  
The xfce4-session package has been compiled with logind support; {{AUR|xfce4-session-consolekit}} from the [[AUR]] can be used.
+
See [[ConsoleKit]] for more information.
  
For a login manager, {{AUR|lxdm-consolekit}} from the [[AUR]] or [[lightdm]] could be used.
+
Begin with OpenRC 0.28 SysVinit is replaced with openrc-init, shutdown is replaced with openrc-shutdown, by using consolekit the system may hang up when shuting down from desktop session. So use {{AUR|elogind-git}} instead. Enable it with:
  
=== Mate ===
+
# rc-update add elogind default
  
Install {{AUR|eudev-dummy}}, {{AUR|mate-session-manager-upower}} and {{AUR|mate-power-manager-upower}} from the [[AUR]].
+
Also you need to replace polkit-consolekit with {{AUR|polkit-elogind}}{{Broken package link|package not found}}, or the system will alarm "not authorized to perform operation" when mounting usb device, and can't reboot or shutdown from the desktop session.
  
If you use {{AUR|mdm-display-manager}} as a login manager and have trouble logging in, edit {{ic|/etc/pam.d/mdm}}, comment out {{ic|session required pam_systemd.so}} and restart {{ic|mdm}}. Additionally append {{ic|session optional pam_ck_connector.so nox11}} if you have {{AUR|consolekit}} installed.
+
== Reverting to systemd ==
  
=== KDE ===
+
Reverting to systemd should be straightforward in most cases. It is essentially the reversal of migrating to OpenRC, with care placed on the following:
  
The kdebase-workspace package needs to be recompiled for use with consolekit ({{AUR|kdebase-workspace-consolekit}} is available from the AUR).
+
* Removal of, or otherwise editing, the {{ic|1=init=}} parameter on the kernel command line
 +
* Replacement of any OpenRC-tailored or no-systemd packages with their stock equivalents (e.g. replacement of {{AUR|dbus-nosystemd}} with {{pkg|dbus}})
  
 
== See also ==
 
== See also ==
Line 202: Line 241:
 
* [[Wikipedia:OpenRC]]
 
* [[Wikipedia:OpenRC]]
 
* [https://wiki.gentoo.org/wiki/OpenRC Gentoo wiki]
 
* [https://wiki.gentoo.org/wiki/OpenRC Gentoo wiki]
* [https://sourceforge.net/projects/archopenrc OpenRC for Arch Linux - sourceforge repository]
 
* [http://systemd-free.org/install.php Complete OpenRC installation guide for Arch Linux]
 
 
* [https://bbs.archlinux.org/viewtopic.php?id=152606 Forum thread about OpenRC in Arch]
 
* [https://bbs.archlinux.org/viewtopic.php?id=152606 Forum thread about OpenRC in Arch]
 
* [http://blog.notfoss.com/posts/openrc-on-arch-linux/ Blog: OpenRC on Arch Linux]
 
* [http://blog.notfoss.com/posts/openrc-on-arch-linux/ Blog: OpenRC on Arch Linux]
 
* [https://wiki.manjaro.org/index.php?title=OpenRC,_an_alternative_to_systemd Manjaro wiki]
 
* [https://wiki.manjaro.org/index.php?title=OpenRC,_an_alternative_to_systemd Manjaro wiki]

Latest revision as of 06:18, 15 September 2019

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

Warning: openrcAUR depends (implicitly) on sysvinitAUR, which conflicts with systemd-sysvcompat. Therefore the system boots with plain sysvinit by default (not OpenRC or systemd), be sure to add a correct init=some-init kernel parameter.

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

Install either the openrcAUR or openrc-gitAUR package. From version 0.25 onward, OpenRC provides its own init at /usr/bin/openrc-init. Optionally, you can use other inits from, e.g., busybox or openrc-sysvinitAUR. Note that when openrc-init is used, it must be paired with openrc-shutdown, and not the shutdown or reboot commands from other packages, otherwise you will encounter errors.

A basic set of service files are available from the openrc-arch-services-gitAUR package. Other packages may have service files provided outside this package; a search on the AUR is recommended.

To maintain compatibility with initscripts-forkAUR, configuration files are installed to /etc/openrc/.

Booting

For booting with OpenRC set the init option in the kernel parameters.
To use OpenRC's built-in init, set init=/usr/bin/openrc-init. To use SysVinit, provided by openrc-sysvinitAUR, set init=/usr/bin/init-openrc.
Note that when using openrc-init, the /etc/inittab file is not used.

Configuration

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

For general information on configuring OpenRC, see:

For instructions when migrating from systemd, 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
Warning: If using init=/usr/bin/openrc-init in your kernel parameters, you'll need to manually enable getty services, otherwise you'll be left with no interactive TTYs[1]

If necessary, create services for each wanted getty by creating symbolic links to /etc/openrc/init.d/getty. E.g. for /dev/tty1:

# ln -s /etc/openrc/init.d/agetty{,.tty1}
# rc-update add agetty.tty1 default


See also Native services and Daemons.

Network

The network is configured through newnet. [2] 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). See netcfg features.

Boot logs

To enable boot logging, uncomment the rc_logger="YES" line in /etc/openrc/rc.conf. When enabled, boot logs are stored in /var/log/rc.log.

Hostname

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

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

Kernel modules

OpenRC uses /etc/openrc/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/openrc/conf.d/keymaps and /etc/openrc/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.

Usage

This section draws a parallel between systemd and other init systems.

You can omit the .service and .target extensions, especially if temporarily editing the kernel parameters.

systemd SysVinit OpenRC Description
systemctl list-units rc.d list rc-status List running services status
systemctl --failed rc-status --crashed Check failed services
systemctl --all rc-update -v show Display all available services.
systemctl (start, stop, restart, status) daemon.service rc.d (start, stop, restart) daemon rc-service daemon (start, stop, restart, status) Change service state.
systemctl (enable, disable) daemon.service chkconfig daemon (on, off) rc-update (add, del) daemon Turn service on or off.
systemctl daemon-reload chkconfig daemon --add Create or modify configuration.

Tips and tricks

Quiet booting

To hide boot messages from OpenRC, you can edit /etc/inittab and add --quiet to every openrc command. For further information check with $ openrc -h.

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

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 /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

/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

opentmpfiles-setup failed to start

On booting openrc you may see lines like these :

* Setting up tmpfiles.d entries ...
chattr: Operation not supported while setting flags on /var/log/journal
chattr: No such file or directory while trying to stat /var/log/journal/%m
chattr: Operation not supported while setting flags on /var/log/journal/remote
[ !! ]
ERROR: opentmpfiles-setup failed to start

This is caused by /usr/lib/tmpfiles.d/journal-nocow.conf using options that are only valid if journal is on a btrfs filesystem.

See https://github.com/OpenRC/opentmpfiles/issues/2 for details

A workaround is to create an empty /etc/tmpfiles.d/journal-nocow.conf to override the settings.

Using OpenRC with a desktop environment

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

# rc-update add consolekit default

See ConsoleKit for more information.

Begin with OpenRC 0.28 SysVinit is replaced with openrc-init, shutdown is replaced with openrc-shutdown, by using consolekit the system may hang up when shuting down from desktop session. So use elogind-gitAUR instead. Enable it with:

# rc-update add elogind default

Also you need to replace polkit-consolekit with polkit-elogindAUR[broken link: package not found], or the system will alarm "not authorized to perform operation" when mounting usb device, and can't reboot or shutdown from the desktop session.

Reverting to systemd

Reverting to systemd should be straightforward in most cases. It is essentially the reversal of migrating to OpenRC, with care placed on the following:

  • Removal of, or otherwise editing, the init= parameter on the kernel command line
  • Replacement of any OpenRC-tailored or no-systemd packages with their stock equivalents (e.g. replacement of dbus-nosystemdAUR with dbus)

See also