With root access I edit the /etc/resolv.conf to add nameserver saving the file give me

"/etc/resolv.conf" E166: Can't open linked file for writing

Do you have a idea? I want to edit resolv.conf because apt-get update is not working.

EDIT I am using 18.04 LTS OS.

Err:1 http://ir.archive.ubuntu.com/ubuntu bionic InRelease
  Could not resolve 'ir.archive.ubuntu.com'
Err:2 http://ir.archive.ubuntu.com/ubuntu bionic-updates InRelease
  Could not resolve 'ir.archive.ubuntu.com'
Err:3 http://ir.archive.ubuntu.com/ubuntu bionic-backports InRelease    
  Could not resolve 'ir.archive.ubuntu.com'
Err:4 http://security.ubuntu.com/ubuntu bionic-security InRelease       
  Could not resolve 'security.ubuntu.com'
Err:5 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
  Could not resolve 'ppa.launchpad.net'
Reading package lists... Done       
W: Failed to fetch http://ir.archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Could not resolve 'ir.archive.ubuntu.com'
W: Failed to fetch http://ir.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Could not resolve 'ir.archive.ubuntu.com'
W: Failed to fetch http://ir.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Could not resolve 'ir.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Could not resolve 'security.ubuntu.com'
W: Failed to fetch http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/dists/bionic/InRelease  Could not resolve 'ppa.launchpad.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.
  • executing ls -al in /etc shows me: resolv.conf -> ../run/systemd/resolve/stub-resolv.conf. Have you tried editing the linked file (as sudo) directly at /run/systemd/resolve/stub-resolv.conf ?
    – Smurfz87
    Nov 12 '19 at 8:05

I reset the system and login graphically. I don't know why but it resolved the problem. I did not edit the resolve.conf anymore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.