- Edited
OUT OF DATE, PLEASE READ POST # 6 BELOW
READY FOR USER :)
note : i have switched my personnal system under it :) for a little time now and i use it in production.
http://skarnet.org/software/
https://github.com/Obarun/obarun-pkgbuild-testing/tree/master/s6
http://obarun.org/forum/viewtopic.php?id=139
-------------------------------------------------------
About ISO :
md5sums :
a604fdb4169cdc9127ba56e522b33df5
http://obarun.org/obarun-iso/s6-v0.0.3/obarunS6_x86_64-v0.0.3.iso
THIS ISO CAN BE USED ON PRODUCTION :)
Use the same login/password as Obarun iso, see download page.
------------------------------------------------------
TODO : last edit 2016/06/06
- Implement lvm2
- Implement cryptab
need tester here to make lvm2 available correctly
-------------------------------------------------------
***************************************************** Why another supervisor *****************************************************
The goal of this projects is clear : replacing runit by S6. Why ? Well, for a huge of reason but principaly :
- Make a PID 1 as small as possible
- Having a log as early as possible
- Having a log for all services needed to boot the machine
- Possibility to make a dependencies tree for service
- Parallezisation for all the booting proccess.
...
All this features is available with S6 and much more.
I test and build this projects on REAL hardware, no virtualization here :).
This tread is dedicate to this projects.So, don't hesitate to give a feedback here.
Assumptions : you use the original initramfs coming from Arch, this assumption will be change in the future
***************************************************** How to test it *****************************************************
EDIT=2016/06/06. The official release and stable will coming soon. When it's ready, the possibility to install s6 with runit on the same system will be not permit with pacman! So enjoy before the change :)
So, following these lines, you can boot obarun on S6. DO NOT USE FOR PRODUCTION, is not ready.
install the necessary package :
Some service can be found here (the list will grow with the time) : https://github.com/Obarun/obarun-s6serv and obviously, the compiled package on obarun repository.
now you need to edit on syslinux.cfg/grub the line append with
The append line in /etc/syslinux/syslinux.cfg need to contains the ro mount options. The boot sequence doesn't need a rw options for a majority of it.
The bundle (see below) boot-rofs is made before mounting the / filesystem with rw options. The bundle boot-rwfs mount the / with ro options.
That's it, you are ready to boot on S6 :)
Useful command :
- reboot :
***************************************************** How it works *****************************************************
Stage 1
Runit start file /etc/runit/1 ( PID 1 ) first. This file contents a series of command to boot the machine in sequential mode (no parallelization here).
S6 start the file /etc/s6/init. This file content a serie of command to start earlier as possible a supervision of service directory. This is completely different. So in fact all that we can find on PID 1 under Runit is found on stage 2 under S6. We take a look on the end of init file :
We find in /etc/s6/svc-serv/ service started by stage 1. In our case, the necessary to provide log and 3 tty for debugging purpose. if something wrong happens on stage 2, we can access on the machine :), very useful. But we can define e.g. a service for earlier internet connection.
So this directory should not contain a service e.g. for udev because the system is not ready yet.
Stage 2
Runit start the necessary service for the system (udev,dbus,internet connection....). But this service is started when we have a fully operational system, and runit doing this on parallelization mode.
S6 start service to provide a fully operational system AND other service needed to use the system. We take a look on /etc/s6/stage2 :
S6-rc is used to manage a dependencies of service tree. It means, we need to do some things before other, e.g. verify if all the mountpoint exist before doing anything else.
All the service for doing this can be found in /etc/s6/rc-serv-boot. The work about service tree is made "offline", then s6-rc-compile is called to make a database of this work, then s6-svscan control this database. see here http://skarnet.org/software/s6-rc/overview.html.
So, on every directory under /etc/s6/rc-serv-boot content a serie of file to properly start a service.
We have "3 sort of service" :
longrun : classic service like udev
oneshot : service is started one time
bundle : a list of services
for the longrun we need to define those file :
type : type of the service, in this case longrun
run : like runit. So this file can be replaced by runit run file, if you want, or call an another file etc etc.
finish : like runit ( can be empty )
dependencies : this file contents the service that need to be launched before the service itself. This file can be exist or not depends of the purpose.
and another : please see here http://skarnet.org/software/s6-rc/s6-rc-compile.html
for the oneshot we need to define those file :
type : type of the service, in this case oneshot
up : what is made on start
down : what is made on stop ( can be empty )
dependencies : this file contents the service that need to be launched before the service itself
and another : .....
for the bundle we need to define those files :
type : type of the service, in this case bundle
contents : the list of the service which will started
The better is to take a look on rc-serv-boot directory :) for understanding the things
Well, on runit all the service in made on /etc/sv then symlinks are created to /var/service to enable the service. This is a little different on S6. Those directories /etc/s6/svc-serv, /etc/s6/compiled/some_database (compiled database of rc-serv-boot and /etc/s6-serv/enabled) are entirely copied as it on the directory /run/s6, then a symlinks is created at /etc/s6-run. So, in fact, the working directory is never modified on running time (better for security reason).
Some explanation about /etc/s6/rc-serv-boot directory :
This directory concerns the off works about service.
The first directory called is "All" by the command "s6-rc -u change All".
All :
This is a bundle named service.
The file "contents" is the list of the services started.
Those names may be : a another bundle e.g. all-Boot or service
Those names can be : a services or an another bundle.
To better clarity, a "code name" was created :
a name beginning by a majuscule signify that's a bundle e.g : "All"
a name beginning by the name of a bundle signify that's the service/bundle is declared onto the bundle name e.g. : all-Boot. all-Boot depends of bundle All.
a name beginning by the name of a bundle AND the name after the underscore begin by a majuscule, signify that's a another bundle e.g : all-Boot is a dependency of bundle All and it's a bundle itself.
With this principle, we can see quickly who depends of who e.g : rofs-console depends of the bundle boot-Rofs which depends of all-Boot bundle which depends of All bundles. With a little practice it can be easy :).
The bundle all-Boot concerns all the services/bundles needed to boot the system properly, DO NOT TOUCH THIS BUNDLE if you don't know what you are doing.
The bundle all-User concerns all the services/bundles needed by the user to run the system.
Normaly, you don't need to touch anything on this directory. Change some things on it can broke the boot procedure if you don't know what you do.
Some explanation about /etc/s6-serv/ directory :
We have at /etc/s6-serv two folder : available and enabled.
The folder available is used by pacman to install xxx-s6serv package. The s6-boot package install two folder onto it : all-User, boot-ready. NEVER ERASE/CHANGE those folders if you do not know what you do.
The folder enabled is used by an user to to create a database compilation source of services. This folder contains a list of sub-directory which contains symlinks pointing at /etc/s6-serv/available. By default, a sub-directory named default is created with s6-boot package.
So if you want to create quickly a service for e.g. openntpd :
create the directory /etc/s6-serv/available/user-openntpd. Under it create these files :
run : you can take the file run from runit :)
type : declare it as longrun
finish : you can take the file finish from runit
dependencies : declare on it the service boot-ready. This allow you to be sure that the system is fully operationnal.
To enable it on the live database, please see here http://obarun.org/forum/viewtopic.php?id=139
for managing service please see this for s6-rc : http://skarnet.org/software/s6-rc/s6-rc.html and this for s6-svscan http://skarnet.org/software/s6/s6-svscanctl.html
about s6.conf :
The file can be found in /etc/s6/s6.conf. So these is the file which must be modified if needed (e.g. keymap).
During boot time, s6.conf is parsed and written on multiple file (one by variable) at /run/s6-conf/.
When a service need to read a variable, it goes to /etc/s6/env/s6-conf which is a symlink pointing to /run/s6-conf.
For the moment, the file s6.conf is parsed on file init, not sure that's a good idea. If A crash occuring during the parsing, it block the boot init.
READY FOR USER :)
note : i have switched my personnal system under it :) for a little time now and i use it in production.
http://skarnet.org/software/
https://github.com/Obarun/obarun-pkgbuild-testing/tree/master/s6
http://obarun.org/forum/viewtopic.php?id=139
-------------------------------------------------------
About ISO :
md5sums :
a604fdb4169cdc9127ba56e522b33df5
http://obarun.org/obarun-iso/s6-v0.0.3/obarunS6_x86_64-v0.0.3.iso
THIS ISO CAN BE USED ON PRODUCTION :)
Use the same login/password as Obarun iso, see download page.
------------------------------------------------------
TODO : last edit 2016/06/06
- Implement lvm2
- Implement cryptab
need tester here to make lvm2 available correctly
-------------------------------------------------------
***************************************************** Why another supervisor *****************************************************
The goal of this projects is clear : replacing runit by S6. Why ? Well, for a huge of reason but principaly :
- Make a PID 1 as small as possible
- Having a log as early as possible
- Having a log for all services needed to boot the machine
- Possibility to make a dependencies tree for service
- Parallezisation for all the booting proccess.
...
All this features is available with S6 and much more.
I test and build this projects on REAL hardware, no virtualization here :).
This tread is dedicate to this projects.So, don't hesitate to give a feedback here.
Assumptions : you use the original initramfs coming from Arch, this assumption will be change in the future
***************************************************** How to test it *****************************************************
EDIT=2016/06/06. The official release and stable will coming soon. When it's ready, the possibility to install s6 with runit on the same system will be not permit with pacman! So enjoy before the change :)
So, following these lines, you can boot obarun on S6. DO NOT USE FOR PRODUCTION, is not ready.
install the necessary package :
$ sudo pacman -S execline skalibs s6 s6-rc s6-linux-utils s6-portable-linux s6-boot s6opts
WARNING : the package s6-boot provide the necessary to boot the machine correctly and 3 tty, but do not provide any user service for a classic utilisation. I mean, you don't have service like dhcpcd, dbus, alsa... . You must install what you needs.Some service can be found here (the list will grow with the time) : https://github.com/Obarun/obarun-s6serv and obviously, the compiled package on obarun repository.
now you need to edit on syslinux.cfg/grub the line append with
APPEND blablabla init=/etc/s6/init
Futhermore, An important change is made with S6. For the moment obarun boot with rw options on boot for the / filesystem. The boot sequence under S6 make a change about it.The append line in /etc/syslinux/syslinux.cfg need to contains the ro mount options. The boot sequence doesn't need a rw options for a majority of it.
The bundle (see below) boot-rofs is made before mounting the / filesystem with rw options. The bundle boot-rwfs mount the / with ro options.
That's it, you are ready to boot on S6 :)
Useful command :
- reboot :
$ /etc/s6/reboot
- poweroff : $ /etc/s6/poweroff
note : to avoids conflicts with runit, those files are on /etc/s6. This behaviour will be change in the future.***************************************************** How it works *****************************************************
Stage 1
Runit start file /etc/runit/1 ( PID 1 ) first. This file contents a series of command to boot the machine in sequential mode (no parallelization here).
S6 start the file /etc/s6/init. This file content a serie of command to start earlier as possible a supervision of service directory. This is completely different. So in fact all that we can find on PID 1 under Runit is found on stage 2 under S6. We take a look on the end of init file :
redirfd -wnb 1 /run/s6-run/service/s6-svscan-log/fifo # ######## [i]with this command, all the message on stdin is redirected on a fifo file. so now we have a trace of what happens.[/i]
# Now we are good for pid2, start it
background { # ######## [i]background means that the scripts do not wait the end of the block before continuing to read/execute the rest[/i]
s6-setsid --
redirfd -w 1 /run/s6-run/service/s6-svscan-log/fifo # ############## [i]all message from stdin is redirected on fifo file[/i]
fdmove -c 2 1 # ##### [i]all the stderr message are redirected to stdin , so in fact fifo file[/i]
/etc/s6/stage2 # ######### [i]now the stage 2 is started but, it's started on a background here, parallelization begin :)[/i]
}
unexport !
fdmove -c 2 1
s6-svscan -st0 /run/s6-run/service # ###### [i]now service containing in /run/s6-run/service is started, WATHEVER HAPPENS on stage 2[/i]
As you can see init is very small : better for debugging, better for stability, better for rapidity and we have an earlier log. But, we don't have a fully operational system before starting the /run/s6-run/service directory service. This is important to keep in mind this behaviour.We find in /etc/s6/svc-serv/ service started by stage 1. In our case, the necessary to provide log and 3 tty for debugging purpose. if something wrong happens on stage 2, we can access on the machine :), very useful. But we can define e.g. a service for earlier internet connection.
So this directory should not contain a service e.g. for udev because the system is not ready yet.
Stage 2
Runit start the necessary service for the system (udev,dbus,internet connection....). But this service is started when we have a fully operational system, and runit doing this on parallelization mode.
S6 start service to provide a fully operational system AND other service needed to use the system. We take a look on /etc/s6/stage2 :
if -nt {
if { s6-echo -- "***************************************************************************" }
if { s6-echo -- "** Start Stage 2 **" }
if { s6-echo -- "***************************************************************************" }
# start service
if { s6-rc-init -c /etc/s6/compiled/current /run/s6-run/service } # #### [i]choose which directory s6-rc use for service and where to put it[/i]
if { s6-rc -u change All } # ###### [i]tell to s6-rc which services/bundles need to be started first[/i]
if { s6-echo -- "***************************************************************************" }
if { s6-echo -- "** Stage 2 completed **" }
s6-echo -- "***************************************************************************"
}
redirfd -w 1 /dev/console
s6-echo "Something wrong on stage2, log to debug it"
As you can see, this file is very very small :). So now the things goes to complexity ( a little ).S6-rc is used to manage a dependencies of service tree. It means, we need to do some things before other, e.g. verify if all the mountpoint exist before doing anything else.
All the service for doing this can be found in /etc/s6/rc-serv-boot. The work about service tree is made "offline", then s6-rc-compile is called to make a database of this work, then s6-svscan control this database. see here http://skarnet.org/software/s6-rc/overview.html.
So, on every directory under /etc/s6/rc-serv-boot content a serie of file to properly start a service.
We have "3 sort of service" :
longrun : classic service like udev
oneshot : service is started one time
bundle : a list of services
for the longrun we need to define those file :
type : type of the service, in this case longrun
run : like runit. So this file can be replaced by runit run file, if you want, or call an another file etc etc.
finish : like runit ( can be empty )
dependencies : this file contents the service that need to be launched before the service itself. This file can be exist or not depends of the purpose.
and another : please see here http://skarnet.org/software/s6-rc/s6-rc-compile.html
for the oneshot we need to define those file :
type : type of the service, in this case oneshot
up : what is made on start
down : what is made on stop ( can be empty )
dependencies : this file contents the service that need to be launched before the service itself
and another : .....
for the bundle we need to define those files :
type : type of the service, in this case bundle
contents : the list of the service which will started
The better is to take a look on rc-serv-boot directory :) for understanding the things
Well, on runit all the service in made on /etc/sv then symlinks are created to /var/service to enable the service. This is a little different on S6. Those directories /etc/s6/svc-serv, /etc/s6/compiled/some_database (compiled database of rc-serv-boot and /etc/s6-serv/enabled) are entirely copied as it on the directory /run/s6, then a symlinks is created at /etc/s6-run. So, in fact, the working directory is never modified on running time (better for security reason).
Some explanation about /etc/s6/rc-serv-boot directory :
This directory concerns the off works about service.
The first directory called is "All" by the command "s6-rc -u change All".
All :
This is a bundle named service.
The file "contents" is the list of the services started.
Those names may be : a another bundle e.g. all-Boot or service
Those names can be : a services or an another bundle.
To better clarity, a "code name" was created :
a name beginning by a majuscule signify that's a bundle e.g : "All"
a name beginning by the name of a bundle signify that's the service/bundle is declared onto the bundle name e.g. : all-Boot. all-Boot depends of bundle All.
a name beginning by the name of a bundle AND the name after the underscore begin by a majuscule, signify that's a another bundle e.g : all-Boot is a dependency of bundle All and it's a bundle itself.
With this principle, we can see quickly who depends of who e.g : rofs-console depends of the bundle boot-Rofs which depends of all-Boot bundle which depends of All bundles. With a little practice it can be easy :).
The bundle all-Boot concerns all the services/bundles needed to boot the system properly, DO NOT TOUCH THIS BUNDLE if you don't know what you are doing.
The bundle all-User concerns all the services/bundles needed by the user to run the system.
Normaly, you don't need to touch anything on this directory. Change some things on it can broke the boot procedure if you don't know what you do.
Some explanation about /etc/s6-serv/ directory :
We have at /etc/s6-serv two folder : available and enabled.
The folder available is used by pacman to install xxx-s6serv package. The s6-boot package install two folder onto it : all-User, boot-ready. NEVER ERASE/CHANGE those folders if you do not know what you do.
The folder enabled is used by an user to to create a database compilation source of services. This folder contains a list of sub-directory which contains symlinks pointing at /etc/s6-serv/available. By default, a sub-directory named default is created with s6-boot package.
So if you want to create quickly a service for e.g. openntpd :
create the directory /etc/s6-serv/available/user-openntpd. Under it create these files :
run : you can take the file run from runit :)
type : declare it as longrun
finish : you can take the file finish from runit
dependencies : declare on it the service boot-ready. This allow you to be sure that the system is fully operationnal.
To enable it on the live database, please see here http://obarun.org/forum/viewtopic.php?id=139
for managing service please see this for s6-rc : http://skarnet.org/software/s6-rc/s6-rc.html and this for s6-svscan http://skarnet.org/software/s6/s6-svscanctl.html
about s6.conf :
The file can be found in /etc/s6/s6.conf. So these is the file which must be modified if needed (e.g. keymap).
During boot time, s6.conf is parsed and written on multiple file (one by variable) at /run/s6-conf/.
When a service need to read a variable, it goes to /etc/s6/env/s6-conf which is a symlink pointing to /run/s6-conf.
For the moment, the file s6.conf is parsed on file init, not sure that's a good idea. If A crash occuring during the parsing, it block the boot init.