Results 1 to 9 of 9

Thread: fixing grub2

  1. #1
    Join Date
    May 2007
    Location
    West Indies
    Beans
    497
    Distro
    Ubuntu

    fixing grub2

    I can’t boot into Ubuntu. I made some changes to /etc/default/grub and now grub2 hangs at startup.

    Code:
    text is deprecated. Use set gfxpayload=vga=text before linux command instead
    error: unrecognized number
    error: you need to load the kernel first
    Even though I backed up the original file before making any changes, I can’t seem to restore the original. You people would be right to suspect that I am simply not using update-grub after making changes to /etc/default/grub in my live environment. I can assure you that I have tried that, but it didn’t update my grub file. I googled around and stumbled upon this guide for chroot’ing into my root directory and then entering update-grub. The guide at one point instructs to enter this command:

    Code:
    sudo mount /dev/sdYY /mnt/boot
    I’m smart enough to enter ‘/dev/sda1’ and not ‘/dev/sdaYY’.

    Unfortunately I am not smart enough to figure out what the solution is on my own.

    Here is my boot-repair log file for troubleshooting this problem I am experiencing.

    I am running 64bit Ubuntu 12.10 Quantal.
    My rig:
    IBM Personal System/2 Model 30-286 - - Intel 80286 (16 bit) 10 Mhz - - 1MB DRAM - - Integrated VGA Display adapter
    1.44MB capacity Floppy Disk - - PS/2 keyboard (no mouse)

  2. #2
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: fixing grub2

    Some examples of chrooting:
    To chroot, you need the same 32bit or 64 bit kernel. Best to use same version.
    https://help.ubuntu.com/community/BasicChroot
    drs305 chroot to purge & reinstall grub2
    http://ubuntuforums.org/showthread.php?t=1581099
    kansasnoob- full chroot one line version with &&---- change sda3 to your install
    http://ubuntuforums.org/showpost.php...2&postcount=10
    http://ubuntuforums.org/showthread.php?t=1470597


    But can you not use liveCD and manually edit grub.cfg (the file we do not edit)? You may be an exception.
    You just need to edit out the problem so you can boot and then run fixes.

    If install is in sda5 or change to your partition.
    mount /dev/sda5 /mnt
    gksu gedit /mnt/boot/grub/grub.cfg
    #May have to do this first as it is write protected also:
    sudo chmod +w /mnt/boot/grub/grub.cfg
    #Or even this first:
    sudo chmod 777 /mnt/boot/grub/grub.cfg
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  3. #3
    Join Date
    Apr 2011
    Location
    3rd Rock from the Sun
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: fixing grub2

    I once had a similar issue. I knew I had to chroot from Ubuntu LiveDVD/USB and I was all set to go for it, just when I got an idea. From my LiveUSB I mounted my Ubuntu "/" partition by just clicking on it from launcher. Then I opened Nautilus/"FILES" with sudo, I guess and replaced my backup grub file in the appropriate directory and rebooted. And guess what, it worked. No update-grub, nothing.

    I just can't remember whether I used Sudo or root to open nautilus... I hope you can figure it out.

    My two cents...
    "Evolution is Nature's way of issuing upgrades."


  4. #4
    Join Date
    Nov 2009
    Location
    Catalunya, Spain
    Beans
    14,560
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: fixing grub2

    When chroot-ing you mount a partition at /mnt/boot ONLY if you have a separate /boot partition in your installation. if you don't, skip that line (command).
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 18.04 LTS 64bit

  5. #5
    Join Date
    May 2007
    Location
    West Indies
    Beans
    497
    Distro
    Ubuntu

    Re: fixing grub2

    Quote Originally Posted by darkod View Post
    When chroot-ing you mount a partition at /mnt/boot ONLY if you have a separate /boot partition in your installation. if you don't, skip that line (command).
    Thanks, darkod, for the tip. I overlooked the part of the instructions in the guide which said that I only need to mount /boot separately if I have a separate parition. I kept this in mind as I loaded my chroot live environment moments ago.

    Quote Originally Posted by fantab View Post
    I once had a similar issue. I knew I had to chroot from Ubuntu LiveDVD/USB and I was all set to go for it, just when I got an idea. From my LiveUSB I mounted my Ubuntu "/" partition by just clicking on it from launcher. Then I opened Nautilus/"FILES" with sudo, I guess and replaced my backup grub file in the appropriate directory and rebooted. And guess what, it worked. No update-grub, nothing.

    I just can't remember whether I used Sudo or root to open nautilus... I hope you can figure it out.

    My two cents...
    Up to this point I haven’t tried this yet. I am trying this now. Here is the output of my commands:

    Code:
    ubuntu@ubuntu:/mnt/etc/default$ sudo rm grub
    
    ubuntu@ubuntu:/mnt/etc/default$ cp grub.bak29April2013 grub
    
    cp: cannot create regular file `grub': Permission denied
    
    ubuntu@ubuntu:/mnt/etc/default$ sudo cp grub.bak29April2013 grub
    
    ubuntu@ubuntu:/mnt/etc/default$ grub-install --recheck /dev/sda
    
    mkdir: cannot create directory `/boot/grub/i386-pc': Permission denied
    
    ubuntu@ubuntu:/mnt/etc/default$ sudo grub-install --recheck /dev/sda
    
    Path `/boot/grub' is not readable by GRUB on boot. Installation is impossible. Aborting.
    
    ubuntu@ubuntu:/mnt/etc/default$
    That last line saying that installation is impossible is strange. This is the first time I encountered it. Here is one further command and it’s output:

    Code:
    ubuntu@ubuntu:/mnt/etc/default$ sudo update-grub
    
    /usr/sbin/grub-probe: error: failed to get canonical path of /cow.
    
    ubuntu@ubuntu:/mnt/etc/default$
    Again, this is strange. What is this error message saying? I googled it and discovered that it has something to do with my chroot.

    I hope this works. I am rebooting now. If restoring the original grub file doesn’t solve my problem, then I will be back to try some of the things oldfred shared.
    My rig:
    IBM Personal System/2 Model 30-286 - - Intel 80286 (16 bit) 10 Mhz - - 1MB DRAM - - Integrated VGA Display adapter
    1.44MB capacity Floppy Disk - - PS/2 keyboard (no mouse)

  6. #6
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: fixing grub2

    Because you are at ubuntu@ubuntu you are in your liveCD. You can mount a partition or use Nautilus(maybe gksudo?) to browse or edit files in your install.

    But if you run a command to update system it still it trying to update liveCD not your install. You have to have done the full chroot (CHange ROOT) so that commands are really done on your install just using the liveCD kernel.
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  7. #7
    Join Date
    May 2007
    Location
    West Indies
    Beans
    497
    Distro
    Ubuntu

    Re: fixing grub2

    Quote Originally Posted by oldfred View Post
    Because you are at ubuntu@ubuntu you are in your liveCD. You can mount a partition or use Nautilus(maybe gksudo?) to browse or edit files in your install.

    But if you run a command to update system it still it trying to update liveCD not your install. You have to have done the full chroot (CHange ROOT) so that commands are really done on your install just using the liveCD kernel.
    Yes, I learned about that upon following the guide that you linked to in your initial post (the guide by drs305). Following that guide solved my problem. I am writing this post now from my native Quantal install.

    Thank you fantab, darkod and oldfred for your contributions.
    My rig:
    IBM Personal System/2 Model 30-286 - - Intel 80286 (16 bit) 10 Mhz - - 1MB DRAM - - Integrated VGA Display adapter
    1.44MB capacity Floppy Disk - - PS/2 keyboard (no mouse)

  8. #8
    Join Date
    Nov 2009
    Location
    Catalunya, Spain
    Beans
    14,560
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: fixing grub2

    You don't seem to be in the chroot, I don't think the prompt should say ubuntu@ubuntu. Or maybe I'm wrong.

    Are you sure you executed:
    sudo chroot /mnt

    after mounting all you needed to mount to prepare for chroot?

    And once you are inside chroot, you don't need sudo, you are inside as root. From the above output it looks to me like you are trying to work in /mnt/etc/default but from outside the chroot.

    And don't hurry using rm, you can make big problems with that.

    Make sure you are inside the chroot, that's the first thing to keep an eye on.

    PS. I was too late typing all this.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 18.04 LTS 64bit

  9. #9
    Join Date
    Apr 2011
    Location
    3rd Rock from the Sun
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: fixing grub2

    I am glad you resolved your issue.
    I have just booted with LiveUSB to double check what I suggested. This will work for simple file replacements or edits.
    Its quite simple but still 'chroot' is the recommended method. However, give the following a shot from Ubuntu LiveDVD/USB:

    1. from the Launcher mount the partition which has your BACKUP Grub file by just clicking on it.
    2. then mount the your "/" partition by just clicking on it.
    3. Open Termianal:

    ubuntu@ubuntu:~$ sudo -i
    root@ubuntu:~# nautilus

    Navigate yourself to /etc/default
    just drag the Backed up Grub folder/file from whereever it is and replace in /etc/default.
    close all nautilus windows.

    root@ubuntu:~# exit

    or

    ubuntu@ubuntu:~$ sudo -i
    root@ubuntu:~# cp /etc/default/grub /etc/default/grub.bak
    root@ubuntu:~# cp /path/to/backedup/grub /etc/default
    root@ubuntu:~# exit

    Reboot.
    Last edited by fantab; May 3rd, 2013 at 03:26 AM.
    "Evolution is Nature's way of issuing upgrades."


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •