brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: a systemd drop-in must clear ExecStart= before it sets a new one

Systemd
~/tips/tip-systemd-reset-execstart-dropin

ExecStart=

Replaces the start command of a service in a drop-in by clearing the inherited one first.

Changing the command of a service in a drop-in fails with a confusing error unless you clear the old one first.

# systemctl edit myapp.service
[Service]
ExecStart=
ExecStart=/usr/local/bin/myapp --port 9000

Most services accept only one ExecStart=, so a second assignment would be an error: “more than one ExecStart= setting”. The empty assignment resets the list inherited from the original unit, and the next line sets the new command. The same trick works for ExecStartPre= and for list settings like Environment=. Oneshot units may have several ExecStart= lines, so without the reset the new command would run in addition to the old ones instead of replacing them.

Further reading: systemd.service manual page

More Systemd tips [Service] sudo mkdir -p /etc/systemd/system/service.d [Service] printf 'hunter2' | sudo systemd-creds encrypt --name=dbpass – dbpass.cred systemd-analyze timespan 1h30min All Systemd tips (88) All topics

Link