GRUB error 17 on external HDD

Just to answer your question, but don’t worry too much about the explanation since it is NOT the problem you have as your HD has a 512 byte sector size.

I didn’t mean the content, the filesystem (NTFS in this case) but the container, the partitions and more specifically the partitions boundaries. Since XP can not handle 4KB sector size, one hack (not the only one) on the partition table is to increment the first logical sector and “push” the partition to align logical and physical sectors. Whether you have XP or not as operating system isn’t relevant. But Linux might not be able to access partitions on hard disks using this hack for XP compatibility unless you blank the partition table and recreate it. Reformating a partition and reinstalling Linux won’t help in such cases. But again, this is not the probleme here.

Here are a couple things you need to check:

  • is your BIOS set to ahci mode or IDE legacy mode? I’ve seen cases where Linux would not boot while in legacy mode (simply not find the partition) but this is very mainboard specific.
  • have you ever been able to boot an operating system installed on your external USB HD with this mainboard?
  • Does it makes a difference if you switch the storage mode?
  • When you installed Linux from CD/DVD, did you have to change the BIOS boot order and if so how did it look like: CD/USB/HD or CD/HD/USB? And later, before you tried to boot the installed system, did you changed it to USB/HD? So if - as I suspect - the order during installation was CD/HD/USB, Linux has been installed on sdb which was hd1 at this time.
  • What else does actually boot on this computer? What’s on your internal HD? (can you show us the complete output of fdisk -l?)

I am using the openSUSE Gnome Live CD.

After turning on my laptop at the splash screen i have an option to enter boot menu by pressing F11. By doing so i’m presented with a list of available boot devices from which i can choose my USB external hard drive. If i do not enter the boot menu then my laptop boots windows normally from the internal HD.

If i choose my external HD in the boot menu then the black screen with the blinking cursor appears. At this point it does not respond to any keyboard input. The only way to turn off my laptop now is by pressing the power button.

I’ll try to hook up the USB drive to my other desktop PC to make sure that my laptop’s (MSI GX623) hardware isn’t the cause of problem.

  • In BIOS under advanced options there was an entry “AHCI mode”. Think it is enabled but i’m not really sure. Selecting “Enable” next to the entry brings up a list with “Disable” and “Enable”(highlighted) but after selecting “Disable” it stays next to the entry (leading me to think that now i should press “Disable” and then select “Enable” to actually disable it. Does this make sense? :stuck_out_tongue: ). By default the entry has “Enable” next to it.
  • Not from the external USB HD. But i was able to boot from openSUSE live USB, from which i installed at first. Also i was able to launch Super grub disk from my USB flash drive (installed under windows with Unetbootin, so i don’t know if it is still booted with GRUB).
  • Did not see any option in BIOS to change storage mode unless by it you mean the AHCI mode. If so, changing it had no effect.
  • The boot order has remained the same (CD/DVD, internal HDD, Network) since i can enter the boot menu and choose the booting device if needed as described in previous post.
  • I have been able to boot from live CD, live USB, that super GRUB USB i mentioned and Windows from internal HD.

Complete fdisk -l output:

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0xbab21f87

   Device Boot  	Start     	End  	Blocks   Id  System
/dev/sda1   *    	2048  	206847  	102400	7  HPFS/NTFS/exFAT
/dev/sda2      	206848   312672255   156232704	7  HPFS/NTFS/exFAT
/dev/sda3   	312674304   625137663   156231680	7  HPFS/NTFS/exFAT

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 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
Disk identifier: 0x742fd272

   Device Boot  	Start     	End  	Blocks   Id  System
/dev/sdb1          	63  1866463892   933231915	7  HPFS/NTFS/exFAT
/dev/sdb2  	1866465280  1874866175 	4200448   82  Linux swap / Solaris
/dev/sdb3   *  1874866176  1927301119	26217472   83  Linux
/dev/sdb4  	1927301120  1953523711	13111296   83  Linux

Some additional info:
Using my USB drive with the desktop PC had no effect. But i noticed some more details in the booting process. When the black screen appears at first the cursor is blinking at the upper left corner of the screen then it moves one line down and the external HD’s activity goes up (judging by it’s blinking light). The rest is as described before.

Based on the description of the boot, the External Hard drive is not booting which means to me a blank or corrupted MBR. I would say, that going into BIOS setup and making the external hard drive the boot drive would be my preferred method. If the Internal drive is listed to boot second and the External drive is missing, then the Internal drive should boot if the external fails. I must say that on a couple of computers I worked on, you could not get the external drive to boot without powering down the Computer and hard drive which you could try. I think this is a compatibility issue between the computer BIOS and the hard drive firmware. It is worth a try to see if it helps. If it does, a computer BIOS update might be worth perusing.

Thank You,

I went into BIOS and set the USB drive as first drive and powered everything off. After booting the computer the black screen appeared same as before. I tried to boot it another time but this time switched the drive off after the black screen showed up again. Only then did the 3rd boot device - the network card - boot (for some reason i could set only one of the drives as boot device).

Since i tried to boot the drive from another computer i don’t think a BIOS update will solve the problem. Also it might be that i already have the latest BIOS version (have to check to be sure though).

You should install Grub in the MBR of your USB drive. You have nothing to lose since it is not your Windows boot drive. There is no point not to have Grub in MBR and having a generic boot code jumping to nowhere. Obviously your root partition (sdb3) can not be reached at that point. You have a black screen because the generic boot code doesn’t know where to go. Grub in MBR might not be more successful but should at least give an error which would be an indication that it is trying to boot. Boot from live CD, become root in a terminal (with su -l) and type:

grub
grub > find /boot/grub/stage2

it should return (hd0,2) or (hd1,2) depending which one is sdb3

  • if it returns (hd0,2), type:
root (hd0,2)

it should answer: Filesystem type is ext2fs, partition type 0x83
Then type

setup (hd0)
  • if it returns (hd1,2), type:
root (hd1,2)

it should answer: Filesystem type is ext2fs, partition type 0x83
Then type

setup (hd1)

Finally type

quit

and reboot.

Make sure you understand this. Don’t write Grub into the MBR of your internal drive or you won’t be able to boot Windows!. If you’re unsure, don’t do it and wait until someone provides a simpler explanation or even a better solution.

If you did it and it doesn’t work and you get an error 17 or similar, the next step would be to erase these 3 partitions (not just the content), create the partitions yourself (with PartedMagic), install openSUSE in expert mode and select these partitions. You’ll just have to format them in the setup. But formating doesn’t modify the geometry (start position and size) of partitions, it only replaces their content.

On 2011-04-11 11:36, stealthiness wrote:
>
> After turning on my laptop at the splash screen i have an option to
> enter boot menu by pressing F11. By doing so i’m presented with a list
> of available boot devices from which i can choose my USB external hard
> drive. If i do not enter the boot menu then my laptop boots windows
> normally from the internal HD.
>
> If i choose my external HD in the boot menu then the black screen with
> the blinking cursor appears. At this point it does not respond to any
> keyboard input. The only way to turn off my laptop now is by pressing
> the power button.

No MBR. It should contain grub. You can not use generic mbr code there, I
think.

file -s /dev/sdb*


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

file -s /dev/sdb*

/dev/sdb:  x86 boot sector; partition 1: ID=0x7, starthead 1, startsector 63, 1866463830 sectors; partition 2: ID=0x82, starthead 254, startsector 1866465280, 8400896 sectors; partition 3: ID=0x83, active, starthead 254, startsector 1874866176, 52434944 sectors; partition 4: ID=0x83, starthead 254, startsector 1927301120, 26222592 sectors, code offset 0xc0
/dev/sdb1: x86 boot sector, code offset 0x52, OEM-ID "NTFS    ", sectors/cluster 8, reserved sectors 0, Media descriptor 0xf8, heads 255, hidden sectors 63, dos < 4.0 BootSector (0x80)
/dev/sdb2: Linux/i386 swap file (new style) 1 (4K pages) size 1050111 pages
/dev/sdb3: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, LBA flag 0x1, 1st sector stage2 0x70490a30, GRUB version 0.97, code offset 0x48
/dev/sdb4: Linux rev 1.0 ext4 filesystem data (needs journal recovery) (extents) (large files) (huge files)

I installed GRUB to MBR. Back to Error 17

Grub Loading stage 1.5.

Grub loading, please wait…
Error 17

Here’s the output from when installing grub, all seems ok to me.

grub> find /boot/grub/stage2
 (hd1,2)

grub> root (hd1,2)
 Filesystem type is ext2fs, partition type 0x83

grub> setup (hd1)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd1)"...  17 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 (hd1) (hd1)1+17 p (hd1,2)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded
Done.

I’ll attempt to reformat the partitions later this evening. But should the results when using PartedMagic be any different from before when formating at the install?

It might. When you create partitions with PartedMagic (or another partitioning tool) you do what you want, meaning you choose the start position and the size of each partition (primary or logical). PartedMagic should adjust the position to cylinder boundaries (I guess). Be careful not to create logical partitions! You don’t need any. I think PartedMagic might want to create logical partitions by default.

When you see Error 17, do you have a Grub shell? Are you able to type something? Like for example:

find /boot/grub/stage2

Also try to boot your USB disk (which now has a bootloader in MBR) on another computer.

No, i can’t type anything.

Booting from another computer didn’t change anything.

I’ll try to reformat the partitions now.

Hmm Are we sure that gparted is not using grub2 now? Seems like you needed an older version to get the older grub OpenSUSE uses.

Should i set GParted to align new partitions to MiB or Cylinder? I couldn’t find a detailed explanation for which option should be chosen.

As long as you use PartedMagic only to erase/create partitions, it doesn’t matter. We didn’t intend to use it for anything else. The OP just reinstalled Legacy Grub from live CD.

@stealthiness
I noticed that your internal HD has 512b sector size but the 1st partition starts at sector 2048. I’m not familiar with Windows laptops though. But just wondering why and what they might have put in these 2 kb (?) Maybe a Windows expert could tell us.

That’s a good question. Since parted default is to use MiB for optimal performance, I would say “cylinder”… just assuming openSUSE setup would use parted default, and you have seen the result already. When you reinstall openSUSE, install Grub in both location: MBR and your root partition… and do not write generic boot code to MBR!

Oh I see. That must be WD Advanced Format drive. Hmmm … I suspected you USB drive might used it … but it looks like your internal drive does.

Some doc about it: How to install a WD Advanced Format Drive on a non-Windows Operating System

Thanks for the info.

Ok, i partitioned my drive with PartedMagic - deleted the old linux partitions and created new ones aligned to MiB (i left my NTFS partition as is). At the install i set GRUB to be written to external HD’s MBR and to the root partition and set the boot partition as active. But it seems nothing has changed. I’m still getting error 17 (still can’t type anything either).

Here’s some info if it helps.
fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0xbab21f87

   Device Boot  	Start     	End  	Blocks   Id  System
/dev/sda1   *    	2048  	206847  	102400	7  HPFS/NTFS/exFAT
/dev/sda2      	206848   312672255   156232704	7  HPFS/NTFS/exFAT
/dev/sda3   	312674304   625137663   156231680	7  HPFS/NTFS/exFAT

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 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
Disk identifier: 0x742fd272

   Device Boot  	Start     	End  	Blocks   Id  System
/dev/sdb1          	63  1866463892   933231915	7  HPFS/NTFS/exFAT
/dev/sdb2  	1867962368  1876518911 	4278272   82  Linux swap / Solaris
/dev/sdb3   *  1876518912  1925672959	24577024   83  Linux
/dev/sdb4  	1925672960  1953523711	13925376   83  Linux

device.map

(hd0)    /dev/disk/by-id/usb-Samsung_STORY_Station_0000002CE093105002BD-0:0
(hd1)    /dev/disk/by-id/ata-WDC_WD3200BEVT-22ZCT0_WD-WXA0A69C9390

menu.lst

# Modified by YaST2. Last modification on Tue Apr 12 01:10:14 EEST 2011
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

default 0
timeout 8
gfxmenu (hd0,2)/boot/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.4
	root (hd0,2)
	kernel /boot/vmlinuz-2.6.37.1-1.2-desktop root=/dev/disk/by-id/usb-Samsung_STORY_Station_0000002CE093105002BD-0:0-part3 resume=/dev/disk/by-id/usb-Samsung_STORY_Station_0000002CE093105002BD-0:0-part2 splash=silent quiet showopts vga=0x345
	initrd /boot/initrd-2.6.37.1-1.2-desktop

###Don't change this comment - YaST2 identifier: Original name: windows 1###
title windows 1
	map (hd1) (hd0)
	map (hd0) (hd1)
	rootnoverify (hd1,0)
	makeactive
	chainloader +1

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.4
	root (hd0,2)
	kernel /boot/vmlinuz-2.6.37.1-1.2-desktop root=/dev/disk/by-id/usb-Samsung_STORY_Station_0000002CE093105002BD-0:0-part3 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x345
	initrd /boot/initrd-2.6.37.1-1.2-desktop

###Don't change this comment - YaST2 identifier: Original name: hard_disk###
title Hard Disk
	rootnoverify (hd0,0)
	chainloader +1

Do you see the menu before getting the error ? If yes , press ‘Esc’ and get to the command prompt for grub. Type in root (hd0, press Tab, is the 4 partitions of sdb displayed ? Or is it the 3 partitions of sda ?

The Grub menu is not really relevant. The error occures before Grub gets to read the menu. The partition containing the menu and Grub stage2 (the part of Grub in the directory /boot/grub ) can not be mounted because, either it is looking on the wrong disk (BIOS settings) - which I doubt since you’re at least trying to boot the right disk, or the partition is located too far or aligned in a way that it can not be reached.
If you compare your fdisk output with the previous one, you’ll notice that the partitions start position and size have changed. This is what I expected and it was worth a try. Hmmm … the different possibilities I can think of:

  • try different boot orders and SATA/AHCI mode settings in your BIOS.
  • look if pressing F11 and selecting a device is different from explicitely changing the boot order in BIOS setup.
  • Backup your Windows partition and blank the first sector. Then reinstall Linux while placing the Linux partitions at the top of the disk. The easiest would be to get another external USB drive if you can afford it.
  • Or create a small /boot partition (100MB) on your internal HD, install Linux in expert mode while selecting both harddisks. I wouldn’t say it is complicated but I can imagine it would be. Well, ok, it is complicated. :frowning: If you had such a partition, you could boot it from Windows boot menu with a trick (consisting in writing the bootsector of this partition in a file) without having to install Grub in the MBR of your Windows drive - as many people are afraid to. But it woud not affect Windows booting behavior … of course if done correctly.

I do not recommend the last option, just mentionned it as a possibility.

I could try to change some options in my other PC’s BIOS, it seems it is more configurable than my laptop’s. But looks like soon there will be nothing else left to try except moving Linux partitions to the beginning of the disk. Just have to find where to back up all that data. I’ll post back if i have any progress.