For unused legacy-daemon.service, prevent boot activation as well as starts from dependencies or manual commands.
Choose systemd's stronger disable operation.
Which command is appropriate?
systemctl mask links the unit name to /dev/null so start requests fail. It is stronger than disable and is reversed with unmask.
Detailed explanation
systemctl mask legacy-daemon.serviceCorrect. It masks the unit so start requests are rejected.
Correct. It masks the unit so start requests are rejected.
systemctl disable legacy-daemon.serviceIncorrect. disable removes enablement links but does not always block manual or dependency starts.
Incorrect. disable removes enablement links but does not always block manual or dependency starts.
systemctl daemon-reloadIncorrect. daemon-reload only rereads unit files.
Incorrect. daemon-reload only rereads unit files.
systemctl reset-failed legacy-daemon.serviceIncorrect. reset-failed clears a failed state and does not prevent starts.
Incorrect. reset-failed clears a failed state and does not prevent starts.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'disable=remove automatic enablement' 'mask=prevent activation by linking unit to /dev/null'Expected result
disable=remove automatic enablement
mask=prevent activation by linking unit to /dev/nullKey points
- mask blocks starts
- Stronger than disable
- Use unmask to reverse
Notes
- Environment: systemctl操作対応表
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.