Unbound won't start on system boot
Robert Moskowitz
rgm at htt-consult.com
Fri Jun 13 09:27:57 UTC 2025
On 6/13/25 12:24 AM, Jeffrey Walton wrote:
> On Thu, Jun 12, 2025 at 5:06 PM Robert Moskowitz <rgm at htt-consult.com> wrote:
>> On 6/12/25 4:40 PM, Jeffrey Walton wrote:
>>> 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?
>> Just rebooted. No daemon-reload.
>>
>>> Finally, what does `journalctl -u unbound.service` have to say?
>> I had to work a little bit to find the messages from the reboot. And I
>> don't think these are them, rather from when I did the restart? Based
>> on uptime and current time, I calculate the system was booted closer to
>> 15:00 and prior to this messages are from 14:45 and are queries.
>>
>> So it looks like there are problems with the content of my override.conf?
>>
>> Jun 12 15:16:12 onlo systemd[1]:
>> /etc/systemd/system/unbound.service.d/override.conf:3: Failed to parse
>> sec value, ignoring: 30 # Allow restarts within a 30-second interval
>> Jun 12 15:16:12 onlo systemd[1]:
>> /etc/systemd/system/unbound.service.d/override.conf:4: Failed to parse
>> unsigned value, ignoring: 2 # Allow a maximum of 2 restarts
>> within the interval
>> Jun 12 15:16:12 onlo systemd[1]:
>> /etc/systemd/system/unbound.service.d/override.conf:8: Failed to parse
>> service restart specifier, ignoring: on-failure # Restart on failure
>> Jun 12 15:16:12 onlo systemd[1]:
>> /etc/systemd/system/unbound.service.d/override.conf:9: Failed to parse
>> sec value, ignoring: 10 # Wait 10 seconds before restarting
>> Jun 12 15:16:12 onlo systemd[1]: unbound.service: Service has more than
>> one ExecStart= setting, which is only allowed for Type=oneshot services.
>> Refusing.
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: service stopped
>> (unbound 1.19.2).
>> Jun 12 15:16:51 onlo systemd[1]: Stopping unbound.service - unbound...
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: server stats for
>> thread 0: 16 queries, 0 answers from cache, 16 recursions, 0 prefetch, 0
>> rejected by ip ratelimiting
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: server stats for
>> thread 0: requestlist max 3 avg 0.5625 exceeded 0 jostled 0
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: mesh has 0 recursion
>> states (0 with reply, 0 detached), 0 waiting replies, 16 recursion
>> replies sent, 0 replies dropped, 0 states jostled out
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: average recursion
>> processing time 0.333283 sec
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: histogram of
>> recursion processing times
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: [25%]=0.131072
>> median[50%]=0.23593 [75%]=0.524288
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: lower(secs)
>> upper(secs) recursions
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: 0.001024 0.002048 1
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: 0.008192 0.016384 2
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: 0.065536 0.131072 1
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: 0.131072 0.262144 5
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: 0.262144 0.524288 3
>> Jun 12 15:16:51 onlo unbound[1823]: [1823:0] info: 0.524288 1.000000 4
> Based on this:
>
>> Jun 12 15:16:12 onlo systemd[1]:
>> /etc/systemd/system/unbound.service.d/override.conf:3: Failed to parse
>> sec value, ignoring: 30 # Allow restarts within a 30-second interval
> It looks like the problem is with your comment style.
>
> It looks like systemd recognizes comments at the start of a line, and
> not at arbitrary positions. See
> <https://www.freedesktop.org/software/systemd/man/latest/systemd.syntax.html>.
I was guessing that last night as I read the journaling when I should
have been a-bed already.
Thanks for the conformation.
I will give that a go.
More information about the ubuntu-users
mailing list