220-1102 Question 275
Single answersystemdA Linux workstation uses systemd. After a software update, a custom backup service named backup-agent.service no longer starts automatically after reboot. The script runs successfully when started manually with systemctl start backup-agent.service. As a technician, you need to make sure the service starts automatically on future boots using the correct systemd method. Which action should you take?
- A
Run systemctl enable backup-agent.service
- B
Run systemctl daemon-reexec backup-agent.service
- C
Add backup-agent.service to /etc/rc.local
- D
Run chkconfig backup-agent.service on
Show answer and explanation
Correct answer: A
Explanation
This question tests practical use of systemd service management. If a unit starts successfully with systemctl start but does not start after reboot, the most likely cause is that the unit is not enabled. The correct command is systemctl enable
- A. Correct.
Correct. In systemd, enabling a service configures it to start automatically at boot by creating the appropriate symlinks based on the unit file's [Install] section, typically into a target such as multi-user.target.wants. Since the service starts manually, the immediate issue is most likely that it is not enabled for startup.
- B. Incorrect.
Incorrect. systemctl daemon-reexec causes systemd itself to re-execute its process while preserving state. This is a specialized administrative action and does not enable a service for automatic startup. A common misconception is confusing systemd daemon management with service startup configuration.
- C. Incorrect.
Incorrect. /etc/rc.local is a legacy startup mechanism and is not the standard way to manage service startup on systemd-based systems. Some distributions may not use rc.local by default at all. Using native systemd unit enablement is the recommended best practice.
- D. Incorrect.
Incorrect. chkconfig is associated with older SysVinit-based service management and is not the standard tool for enabling native systemd services. Some systems may provide compatibility wrappers, but for A+ and real-world best practice, systemctl enable is the correct command.