3

I updated Ubuntu Desktop(although I'm using it as a server) from 14.04 to 16.04 on ssh. After completion and rebooting, it boots into read-only file system.

root@Server:/# touch a
touch: cannot touch 'a': Read-only file system

I tried mount -o remount,rw /, but the output is mount: can't find UUID=/dev/sda1. I think UUID is somehow changed to /dev/sda1. This is the contents of /etc/fstab.

root@Server:/# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=/dev/sda1 /               ext4    errors=remount-ro 0       1
# UUID=643d9cab-177e-4eee-a52f-224ebf0bc405 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=481bc70a-eb80-4040-93a1-696c46faa638 none            swap    sw              0       0

I think I should comment the line UUID=/dev/sda1 and uncomment the line UUID=643d9cab-... right below, but because the root file system was mounted as read-only, I couldn't. I don't know if this would help, but here's a part of kernel message.

root@KrootServer:/# dmesg|grep mount
[    1.794106] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[    5.675605] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[   19.677056] cgroup: new mount options do not match the existing superblock, will be ignored

So how do I fix this problem? I'm trying to fix the problem on ssh, so let me know if I need to physically access the machine.

[+] result of sudo blkid

ian0371@Server:~$ sudo blkid
/dev/sda1: UUID="643d9cab-177e-4eee-a52f-224ebf0bc405" TYPE="ext4" PARTUUID="0000e118-01"
/dev/sda5: UUID="481bc70a-eb80-4040-93a1-696c46faa638" TYPE="swap" PARTUUID="0000e118-05"`
  • Post the result of sudo blkid, as I find it odd that you have two entries for /, this show the UUID of all your devices – George Udosen Jan 26 '17 at 17:59
  • @George I appended the result of sudo blkid. I think /dev/sda1 is commented while upgrading ubuntu. – Ian Song Jan 28 '17 at 14:53
  • So now we know that which is which, boot into recovery mode and mount your file system like this mount -o remount,rw / then comment out the UUID=/dev/sda1 / ext4 errors=remount-ro 0 1 part and umcomment the one under, then reboot normally and lets see if it corrects. Note no spaces between remount,rw! – George Udosen Jan 28 '17 at 15:59

3 Answers3

5

I had the same problem when booting into a copied root filesystem (I forgot to adjust UUID values in /etc/fstab). It turns out mount -o remount still looks in /etc/fstab if you don't specify a device. It worked when manually specifying a device:

mount -o remount,rw /dev/sda1 /
Arne
  • 151
3

Now lets try this fix:

  1. Boot into recovery mode
  2. Select root from recovery menu.
  3. Mount file system with:

    mount -o remount,rw /
    
  4. Using vim or nano change your /etc/fstab like so:

    #UUID=/dev/sda1 /               ext4    errors=remount-ro 0       1
    UUID=643d9cab-177e-4eee-a52f-224ebf0bc405 /               ext4    errors=remount-ro 0       1
    
  5. Then exit and select resume from recovery menu, that should fix your issue.

George Udosen
  • 36,677
  • I finally could access the server and manage to boot into recovery mode. Even in recovery mode "mount" command failed for the same reason. I finally managed to fix the problem by fixing grub script, where it said "ro" and changed it to "rw". – Ian Song Feb 22 '17 at 05:41
  • 1
    If there is an error in etc/fstab (e.g. wrong UUID) the command mount -o remount,rw / fails. – Luís de Sousa Aug 01 '18 at 09:01
  • @IanSong I was STUCK for HOURS and you helped me with the solution. However, it's worth mentioning that you have to replace the whole errors=remount-ro with rw to have access, not just changing the last o to w as you suggested. See here the list of options to the 4th column – testing_22 Oct 26 '21 at 02:32
1

There is something wrong in your /etc/fstab.

UUID=/dev/sda1 /               ext4    errors=remount-ro 0       1
# UUID=643d9cab-177e-4eee-a52f-224ebf0bc405 /               ext4    errors=remount-ro 0 

THe first line is wrong, /dev/sda1 isn't a uuid. The second line looks like the correct one. Put a # in front of the first line, and remove it on the line below.

You can verify the UUID by blkid /dev/sda1 .. if it differs, change the one in /etc/fstab so that it matches.

OR you can remove the UUID= in front of /dev/sda1

Soren A
  • 6,799