Systemd not adding "...wants" link to match WantedBy in unit file
Systemd not adding "...wants" link to match WantedBy in unit file
Ubuntu 16.04LTS
watchdog package version 5.14-3ubuntu0.
systemd package version 229-4ubuntu21.15
I can use "systemctl start watchdog.service" to start up the watchdog
daemon. But I'm trying to cause watchdog.service to start at boot-up with
"systemctl enable watchdog.service".
The default unit file that comes in the package is:
$ cat /lib/systemd/
[Unit]
Description=
Conflicts=
After=multi-
OnFailure=
[Service]
Type=forking
EnvironmentFile
ExecStartPre=
ExecStart=/bin/sh -c '[ $run_watchdog != 1 ] || exec /usr/sbin/watchdog $watchdog_options'
ExecStopPost=
[Install]
And, because there is nothing in the [Install] section, I understand that
"systemctl enable watchdog.service" won't do anything.
So, I added the proper override file:
$ cat /etc/systemd/
[Install]
WantedBy=
systemd seems to see the override file:
$ systemctl cat watchdog.service
# /lib/systemd/
[Unit]
Description=
Conflicts=
After=multi-
OnFailure=
[Service]
Type=forking
EnvironmentFile
ExecStartPre=
ExecStart=/bin/sh -c '[ $run_watchdog != 1 ] || exec /usr/sbin/watchdog $watchdog_options'
ExecStopPost=
[Install]
# /etc/systemd/
[Install]
WantedBy=
Then I run: systemctl enable watchdog.service
And this seems to work. But my understanding is that there should be a link in
/etc/systemd/
But this link is not created.
As a result, when I reboot, I get:
$ systemctl status watchdog.service
● watchdog.service - watchdog daemon
Loaded: loaded (/lib/systemd/
Drop-In: /etc/systemd/
Active: inactive (dead)
Also,
$ systemctl show watchdog.service -p WantedBy
WantedBy=
It's like systemd doesn't see the WantedBy line.
I also tried a complete override of /lib/systemd/
/etc/systemd/
directly into the /lib/systemd/
not the right way to override). But in all cases, systemd won't recognize the
WantedBy= line and won't create the link in .../multi-
If I manually create the link:
ln -s /lib/systemd/
/etc/
and then reboot, watchdog comes up just fine.
But my understanding is that the link should be autogenerated based on the
WantedBy parameter in the [Install] section of the unit file.
So, why isn't that happening? What am I doing wrong?
Also, in case it's helpful /etc/default/
at boot time. I'm not sure how that relates to the above, if at all.
$ cat /etc/default/
# Start watchdog at boot time? 0 or 1
run_watchdog=1
# Start wd_keepalive after stopping watchdog? 0 or 1
run_wd_keepalive=1
# Load module before starting watchdog
#watchdog_
watchdog_
# Specify additional watchdog options here (see manpage).
#watchdog_
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Ubuntu systemd Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Michael Fox for more information if necessary.