제거할 수 없는 /etc/resolv.conf

제거할 수 없는 /etc/resolv.conf

resolvconf오늘 12.04로 업그레이드하는 동안 패키지 에 대한 설치 후 후크를 실행할 때 오류가 발생했습니다 .

Setting up resolvconf (1.63ubuntu11) ...
resolvconf.postinst: Error: Cannot replace the current /etc/resolv.conf with a symbolic link because it is immutable. To correct this problem, gain root privileges in a terminal and run 'chattr -i /etc/resolv.conf' and then 'dpkg --configure resolvconf'. Aborting.

글쎄, 물론 나는 running 을 시도했지만 chattr -i /etc/resolv.conf같은 dpkg --configure resolvconf오류가 발생했습니다.

파일을 수동으로 이동하거나 삭제하려고 했지만 루트 권한으로도 이 작업을 수행할 수 없습니다.

sudo mv /etc/resolv.conf /etc/resolv.conf.old 
mv: cannot move `/etc/resolv.conf' to `/etc/resolv.conf.old': Operation not permitted

sudo rm /etc/resolv.conf                                                       
rm: cannot remove `/etc/resolv.conf': Operation not permitted

/etc에서 루트로 파일을 생성하고 삭제할 수 있으므로 루트 파티션은 읽기 전용으로 마운트되지 않습니다. 또한:

lsattr /etc/resolv.conf
-----a--------- /etc/resolv.conf

답변1

내 경우에는 파일의 불변 속성이 원인입니다. 그렇습니다sudo chattr -a -i /etc/resolv.conf

답변2

도움말 파일( man chattr) 에 따라

A  file  with the `a' attribute set can only be open in append mode for writing.

귀하의 경우 파일에 이 속성이 있습니다.

The  operator  `+'  causes  the  selected attributes to be added to the
       existing attributes of the files; `-' causes them to  be  removed;

따라서 시도하라는 명령은 다음과 같습니다.

sudo chattr -a /etc/resolv.conf

다음을 사용하여 속성을 다시 한 번 나열해 보세요.

lsattr /etc/resolv.conf

그런 다음 파일을 삭제해 보세요.

관련 정보