Cat resolv.conf = no such file or directory / resolv.conf strange attributes

Hi,
I got two Raspberry Pi's running.
Today I did a cat resolv.conf on both result wasn't the same.
I presume result from Pi-hole 2 is correct, while the result from Pi-hole 1 is incorrect. However both Pi-holes appears to working OK.
Any idea / suggestion on how to fix - or it doesn't matter?
Both are running latest version of Beta 6.
Cheers Steen

Pi-hole 1
Cat: resolv.conf: No such file or directory 
ls -l resolv.conf shows a strange attributes. 
lrwxrwxrwx 1 root root 32 Dec 20 16:21 resolv.conf -> /run/systemd/resolve/resolv.conf
Pi-hole 2
# Generated by resolvconf
nameserver 192.168.2.xxx
nameserver 1.1.1.1

What do you see with this command?

cat /etc/resolv.conf

admin@pihole1:~ $ cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory
admin@pihole2:~ $ cat /etc/resolv.conf
# Generated by resolvconf
nameserver 192.168.2.254
nameserver 1.1.1.1

Does sudo cat /etc/resolv.conf do anything?

Take a look at ls -la /run/systemd/resolve/resolv.conf and cat /run/systemd/resolve/resolv.conf. If you need sudo to do either of those two commands then you have permission issues.

A symlinked file should still show it's contents (if it's set to readable) when you view the source.

Can you do dig from the terminal on Pi-hole 1?

Edit: This is a similar symlinked setup

dan@Viking:~$ ls -la /etc/resolv.conf
lrwxrwxrwx 1 root root 20 Feb 17 10:22 /etc/resolv.conf -> /mnt/wsl/resolv.conf
dan@Viking:~$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.29.96.1
dan@Viking:~$ ls -la /mnt/wsl/resolv.conf
-rw-r--r-- 1 root root 197 Feb 16 12:03 /mnt/wsl/resolv.conf

Hi Dan,
Below what you suggested.

admin@pihole1:~ $ sudo cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory
admin@pihole1:~ $ ls -la /run/systemd/resolve/resolv.conf
ls: cannot access '/run/systemd/resolve/resolv.conf': No such file or directory

admin@pihole1:~ $ sudo ls -la /run/systemd/resolve/resolv.conf
ls: cannot access '/run/systemd/resolve/resolv.conf': No such file or directory

admin@pihole1:~ $ cat /run/systemd/resolve/resolv.conf
cat: /run/systemd/resolve/resolv.conf: No such file or directory

admin@pihole1:~ $ sudo cat /run/systemd/resolve/resolv.conf
cat: /run/systemd/resolve/resolv.conf: No such file or directory

When doing CD into ETC I see the resolv.conf file, but in red and there is a comment as seen in the below.

admin@pihole1:/etc $ ls -la resolv.conf
lrwxrwxrwx 1 root root 32 Dec 20 16:21 resolv.conf -> /run/systemd/resolve/resolv.conf

admin@pihole1:/etc $ dig flurry.com

; <<>> DiG 9.16.48-Debian <<>> flurry.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11783
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;flurry.com.                    IN      A

;; ANSWER SECTION:
flurry.com.             2       IN      A       0.0.0.0

;; Query time: 35 msec
;; SERVER: ::1#53(::1)
;; WHEN: Sat Feb 17 19:13:22 GMT 2024
;; MSG SIZE  rcvd: 55

C:\Users\seh20>nslookup flurry.com 192.168.1.252
Server:  pi.hole
Address:  192.168.1.252

Name:    flurry.com
Addresses:  ::
          0.0.0.0

admin@pihole1:/etc $ ls -la resolv.conf
lrwxrwxrwx 1 root root 32 Dec 20 16:21 resolv.conf -> /run/systemd/resolve/resolv.conf

The first "l" indicates that its a symlink as does the ->/run/systemd/resolve/resolv.conf

you may want to cd to that directory ie cd /run/systemd/resolve/resolv.conf and check if its there and if so cat it.

you can also use the find command sudo find / -iname resolv.conf
If it exists that should point to where.

1 Like

Then the symlink is broken, and the ls commands showing that there is no source file.

You can try running find /etc/ -xtype l to confirm is resolv.conf shows up as broken.

The dig commands working means that this isn't a big problem. You might have removed the systemd-resolved and the symbolic link was not removed during the package uninstall process.

Hi,
When CD into directory "cd /run/systemd/resolve/" and running the LS command there is no resolve.conf
When running the sugegsted find, I see several resolv.conf
Not sure what to do.

admin@pihole1:~ $ sudo find / -iname resolv.conf

/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/2776b322500d2e7bc6e46538b12f04a917ebd8d269deac2a509002c                                                                                 96622d8a5/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/172a60a05826a2c247f9db215946430f45dee6cc03162232443b571                                                                                 d8672420f/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/f2744464204650042bd3c3a08b404e3ea9bd53f745de89b932cf82b                                                                                 8e7f9702d/merged/etc/resolv.conf
/var/lib/docker/overlay2/c0aa9ebc2afecdb545570d7ec1a79c5106273d37ed2d0004c134e31                                                                                 5ee703631/merged/etc/resolv.conf
/var/lib/docker/overlay2/2954707bf1db0a00bb1ab850ecce4082382722bdec28d2bcf4258f2                                                                                 e884f9922/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/452b55323d7941e714332c02590b4152fe4b3a664778dca1cadc8ba                                                                                 eac30e97d/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/0cfa431f44ac713326be5849d1bcfd509ea9245c983b3281edec353                                                                                 23da18947/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/a61d0e2087c3b003f1fb1a0d51a01f1ca3f274d326740d5fc78c399                                                                                 ce7967aa8/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/c0aa9ebc2afecdb545570d7ec1a79c5106273d37ed2d0004c134e31                                                                                 5ee703631-init/diff/etc/resolv.conf
/var/lib/docker/overlay2/bbea7f9fe351a26949754c7a8548e0d3d71ae3da60c61753873a242                                                                                 6583dcc01/diff/etc/resolv.conf
/var/lib/docker/overlay2/5f66c854a6036323c1663e76757c8ca3e6c2a04e610ce1f76a5c093                                                                                 96622ac86/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/eaab495eeb7b680f3cca61dccfa9fd67eaee89a43e0f744ffa9cbfc                                                                                 abd4e2ecc/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/90b66f3ef46ca54a5661d2e90a88183c252d013f50c3cd394950670                                                                                 ad09a3bd3/merged/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/90b66f3ef46ca54a5661d2e90a88183c252d013f50c3cd394950670                                                                                 ad09a3bd3/merged/etc/resolv.conf
/var/lib/docker/overlay2/4d62b2f41cde9a06a8a73d17b0dfc1bdc1e6549eeb91b5414bb807c                                                                                 0d87ff615/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/20ca53b4226ee3f5caf9aa9555a8a0288ce504cbdc584fed7b2faa5                                                                                 0a2ee70a5/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/90b66f3ef46ca54a5661d2e90a88183c252d013f50c3cd394950670                                                                                 ad09a3bd3-init/diff/etc/resolv.conf
/var/lib/docker/overlay2/5387cd3c9ace20ac7259721a87ef321cd776ffcd3c065bdfa6b02ae                                                                                 d7c30ae69/diff/etc/resolv.conf
/var/lib/docker/overlay2/77f125ab1651c5e4f2c0ec5d73e573058550cdcec39a15068c6b7b6                                                                                 f29e48bf4/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/b8d308eba4d512718c365b763966148a1438f4c3c39ca0fd0c1d8de                                                                                 6e7837ae4-init/diff/etc/resolv.conf
/var/lib/docker/overlay2/d6c6ba343341efd4f2639fd4394633c2e2e69612549bb93fe9f63f2                                                                                 ecb4ae031/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/7f4ab161bd1a118531d6b22816c13d8bd546105a9a2532ffcf35458                                                                                 6be510a6d-init/diff/etc/resolv.conf
/var/lib/docker/overlay2/6f127b7aa08fe7d6a7320105ce9d04b5fd60092aa7e64b0257dff95                                                                                 a44262e95/diff/usr/lib/systemd/resolv.conf
/var/lib/docker/overlay2/ed53b180899dda0319bf34e2e6cb5a63aaef8524ee04b6e403ad655                                                                                 ae1a74813-init/diff/etc/resolv.conf
/var/lib/docker/overlay2/f2744464204650042bd3c3a08b404e3ea9bd53f745de89b932cf82b                                                                                 8e7f9702d-init/diff/etc/resolv.conf
/var/lib/docker/overlay2/86f827ea29907f702d6924da2881ece716d4424240046cce7ccc0e7                                                                                 71380e041-init/diff/etc/resolv.conf
/var/lib/docker/overlay2/7f4ab161bd1a118531d6b22816c13d8bd546105a9a2532ffcf35458                                                                                 6be510a6d/merged/etc/resolv.conf
/var/lib/docker/containers/b8a755f8a9e6ba3fee3727a00e4e00a77874e60623ef162c40aad                                                                                 0b6badec948/resolv.conf
/var/lib/docker/containers/7f04e99bf1a35c80c8a69599f1973036cf47eb861b74059febc9b                                                                                 0081ec90af0/resolv.conf
/var/lib/docker/containers/05318abfcc6029d00b82bb6a08c689a181c982781104e3427ce71                                                                                 1c7c4bafa3b/resolv.conf
/var/lib/docker/containers/76c236607d1f2f3461d6c682a3e31815249ad8c6892686faaea88                                                                                 7e75fe08f50/resolv.conf
/var/lib/docker/containers/dfd3a97a6dac835d4d56e2741e23f66ca29f7661eb1a34e1be306                                                                                 b599adf2364/resolv.conf
/var/lib/docker/containers/06faafbafbe6af071c2a0ac2a9bbccbd0c983eba07cbf4702391b                                                                                 9985f1e4dc5/resolv.conf
/var/lib/docker/containers/81ba7bd191177fb2bc1369bb37dbfebf5eebd3f799ea295bd2351                                                                                 2746880c19a/resolv.conf
/etc/resolv.conf
/run/dnsmasq/resolv.conf

Hi Dan,

admin@pihole1:~ $ sudo find /etc/ -xtype l
/etc/rc1.d/K01grafana-server
/etc/rc5.d/K01grafana-server
/etc/sv/ssh/log/supervise
/etc/sv/ssh/supervise
/etc/rc6.d/K01grafana-server
/etc/rc3.d/K01grafana-server
/etc/rc0.d/K01grafana-server
/etc/resolv.conf
/etc/systemd/system/multi-user.target.wants/unbound.service
/etc/rc4.d/K01grafana-server
/etc/rc2.d/K01grafana-server

Perhaps I have to remove Pi-hole and re-install?
Steen

If everything is working then I would not re-install.

Check and see if the package is removed with

apt-cache policy systemd-resolved

look for the line starting with "Installed:"

Hi Dan,
Yes, it has been removed, not sure why/how.
I had before going to Beta 6, version 5 running together with unbound.

admin@pihole1:~ $ sudo apt-cache policy systemd-resolved
N: Unable to locate package systemd-resolved

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.