LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Grub entry for multi-partition installation (https://www.linuxquestions.org/questions/linux-general-1/grub-entry-for-multi-partition-installation-4175483175/)

cu3ba11 11-02-2013 01:50 PM

Grub entry for multi-partition installation
 
I recently installed Arch Linux across multiple partitions. I have / mounted on /dev/sdb5, a hard drive, and /boot mounted on /dev/sda6, my ssd.

I successfully installed Grub2 along with Ubuntu on a separate partition, both of which are working fine. The problem is, I'm having some trouble booting into Arch. I can't seem to create an appropriate Grub2 menuentry. I tried running grub-mkconfig, but that didn't work. I've tried writing my own specific menuentry, but I didn't get far. Any suggestions?

Sorry if this should've been in the install forum. I put it here because it seemed more like a Grub2 question than an installation question.

syg00 11-02-2013 04:10 PM

That implies the Ubuntu install has (over-)written the MBR. If so, run update-grub rather than mkconfig - it incorporates os-prober and should find Arch for you. Ubuntu also has very good, if somewhat more dispersed, doco.

cu3ba11 11-02-2013 05:00 PM

I ran update-grub from Ubuntu, and part of the output was 'Found Arch on /dev/sdb5', but the grub menu wasn't updated. Why is this?

syg00 11-02-2013 05:15 PM

From Ubuntu, go here, do as it says and post the RESULTS.txt file so we have a proper idea of what's what.

milomak 11-02-2013 08:37 PM

your bios will set which drive it looks to boot from (well this is actually your decision).

assuming you don't want to change the bios every time you want to boot a different distro, you then need to ask yourself the question of which is your primary distro.

i run debian, arch and an other. debian is my main distro. so i install debian's grub to the mbr of the drive i have set as the first boot disk in bios. (grub-install --recheck /dev/sdX)

i then set the grub of any other distro i install to the boot sector of that partition

What this requires is that i make sure that i have entries in my debian grub to the partitions. so in my case i had to create a file in /etc/grub.d/
Code:

# cat /etc/grub.d/50_personal
#!/bin/sh
exec tail -n +3 $0

menuentry "Arch Linux" {
  set root=(hd1,9)
  chainloader +1
}


menuentry "Fedora" {
  set root=(hd1,8)
  chainloader +1
}

menuentry "Windows 8" {
  set root=(hd0,1)
  chainloader +1
}

so each OS can update it's own grub/bootloader when i am in it, and debian doesn't have to know.

edit - it means i can chroot into any of the distros and run maintenance. so in debian i can update kernel for the arch distro. but then run grub-install --recheck --force /dev/sda9 and when i select arch from the debian grub, it will load the arch grub with the latest kernel.

i can also do the reverse from arch but instead run grub-install --recheck /dev/sdX

--recheck is not really necessary. though --force is for arch.

cu3ba11 11-02-2013 08:55 PM

Here's the output

Code:

Boot Info Script 0.61      [1 April 2012]


============================= Boot Info Summary: ===============================

 => Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of
    the same hard drive for core.img. core.img is at this location and looks
    in partition 94 for .
 => Windows is installed in the MBR of /dev/sdb.

sda1: __________________________________________________________________________

    File system:      ntfs
    Boot sector type:  Windows Vista/7: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System: 
    Boot files:        /bootmgr /Boot/BCD

sda2: __________________________________________________________________________

    File system:      ntfs
    Boot sector type:  Windows Vista/7: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  Windows 7
    Boot files:        /Windows/System32/winload.exe

sda3: __________________________________________________________________________

    File system:      hfsplus
    Boot sector type:  -
    Boot sector info:
    Operating System: 
    Boot files:       

sda4: __________________________________________________________________________

    File system:      Extended Partition
    Boot sector type:  -
    Boot sector info:

sda5: __________________________________________________________________________

    File system:      ext4
    Boot sector type:  -
    Boot sector info:
    Operating System:  Ubuntu 13.04
    Boot files:        /boot/grub/grub.cfg /etc/fstab

sda6: __________________________________________________________________________

    File system:      ext2
    Boot sector type:  -
    Boot sector info:
    Operating System: 
    Boot files:       

sda7: __________________________________________________________________________

    File system:      swap
    Boot sector type:  -
    Boot sector info:

sdb1: __________________________________________________________________________

    File system:      ntfs
    Boot sector type:  Windows Vista/7: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System: 
    Boot files:       

sdb2: __________________________________________________________________________

    File system:      hfsplus
    Boot sector type:  -
    Boot sector info:
    Operating System: 
    Boot files:       

sdb3: __________________________________________________________________________

    File system:      Extended Partition
    Boot sector type:  Unknown
    Boot sector info:

sdb5: __________________________________________________________________________

    File system:      ext4
    Boot sector type:  -
    Boot sector info:
    Operating System:  Arch Linux ()
    Boot files:        /etc/fstab

============================ Drive/Partition Info: =============================

Drive: sda _____________________________________________________________________

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sda1    *          2,048      206,847      204,800  7 NTFS / exFAT / HPFS
/dev/sda2            206,848  109,258,751  109,051,904  7 NTFS / exFAT / HPFS
/dev/sda3        109,258,752  184,555,519    75,296,768  af HFS / HFS+
/dev/sda4        184,557,566  234,440,703    49,883,138  5 Extended
/dev/sda5        184,557,568  211,922,802    27,365,235  83 Linux
/dev/sda6        211,922,866  231,145,471    19,222,606  ef EFI (FAT-12/16/32)
/dev/sda7        231,147,520  234,440,703    3,293,184  82 Linux swap / Solaris


Drive: sdb _____________________________________________________________________

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sdb1              2,048 1,887,438,847 1,887,436,800  7 NTFS / exFAT / HPFS
/dev/sdb2      1,887,438,848 2,097,154,047  209,715,200  af HFS / HFS+
/dev/sdb3      2,097,154,048 3,907,029,167 1,809,875,120  5 Extended
/dev/sdb5      2,097,154,111 3,907,029,167 1,809,875,057  83 Linux


"blkid" output: ________________________________________________________________

Device          UUID                                  TYPE      LABEL

/dev/loop0                                              squashfs 
/dev/sda1        C45A59355A592588                      ntfs      System Reserved
/dev/sda2        5EF86548F8651F8F                      ntfs     
/dev/sda3        ce1342d8-63c2-3c5b-ad8a-5e299e0c8e31  hfsplus    untitled
/dev/sda5        bbab85f2-b7a5-43e7-89ac-42a5bd142721  ext4     
/dev/sda6        e0b20e79-4d3e-4fa0-aae3-4efef7f21f63  ext2     
/dev/sda7        7f6e9b2f-cb4d-44b3-85d1-1308803f667b  swap     
/dev/sdb1        08942F85942F73FA                      ntfs      2TB HDD
/dev/sdb2        59aec368-d32c-3549-8b36-407a999761c4  hfsplus    untitled
/dev/sdb5        6d388a04-1ae1-477a-8f06-0dbbbd2adca1  ext4     
/dev/sr0                                                iso9660    LXFDVD172

================================ Mount points: =================================

Device          Mount_Point              Type      Options

/dev/loop0      /rofs                    squashfs  (ro,noatime)
/dev/sda5        /media/custom/bbab85f2-b7a5-43e7-89ac-42a5bd142721 ext4      (rw,nosuid,nodev,uhelper=udisks2)
/dev/sr0        /cdrom                  iso9660    (ro,noatime)


=========================== sda5/boot/grub/grub.cfg: ===========================

--------------------------------------------------------------------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by 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
  set have_grubenv=true
  load_env
fi
set default="0"

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

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
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
  font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  bbab85f2-b7a5-43e7-89ac-42a5bd142721
else
  search --no-floppy --fs-uuid --set=root bbab85f2-b7a5-43e7-89ac-42a5bd142721
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_GB
  insmod gettext
fi
terminal_output gfxterm
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
if background_color 44,0,30; then
  clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
        set gfxpayload="${1}"
        if [ "${1}" = "keep" ]; then
                set vt_handoff=vt.handoff=7
        else
                set vt_handoff=
        fi
}
if [ "${recordfail}" != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-bbab85f2-b7a5-43e7-89ac-42a5bd142721' {
recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos5'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  bbab85f2-b7a5-43e7-89ac-42a5bd142721
        else
          search --no-floppy --fs-uuid --set=root bbab85f2-b7a5-43e7-89ac-42a5bd142721
        fi
        linux        /boot/vmlinuz-3.8.0-19-generic root=UUID=bbab85f2-b7a5-43e7-89ac-42a5bd142721 ro  quiet splash $vt_handoff
        initrd        /boot/initrd.img-3.8.0-19-generic
}
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-bbab85f2-b7a5-43e7-89ac-42a5bd142721' {
        menuentry 'Ubuntu, with Linux 3.8.0-19-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.8.0-19-generic-advanced-bbab85f2-b7a5-43e7-89ac-42a5bd142721' {
        recordfail
                load_video
                gfxmode $linux_gfx_mode
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos5'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  bbab85f2-b7a5-43e7-89ac-42a5bd142721
                else
                  search --no-floppy --fs-uuid --set=root bbab85f2-b7a5-43e7-89ac-42a5bd142721
                fi
                echo        'Loading Linux 3.8.0-19-generic ...'
                linux        /boot/vmlinuz-3.8.0-19-generic root=UUID=bbab85f2-b7a5-43e7-89ac-42a5bd142721 ro  quiet splash $vt_handoff
                echo        'Loading initial ramdisk ...'
                initrd        /boot/initrd.img-3.8.0-19-generic
        }
        menuentry 'Ubuntu, with Linux 3.8.0-19-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.8.0-19-generic-recovery-bbab85f2-b7a5-43e7-89ac-42a5bd142721' {
        recordfail
                load_video
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos5'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  bbab85f2-b7a5-43e7-89ac-42a5bd142721
                else
                  search --no-floppy --fs-uuid --set=root bbab85f2-b7a5-43e7-89ac-42a5bd142721
                fi
                echo        'Loading Linux 3.8.0-19-generic ...'
                linux        /boot/vmlinuz-3.8.0-19-generic root=UUID=bbab85f2-b7a5-43e7-89ac-42a5bd142721 ro recovery nomodeset
                echo        'Loading initial ramdisk ...'
                initrd        /boot/initrd.img-3.8.0-19-generic
        }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry 'Arch Linux' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod ext4
        set root='hd1, msdos5'

        linux /boot/vmlunz-linux root=/dev/sdb5
        initrd /boot/initramfs-linux.img
}
menuentry "Memory test (memtest86+)" {
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos5'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  bbab85f2-b7a5-43e7-89ac-42a5bd142721
        else
          search --no-floppy --fs-uuid --set=root bbab85f2-b7a5-43e7-89ac-42a5bd142721
        fi
        linux16        /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos5'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  bbab85f2-b7a5-43e7-89ac-42a5bd142721
        else
          search --no-floppy --fs-uuid --set=root bbab85f2-b7a5-43e7-89ac-42a5bd142721
        fi
        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/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-C45A59355A592588' {
        insmod part_msdos
        insmod ntfs
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  C45A59355A592588
        else
          search --no-floppy --fs-uuid --set=root C45A59355A592588
        fi
        chainloader +1
}

### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### 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 ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------

=============================== sda5/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/sda5 during installation
UUID=bbab85f2-b7a5-43e7-89ac-42a5bd142721 /              ext4    errors=remount-ro 0      1
# swap was on /dev/sda7 during installation
UUID=7f6e9b2f-cb4d-44b3-85d1-1308803f667b none            swap    sw              0      0
--------------------------------------------------------------------------------

=================== sda5: Location of files loaded by Grub: ====================

          GiB - GB            File                                Fragment(s)

              =                boot/grub/grub.cfg                            1
              =                boot/initrd.img-3.8.0-19-generic              4
              =                boot/vmlinuz-3.8.0-19-generic                  4
              =                initrd.img                                    4
            ?? = ??            initrd.img.old                                1
            ?? = ??            vmlinuz                                        4

=============================== sdb5/etc/fstab: ================================

--------------------------------------------------------------------------------
#
# /etc/fstab: static file system information
#
# <file system>        <dir>        <type>        <options>        <dump>        <pass>
# UUID=6d388a04-1ae1-477a-8f06-0dbbbd2adca1
/dev/sdb5                  /                ext4              rw,relatime,data=ordered        0 1

# UUID=68de34bd-8a95-461b-adb2-6f36ba52b1ee
/dev/sda6                  /boot            ext4              rw,relatime,data=ordered        0 2

# UUID=7f6e9b2f-cb4d-44b3-85d1-1308803f667b
/dev/sda7                  none              swap              defaults          0 0

# UUID=6d388a04-1ae1-477a-8f06-0dbbbd2adca1
/dev/sdb5                  /                ext4              rw,relatime,data=ordered        0 1

# UUID=68de34bd-8a95-461b-adb2-6f36ba52b1ee
/dev/sda6                  /boot            ext4              rw,relatime,data=ordered        0 2

sys                        /sys              sysfs            rw,nosuid,nodev,noexec,relatime        0 0

efivarfs                    /sys/firmware/efi/efivars        efivarfs          rw,relatime        0 0

# UUID=7f6e9b2f-cb4d-44b3-85d1-1308803f667b
/dev/sda7                  none              swap              defaults          0 0

--------------------------------------------------------------------------------

======================== Unknown MBRs/Boot Sectors/etc: ========================

Unknown BootLoader on sdb3

00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
000001b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff 00 fe  |................|
000001c0  ff ff 83 fe ff ff 3f 00  00 00 71 80 e0 6b 00 00  |......?...q..k..|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200


=============================== StdErr Messages: ===============================

awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
FIBMAP: Invalid argument
FIBMAP: Invalid argument
FIBMAP: Invalid argument
FIBMAP: Invalid argument
FIBMAP: Invalid argument
awk: cmd. line:36: Math support is not compiled in
  No volume groups found

A cut out a lot of 'FIBMAP: Invalid argument's by the way, because they were repeating a lot.

Anyway, a quick summary is:
/dev/sda5: Ubuntu
/dev/sda6: /boot for Arch
/dev/sda7: swap area

/dev/sdb5: / for Arch

Some of the other partitions are currently unused or for Windows.

Make of that what you will.

As for milomak, are you saying that I should create a file like this in my /etc/grub.d folder in Ubuntu? Will that go into my Grub2 menu? I thought that the Grub menu was organized in grub.cfg under /boot.

syg00 11-03-2013 12:26 AM

Sorry, I've no experience with EFI - did the Arch system boot o.k. before the Ubuntu install ?.

colorpurple21859 11-03-2013 08:19 AM

what directories are in /dev/sda6? If there is a grub.cfg located on /dev/sda6 then backing up the grub.cfg that is on /dev/sda6 and copying the grub.cfg from /dev/sda5/boot/grub to the location of the of the grub.cfg that is on /dev/sda6, might fix your problem.
Another option is go into the grub command prompt and run the following to boot arch and then rerun grub-mkconfig to get the changes your looking for in the grub menu.

Code:

set root=(hd1, msdos5)
linux /boot/vmlunz-linux root=/dev/sdb5
initrd /boot/initramfs-linux.img

Just beware you may have to use a rescue cd to reverse the changes if things go from bad to worse.

cu3ba11 11-03-2013 08:25 PM

I ran a fresh install of Arch without trying to install grub. Then I booted into Ubuntu and ran update-grub, which worked. I can now boot into Ubuntu, Arch, or Windows. Thanks for the help.


All times are GMT -5. The time now is 03:52 PM.