Managing Services on Void Linux

Void Linux uses runit for its init system compared to the usual systemd seen on most other distributions. For me personally, its orders of magnitudes easier to use and understand compared to something like systemd which is needlessly complicated. runit does one thing and does it well, it has a small and lean code base, boots up extremely fast since the system services get started up in parallel.

Enabling & Disabling Services

Most of the services & daemons that can be enabled are listed inside /etc/sv/. To enable a service you just need to create a symlink from /etc/sv/<service> to the /var/service/ directory like so:

# ln -s /etc/sv/<service> /var/service/

For example, to enable ssh, you need to run: sudo ln -s /etc/sv/sshd/ /var/service/

Similarly if you want to enable NetworkManager, run: sudo ln -s /etc/sv/NetworkManager/ /var/service/

Remember, all currently enabled services live inside the /var/service/ directory.

services

Disabling a service is as simple as removing the symlink:

# rm /var/service/<service>

Other Basic Usage

You can use the following commands to monitor/start/stop currently enabled services (i.e those inside the /var/service directory)

# sv up <services>         ---> start the service if its not already running
# sv down <services>       ---> stop the service
# sv restart <services>    ---> restart said service
# sv status <services>     ---> get the status of the service (i.e if its running or not)

where <services> can be any service inside the /var/service/ directory.

To see the status of all enabled services, run the following as root: sv status /var/service/*

That's all there is to managing services on void linux!


linux

225 Words

2022-03-16