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'm running 11.10 and I applied some updates. After that whenever I use my computer, I can, but only for about 2 or 3 minutes before it becomes read-only. Any sudo command entered gives me the following error.

sudo: Can't open /var/lib/sudo/ryanmcclure/0: Read-only file system

I also use xpad (a sticky note program) and if I edit the notes, there is never a problem until about 4 minutes later when it says that it can't write to a file because the file system is read on.

How do I solve this problem?

share|improve this question
    
Can you tell us when the problem occurred or when it got triggered? After you installed updates or a new program? Or when you a opened a program perhaps? Also what command were you trying after sudo that returned the error message? And what exactly do you mean your system became read-only? Could be please be a little more clearer? –  nitstorm Feb 20 '12 at 3:22
    
Of course. well, I updated right before this problem came up. Any sudo command, by the way, yields this error. Terminal says after entering any sudo command that it is a read-only file system. I also use xpad (sticky note program). If I edit the notes, there never is a problem until about 4 minutes later when it says it can't write to a file because the file system is read only. –  Ryan McClure Feb 20 '12 at 3:28
    
I'm to the point now that when it switches to read-only, no program will run at all. –  Ryan McClure Feb 20 '12 at 7:36
    
Can it run a program when you do not use sudo? –  Elvis Stressborg Feb 20 '12 at 8:01
    
Have you any other accounts in your system ? Tried this from all? Are you accidentally removed from sudo group? –  Tachyons Feb 20 '12 at 9:38

4 Answers 4

up vote 8 down vote accepted

It sounds like you may have some file system corruption, possibly caused by a failing hard disk. (Normally this is the only way for the system to spontaneously mark the file system as read-only, to prevent further damage.) Try running:

dmesg | less

And scroll to near the bottom to see if there are errors related to your file system and disk. Look for messages about uncorrectable read or write errors (probably on sda), or file system errors (e.g. messages about ext3 or ext4 errors). If you see anything like these, you should back up any important data right away and then investigate whether the disk itself is failing (in which case you'll need to get a new one), or whether it's just a logical failure (in which case you can probably repair the file system with fsck to fix your problem).

share|improve this answer
    
I've been looking into a new HDD lately... but I don't want to lose any of my files and its in a laptop..so how would I go about putting my data from here to the new HDD? Also, with this possibility of corruption, why does it work for a while but then not work anymore? –  Ryan McClure Feb 20 '12 at 9:31
    
Copying data to a new hard disk in a laptop can be tricky. You can use an external drive or NAS to store the data temporarily, then copy it back after changing the internal disk (and reinstalling), or you may be able to burn CDs or DVDs. As for why it would work for a while before failing, the kernel only enables the emergency read-only mode when it notices a reason to do so. If none of the files involved in the boot process are corrupted, it would only be later when something tried to use part of the file system that's damaged that this would happen. (Assuming this is, in fact, your problem.) –  Mike Feb 20 '12 at 9:59
    
I just reinstalled everything and so far its going ok. Thank you all for the help, you all rock! –  Ryan McClure Feb 21 '12 at 9:40
    
The other reason is it rebooted after update and f*ing fsck was running an automated check, as it does every 30 reboot, just that nobody was there to press the continue button, so it mounted the file-system read-only after timeout... –  WitchCraft Aug 10 '13 at 12:21

I had the same problem, googled around and found these two links, which was useful. To me it appeared that I did not give sufficient time to umount the device. BTW my device was /dev/sdax, which is a vfat drive.

The solution these links suggest is to run

sudo fsck.vfat /dev/sda5 -a -w  

or

sudo fsck.msdos -aw /dev/sdb1

The links are:

People are loving the second link, apparently.

I haven't got in the details of seeing what these cmds do, yet.

I did run both the command (aahh!!!! me), took time considerably to execute.

I then umount-ed it and then mounted it. Its working fine for me as of now(repeated the same operation which was earlier reporting read only error). Will update if I see some error. To me it appears its kind of resolved.

share|improve this answer

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1063354

Pretty major bug in the wild where the HD becomes read-only. It's not your HD.

share|improve this answer
    
While this bug is worth mentioning, there is no reason to assume that this bug is what was causing the problem. –  Eric Lambart Oct 28 '13 at 23:08

you can run restarting your pc, as this error comes due to improper mounting, unmountiong of the file system. While restarting system will ask to fix and press f, there aftre the problem should be solved

share|improve this answer

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.