Describe the bug
When unbound is run with systemd's socket activation (see additional information below for an example socket file); unless you set specific IPv4 addresses to listen (like 127.0.0.1:553) on the socket file and set do-ip6: no (also set port: 553 for this example) on unbound.conf, you will get these two error lines:
error: setsockopt(..., IPV6_V6ONLY, ...) failed: Invalid argument
fatal error: could not open ports
To reproduce
Steps to reproduce the behavior:
- Compile and install unbound with systemd support (
--enable-systemd).
- Copy the built
contrib/unbound.service from source to /usr/lib/systemd/system/.
- Install the systemd socket file below to
/usr/lib/systemd/system/.
- Configure
/usr/local/etc/unbound/unbound.conf like below.
- Reload systemd daemon. (
systemctl daemon-reload)
- Start the unbound socket. (
systemctl start unbound.socket)
- Start the unbound service. (
systemctl start unbound.service)
- Check service log. (Assuming journald is installed,
journalctl -xeu unbound)
Expected behavior
Unbound starting.
System:
- Unbound version: 1.16.2
- OS: Debian 11 (bullseye)
unbound -V output:
Version 1.16.2
Configure line: --enable-systemd --enable-subnet --enable-tfo-client --enable-tfo-server --enable-dnstap --enable-dnscrypt --enable-cachedb --enable-ipsecmod --enable-ipset --with-pthreads --with-dynlibmodule --with-pyunbound --with-pythonmodule --with-libevent=/usr --with-libexpat=/usr --with-libhiredis=/usr --with-libnghttp2=/usr --with-protobuf-c=/usr --with-libsodium=/usr --with-libmnl=/usr
Linked libs: libevent 2.1.12-stable (it uses epoll), OpenSSL 1.1.1n 15 Mar 2022
Linked modules: dns64 python dynlib cachedb ipsecmod subnetcache ipset respip validator iterator
DNSCrypt feature available
TCP Fastopen feature available
BSD licensed, see LICENSE in source package for details.
Report bugs to unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues
Additional information
File /usr/lib/systemd/system/unbound.socket:
[Socket]
BindIPv6Only=both
ListenDatagram=553
ListenStream=553
[Install]
WantedBy=sockets.target
File /usr/local/etc/unbound/unbound.conf:
server:
verbosity: 1
port: 553
use-systemd: yes
do-daemonize: no
username: ""
python:
dynlib:
remote-control:
control-enable: no
Describe the bug
When unbound is run with systemd's socket activation (see additional information below for an example socket file); unless you set specific IPv4 addresses to listen (like
127.0.0.1:553) on the socket file and setdo-ip6: no(also setport: 553for this example) on unbound.conf, you will get these two error lines:To reproduce
Steps to reproduce the behavior:
--enable-systemd).contrib/unbound.servicefrom source to/usr/lib/systemd/system/./usr/lib/systemd/system/./usr/local/etc/unbound/unbound.conflike below.systemctl daemon-reload)systemctl start unbound.socket)systemctl start unbound.service)journalctl -xeu unbound)Expected behavior
Unbound starting.
System:
unbound -Voutput:Additional information
File
/usr/lib/systemd/system/unbound.socket:File
/usr/local/etc/unbound/unbound.conf: