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 [2022/10/24 15:18]
throgh [Login display manager]
en:system:init_systems:openrc [2022/10/24 18:43] (current)
throgh [Runlevels]
Line 1: Line 1:
-?!(WIP)!? 
- 
 ====== OpenRC ====== ====== OpenRC ======
 OpenRC is a init system for Operational Systems GNU/Linux, GNU/Hurd and Unix, compatible with [[https://en.wikipedia.org/wiki/POSIX|Posix]]. Created by the Gentoo GNU/Linux developers team. Its purpose is to turn on/off and manage the services of the Operating System. OpenRC is a init system for Operational Systems GNU/Linux, GNU/Hurd and Unix, compatible with [[https://en.wikipedia.org/wiki/POSIX|Posix]]. Created by the Gentoo GNU/Linux developers team. Its purpose is to turn on/off and manage the services of the Operating System.
Line 73: Line 71:
 </code> </code>
 ===== Runlevels ===== ===== Runlevels =====
-OpenRC, as well as sysvinit and init (BSD), has a concept of task execution levels (Runlevels), to define them OpenRC uses names instead of numbers as it is done in the conventional way. There are two types of runlevels:+OpenRC, as well as sysvinit and init (BSD), has a concept of task execution levels (Runlevels), to define them OpenRC uses names instead of numbers as it is done in the conventional way. This allows, for example, to have a default runlevel with "everything" enabled, and a "powersaving" runlevel where some services are disabled.
  
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+The <color #0B71B9/#DDF1FF>rc-status</color> helper will print all currently active runlevels and the state of services in them:
  
 +<code bash>
 +# rc-status
 + * Caching service dependencies ... [ ok ]
 +Runlevel: default
 + modules                      started  ]
 + lvm                          started  ]
 +</code>
 +
 +All runlevels are represented as folders in <color #0B71B9/#DDF1FF>/etc/runlevels/</color> with symlinks to the actual service scripts.
 +
 +Calling openrc with an argument (<color #0B71B9/#DDF1FF>openrc default</color>) will switch to that runlevel; this will start and stop services as needed.
 +
 +Managing runlevels is usually done through the <color #0B71B9/#DDF1FF>rc-update</color> helper, but could of course be done by hand if desired. e.g.
 +<color #0B71B9/#DDF1FF>rc-update add nginx default</color> - add nginx to the default runlevel with the need of root-privileges.
  
-!?(WIP)!?!?+<note important>The command **rc-update** will not start nginxYou would still have to trigger rc, or run the service script by hand, or start it with **rc-service nginx start**.</note>
  
 +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.
 ====== OpenRC ====== ====== OpenRC ======
  
-Since Hyperbola has announced the [[https://www.hyperbola.info/news/end-of-systemd-support/|end of systemd support]], migration to OpenRC is required.+Since Hyperbola has announced the [[https://www.hyperbola.info/news/end-of-systemd-support/|end of systemd support]], OpenRC is our main used init system and with release 0.4 we have also included further support for Runit.
  
 ===== What is OpenRC? ===== ===== What is OpenRC? =====
Line 142: Line 155:
 ===== Migration ===== ===== Migration =====
  
-Since OpenRC is included by default and systemd is blacklisted by [[https://www.hyperbola.info/packages/?q=your-freedom|your-freedom]], one may get messages on migrating like: +<note important> Be aware that since the release of version 0.we do not recommend any kind of migration from another system based onto Arch GNU/Linux. Since Hyperbola has included many changes and therefore differences it would be better to install the system from scratch with all changes you wish.</note>
- +
-<code bash> +
-run 'rc-update add cronie default' +
-run 'rc-update add haveged default' +
-</code> +
- +
-Running these command(s) adds the service(s) to the specified runlevels. For example on running: +
- +
-<code bash> +
-# rc-update add cronie default +
-</code> +
- +
-The cronie service would be added to the default runlevel and would automatically be started at boot. +
- +
-cronie (for cron) and haveged (for entropy harvesting) are some common services that can be enabled. +
- +
-Also you need to install [[https://www.hyperbola.info/packages/?q=polkit|polkit]] to gain enough desktop privileges for operations like shutdown, mounting usb device: +
- +
-<code bash> +
-# pacman -S polkit +
-</code> +
- +
-<note important> Currently, [[https://www.hyperbola.info/packages/?q=networkmanager|NetworkManager]] and any display manager such as [[https://www.hyperbola.info/packages/?q=gdm|GDM]] or [[https://www.hyperbola.info/packages/?q=lightdm|LightDM]] runs the elogind service in Hyperbola automatically, however if you will use the [[https://www.hyperbola.info/packages/?q=xorg-xinit|xinit program]] to start the [[https://www.hyperbola.info/packages/?q=xorg-server|X Window System server]] or [[https://www.hyperbola.info/packages/?q=weston|Weston]]/[[https://www.hyperbola.info/packages/?q=sway|Sway]] to start [[https://www.hyperbola.info/packages/?q=wayland|Wayland]] and use [[https://www.hyperbola.info/packages/?q=netifrc|netifrc]] instead of [[https://www.hyperbola.info/packages/?q=networkmanager|NetworkManager]], you need add the elogind service to a runlevel (eg. default) to be started at boot automatically.</note> +
- +
-<note important> For security reasons, we have plans to use [[https://www.hyperbola.info/todo/consolekit-migration/|ConsoleKit as elogind replacement]]. Since it requires a hard transition, it will be made for the next version, aka Milky Way v0.4. We will make an announcement when it is ready.</note>+
  
 ===== Configuration ===== ===== Configuration =====
Line 292: Line 280:
  
 <code bash> <code bash>
-# ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules+# ln -s /dev/null /lib/udev/rules.d/80-net-name-slot.rules
 </code> </code>
  
Line 336: Line 324:
 ==== The system can't shutdown correctly ==== ==== The system can't shutdown correctly ====
  
-Begin with OpenRC 0.28 SysVinit is replaced with openrc-init, shutdown is replaced with openrc-shutdown. If you use <color #620BB9/#EEDDFF>startx</color> to start your desktop, you also need to modify <color #0B71B9/#DDF1FF>~/.xinitrc</color> for xfce4, replace <color #620BB9/#EEDDFF>exec ck-launch-session startxfce4</color> to <color #620BB9/#EEDDFF>startxfce4</color>.+Begin with OpenRC 0.28 SysVinit is replaced with openrc-init, shutdown is replaced with openrc-shutdown. If you use <color #620BB9/#EEDDFF>startx</color> to start your desktop, you also need to modify <color #0B71B9/#DDF1FF>~/.xinitrc</color> when you have issues with your window-manager starting correctly.
  
 ===== Acknowledgement ===== ===== Acknowledgement =====
  
 This wiki article is based on **[[https://wiki.parabola.nu/|ParabolaWiki]]**. This wiki article is based on **[[https://wiki.parabola.nu/|ParabolaWiki]]**.