Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I made a massive mistake by recursively changing the user of every file under /usr . I can't boot my laptop by any normal means following this mistake, and I'm looking for a way to revert the effects of it.

In order to tackle this problem I started my computer on recovery mode and switched to console as root. My original idea was to change the owner of /usr ( and all files under it ) back to root. I tried :

chown --recursive root /usr
chown -hR root /usr

Sadly this results on all folders under the usr saying Read-only file system, a sample line would be :

chown : changing the ownership of '/usr/bin/...' : Read-only file system

I'm not sure whether there has been no change at all, or I shouldn't refer to root as 'root' on the above line.

Besides this, I have tried a few other things that I found here and there but I was unable to revert the effects of my mistake.

I would be grateful if anyone can point me towards any solution. It would also be very kind of you to mention why it was so wrong to change the owner of the contents under usr, considering that I'm the only user in this operating system.

Thanks in advance for your time.

share|improve this question
    
has been asked before. downvote –  hbdgaf Aug 1 '12 at 20:13
    
how kind of you to supply a link . –  Pumpkin Aug 1 '12 at 20:36
    
it had the same answer as here, chown -R root:root. i believe the last time it was asked it was closed as a dupe of chown-ing / –  hbdgaf Aug 1 '12 at 20:39
add comment

1 Answer

up vote 1 down vote accepted

In recovery mode the root partition has been mounted read-only.

Either remedy this (from recovery mode, after booting), by using

mount -o rw,remount /

Or alternatively the easiest way to fix this may be to boot from a live cd/usb and mount the drives.

Either way once you've succeeded in mounting / in rw-mode, you can change the ownership as you already attempted.

Also don't forget to change the group too:

chown -hR root:root /usr 
share|improve this answer
    
I also wanted to ask whether there were any files under /usr that was suppose to belong to my user account, or are all the files under /usr belongs to root, I'm asking this because if the method you suggest works changing owner of all files under /usr to root can still cause problems as some of them were suppose to belong to the user –  Pumpkin Aug 1 '12 at 19:46
    
If you already chowned all the files under /usr to your user account, then it would be near impossible to find out what other processes may have owned them - I would suggest change it all to root and then see if anything still isn't working. –  mutzmatron Aug 1 '12 at 19:48
    
I think I have managed to revert /usr back to root, but this hasn't fully solved the problem. The sudo option returned however the pc can't still undergo a normal boot, as graphics seems to be problematic –  Pumpkin Aug 1 '12 at 19:58
    
Without searching too deeply, on my system /usr/sbin/uuidd is owned by libuuid, /usr/bin/at is owned by daemon. That's it though... so no other files owned by any other processes. –  mutzmatron Aug 1 '12 at 20:05
    
@Pumpkin: also as I mentioned in my edit to the answer, don't forget to change the group back too. –  mutzmatron Aug 1 '12 at 20:10
show 1 more comment

Your Answer

 
discard

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.