restorecond: Will not restore a file with more than one hard link (/etc/resolv.conf) No such file or directory Error and Solution

I see the following error in my SELinux enabled CentOS or RHEL server:

Jun 21 13:58:43 server3 restorecond: Will not restore a file with more than one hard link (/etc/resolv.conf) No such file or directory
Jun 21 16:14:51 server3 restorecond: Will not restore a file with more than one hard link (/etc/resolv.conf) No such file or directory
Jun 22 13:32:23 server3 restorecond: Will not restore a file with more than one hard link (/etc/resolv.conf) No such file or directory

How do I fix this problem?

You or one of your script may have made additional hard link to your /etc/resolv.conf file. Under CentOS / RHEL / Fedora, file /etc/sysconfig/networking/profiles/default/resolv.conf hard linked with /etc/resolv.conf. To find all hard links, enter:
find / -xdev -samefile /etc/resolv.conf
Sample outputs:

 /etc/sysconfig/networking/profiles/default/resolv.conf

To fix this problem type the following commands:
# rm /etc/sysconfig/networking/profiles/default/resolv.conf
# restorecon /etc/resolv.conf
# ln /etc/resolv.conf /etc/sysconfig/networking/profiles/default/resolv.conf

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • Francisco Maia Mar 12, 2013 @ 23:08

    Thank you for sending my error away ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.