Managing System Services
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:
|
|
For example, to check the status of the NetworkManager service:
|
|
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:
|
|
To display all loaded service units, including inactive ones:
|
|
To display services that failed to start:
|
|
This is particularly useful when troubleshooting startup problems.
Starting and stopping services
To start a service immediately:
|
|
To stop a running service:
|
|
For example, to restart NetworkManager:
|
|
To reload a service’s configuration without performing a full restart, when supported by the service:
|
|
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:
|
|
To disable automatic startup:
|
|
Enabling or disabling a service does not necessarily start or stop it immediately.
To enable and start a service in one operation:
|
|
To stop a service and prevent it from starting automatically:
|
|
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:
|
|
To remove the mask:
|
|
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:
|
|
You can filter the output to find a particular service:
|
|
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:
|
|
For example:
|
|
To display only the most recent log entries:
|
|
To follow new log messages in real time:
|
|
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:
|
|
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:
|
|
To shut down:
|
|
To suspend the system:
|
|
Additional information
For more information about systemd and service management, consult the following manual pages:
|
|
You can also consult the following resources: