Ubuntu goes into read-only mode randomly

Solution 1:

The Issue

The reason it randomly switches to read-only is that if the kernel detects a filesystem error, it immediately switches to read-only mode to prevent further trashing the disk. (That is, the problem isn't with the hard disk itself, but with the filesystem on the hard drive.) If you continue using such a corrupted filesystem, it will only get worse, not better. The easiest way to fix it is to use a live CD/DVD; the Ubuntu install disk will do.

The Fix

It goes without saying, but step zero is, Ensure you have a backup of vital data.

  1. Boot your computer from the live disk.
  2. The easiest way to perform these operations is in the terminal, so go ahead and open one with Ctrl-Alt-T.
  3. Run sudo blkid to get a list of all the block devices on the computer. You are looking for the partition you installed Ubuntu to; it will likely be /dev/sdaX, where X is some number. If you have absolutely no idea which one it is, it will likely be the only one formatted as ext3 or ext4 (TYPE="ext4").
  4. Run sudo umount <your partition> to ensure the partition is unmounted; the filesystem checker will refuse to operate on a mounted disk.
  5. Run sudo fsck -Cy <your partition>. The -C option displays a progress bar and is entirely for show. -y tells fsck to go ahead and fix everything it finds. If it comes back with errors, use your best judgement, or post them here and I'll look at them.
  6. Reboot; hopefully, you're done! If you'd like, you can run fsck more than once to ensure that it really did fix everything.