You are not logged in.

#1 2014-04-21 14:40:35

christopher72
Member
Registered: 2010-09-07
Posts: 24

External USB hard disk fails to boot

I installed Arch Linux on an external USB Lacie 1 TB Hard Disk. I followed instructions on WiKi: "install from exisiting linux", method 2, since I already have Linux installed
on the internal HDD of my laptop (dual boot with Windows, also with Grub as bootloader).

Problem: The external HDD stalls during boot right after the "Welcome to Grub!" - message. I can only hard-reset my laptop from there.

The external HDD has msdos Partition Table.  It is recognized by BIOS just fine, since I can choose to boot from it. It has following (very simple) partition setup:

[root@arch-laptop chris]# fdisk -l /dev/sdb

Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 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
Disklabel type: dos
Disk identifier: 0x000c9610

Device    Boot Start       End   Blocks  Id System
/dev/sdb1 *     2048  40962047 20480000  83 Linux

So there's just the root partition, no boot or home partition defined. Grub installed to the external HDD with no errors.
Here's the grub.cfg auto-generated, without anything adapted.  The UUID of the external HDD /dev/sdb1 is correct.

[root@arch-laptop grub]# cat 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 ###                                                                                                                                                                         
insmod part_gpt                                                                                                                                                                                             
insmod part_msdos                                                                                                                                                                                           
if [ -s $prefix/grubenv ]; then                                                                                                                                                                             
  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 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  5fe1d28c-2640-4b5c-b98b-75d147479348
else
  search --no-floppy --fs-uuid --set=root 5fe1d28c-2640-4b5c-b98b-75d147479348
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_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_archlinux ###

menuentry "Arch Linux pkg-linux kernel" --class arch-linux --class arch --class gnu-linux --class gnu --class os {
    
    if [ x$feature_all_video_module = xy ]; then
        insmod all_video
    fi
    set gfxpayload=keep
    insmod ext2
    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  5fe1d28c-2640-4b5c-b98b-75d147479348
    else
        search --no-floppy --fs-uuid  --set=root 5fe1d28c-2640-4b5c-b98b-75d147479348
    fi
    echo 'Loading Arch Linux pkg-linux kernel ...'
    linux /boot/vmlinuz-linux root=UUID=5fe1d28c-2640-4b5c-b98b-75d147479348 rw  quiet
    echo 'Loading Arch Linux pkg-linux kernel initramfs ...'
    initrd /boot/initramfs-linux.img
}


menuentry "Arch Linux pkg-linux kernel (fallback initramfs)" --class arch-linux --class arch --class gnu-linux --class gnu --class os {
    
    if [ x$feature_all_video_module = xy ]; then
        insmod all_video
    fi
    set gfxpayload=keep
    insmod ext2
    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  5fe1d28c-2640-4b5c-b98b-75d147479348
    else
        search --no-floppy --fs-uuid  --set=root 5fe1d28c-2640-4b5c-b98b-75d147479348
    fi
    echo 'Loading Arch Linux pkg-linux kernel ...'
    linux /boot/vmlinuz-linux root=UUID=5fe1d28c-2640-4b5c-b98b-75d147479348 rw  quiet
    echo 'Loading Arch Linux pkg-linux kernel fallback initramfs ...'
    initrd /boot/initramfs-linux-fallback.img
}

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

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-5fe1d28c-2640-4b5c-b98b-75d147479348' {
        load_video
        set gfxpayload=keep
        insmod gzio
        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  5fe1d28c-2640-4b5c-b98b-75d147479348
        else
          search --no-floppy --fs-uuid --set=root 5fe1d28c-2640-4b5c-b98b-75d147479348
        fi
        echo    'Loading Linux linux ...'
        linux   /boot/vmlinuz-linux root=UUID=5fe1d28c-2640-4b5c-b98b-75d147479348 rw  quiet
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-5fe1d28c-2640-4b5c-b98b-75d147479348' {
        menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-5fe1d28c-2640-4b5c-b98b-75d147479348' {
                load_video
                set gfxpayload=keep
                insmod gzio
                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  5fe1d28c-2640-4b5c-b98b-75d147479348
                else
                  search --no-floppy --fs-uuid --set=root 5fe1d28c-2640-4b5c-b98b-75d147479348
                fi
                echo    'Loading Linux linux ...'
                linux   /boot/vmlinuz-linux root=UUID=5fe1d28c-2640-4b5c-b98b-75d147479348 rw  quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initramfs-linux.img
        }
}

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

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

### BEGIN /etc/grub.d/30_os-prober ###
### 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 ###

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

### BEGIN /etc/grub.d/60_memtest86+ ###
### END /etc/grub.d/60_memtest86+ ###

the internal HDD (/dev/sda) also has GRUB installed, without any problems, with a graphical console menu.
GRUB version is 2.02
laptop: dv6-6b41ed
Legacy BIOS  (no EFI / UEFI).

Any ideas on how to solve / troubleshoot this?

Last edited by christopher72 (2014-04-21 15:05:21)

Offline

#2 2014-04-22 04:13:40

ramkatral
Member
Registered: 2014-04-21
Posts: 29

Re: External USB hard disk fails to boot

Did you set your hooks? They're necessary for an external HDD. It's mentioned as required briefly in the Beginner's guide, but it's easy to miss.

https://wiki.archlinux.org/index.php/Mkinitcpio#HOOKS

The initial ramdisk basically provides for an environment for the kernel to be able to go ahead and load up modules before the actual system is booted.  It allows modules to allow for USB, software RAIDSs, etc. to be mounted so that it can boot them.

Last edited by ramkatral (2014-04-22 04:17:04)

Offline

#3 2014-04-22 16:35:06

christopher72
Member
Registered: 2010-09-07
Posts: 24

Re: External USB hard disk fails to boot

Any hooks in particular? I don't know which hook to add other then the 'blocks' hook, which is there already:
HOOKS="base udev autodetect modconf block filesystems keyboard fsck"
Also, I don't think that could be the problem since loading the initramfs image takes place after choosing something from the Grub Menu.  That menu never appears, I just get "welcome to grub!" with a blinking cursor underneath.
I did add "insmod usbms" in grub.cfg,  but that didn't change anything.
What strikes me as odd is that in grub.cfg, the disk is referred to as "hd1", where I think it could just as well be "hd0" if that's the first hard disk the BIOS boots from. But I'm not sure if that really matters since the search is done with the UUID.
Another thing I tested earlier:  I dd 'd the Arch Live image to the external usb HDD, and then it boots fine...

Offline

#4 2014-04-22 18:33:09

ramkatral
Member
Registered: 2014-04-21
Posts: 29

Re: External USB hard disk fails to boot

Hmm, blocks is the HOOK necessary.  I boot from an external and that is all I needed for it.  hd0 would be your actual onboard drive, even when booting the external, so that's not the one you want to point to. 

When you boot the USB drive, and it's set as first in the boot order in your BIOS, then it basically overrides any other bootloader in favor of its own.  However, it doesn't change the device mounting on the onboard components.  Just like how the onboard is always sda no matter what you boot from, because it's the primary drive.

Sounds like some configuration issue with Grub2, and I'm not too comfortable with that newfangled thing.  I'm an old school LILO/Legacy GRUB kinda guy,.

Last edited by ramkatral (2014-04-22 18:34:37)

Offline

#5 2014-04-27 18:47:48

christopher72
Member
Registered: 2010-09-07
Posts: 24

Re: External USB hard disk fails to boot

Speaking of legacy: I tried with Syslinux as a bootloader on the external usb HDD, and then it works.  So this definately is grub2 related.
Also, I tried forcing Grub2 to use a specific host controller interface:

 [root@arch-laptop /]# grub-install --target=i386-pc --recheck --disk=ehci --debug /dev/sdb
grub-install: --disk-module: (PROGRAM ERROR) Option should have been recognized!?

Very interesting error message... :-) Which sounds like a grub2 bug, oh what a surprise.

Offline

#6 2014-04-28 01:17:28

ramkatral
Member
Registered: 2014-04-21
Posts: 29

Re: External USB hard disk fails to boot

Yea, I'm using gummiboot on mine and it works like a charm.  I really don't like Grub2.  I fail to see why making a configuration file into some complex operation is an improvement.

Offline

Board footer

Powered by FluxBB