Permanent GRUB edit from RO to RW

I recently installed the latest version of UBUNTU onto my laptop and having a slight issue during boot-up.

During boot up I get the following error:

Serious errors were found while checking the disk drive for /.

After doing some research on here, I have been able to fix the problem and get UBUNTU to boot just fine after I go into GRUB boot entry and RO to RW. For example;

RO:

linux   /boot/vmlinuz-3.13.0-24-generic root=UUID=AAC884AC1F144321 loop=/ubuntu/disks/root.disk **ro**   quiet splash $vt_handoff

RW:

linux   /boot/vmlinuz-3.13.0-24-generic root=UUID=AAC884AC1F144321 loop=/ubuntu/disks/root.disk **rw**   quiet splash $vt_handoff

How can I permanently edit this, so that I no longer after edit this EVERY time I boot-up. I greatly appreciate any help. I am a total noob with this OS!


Solution 1:

To answer your question literally: edit /etc/grub.d/10_linux and change ro to rw, then run sudo update-grub. This regenerates the file /boot/grub/grub.cfg which is used at boot time.

But don't do this! ro is the right setting. Changing ro to rw cannot help. Your problem was not solved by changing the boot option, it was solved by running fsck. Now that this is done, the filesystem is usable again.

Filesystem corruption isn't supposed to happen. You should look for the cause of the corruption. This could be a memory problem; run a memory test (select “memory test” at the Grub prompt and leave it running for at least one full pass, e.g. overnight).

Solution 2:

You do not want to edit your GRUB to permanently change ro to rw. You will render some of your recovery options inoperable. If you ever need one of them you might run into problems. A better approach is to edit the /usr/share/initramfs-tools/scripts/local file and modify a line in that file. If you have changed your 10_lupin or 10_linux files, you will need to revert your changes before doing what follows.

  1. Open in your favorite editor as root superuser your /usr/share/initramfs-tools/scripts/local file. Look for the line that reads as follows:

    mount ${roflag} -o loop -t ${FSTYPE} ${LOOPFLAGS} "/host/${LOOP#/}" ${rootmnt}
    
  2. Comment out that line and add the following three lines below that line (make sure they line up with the above line you have commented out):

    loopdev=`losetup -f`
    losetup ${loopdev} "/host/${LOOP#/}"
    mount ${roflag} -t ${FSTYPE} ${LOOPFLAGS} ${loopdev} ${rootmnt}
    
  3. Save the file and run in a terminal:

    sudo update-grub
    

After that, you can reboot your system and you should be good to go whenever kernel updates come around, and you will be able to use recovery options as they should be used. Make sure to make a backup of the edited file in case an upgrade removes your changes. That way, if an upgrade manages to break your changes, you can copy the modified lines in the backed up file and place them in the proper location.