Linux Interview Question 6: systemd Daemon Reload
Linux Interview Questions · Test 1 · question 6 of 10
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?
Show answer and explanation
Answer:
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