User Tools

Site Tools


66intro

go to the main 66 software documentation page

Beginners guide to 66

The minimum essential knowledge to begin using 66

1. Why this guide?

As both s6 and 66 documentation may be overwhelming at first and users may think they should consume the entirety of the documentation before they begin using the software, or the system incorporating it and in this case Obarun, this guide is an introduction to how simple and easy it is to use these tools right away.

When comparing s6/66 to runit for example, an exercise in minimalism and simplicity, the abilities of s6 and 66 appear enormous, but not everyone and right away needs all those abilities. They are there for those who realize the need and understand the functionality of those abilities. It is like obtaining a complete set of professional aircraft mechanic's tools, but for your use of servicing a washing machine only a few basic tools would suffice. It is good to know and study what is available to you at your own time and pace, but you could get back to work (doing laundry, writing, browsing, playing games) after you install it in a very short time. After all you would need a system to boot and be functional so you can go and study the documentation further.

2. What is s6?

s6 is a small suite of programs for UNIX, designed to allow process supervision (a.k.a service supervision), in the line of daemontools and runit, as well as various operations on processes and daemons. It is meant to be a toolbox for low-level process and service administration, providing different sets of independent tools that can be used within or without the framework, and that can be assembled together to achieve powerful functionality with a very small amount of code.

3. What is 66?

66 is a collection of system tools built around s6 and s6-rc created to make the implementation and manipulation of service files on your machine easier. It is meant to be a toolbox for the declaration, implementation and administration of services where separate programs can be joined to achieve powerful functionality with small amounts of code. This translates in fewer hardware resources utilized, thus more available to your work and other software, and improved speed and efficiency.

4. Resources used by 66?

66 software consume very little resources while tools execute. Once they set the s6 system up, make changes, enable and disable daemons/services, they stop. If you are not making changes to your system 66 is as if it is not there. 66 configures s6 easily so you don't have to do it the hard way.

5. What are trees?

Trees are a sets of services, programs, daemons, that should run together as one, all the time, when you need them, depending on the type. For example, if you choose dhcpcd daemon to configure and maintain a connection to your network and wpa_supplicant to configure your wifi connection, you can make a tree of those two services and call it “net”. Since network is up and running you may want a time server to align your system's time, so add ntpd (openntp, ntpclient,..etc.) into the same tree. You may want net to be up all the time, or only when you really need it. A simple command turns the tree on or off. It can be on every time you boot, or it can be off when you boot and you may want to turn it on later. You can have as many services as you want on a tree. There are trees of services meant to be run as root, and some that are meant and needed as a user.

6. How does the system boot?

A quick run down of what booting requires: Set a hostname, mount different sub-filesystems such as /run, /tmp, /proc, /sys, /dev, reads the time from hw-clock, screens what kernel modules should be activated/deactivated, initiates the random number engine, kernel control, enables udev (hw device identification), raid systems, different file system types (encrypted, zfs, btrfs, etc.), mounts various partitions mentioned in /etc/fstab, runs file system checks, network settings and interface identification, enables dmesg kernel messaging/logging system, sets local time, configures an emergency tty (default tty12) and then passes s6 to optional trees and services created by 66 after the system has completely booted.

7. How are services and daemons started and supervised?

Services and daemons can be started within trees, not just independently as in other systems. This allows you to group what you need for specific uses (networking, printing, servers, etc.) so you can activate and deactivate a whole tree of services quickly and efficiently. This frees up resources at all times for your specific use.

8. Which minimal services do I need and how do I set the system up?

On /etc/66 there is a configuration file called init.conf. In this few lines of easily understandable set of variables the initial tree is named. By default it is called boot.. and it is responsible for managing all essential processes needed to completely boot a system. Boot is a tree that now has a module configured and enabled (default in Obarun is boot@system but you can replace system with any name/word you like. To configure your boot module(s) read the linked document or follow the steps listed below (section 11). You can specify on init.conf the name of the default tree to boot (default name is boot). The boot tree among its file system mounting and checking, device configuration, etc, at the end specifies at least one console, tty@tty12 by default and while you configure your module you can specify how many more you want. tty@tty12 will always be available even if the rest of the booting procedure fails, so you can log in as user (only) and fix what is broken.

Don't let this part scare you, when you install obarun the default boot tree and suggested module will work, you must learn a few tricks in configuring it “as you need to”, but you don't have to. The template (service file or front) can be seen in /usr/lib/66/service/boot@ this is Obarun's default and after which every boot@ module is pre-configured before you edit its contents by 66-env.

9. Special Warning

As many new users make the same mistake, try to avoid doing the same.

66 prepares a complex structure of directories and files based on which s6 can operate most efficiently. If something fails, and you are diagnosing trees and services, do not be tempted to manually select a file or a directory to delete or alter. You should NEVER do that. You can disable a service from a tree, you can remove a tree (root or user) and you can attempt to recreate the problematic tree and enable the service. 66-intree and 66-inservice with adjusted -v and -p values will provide you accurate information of what is happening to a tree or service. If you are unsure of the output please ask (irc,forum,66 mailing list) but DO NOT start manually removing files and directories, it will only make matters worse and diagnosing even harder.

To alter manually how a service is run, starts, stops, or its environment, use /etc/66/service and /etc/66/conf to make custom configurations. The distribution's recommended service files are stored at /usr/lib/66/service and you can copy and modify or create your own at /etc/66/service. Alternatively for user services the ~/.66/service is where you can customize user services.

10. Quick Reference Guide

Note: you can full documentation for each tools at 66.


Create a (n)ew tree for booting (default boot) and enable the standard boot bundle of services (boot-66serv) as a single special service:

# 66-tree -n boot
enable a boot module (e.g. boot@justaname ) in tree boot (again boot@-66serv is a special bundle/set of services specifically for booting an arch based system, such as obarun):
# 66-enable -t boot boot@justaname
Now to see the overall status of trees and services:
# 66-intree>
Create a (n)ew tree to run after boot, default on Obarun is root, (E)nable it and make it (c)urrent:
# 66-tree -ncE root
To enable cron daemon (crond) in tree root
66-enable -t root crond
Since tree root is (-c)urrent you could simply use this command and crond would have been enabled on the current tree, but you also want cron started right away (-S)
# 66-enable -S crond
next time you boot after boot is finished the tree root will start all of its services.

To start the services of the newly created tree root on this session if it is down:
# 66-all -t root up
to see the status of services of only the tree root (colorize output -z and see the services in a graphical way -g:
# 66-intree -zg root
to see the status of crond and the last 13 lines of its log:
# 66-inservice -z -p 13 crond
Make a (n)ew network tree called net and (E)nable it:
# 66-tree -nE net
# 66-enable -t net dhcpcd wpa_supplicant ntpd
# 66-all -t net up
to see the status of dhcpcd and the last 12 lines of its log:
# 66-inservice -z -p 12 dhcpcd
Now leave network up but stop wifi:
# 66-stop -t net wpa_supplicant
now start it again
# 66-start -t net wpa_supplicant
or disable wifi all together as you no longer going to need it and immediately (-S)top it:
# 66-disable -t net -S wpa_supplicant
Now, you want to be isolated again, and don't need any network:
# 66-all -t net down

All of the above are run on a root level, but you want to run services as a user specifically needed for your desktop. The procedure is similar, but s6 must be notified to supervise such services in advance. It is best to look at the specific wiki page for doing this.

With most of 66 commands and 66-tools|66-tools, -v 4 will give maximum verbosity, which helps with diagnosing a problem, or when viewing a service log's -p 15 will give you the last 15 lines of the log. -z will colorize the output of most commands which helps visually to separate fields and their value/settings. Please study the configuration for each 66 tool so you can use them more effectively.

11. Configure a boot module

Let's say you have an installation and the default boot tree is boot and the default configured module is called boot@system.

66-intree -z -g

will confirm if this is true.

You may want to create a backup before making any changes. To do so, create a backup of the tree boot.

66-tree -C boot_back boot
You now want to leave this module alone, for backup in case your experimental boot module doesn't work out, and create, configure, and enable the new one. Let's call it boot@justmyname. You must first disable boot@system, it is not getting lost, it is just being removed from the boot tree:
66-disable -t boot boot@system

Let's now create the new module after the default template boot@-66serv stored in /usr/lib/66/service/boot@ .

66-enable -t boot boot@justmyname

It is now enabled and ready for next boot, but its configuration is the default from the template. You now want to configure it differently.

66-env -t boot -e nano boot@justmyname

Nano is used in the example, you can substitute the editor of choice. Hostname, use of file system types, swap, fstab, timezone, hardware clock, and many other fields are there.

Most are as simple as yes/no to enable or disable. You save your changes to the module configuration named boot@justmyname. Now you need to pass your modifications into the boot tree, because it is still having the previous (default) configuration in mind.

66-enable -t boot -F boot@justmyname

You will see a list being produced, everything that was enabled and you disabled will not come up on the list, anything disabled you enabled is showing up now. It is your new custom booting module. You can make several ones to give your machine different specific functionality.

Let's say you made a mistake and the next boot shows a problem, you want to go back to boot@system just so you can boot properly and fix your module. You propably can do this from tty12 but you'd rather reboot to a graphic terminal instead of working in console.

While you reboot you edit your boot loader entry (“e” on grub or “tab” on syslinux will let you edit the boot commands) and go to the line that starts with “linux” and at the end enter:

linux  /boot/vmlinuz-linux......  TREE=boot_back

.. and your system will boot that tree instead of boot@justmyname … as simple as that. You can imagine you can have 4 configurations and boot whichever you want each time with this trick. Your boot loader configuration has not changed, so you use 66-env to reconfigure what you did wrong, or add software missing that are required by your configuration and reboot. The boot tree still is configured to start on boot@justmyname. But if you changed the configuration you must use the option -F to pass the changes to 66.

66-enable -t boot -F boot@justmyname

Now you can reboot and try it again.

66intro.txt · Last modified: 2021/02/23 03:55 by obarun