How to fix "sudo: unable to open ... Read-only file system"?
The filesystem will usually go into read-only while the system is running if there is a filesystem consistency issue. This is specified in fstab
as errors=remount-ro
and will occur when a FS access fails or an emergency read-only remount is requested via Alt+SysRq+U. You can run:
sudo fsck -Af -M
to force a check of all filesystems. As one of the other answers states, looking at dmesg
is also very helpful.
Edit: Don't forget the -M
on the command-line.
NOTE: As mentioned by Bibhas in his answer: If fsck
gets stuck after its version banner:
$ sudo fsck -Af -M
fsck from util-linux 2.20.1
you may want to try using the EXT4-specific fsck
$ sudo fsck.ext4 -f /dev/sda1
Provided the partition in question /dev/sda1
was an ext4 filesystem.
The answer by hexafraction didn't work for me. Every time I tried executing sudo fsck -Af -M
it just showed
$ sudo fsck -Af -M
fsck from util-linux 2.20.1
and nothing else. No error or anything. For me, booting into a live disc and executing this worked -
sudo fsck.ext4 -f /dev/sda1
Provided the partition in question /dev/sda1
was an ext4 filesystem.
Here is the command that solved my problem :
mount -o remount /
better than a reboot or sudo fsck -Af