CompTIA Linux+ (XK0-006)Services and User ManagementMedium

A system administrator is troubleshooting a service that fails to start at boot. The service unit file, `mydaemon.service`, contains `Requires=network-online.target`. Which of the following commands would help verify if the `network-online.target` is being reached or if there are issues preventing it from being achieved?

  1. Asystemctl list-dependencies network-online.target
  2. Bsystemctl status network-online.target
  3. Cjournalctl -u network-online.target
  4. Dip a show
Show answer & explanation

Correct answer: C. journalctl -u network-online.target

While `systemctl status network-online.target` would show its current state, `journalctl -u network-online.target` is more effective for troubleshooting. It displays log messages specifically related to the `network-online.target` unit, which can reveal why it might be failing or taking too long to activate.

Why the other options are wrong

  • A. This command shows what `network-online.target` depends on, which is useful for understanding its structure, but not for diagnosing runtime failures.
  • B. This command shows the current state (active/inactive) but not the detailed events leading to that state or potential failures.
  • D. This command shows network interface information, which is relevant to network connectivity, but doesn't directly provide `systemd` target status or logs.

journalctl for systemd targets

The `journalctl` utility can be used with the `-u` option to view log messages generated by or related to a specific `systemd` unit, including target units like `network-online.target`.

  • Filters logs by unit name.
  • Useful for diagnosing target activation issues.
  • Provides historical and real-time log data.

Memory trick: JOURNALctl logs all TARGET actions.

More Services and User Management questions