‹ All Linux Interview Questions questions

Linux Interview Question 6: systemd Daemon Reload

Linux Interview Questions · Test 1 · question 6 of 10

systemd & Serviceseasy

You edit /etc/systemd/system/myapp.service to add an Environment=LOG_LEVEL=debug line to the [Service] section, then run systemctl restart myapp. The service restarts, but the application still logs at the old level, and systemctl status myapp warns that the unit file changed on disk.

Which step did you miss?

Select one answer
Show answer and explanation

Answer:

  • A. Run systemctl daemon-reload so systemd re-reads the unit file, then restart the service

systemd loads unit files into memory and works from that loaded copy. Editing the file on disk does not change what the manager uses, so restart started the service again with the old definition, and status warned that the file differs from the loaded unit. systemctl daemon-reload makes systemd reload all unit files; after that, systemctl restart myapp starts the process with the new environment variable.

Option B is the classic confusion. systemctl reload asks the *service* to reload its own configuration (for Apache, its httpd.conf) and does not re-read the systemd unit file. The systemctl documentation explicitly says not to confuse it with daemon-reload.

Option C is wrong because enable only creates the symlinks that make the unit start at boot (based on its [Install] section). It does not reload the unit definition for the running manager.

Option D is wrong because reset-failed only clears a unit's "failed" state and its restart counters. It does not re-read the file.

Reference: systemctl - freedesktop.org systemd manual

Practice Test 1 ›

Study guides for Linux Interview Questions