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 16:05]
throgh [OpenRC]
en:system:init_systems:openrc [2025/03/13 01:05] (current)
throgh [The system can't shutdown correctly]
Line 12: Line 12:
  
 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 ===== +
- +
-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.+
  
 ===== Runlevels ===== ===== Runlevels =====
Line 139: Line 59:
  
 <code bash> <code bash>
-# passwd -a <your-user> audio+# usermod -aG audio <your-user>
 </code> </code>
  
Line 145: Line 65:
  
 <code bash> <code bash>
-# passwd -a <your-user> video+# usermod -aG video <your-user>
 </code> </code>
  
Line 151: Line 71:
  
 <code bash> <code bash>
-# passwd -a <your-user> network+# usermod -aG network <your-user>
 </code> </code>
  
Line 157: Line 77:
  
 <code bash> <code bash>
-# passwd -a <your-user> optical+# usermod -aG optical <your-user>
 </code> </code>
  
Line 163: Line 83:
  
 <code bash> <code bash>
-# passwd -a <your-user> storage+# usermod -aG storage <your-user>
 </code> </code>
  
 <code bash> <code bash>
-# passwd -a <your-user> disk+# usermod -aG disk <your-user>
 </code> </code>
  
Line 173: Line 93:
  
 <code bash> <code bash>
-# passwd -a <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 217: 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 235: 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 functionalities, documented in the comments. You can find all the available keymaps in <color #0B71B9/#DDF1FF>/usr/share/kbd/keymaps</color>. Then run:+After editing the files, run the command:
  
 <code bash> <code bash>
Line 259: 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 357: Line 320:
  
 <code bash> <code bash>
-# passwd -a <your-user> power+# usermod -aG power <your-user>
 </code> </code>