Services (also known as daemons) and processes are at the heart of how a Linux system functions. Most of the time a service takes care of itself; you just enable and start it, then let it run. However, because a Cumulus Linux switch is a Linux system, you have the ability to dig deeper if you like. Services may start multiple processes as they run. Services tend to be the most important things to monitor on a Cumulus Linux switch.
You manage services in Cumulus Linux in the following ways:
- Identify currently active or stopped services
- Identify boot time state of a specific service
- Disable or enable a specific service
- Identify active listener ports
systemd and the systemctl Command
In general, you manage services using
systemd via the
systemctl command. You use it with any service on the switch to start, stop, restart, reload, enable, disable, reenable, or get the status of the service.
For example to restart networking, run the command:
service command in Debian Wheezy, the service name is written after the
systemctl subcommand, not before it.
To see all the currently running services, run:
systemctl has a number of subcommands that perform a specific operation on a given service.
- status: Returns the status of the specified service.
- start: Starts the service.
- stop: Stops the service.
- restart: Stops, then starts the service, all the while maintaining state. So if there are dependent services or services that mark the restarted service as Required, the other services also get restarted. For example, running
systemctl restart frr.servicerestarts any of the routing protocol services that are enabled and running, such as
- reload: Reloads a service's configuration.
- enable: Enables the service to start when the system boots, but does not start it unless you use the
systemctl start SERVICENAME.servicecommand or reboot the switch.
- disable: Disables the service, but does not stop it unless you use the
systemctl stop SERVICENAME.servicecommand or reboot the switch. A disabled service can still be started or stopped.
- reenable: Disables, then enables a service. You might need to do this so that any new Wants or WantedBy lines create the symlinks necessary for ordering. This has no side effects on other services.
There is often little reason to interact with the services directly using these commands. If a critical service should happen to crash or hit an error it will be automatically respawned by systemd. Systemd is effectively the caretaker of services in modern Linux systems and is responsible for starting all the necessary services at boot time.
Ensure a Service Starts after Multiple Restarts
systemd is configured to try to restart a particular service only a certain number of times within a given interval before the service fails to start at all. The settings for this are stored in the service script. The settings are StartLimitInterval (which defaults to 10 seconds) and StartBurstLimit (which defaults to 5 attempts), but many services override these defaults, sometimes with much longer times.
switchd.service, for example, sets StartLimitInterval=10m and StartBurstLimit=3, which means if you restart switchd more than 3 times in 10 minutes, it does not start.
When the restart fails for this reason, a message similar to the following appears:
systemctl status switchd.service shows output similar to:
To clear this error, run
systemctl reset-failed switchd.service. If you know you are going to restart frequently (multiple times within the StartLimitInterval), you can run the same command before you issue the restart request. This also applies to stop followed by start.
Keep systemd Services from Hanging after Starting
If you start, restart, or reload any
systemd service that can be started from another
systemd service, you must use the
--no-block option with
systemctl. Otherwise, that service or even the switch itself might hang after starting or restarting.
Identify Active Listener Ports for IPv4 and IPv6
You can identify the active listener ports under both IPv4 and IPv6 using the
Identify Services Currently Active or Stopped
To determine which services are currently active or stopped, run the
You can also run the
systemctl list-unit-files --type service command to list all services on the switch and see which ones are enabled:
Identify Essential Services
If you need to know which services are required to run when the switch boots, run:
To see which services are needed for networking, run:
cumulus@switch:~$ systemctl list-dependencies --after network.target network.target
To identify the services needed for a multi-user environment, run:
cumulus@switch:~$ systemctl list-dependencies --before multi-user.target
The following table lists the most important services in Cumulus Linux.
|Service Name||Description||Affects Forwarding?|
Hardware abstraction daemon, synchronizes the kernel with the ASIC.
|sx_sdk||Only on Mellanox switches, interfaces with the Spectrum ASIC.||YES|
|portwd||Reads pluggable information over the I2C bus. Identifies and classifies the optics that are inserted into the system. Sets interface speeds and capabilities to match the optics.||YES, eventually, if optics are added/removed|
|frr||FRRouting, handles routing protocols. There are separate processes for each routing protocol, like bgpd and ospfd.||YES if routing|
|clag||Cumulus link aggregation daemon, handles MLAG.||YES if using MLAG|
|neighmgrd||Synchronizes MAC address information when MLAG is in use.||YES if using MLAG|
|mstpd||Spanning tree protocol daemon.||YES if using layer 2|
|ptmd||Prescriptive Topology Manager, verifies cabling based on LLDP output, also sets up BFD sessions.||YES if using BFD|
|netd||NCLU back end.||NO|
|rsyslog||Handles logging of syslog messages.||NO|
|ntp||Network time protocol.||NO|
|ledmgrd||LED manager, reads the state of system LEDs.||NO|
|sysmonitor||Watches and logs critical system load (free memory, disk, CPU).||NO|
|lldpd||Handles Tx/Rx of LLDP information.||NO|
|smond||Reads platform sensors and fan information from pwmd.||NO|
|pwmd||Reads and sets fan speeds.||NO|