CompTIA Linux+ (XK0-006)TroubleshootingMedium
A technician is investigating a server that takes an unusually long time to shut down. During the shutdown process, messages appear indicating that systemd is waiting for several services to stop, specifically `network.service` and `firewalld.service`, eventually timing out. Which of the following is the most appropriate initial step to diagnose why these services are failing to stop gracefully?
- ARestart the server in rescue mode and manually stop the services.
- BIncrease the `TimeoutStopSec` value in the service unit files.
- CExamine the `journalctl` logs for the specific services, e.g., `journalctl -u network.service`.
- DCheck the network configuration files in `/etc/sysconfig/network-scripts/` for errors.
Show answer & explanationAnswer & explanation
Correct answer: C. Examine the `journalctl` logs for the specific services, e.g., `journalctl -u network.service`.
When systemd services fail to stop, the most direct way to understand *why* is to check their specific logs. `journalctl -u <service_name>` displays detailed messages from that service, which often include error messages or clues about what caused the hang or failure to stop gracefully.
Why the other options are wrong
- A. Restarting in rescue mode and manually stopping services is a workaround, not a diagnostic step to understand the root cause of the shutdown issue.
- B. Increasing `TimeoutStopSec` only delays the inevitable timeout; it does not resolve the underlying issue causing the service to hang during shutdown.
- D. While network config files *could* be related, the immediate problem is the service failing to stop, not necessarily its configuration during runtime. The logs will reveal the specific failure.
journalctl for Service Failures
`journalctl -u <service_name>` is used to view logs specifically for a given systemd service unit. It's essential for diagnosing why a service failed to start, stop, or is behaving unexpectedly.
- Filters logs by systemd unit name.
- Shows stdout/stderr of the service.
- Crucial for identifying root causes of service issues.
Memory trick: Journalctl's Unit logs unveil the service's ultimate sorrow.