Why has my file-system turned read-only after updates?

107,975

Solution 1

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

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

Solution 3

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

Solution 4

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:
107,975

Related videos on Youtube

Thibault
Author by

Thibault

I'm a music education major at Shepherd University. I couldn't stand the limitations that OSX/Windows gave me, so I made the switch to Linux. Started out with Ubuntu 11.04, survived up until 12.04, and after my system crash as I upgraded to 12.10, I decided to switch to Arch Linux as my default distro. IRC: ryanmcclure

Updated on September 18, 2022

Comments

  • Thibault
    Thibault about 1 year

    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?

    • Nitin Venkatesh
      Nitin Venkatesh over 11 years
      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?
    • Thibault
      Thibault over 11 years
      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.
    • Thibault
      Thibault over 11 years
      I'm to the point now that when it switches to read-only, no program will run at all.
    • user3179505
      user3179505 over 11 years
      Can it run a program when you do not use sudo?
    • Tachyons
      Tachyons over 11 years
      Have you any other accounts in your system ? Tried this from all? Are you accidentally removed from sudo group?
    • Admin
      Admin over 11 years
      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.
    • KansaiRobot
      KansaiRobot over 2 years
      This is something unexpected that happened to me too. It prevented me from doing a lot of things. kinda of major bug
  • Thibault
    Thibault over 11 years
    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?
  • Mike
    Mike over 11 years
    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.)
  • Thibault
    Thibault over 11 years
    I just reinstalled everything and so far its going ok. Thank you all for the help, you all rock!
  • WitchCraft
    WitchCraft about 10 years
    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...
  • Lambart
    Lambart about 10 years
    While this bug is worth mentioning, there is no reason to assume that this bug is what was causing the problem.
  • user391339
    user391339 almost 9 years
    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
    user391339 almost 9 years
    fsck gives me: Error reading block 196831 (Attempt to read block from filesystem resulted in short read). Ignore error<y>? yes Force rewrite<y>? yes yError reading block 196832 (Attempt to read block from filesystem resulted in short read). Ignore error<y>? yes Force rewrite<y>? yes Error reading block 196833 (Attempt to read block from filesystem resulted in short read). Ignore error<y>? yes Force rewrite<y>? yes yError reading block 196834 (Attempt to read block from filesystem resulted in short read). Ignore error<y>? yes .....
  • user391339
    user391339 almost 9 years
    what if this happened to your root filesystem?