PDA

View Full Version : [ubuntu] grub2 fails to load the hard drive



Dominik_Bedek
April 13th, 2016, 02:57 PM
Hello.
I'll fast forward to the problem.
Ubuntu is installed on the hard drive in the laptop, and it is the only OS installed on it.
I'm using it daily, however, recently i had to run a program made for windows.
I've bought a new SSD, installed win10 on it, and successfully booted from BIOS (not UEFI), when connected to usb.
The problem arises here: I want to boot to windows from GRUB2, and only if SHIFT is held during startup (i.e. no interruptions if i don't need windows).
When i try that, update-grub2 gives me Windows10 loader on /sda1.
When it tries to boot it, it fails (no such device *UUID*, converting to 86, error).
When Ubuntu is loaded, the hard drive is recognized and it can be browsed within the file explorer.
The UUID is correct, so that's not the problem (i think).
Windows installation has its own bootloader on the external SSD, so it could be booted from wherever.
I'd like any input on this, i'm with the problem for last 8 hours, it's driving me crazy. Can't really see what to do anymore.
I tried repairing the grub, it was successful, didn't work (because there was nothing to repair).
When doing the ls command in grub2 command line, i'm only getting hd0 with 3 partitions, which is incorrect, because ubuntu is installed on ext4 with 4gb swap, and that's it.
Is it possible that it is reading the external hard drive incorrectly (as the 3rd partition?)

Here's some data:
blkid return:

/dev/sda1: LABEL="TRANSCEND" UUID="3A6616A6661662C5" TYPE="ntfs" PARTUUID="27bff7cd-01"
/dev/sdb1: UUID="1684b5f6-8fe6-48f1-bf47-f2823e890e53" TYPE="ext4" PARTUUID="d0521b29-01"
/dev/sdb5: UUID="a928c417-ae33-4942-b18b-2c557933defc" TYPE="swap" PARTUUID="d0521b29-05"


40_custom:

exec tail -n +3 $0
fstab:

# / was on /dev/sda1 during installation
UUID=1684b5f6-8fe6-48f1-bf47-f2823e890e53 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=a928c417-ae33-4942-b18b-2c557933defc none swap sw 0 0

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
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi

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='hd1,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 1684b5f6-8fe6-48f1-bf47-f2823e890e53
else
search --no-floppy --fs-uuid --set=root 1684b5f6-8fe6-48f1-bf47-f2823e890e53
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
if [ "${recordfail}" = 1 ] ; then
set timeout=10
else
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=10
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=10
fi
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,0; 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-1684b5f6-8fe6-48f1-bf47-f2823e890e53' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
set root='hd1,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 1684b5f6-8fe6-48f1-bf47-f2823e890e53
else
search --no-floppy --fs-uuid --set=root 1684b5f6-8fe6-48f1-bf47-f2823e890e53
fi
linux /boot/vmlinuz-4.2.0-35-generic root=UUID=1684b5f6-8fe6-48f1-bf47-f2823e890e53 ro quiet splash $vt_handoff
initrd /boot/initrd.img-4.2.0-35-generic
}
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-1684b5f6-8fe6-48f1-bf47-f2823e890e53' {
menuentry 'Ubuntu, with Linux 4.2.0-35-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.2.0-35-generic-advanced-1684b5f6-8fe6-48f1-bf47-f2823e890e53' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
set root='hd1,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 1684b5f6-8fe6-48f1-bf47-f2823e890e53
else
search --no-floppy --fs-uuid --set=root 1684b5f6-8fe6-48f1-bf47-f2823e890e53
fi
echo 'Loading Linux 4.2.0-35-generic ...'
linux /boot/vmlinuz-4.2.0-35-generic root=UUID=1684b5f6-8fe6-48f1-bf47-f2823e890e53 ro quiet splash $vt_handoff
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-4.2.0-35-generic
}
menuentry 'Ubuntu, with Linux 4.2.0-35-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.2.0-35-generic-init-upstart-1684b5f6-8fe6-48f1-bf47-f2823e890e53' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
set root='hd1,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 1684b5f6-8fe6-48f1-bf47-f2823e890e53
else
search --no-floppy --fs-uuid --set=root 1684b5f6-8fe6-48f1-bf47-f2823e890e53
fi
echo 'Loading Linux 4.2.0-35-generic ...'
linux /boot/vmlinuz-4.2.0-35-generic root=UUID=1684b5f6-8fe6-48f1-bf47-f2823e890e53 ro quiet splash $vt_handoff init=/sbin/upstart
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-4.2.0-35-generic
}
menuentry 'Ubuntu, with Linux 4.2.0-35-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.2.0-35-generic-recovery-1684b5f6-8fe6-48f1-bf47-f2823e890e53' {
recordfail
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
set root='hd1,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 1684b5f6-8fe6-48f1-bf47-f2823e890e53
else
search --no-floppy --fs-uuid --set=root 1684b5f6-8fe6-48f1-bf47-f2823e890e53
fi
echo 'Loading Linux 4.2.0-35-generic ...'
linux /boot/vmlinuz-4.2.0-35-generic root=UUID=1684b5f6-8fe6-48f1-bf47-f2823e890e53 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-4.2.0-35-generic
}
menuentry 'Ubuntu, with Linux 4.2.0-16-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.2.0-16-generic-advanced-1684b5f6-8fe6-48f1-bf47-f2823e890e53' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
set root='hd1,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 1684b5f6-8fe6-48f1-bf47-f2823e890e53
else
search --no-floppy --fs-uuid --set=root 1684b5f6-8fe6-48f1-bf47-f2823e890e53
fi
echo 'Loading Linux 4.2.0-16-generic ...'
linux /boot/vmlinuz-4.2.0-16-generic root=UUID=1684b5f6-8fe6-48f1-bf47-f2823e890e53 ro quiet splash $vt_handoff
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-4.2.0-16-generic
}
menuentry 'Ubuntu, with Linux 4.2.0-16-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.2.0-16-generic-init-upstart-1684b5f6-8fe6-48f1-bf47-f2823e890e53' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
set root='hd1,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 1684b5f6-8fe6-48f1-bf47-f2823e890e53
else
search --no-floppy --fs-uuid --set=root 1684b5f6-8fe6-48f1-bf47-f2823e890e53
fi
echo 'Loading Linux 4.2.0-16-generic ...'
linux /boot/vmlinuz-4.2.0-16-generic root=UUID=1684b5f6-8fe6-48f1-bf47-f2823e890e53 ro quiet splash $vt_handoff init=/sbin/upstart
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-4.2.0-16-generic
}
menuentry 'Ubuntu, with Linux 4.2.0-16-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.2.0-16-generic-recovery-1684b5f6-8fe6-48f1-bf47-f2823e890e53' {
recordfail
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
set root='hd1,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 1684b5f6-8fe6-48f1-bf47-f2823e890e53
else
search --no-floppy --fs-uuid --set=root 1684b5f6-8fe6-48f1-bf47-f2823e890e53
fi
echo 'Loading Linux 4.2.0-16-generic ...'
linux /boot/vmlinuz-4.2.0-16-generic root=UUID=1684b5f6-8fe6-48f1-bf47-f2823e890e53 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-4.2.0-16-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 'Memory test (memtest86+)' {
insmod part_msdos
insmod ext2
set root='hd1,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 1684b5f6-8fe6-48f1-bf47-f2823e890e53
else
search --no-floppy --fs-uuid --set=root 1684b5f6-8fe6-48f1-bf47-f2823e890e53
fi
knetbsd /boot/memtest86+.elf
}
menuentry 'Memory test (memtest86+, serial console 115200)' {
insmod part_msdos
insmod ext2
set root='hd1,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 1684b5f6-8fe6-48f1-bf47-f2823e890e53
else
search --no-floppy --fs-uuid --set=root 1684b5f6-8fe6-48f1-bf47-f2823e890e53
fi
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 10 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-3A6616A6661662C5' {
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 3A6616A6661662C5
else
search --no-floppy --fs-uuid --set=root 3A6616A6661662C5
fi
parttool ${root} hidden-
drivemap -s (hd0) ${root}
chainloader +1
}
set timeout_style=menu
if [ "${timeout}" = 0 ]; then
set timeout=10
fi
### 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 ###

note: removable drive is: transcend ssd 120gb, uuid 3A6616A6661662C5 with windows 10 installation.

/dev/disk/by-uuid# ll returns:

total 0
drwxr-xr-x 2 root root 100 Tra 13 15:34 ./
drwxr-xr-x 6 root root 120 Tra 13 15:34 ../
lrwxrwxrwx 1 root root 10 Tra 13 15:34 1684b5f6-8fe6-48f1-bf47-f2823e890e53 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Tra 13 15:34 3A6616A6661662C5 -> ../../sda1
lrwxrwxrwx 1 root root 10 Tra 13 15:34 a928c417-ae33-4942-b18b-2c557933defc -> ../../sdb5



df:

Filesystem 1K-blocks Used Available Use% Mounted on
udev 2002868 0 2002868 0% /dev
tmpfs 404240 6620 397620 2% /run
/dev/sdb1 236109568 4676376 219416400 3% /
tmpfs 2021196 160 2021036 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 2021196 0 2021196 0% /sys/fs/cgroup
cgmfs 100 0 100 0% /run/cgmanager/fs
tmpfs 404240 4 404236 1% /run/user/119
tmpfs 404240 48 404192 1% /run/user/1000
/dev/sda1 125032760 42016800 83015960 34% /media/dominik/TRANSCEND




I have no idea what to do next.
Need some fresh thoughts.
Thanks in advance.

yancek
April 13th, 2016, 07:19 PM
I would suggest that you run the boot repair software again and select the option to "Create BootInfo Summary" and NOT try any repairs but post a link to the output here.

Your blkid output shows windows on sda1 while the fstab shows Ubuntu on sda1. The grub.cfg file shows Ubuntu on sdb1. Which drive are you booting from, the internal with Ubuntu? When you set the SSD to first boot priority, does windows 10 boot? Did you use the Custom Installation option with windows 10?


When doing the ls command in grub2 command line, i'm only getting hd0 with 3 partitions, which is incorrect, because ubuntu is installed on ext4 with 4gb swap, and that's it.

This will be clarified with the boot repair output and it should show all drive partitions with boot files.

Dominik_Bedek
April 14th, 2016, 09:07 AM
boot-repair output (without repairing):
http://paste2.org/1bFNGJm9 (http://paste2.org/1bFNGJm9)

Ubuntu is on internal drive.
Windows is on external.
Windows 10 boots when set as 1st boot device.
Ubuntu boots when set as 1st boot device.
Windows 10 doesn't boot when chosen from grub.

Windows10 is installed on external drive via win2usb iirc, and doesn't have any other partitions on the disk. Windows bootloader is installed in C:\.
Ubuntu has no partitions on disk (apart from swap).

yancek
April 14th, 2016, 02:38 PM
Do you see a boot menu when you boot or do you just have Ubuntu boot when you select that drive and windows boot when you select it's drive?
Look at the very top of the bootinfoscript and you can see that you have Grub installed in the MBR of both drives. This might have happened when you ran the boot repair initially as it usually installs boot code to the MBR of all drives for some reason.

So when you have the Ubuntu drive set to first boot priority, do you see a boot menu with windows which you can select? What exactly happens when you do this.