會員註冊 / 登入  |  電腦版  |  Jump to bottom of page

Linux » 解決restorecond: Will not restore a file with more than one hard link (/etc/resolv.conf) 錯誤

發表人: andowson, 七段學員
2011-11-24 10:10:58
最近發現一台RHEL 5.1伺服器的/var/log/message出現這樣的錯誤訊息:
Nov 21 14:19:01 localhost restorecond: Will not restore a file with more than one hard link (/etc/resolv.conf) No such file or directory
Nov 21 16:21:51 localhost restorecond: Will not restore a file with more than one hard link (/etc/resolv.conf) No such file or directory
Nov 22 09:39:47 localhost restorecond: Will not restore a file with more than one hard link (/etc/resolv.conf) No such file or directory
Nov 22 09:40:39 localhost restorecond: Will not restore a file with more than one hard link (/etc/resolv.conf) Invalid argument

因為在CentOS/RHEL中/etc/sysconfig/networking/profiles/default/resolv.conf是hard link到/etc/resolv.conf,我們可以透過下列指令找出全部的hard link
find / -xdev -samefile /etc/resolv.conf

輸出大致如下:
/etc/sysconfig/networking/profiles/default/resolv.conf

/etc/resolv.conf

解法,用root權限依序執行下列步驟即可:

rm /etc/sysconfig/networking/profiles/default/resolv.conf
restorecon /etc/resolv.conf
ln /etc/resolv.conf /etc/sysconfig/networking/profiles/default/resolv.conf

參考資料:
http://www.cyberciti.biz/faq/linux-rhel-fedora-centos-restorecond-will-not-restoreafile/




會員註冊 / 登入  |  電腦版  |  Jump to top of page