[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howtos:general_admin:openrc [2015/05/14 07:34 (UTC)] – /* add configuration section */ aaditya | howtos:general_admin:openrc [2021/09/12 22:18 (UTC)] (current) – [OpenRC] we default to using openrc as init in slackware aaditya | ||
---|---|---|---|
Line 2: | Line 2: | ||
====== OpenRC ====== | ====== OpenRC ====== | ||
- | OpenRC is a dependency based init system | + | OpenRC is a dependency based init system. |
- | ====== Features | + | ===== Features ===== |
- | OpenRC provides a number of features | + | OpenRC provides a number of features like hardware initiated initscript run and cgroups support, without requiring large layout changes. |
====== Installation ====== | ====== Installation ====== | ||
- | Two Slackbuilds are available, [[http://sourceforge.net/projects/mefiles/files/ | + | Two [[slackware: |
- | ===== Pre installation ===== | + | ===== Post installation ===== |
- | The /etc/init.d directory would need to be moved out: | + | After installation, |
- | # mv /etc/init.d /etc/init.d.bak | + | |
- | ===== Post installation | + | === Setup the agetty services |
+ | |||
+ | # main tty | ||
+ | ln -s / | ||
+ | / | ||
+ | |||
+ | cp / | ||
+ | echo ' | ||
+ | |||
+ | # additional ttys | ||
+ | for i in {2..6}; do | ||
+ | ln -s / | ||
+ | / | ||
+ | done | ||
+ | |||
+ | # serial tty (for servers) | ||
+ | ln -s / | ||
+ | / | ||
+ | |||
+ | cp / | ||
+ | echo ' | ||
+ | |||
+ | === Update boot parameters === | ||
+ | |||
+ | Add the following to your boot parameters (via /// | ||
+ | init=/ | ||
+ | |||
+ | Regenerate boot configuration ('lilo -v' or ' | ||
+ | |||
+ | === Enable boot logging === | ||
+ | |||
+ | The main configuration file for OpenRC is /// | ||
- | After installing, /etc/inittab would need to be replaced. The old one can be backed up | + | A common option that could be changed is to enable boot logging by setting '' |
- | # cp /etc/inittab | + | |
- | # mv /etc/inittab.new / | + | |
===== On reboot ===== | ===== On reboot ===== | ||
- | After installing openrc and openrc-services, | + | On rebooting, one is booted to a command line with only the bare minimum of services enabled. |
+ | |||
+ | It may show a warning about deprecated support for /// | ||
+ | # cp /etc/mtab / | ||
+ | # ln -snf / | ||
+ | |||
+ | It may also complain about missing /// | ||
+ | |||
+ | # touch / | ||
+ | |||
+ | ==== Enabling some services ==== | ||
+ | |||
+ | Services can be enabled as: | ||
+ | |||
+ | # rc-service add < | ||
+ | |||
+ | They can be disabled as: | ||
+ | |||
+ | # rc-service del < | ||
Some common services that could be enabled: | Some common services that could be enabled: | ||
- | # rc-update add udev default | ||
# rc-update add dbus default | # rc-update add dbus default | ||
# rc-update add sysklogd default | # rc-update add sysklogd default | ||
# rc-update add dcron default | # rc-update add dcron default | ||
- | # rc-update add alsasound | + | # rc-update add alsasound |
- | # rc-update add consolekit default | + | # rc-update add consolekit default |
+ | # rc-update add sshd default | ||
- | Enabled services can be queried with: | + | Enabled services |
$ rc-status | $ rc-status | ||
- | All services | + | Enabled |
- | # rc-update -v | + | $ rc-update |
+ | |||
+ | Some services that are enabled by default for the **sysinit** runlevel include udev and udev-postmount. | ||
+ | |||
+ | Users who use dmcrypt, lvm, or mdraid could add the following services respectively to the **boot** runlevel: | ||
+ | |||
+ | # rc-update add dmcrypt boot # dmcrypt | ||
+ | # rc-update add device-mapper boot # lvm | ||
+ | # rc-update add lvm boot # lvm | ||
+ | # rc-update add mdraid boot # mdraid | ||
+ | |||
+ | === Network === | ||
+ | |||
+ | If using ethernet via DHCP, the **dhcpcd** service could be enabled: | ||
+ | # rc-update add dhcpcd default | ||
+ | |||
+ | If using wifi with laptops the **NetworkManager** or **wicd** service could be enabled. The combination of dhcpcd and wpa_supplicant (along with a frontend like wpa_gui or wpa_cli) could also be used as a lightweight alternative. | ||
+ | |||
+ | A static network can be configured by editing /// | ||
+ | |||
+ | === Display manager === | ||
+ | |||
+ | To boot to a graphical display manager, /// | ||
+ | |||
+ | # rc-update add xdm default | ||
+ | |||
+ | If using a laptop, the **acpid** service could be enabled as well. | ||
+ | |||
+ | === Migrating existing enabled services === | ||
+ | |||
+ | To check existing enabled services, following code could be used: | ||
+ | |||
+ | |||
+ | for file in / | ||
+ | if [ -x " | ||
+ | echo " | ||
+ | fi | ||
+ | done | ||
+ | |||
+ | For these services corresponding OpenRC services could be enabled, for example: | ||
+ | |||
+ | # rc-update add acpid default | ||
+ | # rc-update add cgmanager default | ||
+ | # rc-update add gpm default | ||
+ | ... | ||
+ | |||
+ | All services present can be queried via: | ||
+ | |||
+ | $ rc-update -v | ||
====== Configuration ====== | ====== Configuration ====== | ||
- | OpenRC services are present in the /etc/init.d folder, and corresponding configuration files are present in /etc/conf.d | + | OpenRC services are present in the ///etc/openrc/init.d// folder, and corresponding configuration files are present in ///etc/openrc/conf.d// |
Some common configuration files include: | Some common configuration files include: | ||
- | / | + | /etc/openrc/ |
- | / | + | /etc/openrc/ |
- | / | + | /etc/openrc/ |
- | + | ||
- | ===== Services | + | ===== Service management |
Services can be started/ | Services can be started/ | ||
Line 62: | Line 156: | ||
# rc-service sshd start | # rc-service sshd start | ||
- | Services can be enabled as: | + | |
+ | ===== Shutdown/ | ||
- | # rc-service add < | + | To shutdown or reboot, one will need to use **openrc-shutdown**. To shutdown from a desktop environment using ConsoleKit2, |
- | For example, | + | ==== Note ==== |
- | # rc-service add sshd default | + | The **ck-system-stop** and **ck-system-restart** files in the [[https:// |
- | + | ||
- | They can be disabled as: | + | |
- | + | ||
- | # rc-service del < | + | |
====== Troubleshooting ====== | ====== Troubleshooting ====== | ||
Line 78: | Line 169: | ||
At the moment only a subset of the included services have been tested, so some of them may not run correctly. | At the moment only a subset of the included services have been tested, so some of them may not run correctly. | ||
- | Some of the tested | + | If some service does not work, try the system provided one in /// |
+ | |||
+ | ==== mysqld ==== | ||
+ | |||
+ | Try adding the following lines to /// | ||
+ | |||
+ | [mysqld] | ||
+ | user = mysql | ||
+ | basedir = /usr | ||
+ | datadir = / | ||
+ | pid-file = / | ||
+ | socket = / | ||
+ | |||
+ | ==== Dealing with crashed | ||
+ | |||
+ | Sometimes openrc reports a service' | ||
+ | |||
+ | If one tries to start a crashed service, `rc-service` reports: | ||
+ | |||
+ | * WARNING: < | ||
+ | |||
+ | So one tries to stop it before starting again. | ||
+ | |||
+ | However in some situations, the service does not stop. This leads to a deadlock where one can neither stop the service nor start it. For such cases: | ||
+ | |||
+ | # rc-service < | ||
+ | * Manually resetting < | ||
+ | |||
+ | **zap** resets the service state, allowing us to start it again. | ||
+ | |||
+ | ===== openrc-init ===== | ||
+ | |||
+ | Since version **0.25**, openrc provides // | ||
+ | |||
+ | This allows switching between OpenRC and other init systems, for example sysvinit, just by changing boot parameters. | ||
+ | |||
+ | For more info, check out the [[https:// | ||
+ | |||
+ | ===== Migrating from /etc/init.d to / | ||
+ | |||
+ | OpenRC 0.39+, as shipped via SBo, changes the service and configuration directory to /// | ||
+ | |||
+ | This is being done to maintain greater compatibility with a vanilla Slackware install. | ||
+ | |||
+ | Existing | ||
+ | |||
+ | === 1. Install openrc-0.39.2 and openrc-services-20181107 === | ||
+ | |||
+ | These packages ship the configuration and service files in /// | ||
+ | |||
+ | === 2. Migrate existing services === | ||
+ | |||
+ | This involves 4 steps: | ||
+ | |||
+ | # migrate existing services | ||
+ | for service in / | ||
+ | svcname=$(basename " | ||
+ | if [ ! -e "/ | ||
+ | if [ -f "/ | ||
+ | cp -v "/ | ||
+ | elif [ -L "/ | ||
+ | # check if symlink is of a service | ||
+ | service_target=$(readlink -f " | ||
+ | service_target_name=$(basename " | ||
+ | if [ $(dirname " | ||
+ | ln -sv "/ | ||
+ | fi | ||
+ | fi | ||
+ | fi | ||
+ | done | ||
+ | |||
+ | # enable existing services | ||
+ | for runlevel in / | ||
+ | for service in ${runlevel}/ | ||
+ | svcname=$(basename " | ||
+ | rvlname=$(basename " | ||
+ | if [ ! -e / | ||
+ | ln -sv / | ||
+ | fi | ||
+ | done | ||
+ | done | ||
+ | |||
+ | # check config changes | ||
+ | for file in / | ||
+ | filename=$(basename " | ||
+ | extension=" | ||
+ | if [ " | ||
+ | continue | ||
+ | fi | ||
+ | if [ -e "/ | ||
+ | diff -Nupr "/ | ||
+ | fi | ||
+ | done | ||
+ | # main config file | ||
+ | diff -Nupr /etc/rc.conf / | ||
+ | |||
+ | # check local.d changes | ||
+ | for file in / | ||
+ | filename=$(basename " | ||
+ | if [ ! -e "/ | ||
+ | cp -v "/ | ||
+ | elif [ -e "/ | ||
+ | # show changes | ||
+ | diff -Nupr "/ | ||
+ | fi | ||
+ | done | ||
+ | |||
+ | Config changes found above can be updated by hand or copy pasted in new location. | ||
+ | |||
+ | === 3. Check and reboot === | ||
+ | |||
+ | Verify if '' | ||
+ | |||
+ | Reboot and check whether things are working expected, make changes as necessary. | ||
+ | |||
+ | The old files and folders can be renamed (or removed). | ||
+ | |||
+ | mv /etc/init.d / | ||
+ | mv /etc/conf.d / | ||
+ | mv / | ||
+ | mv / | ||
+ | mv / | ||
+ | |||
+ | Finally, any changes done to the default Slackware system can be reverted: | ||
+ | |||
+ | mv / | ||
====== See Also ====== | ====== See Also ====== | ||
- | https:// | + | [[https:// |
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
- | https://github.com/OpenRC/openrc/ | + | [[https://www.linuxquestions.org/ |
- | https://wiki.manjaro.org/index.php? | + | [[https://gitlab.com/aadityabagga/ |
Line 98: | Line 320: | ||
<!-- Please do not modify anything below, except adding new tags.--> | <!-- Please do not modify anything below, except adding new tags.--> | ||
<!-- You must remove the tag-word " | <!-- You must remove the tag-word " | ||
- | {{tag> | + | {{tag> |