Skip to content

Modules

A module is a set of services packaged and configured as one unit. You enable it once, you configure it in one place, and 66 turns that configuration into the individual services it implies.

The one that matters to everyone is boot@, which brings the machine up.

Module or instantiated service

Service names containing an @ are not all modules. There are two different things, and the difference is worth getting right.

Instantiated service Module
Example tty@tty12 boot@system
What the @ names One instance of a template One instance of a set
What you configure That instance's environment The set: which services exist at all
What it produces One service Several services

tty@tty12 is a single agetty on a single console, created from the tty@ template. boot@system is a whole set of services, and its configuration decides which of them exist: set LVM=no and the LVM service is simply not there.

You can tell them apart by the Type line of the frontend file:

$ grep '^Type' /usr/share/66/service/boot/boot@
Type = module

Working with a module

The commands are the ordinary ones:

# 66 enable boot@laptop
# 66 configure -L boot@laptop
# 66 configure -e $EDITOR boot@laptop
# 66 reconfigure boot@laptop

The one thing to remember is that editing a module's configuration is not enough. 66 reconfigure is what turns the new configuration into the actual set of services. It prints the resulting list, which is the easiest way to confirm your change did what you meant.

Several instances

Nothing stops you from having more than one instance of a module configured, with only one enabled at a time. It is the cheapest way to keep a working configuration while you experiment with another:

# 66 disable boot@system
# 66 enable boot@laptop

Disabling does not delete, so switching back is one command. See The boot module for the full pattern, including how to boot a spare configuration from the bootloader when your new one fails.

Writing your own

Turning a service into a module is worth it when the same daemon needs several distinct configurations that you switch between, rather than several simultaneous instances.

The frontend file format, the module directory layout and the configure script are documented in the 66 documentation, under module creation and module usage. The shipped module under /usr/share/66/service/boot is the best worked example.