Managing System Services

Manage systemd services in MocaccinoOS using systemctl.

Managing System Services

MocaccinoOS uses systemd to initialize the system and manage background services.

Services are programs that run in the background and provide functionality such as networking, audio, printing, Bluetooth and system logging.

The systemctl command provides an interface for managing these services.

Checking the status of a service

To check the status of a service, use:

1
$ systemctl status service-name

For example, to check the status of the NetworkManager service:

1
$ systemctl status NetworkManager

The output includes:

  • Whether the service is loaded.
  • Whether it is enabled to start automatically.
  • Whether it is currently running.
  • Recent log messages associated with the service.

Press q to exit the status display.

Listing running services

To display all currently active services:

1
$ systemctl list-units --type=service --state=running

To display all loaded service units, including inactive ones:

1
$ systemctl list-units --type=service --all

To display services that failed to start:

1
$ systemctl --failed

This is particularly useful when troubleshooting startup problems.

Starting and stopping services

To start a service immediately:

1
$ sudo systemctl start service-name

To stop a running service:

1
$ sudo systemctl stop service-name

For example, to restart NetworkManager:

1
$ sudo systemctl restart NetworkManager

To reload a service’s configuration without performing a full restart, when supported by the service:

1
$ sudo systemctl reload service-name

Not all services support reloading their configuration.

Enabling and disabling services

Services can be configured to start automatically during system startup.

To enable a service:

1
$ sudo systemctl enable service-name

To disable automatic startup:

1
$ sudo systemctl disable service-name

Enabling or disabling a service does not necessarily start or stop it immediately.

To enable and start a service in one operation:

1
$ sudo systemctl enable --now service-name

To stop a service and prevent it from starting automatically:

1
$ sudo systemctl disable --now service-name

Masking and unmasking services

A service can be masked to prevent it from being started, either manually or automatically through dependencies.

To mask a service:

1
$ sudo systemctl mask service-name

To remove the mask:

1
$ sudo systemctl unmask service-name

Warning: Masking a service is stronger than disabling it. Other services may depend on it, so only mask services when you understand the consequences.

Finding available services

To list installed service unit files and their enablement status:

1
$ systemctl list-unit-files --type=service

You can filter the output to find a particular service:

1
$ systemctl list-unit-files --type=service | grep NetworkManager

Service names are case-sensitive.

Viewing service logs

When a service fails to start or behaves unexpectedly, its logs can help identify the problem.

To display the logs for a specific service:

1
$ journalctl -u service-name

For example:

1
$ journalctl -u NetworkManager

To display only the most recent log entries:

1
$ journalctl -u NetworkManager -n 50

To follow new log messages in real time:

1
$ journalctl -u NetworkManager -f

Press Ctrl+C to stop following the logs.

For more information, see the System Logs and Troubleshooting documentation.

Reloading the systemd configuration

When systemd unit files are added or modified manually, systemd needs to reload its configuration.

Run:

1
$ sudo systemctl daemon-reload

This reloads unit definitions without restarting the system.

Note that this operation does not restart services whose configuration has changed. Those services may need to be restarted separately.

Rebooting and shutting down

You can also use systemctl to control the system’s power state.

To reboot:

1
$ sudo systemctl reboot

To shut down:

1
$ sudo systemctl poweroff

To suspend the system:

1
$ sudo systemctl suspend

Additional information

For more information about systemd and service management, consult the following manual pages:

1
2
3
4
$ man systemctl
$ man systemd
$ man systemd.service
$ man systemd.unit

You can also consult the following resources:

Last modified November 29, 2026: Update SFTP (f553589)