Editing OpenRC
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 4: | Line 4: | ||
==Introduction== | ==Introduction== | ||
− | + | OpenRC is a dependency-based ''init system'' that works with the system-provided init program, normally ''/sbin/init''. Currently, it does not have an init program of its own. It does not function as a replacement for the /sbin/init file. OpenRC is located on /sbin/openrc. | |
− | + | ||
There are 105 [https://github.com/OpenRC/openrc/graphs/contributors contributors on GitHub]. | There are 105 [https://github.com/OpenRC/openrc/graphs/contributors contributors on GitHub]. | ||
Line 15: | Line 14: | ||
The loader will read ''/boot/loader.rc,'' which by default reads in '''[[/boot/defaults/loader.conf]]''' which sets reasonable defaults for variables and reads '''[[/boot/loader.conf]]''' for local changes to those variables. loader.rc then acts on these variables, loading whichever modules and kernel are selected. | The loader will read ''/boot/loader.rc,'' which by default reads in '''[[/boot/defaults/loader.conf]]''' which sets reasonable defaults for variables and reads '''[[/boot/loader.conf]]''' for local changes to those variables. loader.rc then acts on these variables, loading whichever modules and kernel are selected. | ||
− | |||
− | |||
==Installation== | ==Installation== | ||
Line 22: | Line 19: | ||
OpenRC requires GNU make. | OpenRC requires GNU make. | ||
− | Once you have GNU Make installed, the default OpenRC installation can be | + | Once you have GNU Make installed, the default OpenRC installation can be executed using this command: |
make install | make install | ||
Line 95: | Line 92: | ||
==Scripts to run OpenRC== | ==Scripts to run OpenRC== | ||
− | Scripts to run OpenRC are located on | + | Scripts to run OpenRC are located on ''/etc/[[init.d]]/''. |
==OpenRC Users Guide== | ==OpenRC Users Guide== | ||
Line 141: | Line 138: | ||
'''OpenRC''' has a concept of runlevels, similar to what sysvinit historically offered. A runlevel is basically a collection of services that needs to be started. Instead of random numbers they are named, and users can create their own if needed. This allows, for example, to have a default runlevel with "everything" enabled, and a "powersaving" runlevel where some services are disabled. | '''OpenRC''' has a concept of runlevels, similar to what sysvinit historically offered. A runlevel is basically a collection of services that needs to be started. Instead of random numbers they are named, and users can create their own if needed. This allows, for example, to have a default runlevel with "everything" enabled, and a "powersaving" runlevel where some services are disabled. | ||
− | The | + | The rc-status helper will print all currently active runlevels and the state of services in them: |
− | + | <nowiki># rc-status</nowiki> | |
− | + | * Caching service dependencies ... [ ok ] | |
+ | * Runlevel: default | ||
+ | * modules [ started ] | ||
+ | * lvm [ started ] | ||
− | + | All runlevels are represented as folders in ''/etc/runlevels/'' with symlinks to the actual service scripts. | |
− | Managing runlevels is usually done through the '' | + | Calling OpenRC with an argument (openrc default) will switch to that runlevel; this will start and stop services as needed. |
+ | |||
+ | Managing runlevels is usually done through the ''rc-update helper'', but could of course be done by hand if desired. e.g. ''rc-update add nginx default'' - add nginx to the default runlevel '''Note:''' This will not auto-start nginx! You'd still have to trigger rc or run the service script by hand. | ||
FIXME: Document stacked runlevels | FIXME: Document stacked runlevels | ||
Line 213: | Line 215: | ||
===Additional Directories, Programs and Files related to OpenRC=== | ===Additional Directories, Programs and Files related to OpenRC=== | ||
− | |||
− | |||
{|class="wikitable" style="width:96.5%;background:#FFFFFF; border:2px solid #008000;text-align:left;padding: 10px" | {|class="wikitable" style="width:96.5%;background:#FFFFFF; border:2px solid #008000;text-align:left;padding: 10px" | ||
Line 220: | Line 220: | ||
! scope="col" style="width: 100px;"|'''Directory/Files''' | ! scope="col" style="width: 100px;"|'''Directory/Files''' | ||
! scope="col" style="width: 350px;"|'''Description''' | ! scope="col" style="width: 350px;"|'''Description''' | ||
+ | |- | ||
+ | |/bin/rc-status||[https://man.linuxreviews.org/man8/rc-status.8.html rc-status] helper will print all currently active runlevels and the state of services | ||
|- | |- | ||
|/boot/loader.rc||Includes additional commands; Load boot menu; Start the boot menu | |/boot/loader.rc||Includes additional commands; Load boot menu; Start the boot menu | ||
Line 226: | Line 228: | ||
|- | |- | ||
|/etc/devd-openrc||Contains the following files: asus.conf, devmatch-openrc.conf, hyperv.conf, uath.conf, ulpt.conf, and zfs.conf | |/etc/devd-openrc||Contains the following files: asus.conf, devmatch-openrc.conf, hyperv.conf, uath.conf, ulpt.conf, and zfs.conf | ||
+ | |- | ||
+ | |/etc/[[rc.d]]/ ||system and daemon startup/control scripts; see [https://www.freebsd.org/cgi/man.cgi?query=rc&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports rc(8)] | ||
+ | |- | ||
+ | |/usr/[[local/etc/rc.d]]/||The rc.local script contains commands which are pertinent only to a specific site. Typically, the ''/usr/local/etc/rc.d/'' mechanism is used instead of ''rc.local'' these days. | ||
|- | |- | ||
|/etc/openrc.shutdown||[https://manpages.debian.org/testing/openrc/openrc-shutdown.8.en.html openrc-shutdown] is the utility that communicates with [https://manpages.debian.org/testing/openrc/openrc-init.8.en.html openrc-init(8)] to bring down the system or instruct openrc-init to re-execute itself. | |/etc/openrc.shutdown||[https://manpages.debian.org/testing/openrc/openrc-shutdown.8.en.html openrc-shutdown] is the utility that communicates with [https://manpages.debian.org/testing/openrc/openrc-init.8.en.html openrc-init(8)] to bring down the system or instruct openrc-init to re-execute itself. | ||
Line 245: | Line 251: | ||
|- | |- | ||
|/etc/rc.suspend||If drivers can be properly loaded and unloaded, automate this by putting the appropriate commands in [https://www.freebsd.org/doc/handbook/acpi-overview.html /etc/rc.suspend] and /etc/rc.resume. | |/etc/rc.suspend||If drivers can be properly loaded and unloaded, automate this by putting the appropriate commands in [https://www.freebsd.org/doc/handbook/acpi-overview.html /etc/rc.suspend] and /etc/rc.resume. | ||
+ | |- | ||
+ | |/sbin/openrc||The [https://github.com/OpenRC/openrc OpenRC] is a dependency-based init system that works with the system-provided init program, normally /sbin/init. Currently, it does not have an init program of its own. A good documentation you will find on [https://wiki.gentoo.org/wiki/OpenRC gentoo] | ||
|- | |- | ||
|/sbin/openrc-run||[https://manpages.debian.org/testing/openrc/openrc-run.8.en.html openrc-run] is basically an interpreter for shell scripts which provides an easy interface to the often complex system commands and daemons. When a service runs a command it first loads its multiplexed configuration file, then its master configuration file, then /etc/rc.conf and finally the script itself. At this point openrc-run then runs the command given. | |/sbin/openrc-run||[https://manpages.debian.org/testing/openrc/openrc-run.8.en.html openrc-run] is basically an interpreter for shell scripts which provides an easy interface to the often complex system commands and daemons. When a service runs a command it first loads its multiplexed configuration file, then its master configuration file, then /etc/rc.conf and finally the script itself. At this point openrc-run then runs the command given. | ||
+ | |- | ||
+ | |/sbin/rc||[https://www.freebsd.org/cgi/man.cgi?query=rc&apropos=0&sektion=0&manpath=FreeBSD+12.1-RELEASE+and+Ports&arch=default&format=html rc] is a command interpreter and programming language similar to [https://www.freebsd.org/cgi/man.cgi?query=sh&sektion=1&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports sh(1).] | ||
+ | It is based on the AT&T Plan 9 shell of the same name. The shell offers a C-like syntax (much more so than the C shell), and a powerful mechanism for manipulating variables. It is reasonably small and reasonably fast, especially when compared to contemporary shells. Its use is intended to be interactive, but the language lends itself well to scripts. | ||
+ | |- | ||
+ | |/sbin/rc-service||[https://github.com/OpenRC/openrc OpenRC services]. | ||
+ | |- | ||
+ | |/sbin/rc-update||update [https://github.com/OpenRC/openrc OpenRC] | ||
+ | |- | ||
+ | |/sbin/[[Rcorder|rcorder]]||The [https://www.freebsd.org/cgi/man.cgi?query=rcorder&apropos=0&sektion=0&manpath=FreeBSD+12.1-RELEASE+and+Ports&arch=default&format=html rcorder] utility is designed to print out a dependency ordering of a set of interdependent files. Typically it is used to find an execution sequence for a set of shell scripts in which certain files must be executed before others. | ||
|} | |} | ||