Package: knot-resolver
Version: 5.2.1-1
Severity: normal
Control: blocks -1 979840
Control: affects -1 dns-root-data

When i "apt install knot-resolver" on an otherwise clean system running
systemd, the default configuration should start a listener on port 53 on
127.0.0.1.

However, that listener often fails to start.  This leads to failures in
autopkgtests that depend on the kresd package producing such a
functioning listener, like dns-root-data, which is suffering from
#979840 as a result.


Here's an example transcript of the installation (note "failed to load 
properly"):

```
The following NEW packages will be installed:
  knot-resolver
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 292 kB of archives.
After this operation, 976 kB of additional disk space will be used.
Get:1 http://ftp.debian.org/debian bullseye/main amd64 knot-resolver amd64 
5.2.1-1 [292 kB]
Fetched 292 kB in 0s (790 kB/s)       
Preconfiguring packages ...
Selecting previously unselected package knot-resolver.
(Reading database ... 447962 files and directories currently installed.)
Preparing to unpack .../knot-resolver_5.2.1-1_amd64.deb ...
Unpacking knot-resolver (5.2.1-1) ...
Setting up knot-resolver (5.2.1-1) ...
Failed to try-restart kresd@1.service: Unit kresd@1.service failed to load 
properly: Device or resource busy.
See system logs and 'systemctl status kresd@1.service' for details.
Created symlink /etc/systemd/system/kresd.target.wants/kres-cache-gc.service → 
/lib/systemd/system/kres-cache-gc.service.
Created symlink /etc/systemd/system/multi-user.target.wants/kresd.target → 
/lib/systemd/system/kresd.target.
Processing triggers for man-db (2.9.3-2) ...
Processing triggers for libc-bin (2.31-9) ...
```

The reason that it failed to start is that the working director doesn't
appear to exist:

```
Feb 12 20:23:01 alice systemd[1]: Stopping Knot Resolver daemon...
Feb 12 20:23:01 alice systemd[382608]: kresd@1.service: Changing to the 
requested working directory failed: No such file or directory
Feb 12 20:23:01 alice systemd[382608]: kresd@1.service: Failed at step CHDIR 
spawning /usr/bin/env: No such file or directory
Feb 12 20:23:01 alice systemd[1]: kresd@1.service: Control process exited, 
code=exited, status=200/CHDIR
Feb 12 20:23:01 alice systemd[1]: kresd@1.service: Failed with result 
'exit-code'.
Feb 12 20:23:01 alice systemd[1]: Stopped Knot Resolver daemon.
```

Interestingly, the service *does* start successfully if you just do:

```
systemctl start kresd@1.service
```

after the "apt install" has finished running.

here's the systemd unit:

```
# /lib/systemd/system/kresd@.service
# SPDX-License-Identifier: CC0-1.0
[Unit]
Description=Knot Resolver daemon
Documentation=man:kresd.systemd(7)
Documentation=man:kresd(8)
Wants=kres-cache-gc.service
Before=kres-cache-gc.service
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
Environment="SYSTEMD_INSTANCE=%i"
WorkingDirectory=/var/lib/knot-resolver
ExecStart=/usr/sbin/kresd -c /usr/lib/x86_64-linux-gnu/knot-resolver/distro-pre>
ExecStopPost=/usr/bin/env rm -f "/run/knot-resolver/control/%i"
User=knot-resolver
Group=knot-resolver
CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_SETPCAP
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_SETPCAP
TimeoutStopSec=10s
WatchdogSec=10s
Restart=on-abnormal
LimitNOFILE=524288
Slice=system-kresd.slice

[Install]
WantedBy=kresd.target
```

Seems like this might be an issue of postinst script ordering or
something, but i don't fully understand it.  how is
/var/lib/knot-resolver supposed to change ownership to kresd?  I can see
that /etc/init.d/kresd does a chown, but i wouldn't expect that to be
executed at all on a systemd system.

I'm a bit stumped on this, and would welcome help figuring out why the
startup fails.

    --dkg


-- System Information:
Debian Release: bullseye/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing'), (200, 
'unstable-debug'), (200, 'unstable'), (1, 'experimental-debug'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-3-amd64 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages knot-resolver depends on:
ii  adduser                3.118
ii  debconf [debconf-2.0]  1.5.74
ii  dns-root-data          2019052802
ii  libc6                  2.31-9
ii  libdnssec8             3.0.4-2
ii  libedit2               3.1-20191231-2+b1
ii  libfstrm0              0.6.0-1+b1
ii  libgcc-s1              10.2.1-6
ii  libgnutls30            3.7.0-5
ii  libknot11              3.0.4-2
ii  liblmdb0               0.9.24-1
ii  libluajit-5.1-2        2.1.0~beta3+dfsg-5.3
ii  libnghttp2-14          1.42.0-1
ii  libprotobuf-c1         1.3.3-1+b2
ii  libstdc++6             10.2.1-6
ii  libsystemd0            247.3-1
ii  libuv1                 1.40.0-1
ii  libzscanner3           3.0.4-2
ii  lua-sec                1.0-1
ii  lua-socket             3.0~rc1+git+ac3201d-4

Versions of packages knot-resolver recommends:
pn  knot-resolver-module-http  <none>
pn  lua-basexx                 <none>
ii  lua-cqueues                20200726-1

knot-resolver suggests no packages.

-- debconf information excluded

Subject: 

Attachment: signature.asc
Description: PGP signature

Reply via email to