Unbound won't start on system boot
Jeffrey Walton
noloader at gmail.com
Thu Jun 12 20:40:23 UTC 2025
On Thu, Jun 12, 2025 at 4:01 PM Robert Moskowitz <rgm at htt-consult.com> wrote:
>
> Still not starting on boot despite working with service settings.
>
> defaults:
>
> cat /usr/lib/systemd/system/unbound.service
> [Unit]
> Description=Unbound DNS server
> Documentation=man:unbound(8)
> After=network.target
> Before=nss-lookup.target
> Wants=nss-lookup.target
>
> [Service]
> Type=notify
> Restart=on-failure
> EnvironmentFile=-/etc/default/unbound
> ExecStartPre=-/usr/libexec/unbound-helper chroot_setup
> ExecStartPre=-/usr/libexec/unbound-helper root_trust_anchor_update
> ExecStart=/usr/sbin/unbound -d -p $DAEMON_OPTS
> ExecStopPost=-/usr/libexec/unbound-helper chroot_teardown
> ExecReload=+/bin/kill -HUP $MAINPID
>
> [Install]
> WantedBy=multi-user.target
>
> ================
>
> so it is already setup for After= but this is not enough. So via
>
> systemctl edit unbound.service
>
> cat /etc/systemd/system/unbound.service.d/override.conf
> [Unit]
> StartLimitIntervalSec=30 # Allow restarts within a 30-second interval
> StartLimitBurst=3 # Allow a maximum of 3 restarts within the
> interval
>
> [Service]
> RestartSec=10 # Wait 10 seconds before restarting
>
> ==========================
>
> Yet, it fails on boot and this is what status reports:
>
> × unbound.service - Unbound DNS server
> Loaded: loaded (/usr/lib/systemd/system/unbound.service; enabled;
> preset: enabled)
> Drop-In: /etc/systemd/system/unbound.service.d
> └─override.conf
> Active: failed (Result: exit-code) since Thu 2025-06-12 15:46:45
> EDT; 42s ago
> Docs: man:unbound(8)
> Process: 1055 ExecStartPre=/usr/libexec/unbound-helper chroot_setup
> (code=exited, status=0/SUCCESS)
> Process: 1057 ExecStartPre=/usr/libexec/unbound-helper
> root_trust_anchor_update (code=exited, status=0/SUCCESS)
> Process: 1060 ExecStart=/usr/sbin/unbound -d -p $DAEMON_OPTS
> (code=exited, status=1/FAILURE)
> Process: 1063 ExecStopPost=/usr/libexec/unbound-helper
> chroot_teardown (code=exited, status=0/SUCCESS)
> Main PID: 1060 (code=exited, status=1/FAILURE)
> CPU: 44ms
>
> Jun 12 15:46:45 onlo systemd[1]: unbound.service: Scheduled restart job,
> restart counter is at 5.
> Jun 12 15:46:45 onlo systemd[1]: unbound.service: Start request repeated
> too quickly.
> Jun 12 15:46:45 onlo systemd[1]: unbound.service: Failed with result
> 'exit-code'.
> Jun 12 15:46:45 onlo systemd[1]: Failed to start unbound.service -
> Unbound DNS server.
> Jun 12 15:46:45 onlo systemd[1]: unbound.service: Start request repeated
> too quickly.
> Jun 12 15:46:45 onlo systemd[1]: unbound.service: Failed with result
> 'exit-code'.
> Jun 12 15:46:45 onlo systemd[1]: Failed to start unbound.service -
> Unbound DNS server.
>
> =============================
>
> restart works just fine from my login.
>
> So why "restart counter is at 5." And at first I tried
> StartLimitBurst=2. I changed it to 3. Note that it is only trying 2 times.
>
> What am I missing here?
Did you reboot the machine or issue `systemctl daemon-reload` after the changes?
Finally, what does `journalctl -u unbound.service` have to say?
More information about the ubuntu-users
mailing list