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
2

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,

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
-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.

  • If two questions deserve the same word-for-word answer, the correct thing to do is to flag one question as a duplicate of the other, not to post duplicate answers. – Kusalananda Oct 15 at 21:20
  • 1
    Also note that the user tried and failed with using chattr, and that this is not the correct way to solve this issue. – Kusalananda Oct 15 at 21:24
  • Run the command with sudo permisssion. It will not throw above error i.e sudo chattr -V +i filename e.g sudo chattr -V +i /etc/resolv.conf – Ashish Jain Oct 16 at 13:11

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