Permanent GRUB edit from RO to RW

19,306

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.

Share:
19,306

Related videos on Youtube

user282940
Author by

user282940

Updated on September 18, 2022

Comments

  • user282940
    user282940 over 1 year

    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!

    • Nehal J Wani
      Nehal J Wani almost 10 years
      /boot/grub/grub.conf or /boot/grub2/grub.cfg whichever exists.
  • user282940
    user282940 almost 10 years
    Thank you for your help! So you are saying not to change ro to rw? Instead, run the memory test? I just want to clarify.
  • h3.
    h3. over 9 years
    @jaia Is what a documented bug? You did what? I do confirm that the Grub line should contain ro, not rw.
  • jaia
    jaia over 9 years
    The problem the OP reports is fairly common with 14.04 and changing ro to rw is a useful workaround. bugs.launchpad.net/wubi/+bug/1313396 There's no filesystem corruption involved.
  • DarrenRhodes
    DarrenRhodes almost 9 years
    @d-charles-pyle What does, " If you have changed your 10_lupin or 10_linux files, you will need to revert your changes before doing what follows." mean? (Can you elaborate, please?)
  • D. Charles Pyle
    D. Charles Pyle almost 9 years
    The two files I mentioned (located in /etc/grub.d) are the ones wherein a change is made that won't be overwritten the next time you run update-grub or every time you have a kernel update. If you leave the ro as rw in your grub.cfg file, you will have errors and recovery failures crop up when you try to use some of the recovery options in future, as you will if the two files mentioned above are edited. Try running in recovery mode and using some of those options and you will see what I mean. If you do as I have suggested above, you get no errors and no issues booting.
  • D. Charles Pyle
    D. Charles Pyle about 8 years
    Sorry, for some reason did not see the notification for this question. If you changed your two files mentioned above, you would need to revert them to their previous state before editing and following my answer for the above issue. It also should be noted that you should make a backup of the file actually needing editing. A recent update to 14.04.4 from 14.04.3 actually broke this again, requiring my re-editing the file.