Service Management and Init

Service management on Mocaccino Micro

Init system

The Micro and MicroServer ISO flavors are using runit as init system. For ease of use, a very simple helper is provided, and can be used as follows:

List available services

1
$ runit-list

Start a service

1
$ runit-start sshd

Stop a service

1
$ runit-stop sshd

Enable a service on boot

1
$ runit-enable sshd

Disable a service from booting on startup

1
$ runit-disable sshd

Boot scripts

It’s possible to add scripts to be executed during boot execution, under /etc/runit/core-services/*.sh.

For example:

1
$ echo "modprobe e1000e" > /etc/runit/core-services/modules.sh

Yip Integration

Mocaccino Micro can be configured to execute yipfiles during different stages.

1
$ luet install runit-srv/yip

To start the yip service:

1
$ runit-start yip

To Enable yip on boot:

1
$ runit-enable yip

Yip files running periodically

The yip service runs periodically yip files in /etc/yip.d, /etc/yip.yaml and from the boot cmdline on the system.

For example, by creating a yip file as /etc/yip.d/sshd.yaml:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
name: "sshd"
stages:
  reconcile:
  -  name: "sshd_config setup"
     commands: 
     - chmod 644 /etc/ssh/sshd_config
     files:
     - path: "/etc/ssh/sshd_config"
       owner: 0
       group: 0
       permission: 644
       content: |
                 AuthorizedKeysFile %h/.ssh/authorized_keys
                 PermitRootLogin yes
                 ListenAddress 0.0.0.0

yip will make sure and keep sshd configured.

There are two stages currently supported: reconcile and boot. The boot yip stage is run at start, during runit initialization, while the reconcile is called periodically. You can also run yip-reconcile to trigger the execution manually.

For more information about yip, check here. To see a sample /etc/yip.d control-repo check here.

Specifing yip files from boot

It is also possible to use yip to automatically configure the system from boot.

Add yip=... to the boot command lines to specify the yip file to execute across the stages (can be a path to a local file, or either a URL)

Examples

Last modified December 29, 2020: Update migration repositories (2eea810)