Manjaro Difference between revisions of "OpenRC, an alternative to systemd"

Difference between revisions of "OpenRC, an alternative to systemd"

From Manjaro
imported>Aaditya
(removed old text - kept some references)
Tag: Replaced
 
(95 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[https://wiki.gentoo.org/wiki/OpenRC OpenRC] is an [https://en.wikipedia.org/wiki/Init init] system maintained by the Gentoo developers.
{{Out of date|OpenRC is no longer supported --Frede H. 08:41, 25 September 2020 (CEST)}}
OpenRC is a dependency based init system that works with the system provided init program, normally [http://savannah.nongnu.org/projects/sysvinit sysvinit]. It is not a replacement for sysvinit.


It can be used as an alternative to [http://www.freedesktop.org/wiki/Software/systemd/ systemd], for users that like more control over their system and do not want all the features that systemd provides and automatically activates.
__TOC__


== Installation ==
==Unsupported on Manjaro==
{{Important|Manjaro does no longer support OpenRC}}
==Replacement==
{{Important|If you are looking for OpenRC capable Arch have a look at [https://artixlinux.org Artix Linux]}}


OpenRC is available from the the Manjaro repositories. It can be installed as:
==What is OpenRC==
[https://wiki.gentoo.org/wiki/OpenRC OpenRC] is a dependency based [https://en.wikipedia.org/wiki/Init init] system maintained by the Gentoo developers, that works with the system provided init program, normally [http://savannah.nongnu.org/projects/sysvinit sysvinit]. It is not a replacement for sysvinit.


sudo pacman -S openrc-base
It is an alternative to [http://www.freedesktop.org/wiki/Software/systemd/ systemd] for users that like more control over their system, and do not want all the features that systemd provides and automatically activates.


The output of the above command looks like the following:
$ sudo pacman -S openrc-base
:: There are 10 members in group openrc-base:
:: Repository community
    1) cronie-openrc  2) cryptsetup-openrc  3) dbus-openrc
    4) device-mapper-openrc  5) dhcpcd-openrc  6) glibc-openrc
    7) inetutils-openrc  8) lvm2-openrc  9) mdadm-openrc  10) openrc-core
Enter a selection (default=all):
resolving dependencies...
looking for inter-conflicts...
:: openrc-core and systemd-sysvcompat are in conflict. Remove systemd-sysvcompat? [y/N] y
Packages (12): systemd-sysvcompat-212-3 [removal]  sysvinit-2.88-15
                cronie-openrc-20140614-1  cryptsetup-openrc-20140614-1
                dbus-openrc-20140614-1  device-mapper-openrc-20140614-1
                dhcpcd-openrc-20140614-1  glibc-openrc-20140614-1
                inetutils-openrc-20140614-1  lvm2-openrc-20140614-1
                mdadm-openrc-20140614-1  openrc-core-0.12.4-16
Total Download Size:    0.22 MiB
Total Installed Size:  1.19 MiB
:: Proceed with installation? [Y/n]
After installing the ''openrc-base'' package group, OpenRC should boot by default instead of systemd.
Note that it will boot to a command line, as the service for a graphical display manager has not yet been installed.
On installing ''openrc-base'', you may get messages like:
run 'rc-update add cronie default'
run 'rc-update add dhcpcd default'
Running these command(s) adds the service(s) to the specified runlevels. For example if you run:
sudo rc-update add cronie default
Then the cronie service would be added to the default runelevel and would automatically be started at boot.
=== Additional packages ===
==== Display Manager ====
To boot to a graphical display manager, install the '''displaymanager-openrc''' package, and edit the ''/etc/conf.d/xdm'' file to specify your display manager. For example, to use '''lightdm''', change the line
DISPLAYMANAGER="xdm"
to
DISPLAYMANAGER="lightdm"
'''Note:'''
''lightdm'' and a ''lightdm-greeter'' should be installed to use lightdm as display manager.
An alternative to ''lightdm'' that I find simpler is [https://wiki.archlinux.org/index.php/LXDM LXDM]. However the version in the repos does not automatically start a ck-session on login; alternative [https://aur.archlinux.org/packages/lxdm-consolekit/ lxdm-consolekit] from the [[AUR]] can be used.
For more info about consolekit, have a look at the [[Openrc#Consolekit | Consolekit]] section.
==== Audio (ALSA) ====
The '''alsa-utils-openrc''' package can be installed. After installing it, run:
sudo rc-update add alsasound default
to automatically start ''alsa'' at boot.
==== Network Manager ====
By default ''dhcpcd'' is enabled via [http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=3 netifrc]. However if you use Wifi to connect to the internet, or need a graphical network applet, then '''networkmanager-openrc''' can be installed.
''networkmanager-openrc'' replaces the normal networkmanager package in the repos. Also, it requires ''consolekit'' and ''polkit-consolekit'', which replaces the normal polkit from the repos.
==== Consolekit ====
The '''consolekit-openrc''' package can be installed. Consolekit supports multi-user setups, mounting of partitions by unauthorized users, etc. See the [https://wiki.gentoo.org/wiki/ConsoleKit Gentoo-Wiki] for more details.
Only caveat of installing consolekit is that it requires ''polkit-consolekit'', which conflicts with the normal polkit; so if you boot to systemd you wont be able to mount partitions if you are not in the storage group.
However using the command line, or as root user, one can mount any partition or perform most functions that are made available to the normal user via polkit. See the [https://wiki.archlinux.org/index.php/Polkit Arch-wiki] for more details.
Consolekit also allows a normal (non-root) user to shutdown or restart the system if the desktop environment supports it.
See the [[Openrc#Using_Consolekit | Using Consolekit]] section on how to install and for more info.
==== openrc-desktop ====
The ''openrc-desktop'' package group can be used to install most of the above desktop related packages in one go. For example:
$ sudo pacman -S openrc-desktop
:: There are 6 members in group openrc-desktop:
:: Repository community
    1) acpid-openrc  2) alsa-utils-openrc  3) avahi-openrc  4) consolekit-openrc
    5) displaymanager-openrc  6) gpm-openrc
Enter a selection (default=all):
resolving dependencies...
looking for inter-conflicts...
Packages (6): acpid-openrc-20140614-1  alsa-utils-openrc-20140614-1
              avahi-openrc-20140614-1  consolekit-openrc-20140614-1
              displaymanager-openrc-20140614-1  gpm-openrc-20140614-1
Total Installed Size:  0.12 MiB
Net Upgrade Size:      0.00 MiB
:: Proceed with installation? [Y/n]
==== Others ====
For acpi support '''acpid-openrc''' can be installed and enabled.
To suspend and hibernate via the command line, '''pm-utils''' can be installed. You may also need the '''upower-pm-utils''' package if suspend and hibernate does not work. See the [[Using_OpenRC,_an_alternative_to_systemd#Troubleshooting | troubleshooting]] for some issues you may face.
== Configuration ==
=== Adding or Removing services ===
Services can be added to startup with:
sudo rc-update add <service>
A service can be removed from startup with:
sudo rc-update del <service>
=== Check running services ===
To check what services are running, one can type:
rc-status
=== Start / stop / restart services ===
To start / stop / restart services ''immediately'', the '''rc-service''' command can be used. For example:
sudo rc-service networkmanager restart
== Using Consolekit ==
Additionally, if not already done, [https://wiki.gentoo.org/wiki/ConsoleKit consolekit] can be installed to perform root actions like shutting down or restarting system as non-root user from your Desktop Environment.
Consolekit can be installed in the following way:
sudo pacman -S consolekit-openrc
The output looks like the following:
$ sudo pacman -S consolekit-openrc
[sudo] password for aaditya:
resolving dependencies...
looking for inter-conflicts...
:: polkit-consolekit and polkit are in conflict. Remove polkit? [y/N] y
Packages (5): consolekit-0.4.6-4  js185-1.0.0-2  polkit-0.112-2 [removal]
              polkit-consolekit-0.112-2  consolekit-openrc-20140614-1
Total Download Size:    1.90 MiB
Total Installed Size:  10.67 MiB
Net Upgrade Size:      9.08 MiB
:: Proceed with installation? [Y/n]
To check that consolekit is running and a ck-session was started, the following command can be used:
ck-list-sessions
The output looks like the following:
Session1:
unix-user = '1000'
realname = 'Aaditya Bagga'
seat = 'Seat1'
session-type = ''
active = TRUE
x11-display = ':0'
x11-display-device = '/dev/tty7'
display-device = ''
remote-host-name = ''
is-local = TRUE
on-since = '2014-06-15T13:29:58.652929Z'
login-session-id = ''
If you are not getting similar output, then maybe a ck-session is not being started by your display manager.
=== Some gotcha's ===
Dsplay managers that are known to work with consolekit are '''lightdm''', '''lxdm''' (via [https://aur.archlinux.org/packages/lxdm-consolekit/ lxdm-consolekit]), and '''kdm''' (via [https://aur.archlinux.org/packages/kdebase-workspace-consolekit/ kdebase-workspace-consolekit]). Have a look at the [[Openrc#Display_Manager | Display Manager]] section for more info.
If you start a graphical session from the command line, [http://bbs.archbang.org/viewtopic.php?pid=1394#p1394 this forum post] may be of some help.
If you use Openbox or another Window Manager along with [https://wiki.archlinux.org/index.php/Oblogout oblogout], then [https://aur.archlinux.org/packages/oblogout-consolekit/ oblogout-consolekit] from the AUR can be used for having a graphical logout interface.
== Replacing systemd with eudev (advanced users) ==
With OpenRC being used as init system, the role of systemd is reduced to that of a [https://wiki.archlinux.org/index.php/Udev udev] provider, and for compatibility reasons.
[http://www.gentoo.org/proj/en/eudev/ eudev], developed by the Gentoo folks, can be used as replacement. Note that removing systemd could cause some incompatibilities with existing software. The steps to install eudev are as follows:
Step 1) Install ''eudev-openrc'' (along with ''eudev-systemdcompat''):
sudo pacman -S eudev-openrc eudev-systemdcompat
The output looks like the following:
$ sudo pacman -S eudev-openrc eudev-systemdcompat
resolving dependencies...
looking for inter-conflicts...
:: eudev-systemdcompat and systemd are in conflict. Remove systemd? [y/N] y
:: eudev-systemdcompat and libsystemd are in conflict. Remove libsystemd? [y/N] y
Packages (6): eudev-1.9-1  libeudev-1.9-1  libsystemd-212-2 [removal]
              systemd-212-2 [removal]  eudev-openrc-20140712-1
              eudev-systemdcompat-215-1
Total Download Size:    0.93 MiB
Total Installed Size:  6.38 MiB
Net Upgrade Size:      -10.84 MiB
:: Proceed with installation? [Y/n]
After the above steps systemd would be uninstalled and replaced by eudev and its counterparts.
Note the optional dependencies for ''eudev'':
Optional dependencies for eudev
    upower-pm-utils: pm-utils support
The upower-pm-utils package can be installed in order to be able to suspend and hibernate the system.
=== Possible issues ===
After uninstalling systemd, I could not login to my xfce4-session, as it was complied for systemd. Hence I had to install [https://aur.archlinux.org/packages/xfce4-session-consolekit/ xfce4-session-consolekit] from the AUR to get it working.
I also had to downgrade ''xfce4-power-manager'' to version 1.2.0-5 (or less)  to get it working (available [http://sourceforge.net/projects/mefiles/files/Manjaro/openrc-eudev/ here]).
I had to rebuild [https://aur.archlinux.org/packages/gvfs-nosystemd/ gvfs] as my unmounted partitions were not being displayed.
{{Warning|If you want to reinstall systemd again, you can try the command '''sudo pacman -S --force systemd libsystemd'''. The ''--force'' flag is used because of some file conflicts between the libsystemd and libeudev packages. You may need to remove packages depending on eudev before executing this command.}}
== Troubleshooting ==
=== Boot warnings/errors ===
When booting, you may get errors like:
tmpfiles: ignoring invalid entry on line 32 of `/usr/lib/tmpfiles.d//legacy.conf'
tmpfiles: ignoring invalid entry on line 33 of `/usr/lib/tmpfiles.d//legacy.conf'
tmpfiles: ignoring invalid entry on line 34 of `/usr/lib/tmpfiles.d//legacy.conf'
tmpfiles: ignoring invalid entry on line 11 of `/usr/lib/tmpfiles.d//systemd-nologin.conf'
tmpfiles: ignoring invalid entry on line 18 of `/usr/lib/tmpfiles.d//x11.conf'
To correct, I removed the lines referenced in the above files. These errors have been fixed by the developers on [https://github.com/OpenRC/openrc/issues/17 github], and should be available in the next release.
{{Tip|The boot logs for OpenRC are stored in ''/var/log/rc.log''}}
=== Enable Swap (for GPT partitions) ===
If you were using systemd on a GPT partitioned hard disk, then you may need to enable swap via ''/etc/fstab''. This is so because systemd handled swap automatically on GPT partitions, and gave error if it was mounted via fstab.
I added the following entry to my ''/etc/fstab''
# /dev/sda10
UUID=0c3e9434-bc5c-461c-a5e4-4e9fe5f9a149 swap swap sw 0 0
=== Using tmpfs ===
systemd used to set a ''tmpfs'' by default; to set it manually via ''/etc/fstab'', I added the following lines:
tmpfs /tmp tmpfs  nodev,nosuid          0  0
See the [https://wiki.archlinux.org/index.php/Fstab#tmpfs Arch Wiki] for more details.
=== Module auto-loading ===
For OpenRC, the '''modules to be loaded at boot''' are specified in ''/etc/conf.d/modules'' rather than being present as individual files in ''/etc/modules-load.d''
The required modules can be manually moved over.
An example ''/etc/conf.d/modules'' file looks like the following:
# You should consult your kernel documentation and configuration
# for a list of modules and their options.
modules="vboxdrv"
=== Setting hostname ===
If your hostname is being displayed as '''localhost''' even if there a different hostname in ''/etc/hostname'', then you probably need to change your hostname in ''/etc/conf.d/hostname''
=== Setting keymap ===
The keymap can be set via editing {{ic|'''/etc/conf.d/keymaps}}
For setting consolefont edit {{ic|'''/etc/conf.d/consolefont}}
=== Shutting down / rebooting ===
To shutdown the system, the {{ic|'''poweroff'''}} command can be used.
Similarly to reboot, the {{ic|'''reboot'''}} command can be used.
=== X does not start from a virtual terminal ===
With Xorg-1.16, Arch Linux decided to make X rootless using systemd-logind [https://www.archlinux.org/news/xorg-server-116-is-now-available/].
This means that using {{ic|startx}} from a virtual terminal will possibly not work for users of OpenRC init system.
The workaround is to create a file {{ic|/etc/X11/Xwrapper.config}} with the contents:
# Xorg.wrap configuation file
needs_root_rights = yes
Reference: [https://bbs.archlinux.org/viewtopic.php?pid=1441150#p1441150 Arch forum]
=== Get warning messages about / not being mounted ro at shutdown ===
Try downgrading '''util-linux''' to version 2.24.1-6, using [[downgrade]] or [https://sourceforge.net/projects/mefiles/files/Manjaro/openrc-eudev/ this repo].


== Further Reading ==
== Further Reading ==


[https://wiki.archlinux.org/index.php/Openrc The Arch Wiki]
* [https://wiki.archlinux.org/index.php/Openrc The Arch Wiki]
 
* [http://blog.notfoss.com/posts/openrc-on-arch-linux/ OpenRC on Arch Linux]
[http://blog.notfoss.com/posts/openrc-on-arch-linux/ OpenRC on Arch Linux]
* [http://systemd-free.org/ systemd-free.org]
 
* [https://wiki.gentoo.org/wiki/Handbook:X86/Working/Initscripts Initscripts]
[http://abchk1234.wordpress.com/2014/06/03/using-openrc-on-arch-archbang-manjaro-linux/ Using OpenRC on Arch / Archbang / Manjaro Linux]
* [https://wiki.gentoo.org/wiki//etc/local.d /etc/local.d]
 
== Support ==
 
Following is a link to this page's forum counterpart where you can post any related feedback: [https://forum.manjaro.org/index.php?topic=14080.0]




[[Category:Contents Page]]
[[Category:Obsolete]]

Latest revision as of 11:58, 29 June 2024

Tango-dialog-warning.png This article or section is out of date.
Reason: OpenRC is no longer supported --Frede H. 08:41, 25 September 2020 (CEST) (Discuss)
Tango-dialog-warning.png

Unsupported on Manjaro

Info
Manjaro does no longer support OpenRC


Replacement

Info
If you are looking for OpenRC capable Arch have a look at Artix Linux


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. It is not a replacement for sysvinit.

It is an alternative to systemd for users that like more control over their system, and do not want all the features that systemd provides and automatically activates.


Further Reading

Cookies help us deliver our services. By using our services, you agree to our use of cookies.