copy of https://wiki.archlinux.org/index.php?title=OpenRC&oldid=389524 to add artoo's method back to the OpenRC page
New page
[[Category:Boot process]]
[[ja:OpenRC]]
[[ru:OpenRC]]
{{Related articles start}}
{{Related|eudev}}
{{Related|init}}
{{Related|init Rosetta}}
{{Related|SysVinit}}
{{Related articles end}}
{{Warning|Arch Linux only has official support for [[systemd]]. When using OpenRC, please mention so in support requests.}}
[https://wiki.gentoo.org/wiki/OpenRC 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 {{ic|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 {{AUR|openrc}} or {{AUR|openrc-git}} package. {{AUR|openrc-sysvinit}} or {{Pkg|busybox}} are used as the init process. Service files are available from the {{AUR|openrc-arch-services-git}} package.
{{Accuracy|{{AUR|openrc-sysvinit}} removes {{Pkg|systemd-sysvcompat}}}}
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.
=== artoo ===
This method uses {{https://wiki.archlinux.org/index.php/Unofficial_user_repositories#openrc-eudev}}. 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 compiled 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.
== Configuration ==
{{Note|In the following section, ''rcdir'' represents {{ic|/etc/openrc}} for '''apg''', {{ic|/etc}} for '''artoo'''.}}
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.
=== Enabling services ===
Save a list of running daemons:
$ systemctl list-units --state=running "*.service" > daemons.list
Install respective services as described in [[#Installation]]. OpenRC services are enabled by issuing the {{ic|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 [https://wiki.gentoo.org/wiki/Systemd#Native_services Gentoo services] and [[Daemons#List of daemons]].
=== 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 ===
{{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}}.
{{bc|
<nowiki>ip_eth0="192.168.1.2/24"
defaultiproute="via 192.168.1.1"
ifup_eth0="ip link set \$int mtu 1500"
</nowiki>}}
The network service is added to the boot runlevel by default, so no further action is required.
You may also use [[NetworkManager]], [[dhcpcd]] or {{AUR|netcfg}} by enabling the respective services.
==== artoo ====
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}}
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 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 ===
OpenRC sets the hostname from {{ic|''rcdir''/conf.d/hostname}}. The file looks as follows:
{{bc|# Set to the hostname of this machine
hostname<nowiki>=</nowiki>"myhostname"}}
=== Module autoloading ===
OpenRC uses {{ic|''rcdir''/conf.d/modules}} instead of {{ic|/etc/modules-load.d}}. For example:
{{hc|/etc/openrc/conf.d/modules|2=
# 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 {{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}}.
See [http://wiki.gentoo.org/wiki/Localization/HOWTO#Keyboard_layout_for_the_console] and [[Locale]] for details.
== Troubleshooting ==
=== Error while unmounting /tmp ===
When shutting the system down, you might get an error message such as
{{bc|* Unmounting /tmp ...
* in use but fuser finds nothing [ !! ]}}
This can be fixed by adding
no_umounts="/tmp"
to {{ic|''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 {{ic|.conf}} extension under {{ic|''rcdir''/sysctl.d}}
=== During shutdown remounting root as read-only fails ===
If the above happens, edit the {{ic|/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|ConsoleKit|Merge generic steps}}
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 ===
For a login manager, {{AUR|lxdm-consolekit}} from the [[AUR]] or [[LightDM]] could be used.
=== Mate ===
[[Install]] {{AUR|mate-session-manager-upower}} and {{AUR|mate-power-manager-upower}}.
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.
=== KDE ===
The kdebase-workspace package needs to be recompiled for use with consolekit ({{AUR|kdebase-workspace-consolekit}} is available from the AUR).
== See also ==
* [[Wikipedia:OpenRC]]
* [https://wiki.gentoo.org/wiki/OpenRC Gentoo wiki]
* [https://sourceforge.net/projects/archopenrc OpenRC for Arch Linux - sourceforge repository]
* [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]
* [https://wiki.manjaro.org/index.php?title=OpenRC,_an_alternative_to_systemd Manjaro wiki]