root can't write or modify /bin, /usr/bin, /sbin, /usr/sbin

3

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.

user17944

Posted 2009-11-13T19:51:36.337

Reputation:

Answers

2

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.

Cheatah

Posted 2009-11-13T19:51:36.337

Reputation: 121

1Some 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. – None – 2009-11-14T03:08:20.220

1

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

You might want to check the output of mount.

innaM

Posted 2009-11-13T19:51:36.337

Reputation: 9 208

Not mounted read-only – None – 2009-11-14T03:09:38.050

0

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.

Pridkett

Posted 2009-11-13T19:51:36.337

Reputation: 1 262