Results 1 to 5 of 5

Thread: Grub install failed, how to add new Ubuntu install?

  1. #1
    Join Date
    Aug 2012
    Beans
    31

    Grub install failed, how to add new Ubuntu install?

    I just installed a fresh Ubuntu (12.04 I think, currently running 10.04) onto a new partition (formatted with btrfs) but the end of the installation gave me a Grub could not be installed error. So I went about adding it manually using this guide:

    http://linuxnorth.wordpress.com/2011...ub2-revisited/

    which involves editing the grub.cfg via the 40_custom file and running update-grub. After running said command, the update works but only adds everything but my new install, leaving me with an identical grub.cfg as before. My custom grub cfg (has the new install added under 10_linux, I've highlighted the two lines in bold for your convinience).

    #!/bin/sh
    exec tail -n +3 $0
    # This file provides an easy way to add custom menu entries. Simply type the
    # menu entries you want to add after this comment. Be careful not to change
    # the 'exec tail' line above.

    #
    # DO NOT EDIT THIS FILE
    #
    # It is automatically generated by /usr/sbin/grub-mkconfig using templates
    # from /etc/grub.d and settings from /etc/default/grub
    #

    ### BEGIN /etc/grub.d/00_header ###
    if [ -s $prefix/grubenv ]; then
    load_env
    fi
    set default="0"
    if [ ${prev_saved_entry} ]; then
    set saved_entry=${prev_saved_entry}
    save_env saved_entry
    set prev_saved_entry=
    save_env prev_saved_entry
    set boot_once=true
    fi

    function savedefault {
    if [ -z ${boot_once} ]; then
    saved_entry=${chosen}
    save_env saved_entry
    fi
    }

    function recordfail {
    set recordfail=1
    if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
    }
    insmod ext2
    set root='(hd2,6)'
    search --no-floppy --fs-uuid --set fbce1d20-f04d-4d6b-a327-4df782e831f9
    if loadfont /usr/share/grub/unicode.pf2 ; then
    set gfxmode=640x480
    insmod gfxterm
    insmod vbe
    if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
    fi
    fi
    insmod ext2
    set root='(hd2,6)'
    search --no-floppy --fs-uuid --set fbce1d20-f04d-4d6b-a327-4df782e831f9
    set locale_dir=($root)/boot/grub/locale
    set lang=en
    insmod gettext
    if [ ${recordfail} = 1 ]; then
    set timeout=-1
    else
    set timeout=10
    fi
    ### END /etc/grub.d/00_header ###

    ### BEGIN /etc/grub.d/05_debian_theme ###
    set menu_color_normal=white/black
    set menu_color_highlight=black/light-gray
    ### END /etc/grub.d/05_debian_theme ###

    ### BEGIN /etc/grub.d/10_linux ###
    menuentry 'Ubuntu, with Linux 2.6.32-38-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod ext2
    set root='(hd2,6)'
    search --no-floppy --fs-uuid --set fbce1d20-f04d-4d6b-a327-4df782e831f9
    linux /boot/vmlinuz-2.6.32-38-generic root=UUID=fbce1d20-f04d-4d6b-a327-4df782e831f9 ro quiet splash
    initrd /boot/initrd.img-2.6.32-38-generic
    }
    menuentry 'Ubuntu, with Linux 2.6.32-38-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod ext2
    set root='(hd2,6)'
    search --no-floppy --fs-uuid --set fbce1d20-f04d-4d6b-a327-4df782e831f9
    echo 'Loading Linux 2.6.32-38-generic ...'
    linux /boot/vmlinuz-2.6.32-38-generic root=UUID=fbce1d20-f04d-4d6b-a327-4df782e831f9 ro single
    echo 'Loading initial ramdisk ...'
    initrd /boot/initrd.img-2.6.32-38-generic
    }
    menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod btrfs
    set root='(hd2,9)'
    search --no-floppy --fs-uuid --set 3ef7127d-733b-4e0f-9a81-d9fe74bfd4fd
    linux /boot/vmlinuz-3.2.0-29-generic root=UUID=3ef7127d-733b-4e0f-9a81-d9fe74bfd4fd ro quiet splash
    initrd /boot/initrd.img-3.2.0-29-generic
    }
    ### END /etc/grub.d/10_linux ###

    ### BEGIN /etc/grub.d/20_memtest86+ ###
    menuentry "Memory test (memtest86+)" {
    insmod ext2
    set root='(hd2,6)'
    search --no-floppy --fs-uuid --set fbce1d20-f04d-4d6b-a327-4df782e831f9
    linux16 /boot/memtest86+.bin
    }
    menuentry "Memory test (memtest86+, serial console 115200)" {
    insmod ext2
    set root='(hd2,6)'
    search --no-floppy --fs-uuid --set fbce1d20-f04d-4d6b-a327-4df782e831f9
    linux16 /boot/memtest86+.bin console=ttyS0,115200n8
    }
    ### END /etc/grub.d/20_memtest86+ ###

    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry "Windows 7 (loader) (on /dev/sdc1)" {
    insmod fat
    set root='(hd2,1)'
    search --no-floppy --fs-uuid --set cca9-0618
    chainloader +1
    }
    ### END /etc/grub.d/30_os-prober ###

    ### BEGIN /etc/grub.d/40_custom ###
    # This file provides an easy way to add custom menu entries. Simply type the
    # menu entries you want to add after this comment. Be careful not to change
    # the 'exec tail' line above.
    ### END /etc/grub.d/40_custom ###



    Now, blkid gives me two UUID's for the new install partition:

    /dev/sdb9: UUID="3ef7127d-733b-4e0f-9a81-d9fe74bfd4fd" UUID_SUB="2980d3b1-b866-414a-804e-4c8d7d634e51" TYPE="btrfs"

    I ended up modifying the /boot/grub/grub.cfg directly and adding these details to the grub 00_header but Grub cannot work with this. When I reverted to the config pasted above, all is well, but when I try to boot my new install (using both UUID's, on different occasions) GRUB says:

    error: file not found
    error: no such device: 3ef7127d-733b-4e0f-9a81-d9fe74bfd4fd or 2980d3b1-b866-414a-804e-4c8d7d634e51
    error: hd2, 9 cannot get C/H/S values.
    error: you need to load the kernel first

    The regular 'UUID' is also reflected when browsing this partition in Nautilus.

    Oh, in the root of my new install is the folder '@', within is /, is this normal?

    What should I try for my next trick? I'm having issues with apt, which I've spent hours trying to fix (might be a prob with my modem/ISP, which is an iphone/mobile provider, but I won't know for sure until I get this new install up) so I'd rather not have install anything to help here, if that's possible. Any help is greatly appreciated.
    Last edited by chrisinpants; September 5th, 2012 at 05:45 PM. Reason: UUID

  2. #2
    Join Date
    Nov 2010
    Location
    India
    Beans
    Hidden!

    Re: Grub install failed, how to add new Ubuntu install?

    use Grub-Recovery in my signature to restore the Grub .
    Dont miss anything even it is small. one small pin is enough to bring down a man.


  3. #3
    Join Date
    Aug 2012
    Beans
    31

    Re: Grub install failed, how to add new Ubuntu install?

    Thanks Raja. As the guide instructs, I've tried:

    grub-install /dev/sda9

    =

    /usr/sbin/grub-setup: error: unable to identify a filesystem in hd1,9; safety check can't be performed.


    The filesystem on that device is btrfs. I get the same reults with:


    grub-install --force /dev/sdb9


    Chris
    Last edited by chrisinpants; September 5th, 2012 at 07:12 PM.

  4. #4
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Grub install failed, how to add new Ubuntu install?

    The standard is ext formats so I think grub loads that by default, but it has a mod file to load that driver also. In your grub.cfg is insmod ext2 which is for the entire family of ext formats.

    So you may need to load the btrfs.mod file with a insmod btrfs command.
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  5. #5
    Join Date
    Aug 2012
    Beans
    31

    Re: Grub install failed, how to add new Ubuntu install?

    I did try that but it was to no avail. I've just reinstalled with ext4. It seemed like a long winded approach reading other threads on using btrfs, just not worth it for my needs. Thanks for your help.

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
  •