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

A system administrator has just modified the unit file for a `systemd` service named `myservice.service` (e.g., `/etc/systemd/system/myservice.service`). After saving the changes, the administrator attempts to `systemctl start myservice.service`, but the changes do not seem to take effect. What is the most likely reason for this, and which command should be executed to resolve it?

  1. AThe service is masked; use `sudo systemctl unmask myservice.service`.
  2. BThe unit file has syntax errors; check `journalctl -xe`.
  3. CThe service is already running; use `systemctl restart myservice.service`.
  4. D`systemd` needs to reload its configuration; use `sudo systemctl daemon-reload`.
Show answer & explanation

Correct answer: D. `systemd` needs to reload its configuration; use `sudo systemctl daemon-reload`.

After modifying a `systemd` unit file, `systemd` needs to re-read its configuration files from disk. This is done with the `systemctl daemon-reload` command.

Why the other options are wrong

  • A. Masking prevents a service from being started or enabled; it's a different issue than changes not taking effect after editing an active unit file.
  • B. While syntax errors could be an issue, the primary reason for changes not taking effect after modification is that `systemd` hasn't reloaded its daemon.
  • C. Restarting the service would apply changes if `systemd` had already loaded them, but the problem states changes 'do not seem to take effect', implying `systemd` hasn't seen the new file.

systemctl daemon-reload

The `systemctl daemon-reload` command instructs the `systemd` manager to reload all unit files from disk, incorporating any changes made since the last reload.

  • Essential after modifying any `.service`, `.timer`, `.target`, etc., unit files.
  • Does not stop or start any services.
  • Updates `systemd`'s internal representation of unit configurations.

Memory trick: Daemon reload makes systemd see new code.

More Services and User Management questions