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

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

From Manjaro
imported>Aaditya
imported>Fhdk
(added out of date)
 
(20 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Out of date|OpenRC is no longer supported --Frede H. 08:41, 25 September 2020 (CEST)}}
__TOC__
==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]}}
==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.
[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.


Line 4: Line 14:


== Installation ==
== Installation ==
 
{{Important|OpenRC on Manjaro has been [https://forum.manjaro.org/t/manjaro-openrc-will-be-discontinued/28387 discontinued].}}
OpenRC is available from the the Manjaro repositories. It can be installed as:
OpenRC is available from the the Manjaro repositories. It can be installed as:
  sudo pacman -S openrc-base
  sudo pacman -S openrc-base


The output of the above command looks like the following:
The output of the above command looks like the following:
  $ sudo pacman -S openrc-base
  $ sudo pacman -S openrc-base
  :: There are 10 members in group openrc-base:
  :: There are 10 members in group openrc-base:
Line 39: Line 47:


On installing ''openrc-base'', one may get messages like:
On installing ''openrc-base'', one may get messages like:
  run 'rc-update add dbus default'
  run 'rc-update add dbus default'
  run 'rc-update add cronie default'
  run 'rc-update add cronie default'


Running these command(s) adds the service(s) to the specified runlevels. For example on running:
Running these command(s) adds the service(s) to the specified runlevels. For example on running:
  sudo rc-update add dbus default
  sudo rc-update add dbus default


The dbus service would be added to the default runelevel and would automatically be started at boot.
The dbus service would be added to the default runelevel and would automatically be started at boot.
''dbus'' (system message bus) and ''cronie'' (for cron) are some common services that can be enabled.
''dbus'' (system message bus) and ''cronie'' (for cron) are some common services that can be enabled.
=== Additional packages ===
=== Additional packages ===
==== Display Manager ====
==== Display Manager ====
 
To boot to a graphical display manager, the '''displaymanager-openrc''' package can be installed. After installing it, the ''/etc/conf.d/xdm'' file needs to be edited to specify the display manager.
To boot to a graphical display manager, the '''displaymanager-openrc''' package can be installed.
 
After installing it, the ''/etc/conf.d/xdm'' file needs to be edited to specify the display manager.


For example, to use '''lightdm''', change the line:
For example, to use '''lightdm''', change the line:
  DISPLAYMANAGER="xdm"
  DISPLAYMANAGER="xdm"
to
to
Line 65: Line 65:


Finally the '''xdm''' service can be added to default runlevel:
Finally the '''xdm''' service can be added to default runlevel:
  sudo rc-update add xdm default
  sudo rc-update add xdm default


'''Note:'''
'''Note:'''
''lightdm'' and a ''lightdm-greeter'' (like ''lightdm-gtk-greeter'') should be installed to use lightdm as display manager. A guide is available on the [https://forum.manjaro.org/index.php?topic=21386.0 forums].
''lightdm'' and a ''lightdm-greeter'' (like ''lightdm-gtk-greeter'') should be installed to use lightdm as display manager. A guide is available on the [https://forum.manjaro.org/index.php?topic=21386.0 forums].


Line 77: Line 75:


==== Audio (ALSA) ====
==== Audio (ALSA) ====
The '''alsa-utils-openrc''' package can be installed. After installing it, run:
The '''alsa-utils-openrc''' package can be installed. After installing it, run:
  sudo rc-update add alsasound default
  sudo rc-update add alsasound default


to automatically start ''alsa'' at boot.
to automatically start ''alsa'' at boot.
==== Network Manager ====
==== Network Manager ====
By default ''dhcpcd'' is enabled via [https://github.com/gentoo/netifrc netifrc]. However if one uses Wifi to connect to the internet, or need a graphical network applet, then '''networkmanager-openrc''' can be installed.
By default ''dhcpcd'' is enabled via [https://github.com/gentoo/netifrc netifrc]. However if one uses Wifi to connect to the internet, or need a graphical network applet, then '''networkmanager-openrc''' can be installed.


Line 91: Line 85:


Other alternatives like ''wicd-openrc'' and ''connman-openrc'' are also available.
Other alternatives like ''wicd-openrc'' and ''connman-openrc'' are also available.
==== Consolekit ====
==== 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.  
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.  


Line 99: Line 91:


See the [[Openrc#Using_Consolekit | Using Consolekit]] section on how to install it and for more info.
See the [[Openrc#Using_Consolekit | Using Consolekit]] section on how to install it and for more info.
==== openrc-desktop ====
==== openrc-desktop ====
The ''openrc-desktop'' package group can be used to install most of the above desktop related packages in one go. For example:
The ''openrc-desktop'' package group can be used to install most of the above desktop related packages in one go. For example:
 
<pre>
  $ sudo pacman -S openrc-desktop
  $ sudo pacman -S openrc-desktop
  :: There are 6 members in group openrc-desktop:
  :: There are 6 members in group openrc-desktop:
Line 122: Line 112:
   
   
  :: Proceed with installation? [Y/n]  
  :: Proceed with installation? [Y/n]  
 
</pre>
==== Others ====
==== Others ====
===== ACPI =====
===== ACPI =====
For handling acpi events, '''acpid-openrc''' can be installed and enabled (see [https://wiki.archlinux.org/index.php/Acpid this] for more details on acpid).
For handling acpi events, '''acpid-openrc''' can be installed and enabled (see [https://wiki.archlinux.org/index.php/Acpid this] for more details on acpid).
===== Logging =====
===== Logging =====
For logging, a logger can be chosen from ''metalog-openrc'', ''syslog-ng-openrc'', and ''rsyslog-openrc'', by installing the package and enabling its respective service.
For logging, a logger can be chosen from ''metalog-openrc'', ''syslog-ng-openrc'', and ''rsyslog-openrc'', by installing the package and enabling its respective service.
===== Suspend/Hibernate =====
===== Suspend/Hibernate =====
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]] section for some issues that one could face.
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]] section for some issues that one could face.
=== Note ===
=== Note ===
If using [[plymouth]] before, then {{ic|/etc/mkinitcpio.conf}} would need to be edited to remove the '''plymouth''' hook, as plymouth does not work correctly with OpenRC. The hooks line should look like:
If using [[plymouth]] before, then {{ic|/etc/mkinitcpio.conf}} would need to be edited to remove the '''plymouth''' hook, as plymouth does not work correctly with OpenRC. The hooks line should look like:
  HOOKS="base udev autodetect modconf block resume filesystems keyboard keymap fsck"
  HOOKS="base udev autodetect modconf block resume filesystems keyboard keymap fsck"


After that would need to regenerate the initrd as:
After that would need to regenerate the initrd as:
  sudo mkinitcpio -p linux<version>
  sudo mkinitcpio -p linux<version>


For example,
For example,
  sudo mkinitcpio -p linux314
  sudo mkinitcpio -p linux314
== Configuration ==
== Configuration ==
=== Adding or Removing services ===
=== Adding or Removing services ===
Services can be added to startup with:
Services can be added to startup with:
  sudo rc-update add <service> <runlevel>
  sudo rc-update add <service> <runlevel>
For example,
For example,
  sudo rc-update add sshd default
  sudo rc-update add sshd default
runlevel can be skipped if adding services to the current runlevel, ie:
runlevel can be skipped if adding services to the current runlevel, ie:
  sudo rc-update add sshd
  sudo rc-update add sshd
A service can be removed from startup with:
A service can be removed from startup with:
  sudo rc-update del <service> <runlevel>
  sudo rc-update del <service> <runlevel>
=== Check running services ===
=== Check running services ===
To check what services are running, one can type:
To check what services are running, one can type:
  rc-status
  rc-status
=== Start / stop / restart services ===
=== Start / stop / restart services ===
To start / stop / restart services ''immediately'', the '''rc-service''' command can be used. For example:
To start / stop / restart services ''immediately'', the '''rc-service''' command can be used. For example:
  sudo rc-service networkmanager restart
  sudo rc-service networkmanager restart
=== Some common services ===
=== Some common services ===
To enable printing support, the '''cups-openrc''' package can be installed. For example,
To enable printing support, the '''cups-openrc''' package can be installed. For example,
 
<pre>
  $ sudo pacman -S cups-openrc
  $ sudo pacman -S cups-openrc
  resolving dependencies...
  resolving dependencies...
Line 197: Line 158:
   
   
  :: Proceed with installation? [Y/n]  
  :: Proceed with installation? [Y/n]  
 
</pre>
The service for it is ''cupsd''.
The service for it is ''cupsd''.
  $ sudo rc-service cupsd start
  $ sudo rc-service cupsd start
  * Starting cupsd ...                                                                                                      [ ok ]
  * Starting cupsd ...                                                                                                      [ ok ]
 
For ssh, the '''openssh-openrc''' package can be installed. The service for it is named ''sshd''.
For ssh, the '''openssh-openrc''' package can be installed.
 
The service for it is named ''sshd''.
 
{{Tip | All services present can be listed with the '''{{ic|rc-service --list}}''' command.}}
{{Tip | All services present can be listed with the '''{{ic|rc-service --list}}''' command.}}
== Using Consolekit ==
== Using Consolekit ==
 
{{Important|Consolekit has been deprecated in Manjaro in favour of [https://forum.manjaro.org/t/switch-from-consolekit-to-elogind/19412 elogind].}}
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.
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:
Consolekit can be installed in the following way:
  sudo pacman -S consolekit-openrc polkit-consolekit cgmanager-openrc
  sudo pacman -S consolekit-openrc polkit-consolekit cgmanager-openrc


The output looks like the following:
The output looks like the following:
 
<pre>
  $ sudo pacman -S consolekit-openrc polkit-consolekit cgmanager-openrc
  $ sudo pacman -S consolekit-openrc polkit-consolekit cgmanager-openrc
  resolving dependencies...
  resolving dependencies...
Line 224: Line 178:
  :: polkit-consolekit and polkit are in conflict. Remove polkit? [y/N] y
  :: polkit-consolekit and polkit are in conflict. Remove polkit? [y/N] y
   
   
  Packages (9): cgmanager-0.37-2  consolekit-1.0.0-3  libnih-1.0.3-2 openrc-core-0.17-2  polkit-0.112-2 [removal] cgmanager-openrc-20150911-1
  Packages (9): cgmanager-0.37-2  consolekit-1.0.0-3  libnih-1.0.3-2  
              consolekit-openrc-20150911-1  polkit-consolekit-0.113-1
              openrc-core-0.17-2  polkit-0.112-2 [removal]  
              cgmanager-openrc-20150911-1 consolekit-openrc-20150911-1   
              polkit-consolekit-0.113-1
   
   
  Total Download Size:    0.92 MiB
  Total Download Size:    0.92 MiB
Line 232: Line 188:
   
   
  :: Proceed with installation? [Y/n]  
  :: Proceed with installation? [Y/n]  
 
</pre>
After installing it can be enabled with {{ic|'''sudo rc-update add consolekit'''}} and would be activated after a reboot.
After installing it can be enabled with {{ic|'''sudo rc-update add consolekit'''}} and would be activated after a reboot.
To check that consolekit is running and a ck-session was started, the following command can be used:
To check that consolekit is running and a ck-session was started, the following command can be used:
  ck-list-sessions
  ck-list-sessions
The output looks like the following:
The output looks like the following:
 
</pre>
  Session1:
  Session1:
  unix-user = '1000'
  unix-user = '1000'
Line 253: Line 207:
  on-since = '2014-06-15T13:29:58.652929Z'
  on-since = '2014-06-15T13:29:58.652929Z'
  login-session-id = ''
  login-session-id = ''
 
</pre>
If you are not getting any output, then maybe a ck-session is not being started by your display manager.
If you are not getting any output, then maybe a ck-session is not being started by your display manager. To start a ck-session and X session from the command line following syntax could be used:
 
To start a ck-session and X session from the command line following syntax could be used:
 
  ck-launch-session <session-name>
  ck-launch-session <session-name>


For example,
For example,
  ck-launch-session startxfce4
  ck-launch-session startxfce4


=== Some gotcha's ===
=== Some gotcha's ===
Display managers that are known to work with consolekit are '''lightdm''', '''lxdm''' (via [https://aur.archlinux.org/packages/lxdm-consolekit/ lxdm-consolekit]), '''kdm''' (via [https://aur.archlinux.org/packages/kdebase-workspace-consolekit/ kdebase-workspace-consolekit]), and '''mdm''' (via [https://aur.archlinux.org/packages/mdm-nosystemd/ mdm-nosystemd]). Have a look at the [[Openrc#Display_Manager | Display Manager]] section for more info.
Display managers that are known to work with consolekit are '''lightdm''', '''lxdm''' (via [https://aur.archlinux.org/packages/lxdm-consolekit/ lxdm-consolekit]), '''kdm''' (via [https://aur.archlinux.org/packages/kdebase-workspace-consolekit/ kdebase-workspace-consolekit]), and '''mdm''' (via [https://aur.archlinux.org/packages/mdm-nosystemd/ mdm-nosystemd]). Have a look at the [[Openrc#Display_Manager | Display Manager]] section for more info.


Line 273: Line 222:


== Replacing systemd with eudev ==
== Replacing systemd with eudev ==
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.
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.


Line 279: Line 227:


The steps to install eudev are as follows:
The steps to install eudev are as follows:
  sudo pacman -S eudev eudev-systemdcompat
  sudo pacman -S eudev eudev-systemdcompat


The output looks like the following:
The output looks like the following:
 
<pre>
  $ sudo pacman -S eudev eudev-systemdcompat
  $ sudo pacman -S eudev eudev-systemdcompat
  resolving dependencies...
  resolving dependencies...
Line 299: Line 246:
   
   
  :: Proceed with installation? [Y/n]  
  :: Proceed with installation? [Y/n]  
 
</pre>
After the above steps systemd would be uninstalled and replaced by eudev and its counterparts.
After the above steps systemd would be uninstalled and replaced by eudev and its counterparts.


=== Note ===
=== Note ===
''eudev-systemdcompat'' has been superseded by ''eudev-systemd'' and ''libeudev-systemd'' [https://forum.manjaro.org/t/update-troubles/9046 (link)].
''eudev-systemdcompat'' has been superseded by ''eudev-systemd'' and ''libeudev-systemd'' [https://forum.manjaro.org/t/update-troubles/9046 (link)].


== Troubleshooting ==
== Troubleshooting ==
=== Boot logs ===
=== Boot logs ===
The boot logs for OpenRC are stored in ''/var/log/rc.log''
The boot logs for OpenRC are stored in ''/var/log/rc.log''


=== Get warning at shutdown ===
=== Get warning at shutdown ===
 
If at shutdown there is a message like: ''WARNING: /usr/lib/rc/cache is not writable!''
If at shutdown there is a message like:
 
WARNING: /usr/lib/rc/cache is not writable!


Then this directory can be created as:
Then this directory can be created as:
  sudo mkdir /usr/lib/rc/cache
  sudo mkdir /usr/lib/rc/cache


=== Error about /etc/sysctl.conf not found ===
=== Error about /etc/sysctl.conf not found ===
It can be created with:
It can be created with:
  sudo touch /etc/sysctl.conf
  sudo touch /etc/sysctl.conf


=== Enable Swap (for GPT partitions) ===
=== 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. The following entry may be added to ''/etc/fstab''
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.
<pre>
 
  # /dev/sdyX
I added the following entry to my ''/etc/fstab''
  UUID=xxxx-yyyy.zzzz-xxxx swap swap sw 0 0
 
</pre>
  # /dev/sda10
  UUID=0c3e9434-bc5c-461c-a5e4-4e9fe5f9a149 swap swap sw 0 0
 
=== Using tmpfs ===
=== Using tmpfs ===
systemd used to set a ''tmpfs'' by default; to set it manually via ''/etc/fstab'', the following lines can be added:
systemd used to set a ''tmpfs'' by default; to set it manually via ''/etc/fstab'', the following lines can be added:
 
<pre>
  tmpfs /tmp tmpfs  nodev,nosuid          0  0
  tmpfs /tmp tmpfs  nodev,nosuid          0  0
 
</pre>
See the [https://wiki.archlinux.org/index.php/Fstab#tmpfs Arch Wiki] for more details.
See the [https://wiki.archlinux.org/index.php/Fstab#tmpfs Arch Wiki] for more details.


=== Module auto-loading ===
=== 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:
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''
<pre>
 
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
  # You should consult your kernel documentation and configuration
  # for a list of modules and their options.
  # for a list of modules and their options.
  modules="vboxdrv"
  modules="vboxdrv"
 
<pre>
=== Setting hostname ===
=== 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''
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 ===
=== Setting keymap ===
 
The keymap for the console can be set via editing {{ic|/etc/conf.d/keymaps}}. For X11 (graphical part of the system), it can be set via {{ic|/etc/X11/xorg.conf.d/20-keyboard.conf}}. For more information have a look at the [http://wiki.gentoo.org/index.php?title=Keyboard_layout_switching Gentoo wiki] (with the difference that in Arch/Manjaro the keymaps are stored in ''/usr/share/kbd/keymaps'' [https://wiki.archlinux.org/index.php/Keymap]).
The keymap for the console can be set via editing {{ic|/etc/conf.d/keymaps}}.
 
For X11 (graphical part of the system), it can be set via {{ic|/etc/X11/xorg.conf.d/20-keyboard.conf}}
 
For more information have a look at the [http://wiki.gentoo.org/index.php?title=Keyboard_layout_switching Gentoo wiki] (with the difference that in Arch/Manjaro the keymaps are stored in ''/usr/share/kbd/keymaps'' [https://wiki.archlinux.org/index.php/Keymap]).


=== Setting Hardware clock ===
=== Setting Hardware clock ===
Can be done by editing {{ic|/etc/conf.d/hwclock}}
Can be done by editing {{ic|/etc/conf.d/hwclock}}


=== Shutting down / rebooting ===
=== Shutting down / rebooting ===
 
To shutdown the system, the {{ic|'''poweroff'''}} command can be used. Similarly to reboot, the {{ic|'''reboot'''}} command can be used.
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 ===
=== 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/].
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.
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:
 
<pre>
The workaround is to create a file {{ic|/etc/X11/Xwrapper.config}} with the contents:
 
  # Xorg.wrap configuation file
  # Xorg.wrap configuation file
  needs_root_rights = yes
  needs_root_rights = yes
 
</pre>
Reference: [https://bbs.archlinux.org/viewtopic.php?pid=1441150#p1441150 Arch forum]
Reference: [https://bbs.archlinux.org/viewtopic.php?pid=1441150#p1441150 Arch forum]


=== Input devices not working ===
=== Input devices not working ===
With ''eudev-3.0'', a new '''input''' group was introduced; you could try adding your user to it.
With ''eudev-3.0'', a new '''input''' group was introduced; you could try adding your user to it.
  sudo gpasswd -a <user> input
  sudo gpasswd -a <user> input


Line 400: Line 314:


=== MySQL service not working ===
=== MySQL service not working ===
 
Have a look here: https://archived.forum.manjaro.org/t/mariadb-daemon-dont-start-in-openrc/20356
Have a look here: https://forum.manjaro.org/t/mariadb-daemon-dont-start-in-openrc/20356


=== Pulseaudio does not start / work ===
=== Pulseaudio does not start / work ===
 
See: https://archived.forum.manjaro.org/t/pulseaudio-and-openrc/5881/1
See: https://forum.manjaro.org/t/pulseaudio-and-openrc/5881/1


=== Ctrl + Alt + Backspace causes problems with some display managers ===
=== Ctrl + Alt + Backspace causes problems with some display managers ===
 
Have a look here: https://archived.forum.manjaro.org/t/ctrl-alt-backspace-doesnt-log-out-zaps-xorg-openrc
Have a look here: https://forum.manjaro.org/t/ctrl-alt-backspace-doesnt-log-out-zaps-xorg-openrc


=== Httpd (Apache) service status says crashed ===
=== Httpd (Apache) service status says crashed ===
If the {{ic|httpd}} process is running but {{ic|rc-status}} shows the service as crashed, try editing ''/etc/init.d/httpd'' and remove the {{ic|start-stop-daemon}} call when starting the service:
If the {{ic|httpd}} process is running but {{ic|rc-status}} shows the service as crashed, try editing ''/etc/init.d/httpd'' and remove the {{ic|start-stop-daemon}} call when starting the service:
   # sed 's|start-stop-daemon --start -- ${APACHE2} ${APACHE2_OPTS} -k start|${APACHE2} ${APACHE2_OPTS} -k start|' -i /etc/init.d/httpd
   # sed 's|start-stop-daemon --start -- ${APACHE2} ${APACHE2_OPTS} -k start|${APACHE2} ${APACHE2_OPTS} -k start|' -i /etc/init.d/httpd


Forum link: https://forum.manjaro.org/t/solved-apache-service-httpd-status-status-crashed/19878
Forum link: https://archived.forum.manjaro.org/t/solved-apache-service-httpd-status-status-crashed/19878
 
== Further Reading ==


[https://wiki.archlinux.org/index.php/Openrc The Arch Wiki]
A better solution seems to be to explicitly add the ''pidfile'' option to start stop daemon:
  # sed 's|start-stop-daemon --start|start-stop-daemon --start --pidfile ${PIDFILE}|' -i /etc/init.d/httpd


[http://blog.notfoss.com/posts/openrc-on-arch-linux/ OpenRC on Arch Linux]
More details: https://bitbucket.org/aadityabagga/openrc-services-ng/issues/4/issue-with-httpd-service


[https://wiki.manjaro.org/index.php?title=Autostart_X_at_Login_-_OpenRC_%26_SystemD Autostart X at Login - OpenRC]
=== Unable to build ISO using manjaro-tools on OpenRC ===
Try loading the ''loop'' module, see https://archived.forum.manjaro.org/t/manjaro-tools-14-on-testing-openrc/17156 for more info.


[http://systemd-free.org/ systemd-free.org]
== Further Reading ==
 
[https://wiki.gentoo.org/wiki/Handbook:X86/Working/Initscripts Initscripts]
 
[https://wiki.gentoo.org/wiki//etc/local.d /etc/local.d]
 
== Support ==


Following is a link where you can post any related feedback: [https://forum.manjaro.org/c/technical-issues-and-assistance/openrc]
* [https://wiki.archlinux.org/index.php/Openrc The Arch Wiki]
* [http://blog.notfoss.com/posts/openrc-on-arch-linux/ OpenRC on Arch Linux]
* [https://wiki.manjaro.org/index.php?title=Autostart_X_at_Login_-_OpenRC_%26_SystemD Autostart X at Login - OpenRC]
* [http://systemd-free.org/ systemd-free.org]
* [https://wiki.gentoo.org/wiki/Handbook:X86/Working/Initscripts Initscripts]
* [https://wiki.gentoo.org/wiki//etc/local.d /etc/local.d]




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

Latest revision as of 06:41, 25 September 2020

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.

Installation

Info
OpenRC on Manjaro has been discontinued.


OpenRC is available from the the Manjaro repositories. It can be installed as:

sudo pacman -S openrc-base

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, one may get messages like:

run 'rc-update add dbus default'
run 'rc-update add cronie default'

Running these command(s) adds the service(s) to the specified runlevels. For example on running:

sudo rc-update add dbus default

The dbus service would be added to the default runelevel and would automatically be started at boot. dbus (system message bus) and cronie (for cron) are some common services that can be enabled.

Additional packages

Display Manager

To boot to a graphical display manager, the displaymanager-openrc package can be installed. After installing it, the /etc/conf.d/xdm file needs to be edited to specify the display manager.

For example, to use lightdm, change the line:

DISPLAYMANAGER="xdm"

to

DISPLAYMANAGER="lightdm"

Finally the xdm service can be added to default runlevel:

sudo rc-update add xdm default

Note: lightdm and a lightdm-greeter (like lightdm-gtk-greeter) should be installed to use lightdm as display manager. A guide is available on the forums.

An alternative to lightdm is LXDM. However the version in the repository does not automatically start a ck-session on login; alternative lxdm-consolekit from the AUR can be used.

For more information about consolekit, have a look at the 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 netifrc. However if one uses 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.

Other alternatives like wicd-openrc and connman-openrc are also available.

Consolekit

The consolekit-openrc package can be installed. Consolekit supports multi-user setups, mounting of partitions by unauthorized users, etc. See the Gentoo-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 Using Consolekit section on how to install it 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

ACPI

For handling acpi events, acpid-openrc can be installed and enabled (see this for more details on acpid).

Logging

For logging, a logger can be chosen from metalog-openrc, syslog-ng-openrc, and rsyslog-openrc, by installing the package and enabling its respective service.

Suspend/Hibernate

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 troubleshooting section for some issues that one could face.

Note

If using plymouth before, then /etc/mkinitcpio.conf would need to be edited to remove the plymouth hook, as plymouth does not work correctly with OpenRC. The hooks line should look like:

HOOKS="base udev autodetect modconf block resume filesystems keyboard keymap fsck"

After that would need to regenerate the initrd as:

sudo mkinitcpio -p linux<version>

For example,

sudo mkinitcpio -p linux314

Configuration

Adding or Removing services

Services can be added to startup with:

sudo rc-update add <service> <runlevel>

For example,

sudo rc-update add sshd default

runlevel can be skipped if adding services to the current runlevel, ie:

sudo rc-update add sshd

A service can be removed from startup with:

sudo rc-update del <service> <runlevel>

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

Some common services

To enable printing support, the cups-openrc package can be installed. For example,

 $ sudo pacman -S cups-openrc
 resolving dependencies...
 looking for inter-conflicts...
 
 Packages (1): cups-openrc-20141014-1
 
 Total Installed Size:   0.01 MiB
 Net Upgrade Size:       0.00 MiB
 
 :: Proceed with installation? [Y/n] 

The service for it is cupsd.

$ sudo rc-service cupsd start
* Starting cupsd ...                                                                                                       [ ok ]

For ssh, the openssh-openrc package can be installed. The service for it is named sshd.


Tip
All services present can be listed with the rc-service --list command.

Using Consolekit

Info
Consolekit has been deprecated in Manjaro in favour of elogind.


Additionally, if not already done, 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 polkit-consolekit cgmanager-openrc

The output looks like the following:

 $ sudo pacman -S consolekit-openrc polkit-consolekit cgmanager-openrc
 resolving dependencies...
 looking for inter-conflicts...
 :: polkit-consolekit and polkit are in conflict. Remove polkit? [y/N] y
 
 Packages (9): cgmanager-0.37-2  consolekit-1.0.0-3  libnih-1.0.3-2 
               openrc-core-0.17-2  polkit-0.112-2 [removal] 
               cgmanager-openrc-20150911-1 consolekit-openrc-20150911-1  
               polkit-consolekit-0.113-1
 
 Total Download Size:    0.92 MiB
 Total Installed Size:   4.44 MiB
 Net Upgrade Size:       2.84 MiB
 
 :: Proceed with installation? [Y/n] 

After installing it can be enabled with sudo rc-update add consolekit and would be activated after a reboot. 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 any output, then maybe a ck-session is not being started by your display manager. To start a ck-session and X session from the command line following syntax could be used:

ck-launch-session <session-name>

For example,

ck-launch-session startxfce4

Some gotcha's

Display managers that are known to work with consolekit are lightdm, lxdm (via lxdm-consolekit), kdm (via kdebase-workspace-consolekit), and mdm (via mdm-nosystemd). Have a look at the Display Manager section for more info.

If you start a graphical session from the command line, this forum post may be of some help.

If you use Openbox or another Window Manager along with oblogout, then oblogout-consolekit from the AUR can be used for having a graphical logout interface.

Replacing systemd with eudev

With OpenRC being used as init system, the role of systemd is reduced to that of a udev provider, and for compatibility reasons.

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:

sudo pacman -S eudev eudev-systemdcompat

The output looks like the following:

 $ sudo pacman -S eudev eudev-systemdcompat
 resolving dependencies...
 looking for conflicting packages...
 :: eudev and libsystemd are in conflict (libgudev-1.0.so). Remove libsystemd? [y/N] y
 :: eudev-systemdcompat and systemd are in conflict. Remove systemd? [y/N] y
 warning: dependency cycle detected:
 warning: eudev-systemdcompat will be installed before its eudev dependency
 
 Packages (4) libsystemd-219-6 [removal]  systemd-219-6 [removal]  eudev-3.0-1  eudev-systemdcompat-219-2
 
 Total Download Size:     0.95 MiB
 Total Installed Size:    7.09 MiB
 Net Upgrade Size:      -18.78 MiB
 
 :: Proceed with installation? [Y/n] 

After the above steps systemd would be uninstalled and replaced by eudev and its counterparts.

Note

eudev-systemdcompat has been superseded by eudev-systemd and libeudev-systemd (link).

Troubleshooting

Boot logs

The boot logs for OpenRC are stored in /var/log/rc.log

Get warning at shutdown

If at shutdown there is a message like: WARNING: /usr/lib/rc/cache is not writable!

Then this directory can be created as:

sudo mkdir /usr/lib/rc/cache

Error about /etc/sysctl.conf not found

It can be created with:

sudo touch /etc/sysctl.conf

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. The following entry may be added to /etc/fstab

 # /dev/sdyX
 UUID=xxxx-yyyy.zzzz-xxxx	swap	swap	sw	0	0

Using tmpfs

systemd used to set a tmpfs by default; to set it manually via /etc/fstab, the following lines can be added:

 tmpfs		/tmp		tmpfs   nodev,nosuid          	0  	0

See the 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"
<pre>
=== 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 for the console can be set via editing {{ic|/etc/conf.d/keymaps}}. For X11 (graphical part of the system), it can be set via {{ic|/etc/X11/xorg.conf.d/20-keyboard.conf}}. For more information have a look at the [http://wiki.gentoo.org/index.php?title=Keyboard_layout_switching Gentoo wiki] (with the difference that in Arch/Manjaro the keymaps are stored in ''/usr/share/kbd/keymaps'' [https://wiki.archlinux.org/index.php/Keymap]).

=== Setting Hardware clock ===
Can be done by editing {{ic|/etc/conf.d/hwclock}}

=== 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:
<pre>
 # Xorg.wrap configuation file
 needs_root_rights = yes

Reference: Arch forum

Input devices not working

With eudev-3.0, a new input group was introduced; you could try adding your user to it.

sudo gpasswd -a <user> input

Reference: https://github.com/gentoo/eudev/issues/107

MySQL service not working

Have a look here: https://archived.forum.manjaro.org/t/mariadb-daemon-dont-start-in-openrc/20356

Pulseaudio does not start / work

See: https://archived.forum.manjaro.org/t/pulseaudio-and-openrc/5881/1

Ctrl + Alt + Backspace causes problems with some display managers

Have a look here: https://archived.forum.manjaro.org/t/ctrl-alt-backspace-doesnt-log-out-zaps-xorg-openrc

Httpd (Apache) service status says crashed

If the httpd process is running but rc-status shows the service as crashed, try editing /etc/init.d/httpd and remove the start-stop-daemon call when starting the service:

 # sed 's|start-stop-daemon --start -- ${APACHE2} ${APACHE2_OPTS} -k start|${APACHE2} ${APACHE2_OPTS} -k start|' -i /etc/init.d/httpd

Forum link: https://archived.forum.manjaro.org/t/solved-apache-service-httpd-status-status-crashed/19878

A better solution seems to be to explicitly add the pidfile option to start stop daemon:

 # sed 's|start-stop-daemon --start|start-stop-daemon --start --pidfile ${PIDFILE}|' -i /etc/init.d/httpd

More details: https://bitbucket.org/aadityabagga/openrc-services-ng/issues/4/issue-with-httpd-service

Unable to build ISO using manjaro-tools on OpenRC

Try loading the loop module, see https://archived.forum.manjaro.org/t/manjaro-tools-14-on-testing-openrc/17156 for more info.

Further Reading

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