Diagnosis:
journalctl -b -u systemd-resolved.service --no-hostname --no-pager
# systemctl status systemd-resolved.service
× systemd-resolved.service - Network Name Resolution
Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Wed 2023-01-04 06:58:15 CST; 7min ago
Docs: man:systemd-resolved.service(8)
man:org.freedesktop.resolve1(5)
https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
Process: 1296 ExecStart=/usr/lib/systemd/systemd-resolved (code=exited, status=1/FAILURE)
Main PID: 1296 (code=exited, status=1/FAILURE)
Error: 13 (Permission denied)
CPU: 63ms
# ls -lhat /run/systemd/resolve/
total 0
drwxr-xr-x. 25 root root 620 Jan 4 06:58 ..
drwxr-xr-x. 2 systemd-resolve systemd-resolve 40 Jan 4 06:58 .
$ journalctl -b -g AVC --no-hostname --no-pager
Jan 04 06:58:15 audit[1258]: AVC avc: denied { watch } for pid=1258 comm="systemd-resolve" path="/" dev="dm-0" ino=128 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=dir permissive=0
Jan 04 06:58:15 audit[1287]: AVC avc: denied { watch } for pid=1287 comm="systemd-resolve" path="/" dev="dm-0" ino=128 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=dir permissive=0
Jan 04 06:58:15 audit[1290]: AVC avc: denied { watch } for pid=1290 comm="systemd-resolve" path="/" dev="dm-0" ino=128 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=dir permissive=0
Jan 04 06:58:15 audit[1293]: AVC avc: denied { watch } for pid=1293 comm="systemd-resolve" path="/" dev="dm-0" ino=128 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=dir permissive=0
Jan 04 06:58:15 audit[1296]: AVC avc: denied { watch } for pid=1296 comm="systemd-resolve" path="/" dev="dm-0" ino=128 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=dir permissive=0
Fix:
# systemctl stop systemd-resolved.service
# systemctl start systemd-resolved.service
# ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
DNS now works as expected, and the files exist under the /run directory as expected:
# ls -lhat /run/systemd/resolve/
total 8.0K
drwxr-xr-x. 3 systemd-resolve systemd-resolve 120 Jan 4 07:09 .
drwx------. 2 systemd-resolve systemd-resolve 80 Jan 4 07:09 netif
-rw-r--r--. 1 systemd-resolve systemd-resolve 912 Jan 4 07:09 resolv.conf
srw-rw-rw-. 1 systemd-resolve systemd-resolve 0 Jan 4 07:09 io.systemd.Resolve
-rw-r--r--. 1 systemd-resolve systemd-resolve 920 Jan 4 07:09 stub-resolv.conf
drwxr-xr-x. 26 root root 640 Jan 4 07:09 ..
I’m unsure why there would be SELinux errors during boot but not when I manually restart the service.