PDA

View Full Version : Hard linked resolv.conf and restorecond



Mack
29th June 2007, 09:38 PM
Hello---

At least in FC6, /etc/resolv.conf and /etc/sysconfig/networking/profiles/default/resolv.conf are hard linked. This seems to be behind the log message

restorecond: Will not restore a file with more than one hard link (/etc/resolv.conf) Invalid argument

that a lot of people have noticed---or at least a lot of people among the who-knows-how-many who use SELinux have noticed.

Replacing /etc/sysconfig/networking/profiles/default/resolv.conf with a symlink to the "real" resolv.conf, /etc/resolv.conf, fixes the restorecond problem.

As far as I can tell (!!) this doesn't seem to break anything. In particular system-config-network doesn't seem to be upset about it.

Does anyone know of any problems that this might cause? Does anything other than system-config-network use /etc/sysconfig/networking/profiles/default/resolv.conf?

Thanks for any advice!

thedeadbunnymm7
18th June 2008, 12:49 AM
I read somewhere else that you should find the hard-linked file, delete it, restorecon /etc/resolv.conf, then re-create the link.

for example:

$ ls -i /etc/resolv.conf #get inode
7405582 /etc/resolv.conf
$ sudo find /etc -inum 7405582 #find hard link
Password:
/etc/sysconfig/networking/profiles/default/resolv.conf
/etc/resolv.conf
$ sudo /usr/sbin/lsof|grep resolv.conf #make sure it is not open
$ sudo rm /etc/sysconfig/networking/profiles/default/resolv.conf #delete
$ sudo restorecon /etc/resolv.conf
$ sudo ln /etc/resolv.conf /etc/sysconfig/networking/profiles/default/resolv.conf #recreate hard link

f14f21
30th April 2010, 09:04 AM
I read somewhere else that you should find the hard-linked file, delete it, restorecon /etc/resolv.conf, then re-create the link.

for example:

$ ls -i /etc/resolv.conf #get inode
7405582 /etc/resolv.conf
$ sudo find /etc -inum 7405582 #find hard link
Password:
/etc/sysconfig/networking/profiles/default/resolv.conf
/etc/resolv.conf
$ sudo /usr/sbin/lsof|grep resolv.conf #make sure it is not open
$ sudo rm /etc/sysconfig/networking/profiles/default/resolv.conf #delete
$ sudo restorecon /etc/resolv.conf
$ sudo ln /etc/resolv.conf /etc/sysconfig/networking/profiles/default/resolv.conf #recreate hard link

thanks for ur help, that was great