Nicht entfernbare Datei /etc/resolv.conf

Nicht entfernbare Datei /etc/resolv.conf

Während eines Upgrades auf 12.04 ist mir heute beim Ausführen des Post-Install-Hooks für das Paket ein Fehler aufgetreten resolvconf:

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.

Nun, ich habe natürlich versucht, es auszuführen chattr -i /etc/resolv.conf, aber dpkg --configure resolvconfes trat derselbe Fehler auf.

Ich habe versucht, die Datei manuell zu verschieben oder zu löschen, aber das ist nicht einmal als Root möglich:

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

Ich kann eine Datei in /etc erstellen und dann löschen (als Root), sodass die Root-Partition nicht schreibgeschützt oder so gemountet wird. Außerdem:

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

Antwort1

In meinem Fall ist das unveränderliche Attribut der Datei die Ursache.sudo chattr -a -i /etc/resolv.conf

Antwort2

gemäß den Hilfedateien ( man chattr),

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

In Ihrem Fall hat die Datei dieses Attribut

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

Der zu versuchende Befehl wäre also:

sudo chattr -a /etc/resolv.conf

und versuchen Sie noch einmal, die Attribute aufzulisten, indem Sie

lsattr /etc/resolv.conf

Versuchen Sie dann, die Datei zu löschen

verwandte Informationen