Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

The title might not be as descriptive as I would like it to be but couldn't come up with a better one.

My server's file system went into Read-only. And I don't understand why it does so and how to solve it.

I can SSH into the server and when trying to start apache2 for example I get the following :

username@srv1:~$ sudo service apache2 start
[sudo] password for username:
sudo: unable to open /var/lib/sudo/username/1: Read-only file system
 * Starting web server apache2                                                                                                                                                                                                               (30)Read-only file system: apache2: could not open error log file /var/log/apache2/error.log.
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.

When I try restarting the server I get :

username@srv1:~$ sudo shutdown -r now
[sudo] password for username:
sudo: unable to open /var/lib/sudo/username/1: Read-only file system

Once I restart it manually it just start up without any warning or message saying something is wrong.

I hope somebody could point me into the right direction to resolve this issue.

share|improve this question
add comment

6 Answers

up vote 13 down vote accepted

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.

share|improve this answer
I think you should not force a filesystem check on other r/w mounted filesystems. That will potentially corrupt your data. Add the -M option to skip mounted filesystems. (-M Do not check mounted filesystems and return an exit code of 0 for mounted filesystems. from FSCK(8)) –  gertvdijk Jun 24 '13 at 18:35
This doesn't help, I just get the same error when trying to run that command. sudo: unable to open /var/lib/sudo/kuplack/1: Read-only file system fsck from util-linux 2.20.1 –  Mark Kramer Dec 8 '13 at 21:47
add comment

Here is the command that solved my problem :

mount -o remount /

better than a reboot or sudo fsck -Af

share|improve this answer
Not better if the OS made your disk read-only to prevent possible corruption. –  Drew Noakes Feb 11 '13 at 17:24
Not only that - only root will be able to remount the filesystem and sudo isn't going to work if the filesystem is read-only. –  Nathan Osman Aug 30 '13 at 7:21
Doesn't help, I just get the same message: sudo: unable to open /var/lib/sudo/kuplack/1: Read-only file system mount: cannot remount block device /dev/sda2 read-write, is write-protected –  Mark Kramer Dec 8 '13 at 21:49
add comment

Usually linux puts your filesystems in read only when errors occur, especially errors with the disk or the filesystem itself, errors like a wrong journal entry for example.

You better check your dmesg for disk related errors.

Google is full of discussion about this and you can pick the ones that is closer to your configuration, but a look at dmesg is usually enough.

share|improve this answer
What should one look at / grep for in dmesg output? –  isomorphismes Mar 8 '13 at 23:47
Unfortunately if you opted to encrypt your home folder, dmesg is bound to be full of useless errors from ecryptfs. –  Nathan Osman Aug 30 '13 at 7:22
add comment

Try running dmesg | grep "EXT4-fs error" to see if you have any issues related to the filesystem / journaling system itself. I would recommend you to restart your system, then. Also, sudo fsck -Af answer by ObsessiveSSOℲ won't hurt.

share|improve this answer
add comment

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 -

sudp fsck.ext4 -f /dev/sda1

Provided, my troubling partition in question was /dev/sda1 and it had an ext4 filesystem.

share|improve this answer
add comment

see UPDATE at end of post

after installing 12.04, Recovery Menu reports state of file system(fs) as read-only(ro). also, while in that menu, usb keyboard and usb mouse do not work—cursor is frozen at center of screen.

memtest86 reported failed address worth 100 bits at 003f8387550, so I added GRUB_BADRAM="0x003f8387550" to gedit /etc/default/grub then ran update-grub and saw badram 0x003f8387550 in /boot/grub/grub.cfg. does my 0x003f8387550 hack seem correct?

also added GRUB_PRELOAD_MODULES="usb usb_keyboard usb_mouse" to gedit /etc/default/grub then ran update-grub but nothing showed up anywhere in /boot/grub/grub.cfg

would like to get usb keyboard and mouse running in 12.04

installed 10.10 with expired support, but have internet access. is it possible that smaller footprint of 10.10 fell short of bad mem address?

fsck -Af reported: 0.1% of fs is non-contiguous. does non-contiguous mean the same thing as fragmented?

after mount -o remount /, fs state remained ro.

dmesg dumped a ton of info, so I am unsure what to look for, but did see EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro,commit=0 which probably applies to 12.04, since 10.10 fs does not remount into ro mode.


  • ACPI: resource piix4_smbus [io 0x0b00-0x0b07] conflicts with ACPI region SOR1 [io 0x0b00-0x0b0f pref window]
  • ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
  • EDAC MC: Ver: 2.1.0 Sep 19 2010
  • lp: driver loaded but no devices found
  • EDAC amd64_edac: Ver: 3.3.0 Sep 19 2010
  • EDAC amd64: This node reports that Memory ECC is currently disabled, set F3x44[22] (0000:00:18.3)
  • EDAC amd64: ECC disabled in the BIOS or no ECC capability, module will not load
  • Either enable ECC checking or force module loading by setting 'ecc_enable_override'
  • (Note that use of the override may cause unknown side effects.)
  • amd64_edac: probe of 0000:00:18.2 failed with error -22

should I enable Memory ECC?

before ordering new RAM sticks, I would like to ninja 12.04 or 12.10 into full blown functionality—there's a lot to learn!


found the problem! somehow my installation media(flash drive) was corrupted, so—among other things—my operating system partition was being formatted to msdos. after installing 12.04 AMD64 LTS from a CD instead, Ubuntu runs like a champ, and I learned a lot along the way.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.