How to fix read-only file-system on 18.04

120,134

Solution 1

I know there's a good answer out there, but I'm having trouble finding it right at the moment.

Your system has by default, a line in /etc/fstab which indicates that if there is an error in the file system, that it should go into read-only mode, to prevent further corruption or dataloss.

The way to fix this, is to boot from a live USB, open a terminal window and use the command

sudo fsck -f /dev/sdxx

where "sdxx" is the partition of the hard drive that Linux resides on. You could use lsblk to determine the partition name, if you don't know it.

You could also copy your data to a backup hard drive before performing the disk check - the live USB should allow you to mount both your USB backup disk, and the partition that is having the problem (in read-only mode).

Solution 2

Go to the terminal and enter the following command and read-only problems in Ubuntu 18.04 LTS will be gone:

sudo ntfsfix /dev/your_drive

Don't forget to unmount the read-only drives and restart Ubuntu. Your drive addresses can be found by using:

sudo fdisk -l

Solution 3

Normally the mounted disk filesystem becomes read-only when the server or pc is not shutdown correctly. I had the same issue with my ubuntu server. I ran the following command to run fsck and it fixed it.

sudo fsck.ext4 -f /dev/sda1

You have to press y for everything and reboot after its done. and it works.

Solution 4

Let the Computer shut properly, mine had taken around 15 minutes to properly shutdown after the read only file system error. Then use sudo fsck.ext4 -f /dev/sda6 and reboot. This worked for me.

Share:
120,134

Related videos on Youtube

Kaleb
Author by

Kaleb

Updated on September 18, 2022

Comments

  • Kaleb
    Kaleb over 1 year

    Today, after several uninterrupted weeks of happily using my Ubuntu machine again, I ran into another error, this time just after okaying a typical software update. Instead of giving me a successful package installation message, it gave me some sort of notification that "the daemon that allows installation is not working". I can't remember if that was exactly it or not, but I hit "ok" and the box went away. Strange I thought.

    Suspecting something was up, I immediately hooked up my external drive to make a backup -- but my drive wouldn't mount. It was visible in Nautilus, but when I clicked on it, it said: enter image description here

    So apparently my file system has up and decided to go read-only. Is there a way to fix this, or must I purchase a new hard drive and start over? Is there a way to somehow mount my external drive and backup my data first? Can this somehow be fixed using fsck, a command I don't know about?

    My system is set up with my / Ubuntu partition on a 250GB SSD, and my /home on a separate 500GB HDD. I believe the problem must be with my / drive, since I can still edit and save anything in my home directory as normal. I seem to be unable to edit anything on the / drive though, like install software or mount drives. Here is a screenshot of the errors I got when trying to make a backup using Aptik: enter image description here

    I'm still new to computers so am rather clueless here. Any help would be really appreciated.

  • Kaleb
    Kaleb about 5 years
    Thanks for the advice. I will definitely try this as soon as possible. One question though, since I like to know some of what a command does: What exactly is the purpose of the -f and what does it do?
  • Charles Green
    Charles Green about 5 years
    ext4 writes data to the superblock on shutdown, and may erroneously write that the disk is OK. the -f option informs fsck to check the disk, even if the superblock indicates that the disk is good. fsck on an ext4 system will call e2fsck, so you can research the options with man e2fsck
  • Asis Datta
    Asis Datta about 4 years
    This solution worked correctly for me.
  • user838494
    user838494 about 4 years
    This works for me, but there is no need to restart Ubuntu. Just remounting the drive is suffice.
  • xdola
    xdola about 3 years
    Works also if ntfsfix gives error. The trick is to reboot and boot on Windows, that will check and correct his sh*t
  • prismspecs
    prismspecs about 3 years
    similarly, this gave me an error but I was able to repair via Windows