- This repo is intended to be used on Slackware-current ("current" branch) and Slackware 15.0 ("15.0" branch).
- Before using this repo, read the s6, s6-rc, and s6-linux-init home page first to have a better understanding of what they are and what features or advantages that they provide compared to other init systems. Or for a quick introduction in video format, see this video.
- skalibs
- execline
- s6
- s6-rc
- s6-linux-init
All of them are available on SBo.
-
Clone this repo.
-
Create a copy of the
sourcedirectory from this repo and put it somewhere else in your system (e.g./etc/s6/rc/source). -
Edit these two files (all paths below are relative to the
sourcedirectory that you just copied):bundles/S/contents: this file contains a list of services that are needed to initialize the system, just like therc.Sscript. In this file you can (for example) uncommentfontservice to load a custom screen font for the virtual console (seerc.font/font/upfor instructions on how to load your desired custom screen font).bundles/M/contents: this file contains a list of services that will be started when entering one of the multi user runlevels (runlevel 2, 3, 4, and 5 by default), just like therc.Mscript. In this file you can (for example) uncommentcpufreqandbluetoothservice to set the default cpu governor and enable bluetooth support, respectively, at boot time.
-
Feel free to edit all other files inside the
sourcedirectory beside those two files above. -
Use
s6-rc-compile(more details are available in/usr/doc/s6-rc-<version>/doc/s6-rc-compile.html) to compile a new s6-rc service database from yoursourcedirectory that will be used by s6-rc at runtime to manage services:s6-rc-compile /etc/s6/rc/compiled /etc/s6/rc/source/*Explanation:
/etc/s6/rc/compiled: tells6-rc-compileto put the compiled database data in/etc/s6/rc/compileddirectory (it must not exist beforehand). Of course you can change/etc/s6/rc/compiledto other places that you want./etc/s6/rc/source/*: tells6-rc-compileto search for service definition source directories in all subdirectories of/etc/s6/rc/sourcedirectory (notice the trailing asterisk). Of course you should change/etc/s6/rc/sourceto the path of your own copy ofsourcedirectory.
-
Run the
s6-linux-init-makercommand (more details are available in/usr/doc/s6-linux-init-<version>/doc/s6-linux-init-maker.html) to create all necessary files that the system needs to be able to properly boot and bring up a full s6 infrastructure. Below is thes6-linux-init-makerinvocation that I use for my system (feel free to change them and add any other options that suit your needs):s6-linux-init-maker \ -c /etc/s6/init/current \ -u adm \ -G "agetty 38400 tty12 linux" \ -1 \ -p "/usr/bin:/usr/sbin:/bin:/sbin" \ -t 2 \ -D 4 \ /etc/s6/init/currentExplanation:
-c /etc/s6/init/current: tells6-linux-initto look inside/etc/s6/init/currentat system startup for all the necessary files it needs in order to boot the system properly. We will reference this directory as basedir.-u adm: the catch-all logger will run as theadmuser. The catch-all logger is a service that is started early at boot time to log all system startup and shutdown time messages (except for kernel messages) to the logging directory/run/uncaught-logs(ortmpfsdir/uncaught-logswhere tmpfsdir is the argument that was given to the--tmpfsdir=configure option at s6-linux-init build time). This is made possible by usings6-logwhich takes inputs from stdin and processes them based on the logging script given to it (like adding timestamps, deselect certain lines, etc.). See/usr/doc/s6-<version>/doc/s6-log.htmlfor more details ons6-log.-G "agetty 38400 tty12 linux": start an early getty service by executing the given command line (agetty 38400 tty12 linux). The command lineagetty 38400 tty12 linuxwill start anagettyinstance that connects to port/dev/tty12with baud rate38400andTERM=linux.-1: make it so that all the messages that are sent to the catch-all logger are also copied to/dev/console(without timestamps) so those messages will also appear on the computer screen just like Slackware's default init system but better since those messages can still be accessed even after the system has finished booting.-p "/usr/bin:/usr/sbin:/bin:/sbin": set the initial value of thePATHenvironment variable to/usr/bin:/usr/sbin:/bin:/sbin. Almost all s6-rc service definitions in this repo do not use absolute path when invoking a program so at least these directories should be added to the initialPATHvalue.-t 2: set the catch-all logger timestamp format to ISO 8601 format.-D 4: set the default runlevel to runlevel4./etc/s6/init/current: tells6-linux-init-makerto put the generated files inside/etc/s6/init/currentdirectory (this directory must not exist beforehand). You can change this argument to other places that you want (e.g./tmp/init-current) but don't forget to move/copy the generated files back to the declared basedir (/etc/s6/init/currentin my case). Usecp -awhen copying the generated files since there are fifos, files with precise uid/gid permissions, and files with non-standard access rights, so be sure to copy it verbatim.
-
Edit
rc.init,rc.shutdown, andrunlevelinsidebasedir/scriptsto incorporate below changes:rc.shutdown: uncommentexec s6-rc -v2 -bDa changesince we're going to use s6-rc as the service manager.rc.init:- uncomment and change
s6-rc-init /run/servicetos6-rc-init -c /etc/s6/rc/compiled /run/service. Change/etc/s6/rc/compiledto the path of your new s6-rc service database directory that you have compiled before. Also if you use different tmpfsdir when compiling s6-linux-init, change/runto your tmpfsdir. - uncomment and change
exec /etc/s6-linux-init/current/scripts/runlevel "$rl"tos6-rc -v2 -up change "$rl"; exec s6-rc -v1 -bu change gettys. Thes6-rc -v2 -up change "$rl"part will bring the system up to the desired runlevel and theexec s6-rc -v1 -bu change gettyspart will start all configured gettys (tty1 to tty6 by default). By runnings6-rc -v2 -up change "$rl"first and then followed byexec s6-rc -v1 -bu change gettys, the login prompt at tty1 will not be covered by boot time messages that also appear on tty1.
- uncomment and change
runlevel: uncomment and changeexec s6-rc -v2 -up change "$1"toexec s6-rc -v2 -up change gettys "$1". This will make sure the already running gettys are not stopped when changing from one runlevel to another.
-
Edit
basedir/bin/initand changes6-linux-initto/sbin/s6-linux-initsince the PATH environment variable is undefined at early boot time. This is not necessary if you add/sbinto the default executable search path when compiling skalibs (see its SBo README file for more details on how to do that). -
Lastly, make a backup copy of
/sbin/halt,/sbin/init,/sbin/poweroff,/sbin/reboot,/sbin/shutdown, and/sbin/telinit. Then, copy all scripts insidebasedir/binto/sbin(or alternatively, you can just create symbolic links that point to each scripts insidebasedir/bin).
- The default init system and the s6-based init system can actually
coexist by copying/linking the scripts inside
basedir/binto/sbinbut using different names (e.g. instead ofinit, rename it toinit.s6). Then, when you want to boot to the s6-based init system, passinit=/sbin/init.s6(for example) to the kernel as a command line argument. This is mainly useful for testing the s6-based init system before using it as the main init system. - It's a good idea to use a time-based naming scheme for the compiled
s6-rc service database and then create a symbolic link with generic
name that points to the service database that you want to use by
default at system startup. For example, each time you compile a new
database, you run
s6-rc-compile compiled-$(date +%y%m%d-%R:%S) source/*. Then, if you want to make it the default service database, make a symbolic link namedcompiledthat points to it. With this approach, you don't have to modifybasedir/scripts/rc.initevery time you change your default service database. - If you use symbolic link for the default service database (like
above), you probably want to add the
-doption tos6-rc-initinvocation inbasedir/scripts/rc.init. The-doption will tells6-rc-initto dereference the argument that is given to the-coption (/etc/s6/rc/compiledin my example above) and use that instead. The symbolic link will then not be used by s6-rc and thus can be updated freely without affecting the currently running system. Without the-doption, you have to runs6-rc-update another_compiled_database_absolute_pathfirst before updating the symbolic link.
- Start a service:
s6-rc change service_name - Stop a service:
s6-rc -d change service_name - Restart a longrun service:
s6-svc -r /run/service/service_name - List all active services:
s6-rc -a list - List all nonactive services:
s6-rc -da list - Switch to another compiled service database:
s6-rc-update another_compiled_database_absolute_path
Below rc scripts are not yet converted to s6-rc service definition:
- rc.sendmail
- rc.6 (pppd)
Sl6ckware is not affiliated, associated, endorsed by, or in any way officially connected with Slackware. The official Slackware website can be found at http://www.slackware.com/.