System-Installation

為什麼 GRUB 在我的多重引導配置中引導 Debian 32 位而不是 Ubuntu 64 位?

  • September 18, 2013

我在我的系統上安裝了 Ubuntu GNOME Remix 64-bis。我將安裝程序設置為重用我的/boot/home. 由於 ubiquity(Ubuntu 安裝程序)讓我很難安裝 GRUB,所以我選擇“在沒有引導載入程序的情況下繼續”,並且由於我/boot以前安裝/安裝了/boot我只需update-grub要從 Debian 32 位做,問題就解決了……聽起來很容易,但事實並非如此。該update-grub命令在我的另一個 HD 中檢測到 Ubuntu:

sudo update-grub2
[sudo] password for braiam: 
Generating grub.cfg ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-3.10-2-686-pae
Found initrd image: /boot/initrd.img-3.10-2-686-pae
Found linux image: /boot/vmlinuz-3.8.0-19-generic
Found initrd image: /boot/initrd.img-3.8.0-19-generic
Found memtest86+ image: /memtest86+.bin
Found memtest86+ multiboot image: /memtest86+_multiboot.bin
Found Ubuntu 13.04 (13.04) on /dev/sda1
Found Windows 7 (loader) on /dev/sdb1
done

但是當我選擇“Ubuntu 13.04”時,它會啟動到 Debian。我檢查了 grub.cfg 條目,發現rootUUID值設置為與 Debian 相同。

sudo grub-mkconfig
Generating 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
 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 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,msdos7'
if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos7 --hint-efi=hd1,msdos7 --hint-baremetal=ahci1,msdos7 --hint='hd0,msdos7'  cead26d6-08f4-4894-ac78-a9a4ce59f773
else
 search --no-floppy --fs-uuid --set=root cead26d6-08f4-4894-ac78-a9a4ce59f773
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_US
 insmod gettext
fi
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='hd0,msdos8'
if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos8 --hint-efi=hd1,msdos8 --hint-baremetal=ahci1,msdos8 --hint='hd0,msdos8'  0cef2d59-21ca-4ba2-a9b2-0b9ef1f42589
else
 search --no-floppy --fs-uuid --set=root 0cef2d59-21ca-4ba2-a9b2-0b9ef1f42589
fi
Found background image: /usr/share/images/desktop-base/desktop-grub.png
insmod png
if background_image /braiam/.cache/gnome-control-center/backgrounds/14fb12e1345ca2dfd3807e7f7b1122b0d6015d9453ed5742de72b988a9cffded; then
 set color_normal=white/black
 set color_highlight=black/white
else
 set menu_color_normal=cyan/blue
 set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
Found linux image: /boot/vmlinuz-3.10-2-686-pae
Found initrd image: /boot/initrd.img-3.10-2-686-pae
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-cead26d6-08f4-4894-ac78-a9a4ce59f773' {
   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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
   else
     search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
   fi
   echo    'Loading Linux 3.10-2-686-pae ...'
   linux   /vmlinuz-3.10-2-686-pae root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro initrd=/install/initrd.gz quiet radeon.hw_i2c=1
   echo    'Loading initial ramdisk ...'
   initrd  /initrd.img-3.10-2-686-pae
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-cead26d6-08f4-4894-ac78-a9a4ce59f773' {
   menuentry 'Debian GNU/Linux, with Linux 3.10-2-686-pae' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.10-2-686-pae-advanced-cead26d6-08f4-4894-ac78-a9a4ce59f773' {
       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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
       else
         search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
       fi
       echo    'Loading Linux 3.10-2-686-pae ...'
       linux   /vmlinuz-3.10-2-686-pae root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro initrd=/install/initrd.gz quiet radeon.hw_i2c=1
       echo    'Loading initial ramdisk ...'
       initrd  /initrd.img-3.10-2-686-pae
   }
   menuentry 'Debian GNU/Linux, with Linux 3.10-2-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.10-2-686-pae-recovery-cead26d6-08f4-4894-ac78-a9a4ce59f773' {
       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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
       else
         search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
       fi
       echo    'Loading Linux 3.10-2-686-pae ...'
       linux   /vmlinuz-3.10-2-686-pae root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro single initrd=/install/initrd.gz
       echo    'Loading initial ramdisk ...'
       initrd  /initrd.img-3.10-2-686-pae
   }
Found linux image: /boot/vmlinuz-3.8.0-19-generic
Found initrd image: /boot/initrd.img-3.8.0-19-generic
   menuentry 'Debian GNU/Linux, with Linux 3.8.0-19-generic' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.8.0-19-generic-advanced-cead26d6-08f4-4894-ac78-a9a4ce59f773' {
       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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
       else
         search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
       fi
       echo    'Loading Linux 3.8.0-19-generic ...'
       linux   /vmlinuz-3.8.0-19-generic root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro initrd=/install/initrd.gz quiet radeon.hw_i2c=1
       echo    'Loading initial ramdisk ...'
       initrd  /initrd.img-3.8.0-19-generic
   }
   menuentry 'Debian GNU/Linux, with Linux 3.8.0-19-generic (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.8.0-19-generic-recovery-cead26d6-08f4-4894-ac78-a9a4ce59f773' {
       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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
       else
         search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
       fi
       echo    'Loading Linux 3.8.0-19-generic ...'
       linux   /vmlinuz-3.8.0-19-generic root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro single initrd=/install/initrd.gz
       echo    'Loading initial ramdisk ...'
       initrd  /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+ ###
Found memtest86+ image: /memtest86+.bin
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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
   else
     search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
   fi
   linux16 /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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
   else
     search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
   fi
   linux16 /memtest86+.bin console=ttyS0,115200n8
}
Found memtest86+ multiboot image: /memtest86+_multiboot.bin
menuentry "Memory test (memtest86+, experimental multiboot)" {
   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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
   else
     search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
   fi
   multiboot   /memtest86+_multiboot.bin
}
menuentry "Memory test (memtest86+, serial console 115200, experimental multiboot)" {
   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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
   else
     search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
   fi
   multiboot   /memtest86+_multiboot.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
Found Ubuntu 13.04 (13.04) on /dev/sda1
menuentry 'Ubuntu 13.04 (13.04)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-bf554a2f-a035-4c22-bca8-162def35a03c' {
   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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
   else
     search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
   fi
   linux /vmlinuz-3.10-2-686-pae root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro initrd=/install/initrd.gz quiet radeon.hw_i2c=1
   initrd /initrd.img-3.10-2-686-pae
}
submenu 'Advanced options for Ubuntu 13.04 (13.04)' $menuentry_id_option 'osprober-gnulinux-advanced-bf554a2f-a035-4c22-bca8-162def35a03c' {
   menuentry 'Debian GNU/Linux (on /dev/sda1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-3.10-2-686-pae--bf554a2f-a035-4c22-bca8-162def35a03c' {
       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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
       else
         search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
       fi
       linux /vmlinuz-3.10-2-686-pae root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro initrd=/install/initrd.gz quiet radeon.hw_i2c=1
       initrd /initrd.img-3.10-2-686-pae
   }
   menuentry 'Debian GNU/Linux, with Linux 3.10-2-686-pae (on /dev/sda1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-3.10-2-686-pae--bf554a2f-a035-4c22-bca8-162def35a03c' {
       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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
       else
         search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
       fi
       linux /vmlinuz-3.10-2-686-pae root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro initrd=/install/initrd.gz quiet radeon.hw_i2c=1
       initrd /initrd.img-3.10-2-686-pae
   }
   menuentry 'Debian GNU/Linux, with Linux 3.10-2-686-pae (recovery mode) (on /dev/sda1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-3.10-2-686-pae-root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro single initrd=/install/initrd.gz-bf554a2f-a035-4c22-bca8-162def35a03c' {
       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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
       else
         search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
       fi
       linux /vmlinuz-3.10-2-686-pae root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro single initrd=/install/initrd.gz
       initrd /initrd.img-3.10-2-686-pae
   }
   menuentry 'Debian GNU/Linux, with Linux 3.8.0-19-generic (on /dev/sda1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-3.8.0-19-generic--bf554a2f-a035-4c22-bca8-162def35a03c' {
       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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
       else
         search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
       fi
       linux /vmlinuz-3.8.0-19-generic root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro initrd=/install/initrd.gz quiet radeon.hw_i2c=1
       initrd /initrd.img-3.8.0-19-generic
   }
   menuentry 'Debian GNU/Linux, with Linux 3.8.0-19-generic (recovery mode) (on /dev/sda1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-3.8.0-19-generic-root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro single initrd=/install/initrd.gz-bf554a2f-a035-4c22-bca8-162def35a03c' {
       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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
       else
         search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
       fi
       linux /vmlinuz-3.8.0-19-generic root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro single initrd=/install/initrd.gz
       initrd /initrd.img-3.8.0-19-generic
   }
   menuentry 'Ubuntu 13.04 (13.04) (on /dev/sda1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-3.10-2-686-pae--bf554a2f-a035-4c22-bca8-162def35a03c' {
       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=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd0,msdos5'  279a18da-130b-46dd-8b54-84da48eb445f
       else
         search --no-floppy --fs-uuid --set=root 279a18da-130b-46dd-8b54-84da48eb445f
       fi
       linux /vmlinuz-3.10-2-686-pae root=UUID=cead26d6-08f4-4894-ac78-a9a4ce59f773 ro initrd=/install/initrd.gz quiet radeon.hw_i2c=1
       initrd /initrd.img-3.10-2-686-pae
   }
}

Found Windows 7 (loader) on /dev/sdb1
menuentry 'Windows 7 (loader) (on /dev/sdb1)' --class windows --class os $menuentry_id_option 'osprober-chain-AA64B45A64B42AC9' {
   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=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 --hint='hd0,msdos1'  AA64B45A64B42AC9
   else
     search --no-floppy --fs-uuid --set=root AA64B45A64B42AC9
   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 ###
done

我可以編輯手頭的條目,但是 grub.cfg 一開始就有的“不要編輯這個文件”讓我退縮了。我應該手動編輯這些條目,創建自定義腳本,還是我注定要失敗?

ls /boot主盤:

ls /boot/
abi-3.8.0-19-generic       initrd.img-3.8.0-19-generic  System.map-3.8.0-19-generic
config-3.10-2-686-pae      iso                          vmlinuz-3.10-2-686-pae
config-3.8.0-19-generic    lost+found                   vmlinuz-3.8.0-19-generic
extlinux                   memtest86+.bin               vmlinuz-3.8.0-19-generic.efi.signed
grub                       memtest86+_multiboot.bin
initrd.img-3.10-2-686-pae  System.map-3.10-2-686-pae

ls /boot我安裝 Ubuntu 的磁碟:

ls /media/braiam/bf554a2f-a035-4c22-bca8-162def35a03c/boot/
grub  initrd.img-3.8.0-19-generic.new

blkid

blkid
/dev/sda1: UUID="bf554a2f-a035-4c22-bca8-162def35a03c" TYPE="ext4" #here Ubuntu
/dev/sda2: UUID="7cb917ba-babb-42cd-897e-2070d540eda4" TYPE="swap" 
/dev/sdb1: UUID="AA64B45A64B42AC9" TYPE="ntfs" 
/dev/sdb2: UUID="F66E431C6E42D551" TYPE="ntfs" 
/dev/sdb3: UUID="75a0854b-8b6b-453f-8aec-2a081a1f19e3" TYPE="swap" 
/dev/sdb5: UUID="279a18da-130b-46dd-8b54-84da48eb445f" TYPE="ext4" #Here boot
/dev/sdb6: UUID="393cd35e-b827-4dea-acb5-2a66f2369dce" TYPE="swap" 
/dev/sdb7: UUID="cead26d6-08f4-4894-ac78-a9a4ce59f773" TYPE="ext4" #here Debian
/dev/sdb8: UUID="0cef2d59-21ca-4ba2-a9b2-0b9ef1f42589" TYPE="ext4" 

fdisk -l:

sudo fdisk -l
[sudo] password for braiam: 

Disk /dev/sda: 13.7 GB, 13701316608 bytes
255 heads, 63 sectors/track, 1665 cylinders, total 26760384 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8e48c4c5

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1         2104515    26749046    12322266   83  Linux (here is Ubuntu)
/dev/sda2              63     2104514     1052226   82  Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/sdb: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders, total 390721968 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1549f232

  Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          63   223629311   111814624+   7  HPFS/NTFS/exFAT
/dev/sdb2       225724416   336437306    55356445+   7  HPFS/NTFS/exFAT
/dev/sdb3       223629312   225724415     1047552   82  Linux swap / Solaris
/dev/sdb4       336439294   390721535    27141121    5  Extended
/dev/sdb5       336439296   338391039      975872   83  Linux (here is boot)
/dev/sdb6       338393088   339390463      498688   82  Linux swap / Solaris
/dev/sdb7       339392512   368687103    14647296   83  Linux (here is Debian)
/dev/sdb8       368689152   390721535    11016192   83  Linux

Ubuntu 的 fstab 和 Debian 的 fstab 是一樣的,除了/入口。

sudo os-prober 
[sudo] password for braiam: 
/dev/sda1:Ubuntu 13.04 (13.04):Ubuntu:linux
/dev/sdb1:Windows 7 (loader):Windows:chain

cat /boot/grub/device.map:

cat /boot/grub/device.map 
(hd0)   /dev/disk/by-id/ata-Maxtor_6L200M0_L40WL3VH
(hd1)   /dev/disk/by-id/usb-Sandisk-Curzer

(自從我執行sudo grub-mkdevicemap更改條目以來,我從腦海中提取了這些資訊)

我將安裝程序設置為重用我的/boot

我自己還沒有使用過雙啟動設置,但這對我來說似乎是個錯誤。update-grub用於grub-probe確定目前根文件系統位於哪個設備上,然後將此設備作為root=參數附加linux/boot/grub/grub.cfg. 這可能是您的 Ubuntu 條目正在引導 Debian 的原因 - 您可能正在使用 Ubuntu 的核心和 initramfs,但您grub.cfg指示它安裝您的 Debian 分區,然後繼續從該分區引導。

我會嘗試將 Ubuntu 重新定位/boot到它自己的根文件系統(這不應該太難,然後你不必重新分區,這可能需要重新安裝 Ubuntu)。然後設置 Debian 的 grub 來鍊式載入 Ubuntu 的 grub;那麼它應該可以正常工作。


編輯:關於如何設置 Ubuntu 的小方法/grub。請注意,我是從記憶中輸入的,所以要小心;)

  1. 是的,*3.8*從 Debian轉移/grub到 Ubuntu 的/grub.
  2. 打開根外殼。
  3. chroot進入 Ubuntu 的文件系統:
cd /media/braiam/bf554a2f-a035-4c22-bca8-162def35a03c
for i in proc sys dev; do mount --bind /$i $i; done
chroot /mnt /bin/bash

你現在Ubuntu 系統中(Ubuntu 的根文件系統現在是/,至少在這個 shell 中),幾乎就像你已經啟動它一樣。 4. 如果您已經debsums安裝在 Ubuntu 上,您現在可以檢查失去的文件(以防您在 Debian 的引導中忘記了某些內容),但這可能需要一段時間:

debsums -s
  1. 如果您需要在 中訪問 Internet chroot,例如重新安裝損壞的軟體包,/etc/resolv.conf則在 chroot 中進行編輯應該可以解決問題。只需將nameserver線路指向 Debian 正在使用的同一 DNS 伺服器。
vim /etc/resolv.conf
  1. 執行grub-mkdevicemap。不確定這是否重要,但它可能不會受到傷害。
grub-mkdevicemap
  1. 好吧,我不得不承認,我現在真的不確定如何在 Ubuntu 上安裝 grub,/boot或者是否有必要。grub-install需要一個設備,但我們不希望它寫一個 MBR …:/

我將不得不對此進行更多研究。

我現在才意識到你的 Ubuntu 實際上是在一個單獨的硬碟上。只需將其安裝到此硬碟的 MBR 中即可:

grub-install /dev/sda
  1. 更新 grub 並重建 initramfs:
update-grub
update-initramfs -u
  1. 離開chroot
exit

你仍然需要弄清楚如何告訴 Debian 的 grub 它應該鍊式載入現在存在於 Ubuntu 硬碟上的 grub2 MBR;我不知道它是否會自己解決這個問題。也許在 Debian 文件系統上添加一個chainloader部分?/etc/grub.d/40_custom

引用自:https://unix.stackexchange.com/questions/91298