0

I got this

drwxrwxr-x 3 root tunnel 100 date and time .
drwxr-xr-x 33 root root 860 date and time …
-rwxrwxr-x 1 root tunnel 0 date and time enable-updates
drwxrwxr-x 2 root tunnel 40 date and time interface
-rwxrwxr-x 1 root tunnel 151 date and time resolv.conf

Then I run

sudo chown --recursive root:tunnel run/resolvconf
sudo chmod --recursive 775 /run/resolvconf

Then I get this

drwxrwxr-x 3 root tunnel 100 date and time .
drwxr-xr-x 33 root root 860 date and time …
-rwxrwxr-x 1 root tunnel 0 date and time enable-updates
drwxrwxr-x 2 root tunnel 40 date and time interface
-rwxrwxr-x 1 root tunnel 151 date and time resolv.conf

but after few second or reboot all is OVERWRITTEN flags and file resolv.conf and I get this again

ls -al /run/resolvconf
total 4
drwxrwxr-x  3 root tunnel 100 date and time .
drwxr-xr-x 33 root root   860 date and time ..
-rw-r--r--  1 root root     0 date and time enable-updates
drwxrwxr-x  2 root tunnel  40 date and time interface
-rw-r--r--  1 root root   151 date and time resolv.conf

and I cant chattr

chattr: Operation not supported while reading flags on /etc/resolv.conf

here is cat for resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND – YOUR CHANGES WILL BE OVERWRITTEN
user322432
  • 1
  • 1
  • 1
  • 1

3 Answers3

3

As it's written the resolv.conf file is overwritten each times you start or restart the network manager demon

If you want to keep a static DNS you've to add this line in you /etc/network/interfaces file :

dns-nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx

In my example you've to replace xxxx.xxxx.xxxx.xxxx by the IP address of the desired DNS. You could put 8.8.8.8 and 8.8.4.4 which is the DNS of Google as example.

Regards,

dubis
  • 1,460
0

The /etc/resolv.conf is just a symbolic link , because you have resolvconf package installed on your system the default ls -al /etc/resolv.conf :

/etc/resolv.conf -> /etc/resolvconf/run/resolv.conf

That's why your recive chattr: Operation not supported while reading flags on /etc/resolv.conf error.

Remove the /etc/resolv.conf then create it again.

rm /etc/resolv.conf # or use unlink command
nano /etc/resolv.conf # etdit your file
chattr +i /etc/resolv.conf
GAD3R
  • 66,769
-2

Use the below command to prevent the resolv.conf or any file from being overwritten after reboot:

chattr -V +i filename e.g chattr -V +i /etc/resolv.conf

To Revert Back the Change Use the below Command:

chattr -i filename - to re-enable insert to the file

chattr (Change Attribute) is a command line Linux utility that is used to set/unset certain attributes to a file in Linux system to secure accidental deletion or modification of important files and folders, even though you are logged in as a root user.

oxr463
  • 1,240