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 1: | Line 1: | ||
{{welcome}} | {{welcome}} | ||
− | {{Navbar | + | {{Navbar System}} |
− | + | ||
==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. | |
− | + | ||
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]. | ||
GhostBSD/FreeBSD provides for booting from both the older MBR standard and the newer GUID Partition Table (GPT). | GhostBSD/FreeBSD provides for booting from both the older MBR standard and the newer GUID Partition Table (GPT). | ||
− | Once the kernel boot process is finished, the kernel passes control to the user process [https://www.freebsd.org/cgi/man.cgi?query=init&sektion=8&manpath=freebsd-release-ports init(8)], which is located at ''/sbin/init''. The '' | + | Once the kernel boot process is finished, the kernel passes control to the user process [https://www.freebsd.org/cgi/man.cgi?query=init&sektion=8&manpath=freebsd-release-ports init(8)], which is located at ''/sbin/init''. The ''/boot/defaults/loader.conf'' states as GhostBSD defaults: ''rc_system="openrc".'' |
The loader is the final stage of the three-stage bootstrap process. It is located on the file system, usually as ''/boot/loader.'' | The loader is the final stage of the three-stage bootstrap process. It is located on the file system, usually as ''/boot/loader.'' | ||
− | The loader will read ''/boot/loader.rc,'' which by default reads in '' | + | 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 18: | ||
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 70: | Line 66: | ||
If any of the following files exist then we do not overwrite them<br/> | If any of the following files exist then we do not overwrite them<br/> | ||
− | * | + | * ''/etc/devd.conf'' |
− | * | + | * ''/etc/rc'' |
− | * | + | * ''/etc/rc.shutdown'' |
− | * | + | * ''/etc/conf.d/*'' |
− | ''' | + | '''''rc'' and ''rc.shutdown'' are the hooks from the BSD init into OpenRC.''' |
− | ''' | + | '''''devd.conf'' is modified from FreeBSD to call /etc/rc.devd which is a generic hook into OpenRC.''' |
inittab is the same, but for SysVInit as used by most Linux distributions. This can be found in the support folder. | inittab is the same, but for SysVInit as used by most Linux distributions. This can be found in the support folder. | ||
− | Obviously, if you're installing this onto a system that does not use | + | Obviously, if you're installing this onto a system that does not use OpenRC by default then you may wish to backup the above listed files, remove them and then install so that the OS hooks into OpenRC. |
==OpenRC Developers Guide== | ==OpenRC Developers Guide== | ||
Line 95: | Line 91: | ||
==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 139: | Line 135: | ||
===Runlevels=== | ===Runlevels=== | ||
− | + | 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 154: | Line 155: | ||
The default startup uses the runlevels ''sysinit'', ''boot'', and ''default'', in that order. Shutdown uses the shutdown runlevel. | The default startup uses the runlevels ''sysinit'', ''boot'', and ''default'', in that order. Shutdown uses the shutdown runlevel. | ||
− | ===The Magic of | + | ===The Magic of conf.d=== |
− | Most service scripts need default values. It would be fragile to explicitly source some arbitrary files. By convention ''openrc-run'' will source the matching file in | + | Most service scripts need default values. It would be fragile to explicitly source some arbitrary files. By convention ''openrc-run'' will source the matching file in ''/etc/conf.d/'' for any script in ''/etc/init.d/'' |
This allows you to set random startup-related things easily. | This allows you to set random startup-related things easily. | ||
Line 177: | Line 178: | ||
It helps with starting daemons, backgrounding, creating PID files and many other convenience functions related to managing daemons. | It helps with starting daemons, backgrounding, creating PID files and many other convenience functions related to managing daemons. | ||
− | ===/etc/ | + | ===/etc/rc.conf=== |
− | This file manages the default configuration for | + | This file manages the default configuration for OpenRC, and it has examples of per-service-script variables. |
Among these are ''rc_parallel'' (for parallelized startup), ''rc_log'' (logs all boot messages to a file), and a few others. | Among these are ''rc_parallel'' (for parallelized startup), ''rc_log'' (logs all boot messages to a file), and a few others. | ||
Line 187: | Line 188: | ||
Setting ''ulimit'' and nice values per service can be done through the ''rc_ulimit'' variable. | Setting ''ulimit'' and nice values per service can be done through the ''rc_ulimit'' variable. | ||
− | Under Linux, OpenRC can use cgroups for process management as well. Once the kernel is configured appropriately, the ''rc_cgroup_mode'' setting in | + | Under Linux, OpenRC can use cgroups for process management as well. Once the kernel is configured appropriately, the ''rc_cgroup_mode'' setting in ''/etc/rc.conf'' should be used to control whether ''cgroups'' version one, two, or both are used. The default is to use both if they are available. |
− | By changing certain settings in the service's ''conf.d'' file limits can be enforced per service. These settings are documented in detail in the default | + | By changing certain settings in the service's ''conf.d'' file limits can be enforced per service. These settings are documented in detail in the default ''/etc/rc.conf'' under LINUX CGROUPS RESOURCE MANAGEMENT. |
===Dealing with Orphaned Processes=== | ===Dealing with Orphaned Processes=== | ||
Line 210: | Line 211: | ||
OpenRC has wrappers for many common output tasks in ''libeinfo''. This allows to print colour-coded status notices and other things. To make the output consistent the bundled service scripts all use ''ebegin/eend'' to print nice messages. | OpenRC has wrappers for many common output tasks in ''libeinfo''. This allows to print colour-coded status notices and other things. To make the output consistent the bundled service scripts all use ''ebegin/eend'' to print nice messages. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==For more Information See== | ==For more Information See== |