Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:system:init_systems:openrc [2024/12/31 10:41]
throgh [Login manager]
en:system:init_systems:openrc [2025/03/13 01:05] (current)
throgh [The system can't shutdown correctly]
Line 1: Line 1:
 ====== OpenRC ====== ====== OpenRC ======
-OpenRC is an init system for operating systems such as GNU/Linux, GNU/Hurd and Unix. It is a [[https://en.wikipedia.org/wiki/POSIX|POSIX]]-compatible alternative solution to the problematic [[https://wiki.hyperbola.info/doku.php?id=en:philosophy:systemd_denial|systemd]] init system. OpenRC was created by the Gentoo GNU/Linux development team. Its purpose is to enable, disable and/or manage the services of the operating system.+ 
 +OpenRC is an init system for operating systems such as GNU/Linux, GNU/Hurd and Unix. It is a [[https://en.wikipedia.org/wiki/POSIX|POSIX]]-compatible alternative solution to the problematic [[https://wiki.hyperbola.info/doku.php?id=en:philosophy:systemd_denial|systemd]] software-suite. OpenRC was created by the Gentoo GNU/Linux development team. Its purpose is to enable, disable and/or manage the services of the operating system.
  
 OpenRC emerged at the end of 2007, ((for more details go to: [[https://github.com/OpenRC/openrc/blob/master/HISTORY.md#openrc-history|OpenRC History]])) when Roy Marples retired as a Gentoo GNU/Linux developer. However, he wanted to keep the **baselayout-2** project as an independent project. The Gentoo Project Board has allowed it to continue being maintained as an external project, once the project name was modified to OpenRC with the two-clause BSD license. OpenRC emerged at the end of 2007, ((for more details go to: [[https://github.com/OpenRC/openrc/blob/master/HISTORY.md#openrc-history|OpenRC History]])) when Roy Marples retired as a Gentoo GNU/Linux developer. However, he wanted to keep the **baselayout-2** project as an independent project. The Gentoo Project Board has allowed it to continue being maintained as an external project, once the project name was modified to OpenRC with the two-clause BSD license.
Line 7: Line 8:
  
 In 2013, the OpenRC team became independent from Gentoo GNU/Linux again and changed the primary development to <color #B90B0B/#FFDDDD>GitHub</color>. In 2013, the OpenRC team became independent from Gentoo GNU/Linux again and changed the primary development to <color #B90B0B/#FFDDDD>GitHub</color>.
 +
 ===== Features ===== ===== Features =====
 +
 OpenRC provides a number of interesting features: OpenRC provides a number of interesting features:
-  Compatible with //UNIX// philosophy +  Compatible with //UNIX// philosophy 
-  Portable to non-GNU/Linux systems +  Portable to non-GNU/Linux systems 
-  Cgroups ([[https://en.wikipedia.org/wiki/Cgroups|control groups]]) support +  Cgroups ([[https://en.wikipedia.org/wiki/Cgroups|control groups]]) support 
-  Parallel service initialization +  Parallel service initialization 
-  Dependency-based initialization +  Dependency-based initialization 
-  Automatic dependency calculation +  Automatic dependency calculation 
-  Enables per-service resource limiting and unlimiting +  Enables per-service resource limiting and unlimiting 
-  Sections of split configurations: **init.d** and **conf.d** +  Sections of split configurations: **init.d** and **conf.d** 
-  Well-explained and self-explanatory configuration files +  Well-explained and self-explanatory configuration files 
-  Startup scripts are extensible and customizable +  Startup scripts are extensible and customizable 
-  Designed to be 100% compatible with virtualization environments +  Designed to be 100% compatible with virtualization environments 
-  Modular architecture suitable and separate optional components: **cron**, **syslog**, etc. +  Modular architecture suitable and separate optional components: **cron**, **syslog**, etc. 
-  Expressive and flexible network handling (including VPN, bridges, etc.) +  Expressive and flexible network handling (including VPN, bridges, etc.) 
-  Verbose mode to debug service activity+  Verbose mode to debug service activity
  
-===== Configuration ===== +===== Runlevels =====
-Configuring OpenRC is a simple task. Below are some steps to optimize the use of this initialization system. +
-==== Boot logs ==== +
-Open the configuration file <color #0B71B9/#DDF1FF>/etc/rc.conf</color>, and uncomment the reference line <color #0B71B9/#DDF1FF>rc_logger="YES"</color>.\\ +
-The log files for the entire **rc** process will be stored in <color #0B71B9/#DDF1FF>/var/log/rc.log</color>+
-==== Hostname ==== +
-To add or edit a host name, edit or create the file <color #0B71B9/#DDF1FF>/etc/conf.d/hostname</color> and add: +
-<code bash> +
-hostname="desired_name" +
-</code> +
-==== Keyboard ==== +
-To modify the key map for use in the **console**: edit the file <color #0B71B9/#DDF1FF>/etc/conf.d/consolefont</color>. See the full list of all the options available under <color #0B71B9/#DDF1FF>/usr/share/kbd/keymaps/</color>+
-<code bash> +
-keymap="en_UK" +
-</code> +
-To configure the keyboard for use with a **graphical interface**, edit the file <color #0B71B9/#DDF1FF>/etc/conf.d/keymaps</color>. Again, the full list of options is available under <color #0B71B9/#DDF1FF>/usr/share/kbd/keymaps/</color>+
-<code bash> +
-keymap="en_UK" +
-</code> +
-After editing the files, run the command: +
-<code bash> +
-# rc-service keymaps restart +
-</code> +
-==== Login manager ==== +
-**xorg-xdm**+
  
-To enable the login manager, edit <color #0B71B9/#DDF1FF>/etc/conf.d/xdm</color>. 
- 
-If that file does not already exist, then first make sure to install the package **xorg-xdm**: 
-<code bash> 
-pacman -S xorg-xdm 
-</code> 
- 
-As an example, to use **slim** as the graphical login manager (//with the precondition to install the package **slim**//), replace with the line: 
-<code bash> 
-DISPLAYMANAGER="slim" 
-</code> 
- 
-In order for changes to take effect, make sure to enable the xdm daemon, like so: 
-<code bash> 
-# rc-update add xdm default 
-</code> 
- 
-**slim** 
- 
-The alternative would be to use **slim** direct. So first make sure to install the package **slim**: 
-<code bash> 
-pacman -S slim 
-</code> 
- 
-You can add the service direct at the corresponding runlevel: 
-<code bash> 
-# rc-update add slim default 
-</code> 
-==== Kernel modules ==== 
-For the automatic loading of any module of the <color #0BB928/#DDFFE3>Kernel Linux-Libre</color> edit the file <color #0B71B9/#DDF1FF>/etc/conf.d/modules</color>. 
-<code bash> 
-modules="module_name" 
-</code> 
-This is only necessary after installation of an application or driver, made by the system administrator, by default all native modules of <color #0BB928/#DDFFE3>Kernel Linux-Libre</color> are loaded automatically. 
-==== Silent boot ==== 
-To hide OpenRC messages during system startup, edit the file <color #0B71B9/#DDF1FF>/etc/inittab</color> and set the option to the OpenRC command: 
-<code bash> 
---quiet 
-</code> 
-For more information: 
-<code bash> 
-$ openrc -h 
-</code> 
-===== Runlevels ===== 
 OpenRC, as well as sysvinit and init (BSD), has a concept of task execution levels (i.e., [[https://en.wikipedia.org/wiki/Runlevel|runlevels]]). To define them in the conventional way, OpenRC uses names instead of numbers. This allows, for example, to have a default runlevel with "everything" enabled with a "powersaving" runlevel where some services are disabled. OpenRC, as well as sysvinit and init (BSD), has a concept of task execution levels (i.e., [[https://en.wikipedia.org/wiki/Runlevel|runlevels]]). To define them in the conventional way, OpenRC uses names instead of numbers. This allows, for example, to have a default runlevel with "everything" enabled with a "powersaving" runlevel where some services are disabled.
  
Line 115: Line 50:
  
 The default startup uses the runlevels <color #0B71B9/#DDF1FF>sysinit</color>, <color #0B71B9/#DDF1FF>boot</color>, and <color #0B71B9/#DDF1FF>default</color>, in that order. Shutdown uses the <color #0B71B9/#DDF1FF>shutdown</color> runlevel. The defined runlevel <color #0B71B9/#DDF1FF>nonetwork</color> is used only for non-network services. The default startup uses the runlevels <color #0B71B9/#DDF1FF>sysinit</color>, <color #0B71B9/#DDF1FF>boot</color>, and <color #0B71B9/#DDF1FF>default</color>, in that order. Shutdown uses the <color #0B71B9/#DDF1FF>shutdown</color> runlevel. The defined runlevel <color #0B71B9/#DDF1FF>nonetwork</color> is used only for non-network services.
-===== Removal of systemd ===== 
- 
-Since Hyperbola has announced the [[https://www.hyperbola.info/news/end-of-systemd-support/|end of systemd support]], OpenRC is our main init system in use, and with release 0.4, we have also included further support for [[https://smarden.org/runit|runit]]. 
- 
-===== 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 SysVinit. 
- 
-===== Warning ===== 
- 
-<note warning>Please read the whole warning</note> 
  
-<color #620BB9/#EEDDFF>netctl</color> required systemd to work; therefore, it will not work anymore beginning with Milky Way v0.2, since OpenRC has become the main init system of Hyperbola. You should already have an alternative included with supported versions of Hyperbola; at present, it is [[https://www.hyperbola.info/packages/?q=netifrc|netifrc]].+<note warning><color #620BB9/#EEDDFF>netctl</color> required systemd to work; therefore, it will not work anymore beginning with Milky Way v0.2, since OpenRC has become the main init system of Hyperbola. You should already have an alternative included with supported versions of Hyperbola; at present, it is [[https://www.hyperbola.info/packages/?q=netifrc|netifrc]].</note>
  
 ===== Groups ===== ===== Groups =====
Line 135: Line 59:
  
 <code bash> <code bash>
-passwd -<your-user> audio+usermod -aG audio <your-user>
 </code> </code>
  
Line 141: Line 65:
  
 <code bash> <code bash>
-passwd -<your-user> video+usermod -aG video <your-user>
 </code> </code>
  
Line 147: Line 71:
  
 <code bash> <code bash>
-passwd -<your-user> network+usermod -aG network <your-user>
 </code> </code>
  
Line 153: Line 77:
  
 <code bash> <code bash>
-passwd -<your-user> optical+usermod -aG optical <your-user>
 </code> </code>
  
Line 159: Line 83:
  
 <code bash> <code bash>
-passwd -<your-user> storage+usermod -aG storage <your-user>
 </code> </code>
  
 <code bash> <code bash>
-passwd -<your-user> disk+usermod -aG disk <your-user>
 </code> </code>
  
Line 169: Line 93:
  
 <code bash> <code bash>
-passwd -<your-user> sys+usermod -aG sys <your-user>
 </code> </code>
- 
-<note>For security reasons, first try these features before adding your user to these groups. For example, in some cases adding your user to the <color #620BB9/#EEDDFF>optical</color> group may not be necessary.</note> 
  
 ===== Migration ===== ===== Migration =====
Line 213: Line 135:
       ==> rc 'rc-update add ... default'       ==> rc 'rc-update add ... default'
 </code> </code>
 +
 +==== Boot logs ====
 +
 +Open the configuration file <color #0B71B9/#DDF1FF>/etc/rc.conf</color>, and uncomment the reference line <color #0B71B9/#DDF1FF>rc_logger="YES"</color>.\\
 +The log files for the entire **rc** process will be stored in <color #0B71B9/#DDF1FF>/var/log/rc.log</color>.
 +
 ==== Hostname ==== ==== Hostname ====
  
Line 230: Line 158:
 </code> </code>
  
-==== Network settings ====+==== Keyboard and Keymap ====
  
-You need to enable the daemon <color #620BB9/#EEDDFF>dhcpcd</color> at runlevel default:+To modify the key map for use in the **console**: edit the file ''<color #0B71B9/#DDF1FF>/etc/conf.d/consolefont</color>''. See the full list of all the options available under ''<color #0B71B9/#DDF1FF>/usr/share/kbd/keymaps/</color>''. The below setting is just one example for US-English keyboard maps.
  
 <code bash> <code bash>
-# rc-update add dhcpcd default+keymap="us"
 </code> </code>
  
-==== Keymap ====+To configure the keyboard for use with a **graphical interface**, edit the file ''<color #0B71B9/#DDF1FF>/etc/conf.d/keymaps</color>''. Again, the full list of options is available under ''<color #0B71B9/#DDF1FF>/usr/share/kbd/keymaps/</color>''. The following example is for US-English keyboard maps:
  
-As the hostname, you need to setup the keymap in the file <color #0B71B9/#DDF1FF>/etc/conf.d/keymaps</color>:  +<code bash>
- +
-<code>+
 keymap="us" keymap="us"
 </code> </code>
  
-If you have an advanced usage of your keymap, you can watch the other functionalitiesdocumented in the comments. You can find all the available keymaps in <color #0B71B9/#DDF1FF>/usr/share/kbd/keymaps</color>. Then run:+After editing the filesrun the command:
  
 <code bash> <code bash>
Line 254: Line 180:
 <note>This only applies for CLI. If you are using X11, this won't affect your graphical environment.</note> <note>This only applies for CLI. If you are using X11, this won't affect your graphical environment.</note>
  
-==== Login display manager ====+==== Network settings ====
  
-Unlike in many other operating system distributions: thanks to OpenRC support, the DM can be launched directly.+You need to enable the daemon <color #620BB9/#EEDDFF>dhcpcd</color> at runlevel default:
  
-Just make sure that you have first read and understood the information in the [[OpenRC#login_manager|Login Manager section]].+<code bash> 
 +rc-update add dhcpcd default 
 +</code>
  
-For example, to use <color #620BB9/#EEDDFF>xdm</color> as the display manager, you just need enable the service. 
  
 +
 +==== Login manager ====
 +
 +**xorg-xdm**
 +
 +To enable the login manager, edit <color #0B71B9/#DDF1FF>/etc/conf.d/xdm</color>.
 +
 +If that file does not already exist, then first make sure to install the package **xorg-xdm**:
 +<code bash>
 +pacman -S xorg-xdm
 +</code>
 +
 +As an example, to use **slim** as the graphical login manager (//with the precondition to install the package **slim**//), replace with the line:
 +<code bash>
 +DISPLAYMANAGER="slim"
 +</code>
 +
 +In order for changes to take effect, make sure to enable the xdm daemon, like so:
 <code bash> <code bash>
 # rc-update add xdm default # rc-update add xdm default
 </code> </code>
 +
 +**slim**
 +
 +The alternative would be to use **slim** direct. So first make sure to install the package **slim**:
 +<code bash>
 +pacman -S slim
 +</code>
 +
 +You can add the service direct at the corresponding runlevel:
 +<code bash>
 +# rc-update add slim default
 +</code>
 +
 +==== Kernel modules ====
 +
 +For the automatic loading of any module of the <color #0BB928/#DDFFE3>Kernel Linux-Libre</color> edit the file <color #0B71B9/#DDF1FF>/etc/conf.d/modules</color>.
 +
 +<code bash>
 +modules="module_name"
 +</code>
 +
 +This is only necessary after installation of an application or driver, made by the system administrator, by default all native modules of <color #0BB928/#DDFFE3>Kernel Linux-Libre</color> are loaded automatically.
 +
  
 ===== Adaptation between systemctl and rc-update ===== ===== Adaptation between systemctl and rc-update =====
Line 282: Line 250:
 </code> </code>
  
-(As a current alternative, OpenRC does allow ''delete'' to be abbreviated down to just ''del''.) 
 ==== Services currently running ==== ==== Services currently running ====
  
Line 291: Line 258:
 </code> </code>
  
-==== Stop/Start/Restart a service ====+==== Stop / Start / Restart a service ====
  
 To restart a service, you need to use <color #620BB9/#EEDDFF>rc-service</color>: To restart a service, you need to use <color #620BB9/#EEDDFF>rc-service</color>:
Line 350: Line 317:
 ==== The system can't shutdown correctly ==== ==== The system can't shutdown correctly ====
  
-Beginning with OpenRC 0.28, SysVinit is replaced with openrc-init, and shutdown is replaced with openrc-shutdown.+Please add your user to the group <color #620BB9/#EEDDFF>power</color>:
  
-If you use ''<color #620BB9/#EEDDFF>startx</color>'' to start your desktop, you also need to modify ''<color #0B71B9/#DDF1FF>~/.xinitrc</color>'' to prevent any issues with your window manager starting correctly.+<code bash> 
 +usermod -aG power <your-user> 
 +</code> 
 + 
 +Afterwards you should be able to use the command as follows: 
 + 
 +<code bash> 
 +doas poweroff 
 +</code>
  
-===== Acknowledgement ===== 
  
-This wiki article is based on **[[https://wiki.parabola.nu/|ParabolaWiki]]**.