20

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?

7
  • 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? Feb 20, 2012 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. Feb 20, 2012 at 3:28
  • I'm to the point now that when it switches to read-only, no program will run at all. Feb 20, 2012 at 7:36
  • Can it run a program when you do not use sudo? Feb 20, 2012 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.
    – user69971
    Jun 11, 2012 at 18:24

4 Answers 4

21

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

6
  • 1
    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? Feb 20, 2012 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, 2012 at 9:59
  • I just reinstalled everything and so far its going ok. Thank you all for the help, you all rock! Feb 21, 2012 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, 2013 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?
    – user391339
    Dec 20, 2014 at 0:52
2

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.

1
  • what if this happened to your root filesystem?
    – user391339
    Dec 20, 2014 at 1:09
2

You can restart your PC, as this error comes due to improper mounting, unmounting of the file system. While restarting, system will ask to fix and press f, there after the problem should be solved.

1
  • These days, the reboot will usually automatically fix the drive as required without you having to hit any key. But that was indeed enough for me. Simply rebooting. In my case, it happened in all my virtualbox systems because the host was writing to disk for like 10 min. straight blocking all I/O in the VMs. Aug 5, 2022 at 18:15
1

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.

1
  • 2
    While this bug is worth mentioning, there is no reason to assume that this bug is what was causing the problem.
    – Lambart
    Oct 28, 2013 at 23:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .