Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On a debian system, I'm logged in as root.

I cannot create any files in /bin, /usr/bin, /sbin or /usr/sbin.

I can create files in /, /usr, /usr/local, /usr/share, etc, etc.

All these directories are owned by root and have permission 755.

The partition is not full.

touch /usr/bin/foo

touch: cannot touch `/usr/bin/foo': Permission denied

(and the file does not already exist)

touch /usr/local/foo

(no error)

Also, chown and chmod fail on directories named "bin" or "sbin", but not on other directories.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

You might want to check the file attributes using lsattr. It's well possible that those directories have been made "immutable" to prevent alteration, even by root.

share|improve this answer
    
Some directories under /usr are marked "I" (not "i" for immutable). It turns out root can't write to any of the directories marked "I". man chattr sez: The "I" attribute is used by the htree code to indicate that a directory is being indexed using hashed trees. It may not be set or reset using chattr(1), although it can be displayed by lsattr(1). I have no idea what that means, or why directories would be stuck in this state, but you've set me off in the right direction. –  user17944 Nov 14 '09 at 3:08

Sounds like those directories where you can't change anything were mounted read-only.

You might want to check the output of mount.

share|improve this answer
    
Not mounted read-only –  user17944 Nov 14 '09 at 3:09

To add on to Manni's answer, often times a file system will be mounted read only if there was an error during a file system check. You may want to check your boot logs to see if there were errors.

share|improve this answer

Your Answer

 
discard

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