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.

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?
–
nitstormFeb 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 McClureFeb 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 McClureFeb 20 '12 at 7:36

Can it run a program when you do not use sudo?
–
Elvis StressborgFeb 20 '12 at 8:01

1

I do not agree that this problem is associated with a failing hard drive. I have had this happen to me to on both my internal hard drive, which is not failing, and USB thumbsticks. I say it is a bug. I experience the problem usually after a write operation involving a large file or copy of many files at once. The filesystem mysteriously becomes read-only and you cannot to anything until after you reboot.
–
user69971Jun 11 '12 at 18:24

4 Answers
4

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).

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 McClureFeb 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.)
–
MikeFeb 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 McClureFeb 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...
–
WitchCraftAug 10 '13 at 12:21

can someone elaborate further on this answer? reinstalling everything is not an option for everyone. what do you do to turn it back to read-write?
–
user391339Dec 20 '14 at 0:52

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.

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.

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