Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

During an upgrade to 12.04 today I've got an error when running post-install hook for resolvconf package:

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.

Well, surely I tried running chattr -i /etc/resolv.conf, but dpkg --configure resolvconf produced the same error.

I tried to move or delete the file manually, but I can't do this even as root:

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

I am able to create and then delete a file in /etc (as root), so the root partition is not mounted read-only or anything. Also:

lsattr /etc/resolv.conf
-----a--------- /etc/resolv.conf
share|improve this question
up vote 2 down vote accepted

as per the help files (man chattr),

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

In your case the file has this attribute

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

So the command to try would be

sudo chattr -a /etc/resolv.conf

and try listing the attributes once again using

lsattr /etc/resolv.conf

Then try deleting the file

share|improve this answer
Yep, that fixed the problem, thanks. The chattr manpage is kinda ambiguous - I thought it says "file can be open only in append mode" (i.e. no effect on other operations, such as delete), while what it actually means is "file can only be open, and only in append mode" – Sergey Apr 27 '12 at 5:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.