/run/resolvconf/resolv.conf gets erased each time I restart, and I can't use internet without it (16.04)

19,832

Solution 1

You should restore the resolv.conf symbolic link and add required nameservers to /etc/resolvconf/resolv.conf.d/base. Follow these steps:

  1. Reinstall resolvconf package:

    $ sudo apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall resolvconf
    
  2. Add required nameservers to /etc/resolvconf/resolv.conf.d/base:

    $ sudo bash -c 'echo "nameserver 8.8.8.8" >> /etc/resolvconf/resolv.conf.d/base'
    $ sudo bash -c 'echo "nameserver 8.8.4.4" >> /etc/resolvconf/resolv.conf.d/base'
    
  3. Regenerate resolv.conf:

    $ sudo resolvconf -u
    
  4. Restart your network interfaces:

    $ sudo ifdown -a ; sudo ifup -a
    

Solution 2

I think the resolv.conf is not updated automatically. You can reconfigure it

sudo dpkg-reconfigure resolvconf
Share:
19,832

Related videos on Youtube

Antonio Kuri
Author by

Antonio Kuri

Updated on September 18, 2022

Comments

  • Antonio Kuri
    Antonio Kuri over 1 year

    I have been solving issues with my ubuntu - windows partition. So after having an issue with the clock of the system and i think this triggering that I couldn't log into my user (it just bounced back) but being free to log like guest, so I created a new user like suggested here.

    So, it worked, but now I couldn't load anything although the icon appeared like connected, both wireless and ethernet. So I found a solution... somewhere, that said to add to /etc/resolv.conf

    nameserver 8.8.8.8

    nameserver 8.8.4.4

    So, I found it but it had a symlink to /run/resolvconf/resolv.conf and it didn't exists, so I made one with only said lines. And the internet worked then!!

    But when I restart the computer, /run/resolvconf/resolv.conf is gone so I have to make one again each time.

    How can I fix this? Apparently there aren't any other symlinks broken, and I have also done this with no result. Thanks everybody

    • Admin
      Admin over 7 years
      Try running sudo dpkg-reconfigure resolvconf and answering 'Yes' when it asks you if you want to prepare /etc/resolv.conf for dynamic updates.
    • Admin
      Admin over 7 years
      @Antonio Kuri Have you tried some of these solutions?
    • Admin
      Admin over 7 years
      Yeah, I just did. Something is missing
    • Admin
      Admin over 7 years
      @AntonioKuri I've updated my answer. Try from the beginning again. Changed step 1.
  • Antonio Kuri
    Antonio Kuri over 7 years
    When running step 3, it gives back: run-parts: failed to open directory /etc/resolvconf/update.d: No such file or directory
  • Antonio Kuri
    Antonio Kuri over 7 years
    It does make that persistent but doesn't help to fix the connection. No site loads
  • Antonio Kuri
    Antonio Kuri over 7 years
    NetworkManager just crashed while doing nothing. Executable path: /usr/sbin/NetworkManager
  • Thiago Rider Augusto
    Thiago Rider Augusto over 7 years
    Did you tried restarting NetworkManager?
  • Antonio Kuri
    Antonio Kuri over 7 years
    Doing the stated worked. Now I restart and the connection works just fine. Thanks