1

I've edited /etc/resolve.conf on my ubuntu 20.04 by mistake and it corrupted as below :

root@ubnt20srv-test-01:/etc# cat resolv.conf

 cat: resolv.conf: No such file or directory

but the file exist:

root@ubnt20srv-test-01:/etc# ls -la | grep resolv.conf
lrwxrwxrwx   1 root root         39 Jul 31  2020 resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

and I get this error when I want to reedit it with vim :

"resolv.conf"
"resolv.conf" E166: Can't open linked file for writing
Press ENTER or type command to continue

enter code here

I restarted VM but it didn't recreated. what should I do?

1

2 Answers 2

0

it was because the systemd-resolved.service was stopped. :) I started the service and the file regenerated.

0

root@techchamp:~# cd /etc/ root@techchamp:/etc# ls -la resolv.conf lrwxrwxrwx 1 root root 32 Jun 6 19:01 resolv.conf -> /run/systemd/resolve/resolv.conf

See above error solution is here :))

Now go to cd /run/systemd/ & create new folder name with resolve & open resolve folder

after that create nano file in this folder name with resolv.conf

Yeah that's done now you check again with nano /etc/resolv.conf it's open & working correctly...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .