Just a thought

GRUB error 17 ( Debian/Ubuntu )

Posted by stringofthoughts on May 24, 2009

Grub error 17 and Grub error 15, the most common grub error messages. Grub error 17 is kind of scary because you don’t even see your grub menu in this case and grub error 15 is very frustrating because it shows the grub menu but comes back to same error over and over again. I was also terrified of these error because once you get these error you can’t use your system, you can’t access the net and that’s is just not cool.is it ?

The reason for grub error 17 is a messed up partition table disk order. How partition table disk order gets messed up I have no idea but it does sometimes and then you get error 17. So what does it mean by a messed up partition table disk order. It means say your drive A was /dev/hda2 earlier now it is /dev/hda3 or something else bottom line for you to know is that you need to fix this to get rid of error 17. A good way to find this out is using a live CD

$ sudo fdisk -l

You ‘ll get something like (this is only an example)

Disk /dev/hda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x247ae615

Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1275    10241406    c  W95 FAT32 (LBA)
/dev/hda2            1276       24320   185108962+   f  W95 Ext’d (LBA)
/dev/hda5            1276        1397      979902   82  Linux swap / Solaris
/dev/hda6            1398        2550     9261441   83  Linux
/dev/hda7            2551        6374    30716248+   b  W95 FAT32

Partition table entries are not in disk order

I ‘ve a perfectly good system. I ‘ve added this line in bold at the end to show how it’ll look like if your partition table disk order is messed up. To fix the disk order.

$ sudo fdisk /dev/hda

Please note it’s hda not hda1 or hda3. No numbers we are working on entire disk. It’ll take you to fdisk prompt. Be careful here.

choose option x (extra functionality (experts only)) and enter.
then select f (fix partition order) and enter.
then select option w (write table to disk and exit), and enter.

X F W in short. Don’t do anything else unless you know what you are doing.

Now run

$ sudo fdisk -l | grep -i linux

The partition table disk order is changed and you need to note down 2 important things. Where is your swap and linux root devices. The command above will give you

/dev/hda5            1276        1397      979902   82  Linux swap / Solaris
/dev/hda6            1398        2550     9261441   83  Linux

Note this down Swap :: /dev/hda5 and Linux root :: /dev/hda6

Now you need to install grub. It’s very simple. The grub will be installed on /dev/hda6 which is written as (hd0,5) in grub. Make sure you understand this if it’s /dev/hda1 then you ‘ll use (hd0,0). It’s always one digit less in (hdX,Y).

$ sudo grub

grub > root (hd0,5)

grub > setup (hd0)

grub > quit

This is my personal observation that sometimes even if after re-installing grub /boot/grub/menu.lst is not updated. So open your menu.lst file and check /dev/hda6 and (hd0,5) is the root device in the file and not any other device. If it’s set to any other device you ‘ll end up with error 15. Here in our example root is /dev/hda6 so there is a entry in menu.lst like

title        Debian GNU/Linux, kernel 2.6.26-2-686
root        (hd0,5)
kernel        /boot/vmlinuz-2.6.26-2-686 root=/dev/hda6 ro
initrd        /boot/initrd.img-2.6.26-2-686

title        Debian GNU/Linux, kernel 2.6.26-2-686 (single-user mode)
root       (hd0,5)
kernel        /boot/vmlinuz-2.6.26-2-686 root=/dev/hda6 ro single
initrd        /boot/initrd.img-2.6.26-2-686

For Ubuntu users it’ll be (hd0,5) and /dev/sda6. Make sure the root device is correct in this file.

Next file to check is /etc/fstab. Open the file and check the device for swap and root is correct. here is an example

# /etc/fstab: static file system information.
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/hda6 /               ext3    errors=remount-ro 0       1
/dev/hda5 none            swap    sw              0       0
/dev/hdc        /media/cdrom0   udf,iso9660 user,noauto     0       0

Once you are done you can reboot. You ‘ve just solved your grub problem 🙂


42 Responses to “GRUB error 17 ( Debian/Ubuntu )”

  1. […] Error 17 is described here […]

  2. […] Error 17 is described here […]

  3. Poovaiah M P said

    thank you very much for the post. This was very helpful for me. Keep up the good work

  4. anamtamrin said

    thank u very very much…

  5. Levi said

    I tried this and although very well written, had issues. Looking for insight.

    For starters, i got this error because of an update in Ubuntu 9.04. Not sure why.

    fdisk -l returns:
    sda1* W95 Fat32
    sda2 extended
    sda5 Linux swap / solaris

    no order issues when fdisk dev/sda ran.

    fdisk -l | grep -i linux returns:
    sda5 Linux swap / solaris

    ran grub
    grub>root (sd0,4) returns:
    Error 23: Error while parsing number

    for poopies and chuckles i tried…
    grub>root (sd0,1)

    same result.

    • stringofthoughts said


      I’m not aware of your whole problem but one thing i noticed in your comment is that you don’t ‘ve a Linux partition. You ‘ve a swap partition but not the partition where you had installed Linux.

      $ fdisk -l | grep -i linux should ‘ve returned

      /dev/sda1 1276 1397 979902 82 Linux swap / Solaris
      /dev/sda2 1398 2550 9261441 83 Linux

      A Linux partition and a swap partition. You ‘ve only swap partition. same thing with fdisk -l , your main Linux partition is missing.

      You could try to retrieve partition table or if you ‘ve important data in there somewhere you should make a disk image so that you can retrieve data later. I feel like you could try to get the partition back or make a new partition and do a fresh installation.

      Good Luck 🙂

  6. - said

    […] […]

  7. Steve said

    Sorry, Ubuntu newbie here. I have a Windows/Ubuntu dual boot set up and recently repartioned a drive through Windows. Now I am getting Grub Error 17. Looks like my partition table is indeed out of order. Here is what I am getting:

    ubuntu@ubuntu:~$ sudo fdisk -l

    Disk /dev/sda: 160.0 GB, 160041885696 bytes
    255 heads, 63 sectors/track, 19457 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0xc3ffc3ff

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 3825 30724281 7 HPFS/NTFS
    /dev/sda2 3826 10324 52203217+ f W95 Ext’d (LBA)
    /dev/sda3 10325 17654 58878225 83 Linux
    /dev/sda4 17655 19457 14482597+ 12 Compaq diagnostics
    /dev/sda5 7712 10006 18429952 7 HPFS/NTFS
    /dev/sda6 10007 10324 2554303+ 82 Linux swap / Solaris

    However, I am getting stalled on the next command:

    ubuntu@ubuntu:~$ sudo fdisk /dev/hda

    Unable to open /dev/hda

    Any help is appreciated. Thanks!

    • stringofthoughts said

      Hi Steve,

      I’ve wrote those blogs from a debian system. Debian shows hard disk as /dev/hdx where as ubuntu shows ’em as /dev/sdx . I guess you copied commands from my blog. You should try

      $ sudo fdisk /dev/sda

      replace hdx with sdx and i think it’ll work out just fine.

      Good luck 🙂

  8. Steve said

    By the way, I am using a Ubuntu live CD. Do I need to mount the hard drive first? Just an idea from reading forums.

  9. mohamed said

    ubuntu@ubuntu:~$ $ sudo fdisk -l
    bash: $: command not found

  10. hosein said

    I have problem with

    grub> root(sd0,5)

    Error 27: Unrecognized command

    Do you help me?

    • stringofthoughts said


      Your command is incorrect. Try this

      grub> root (hd0,5)

      There is always a space between root and the string (hd0,5) and hard disk is represented as hd0 and not as sd0. These were the two problems with your command.

      I hope it works.

      Good Luck 🙂

  11. Marc said


    After typing sudo grub I get this:

    sudo: grub: command not found

    An I cannot proceed any further. Any suggestions?

    Thanks for your help!

    • stringofthoughts said

      Hi Marc!

      The command is not found because the is grub is not installed in your system. Trying apt-get from live CD won’t fix the problem. Without any more information it’s difficult for me to suggest anything but you can take a look here but don’t try it blindly. http://www.gnu.org/software/grub/manual/html_node/Installing-GRUB-using-grub_002dinstall.html.

      Download this script http://sourceforge.net/projects/bootinfoscript/ and execute as suggested in the script. It’ll generate a report, send me that report. It’ll be helpful for me to understand your system.

      grubinstall is a little bit risky command if you are executing it blindly. Be careful.

      • Marc said


        The report it generated is as follows:

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

        => Grub0.97 is installed in the MBR of /dev/sda and looks on the same drive
        in partition #1 for /boot/grub/stage2 and /boot/grub/menu.lst.

        sda1: _________________________________________________________________________

        File system:
        Boot sector type: –
        Boot sector info:
        Mounting failed:
        mount: unknown filesystem type ”

        sda2: _________________________________________________________________________

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

        sda5: _________________________________________________________________________

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

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

        Drive: sda ___________________ _____________________________________________________

        Disk /dev/sda: 203.9 GB, 203928109056 bytes
        255 heads, 63 sectors/track, 24792 cylinders, total 398297088 sectors
        Units = sectors of 1 * 512 = 512 bytes
        Disk identifier: 0x6c2be8ed

        Partition Boot Start End Size Id System

        /dev/sda1 * 63 386,154,404 386,154,342 83 Linux
        /dev/sda2 386,154,405 398,283,479 12,129,075 5 Extended
        /dev/sda5 386,154,468 398,283,479 12,129,012 82 Linux swap / Solaris

        blkid -c /dev/null: ____________________________________________________________

        /dev/loop0: TYPE=”squashfs”
        /dev/sda5: UUID=”23b42fa1-ea84-4f71-9d70-ef979de8f7ba” TYPE=”swap”

        =============================== “mount” output: ===============================

        aufs on / type aufs (rw)
        none on /proc type proc (rw,noexec,nosuid,nodev)
        none on /sys type sysfs (rw,noexec,nosuid,nodev)
        udev on /dev type tmpfs (rw,mode=0755)
        /dev/sr0 on /cdrom type iso9660 (rw)
        /dev/loop0 on /rofs type squashfs (rw)
        none on /sys/fs/fuse/connections type fusectl (rw)
        none on /sys/kernel/debug type debugfs (rw)
        none on /sys/kernel/security type securityfs (rw)
        none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
        none on /dev/shm type tmpfs (rw,nosuid,nodev)
        tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
        none on /var/run type tmpfs (rw,nosuid,mode=0755)
        none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
        none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
        binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
        gvfs-fuse-daemon on /home/ubuntu/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=ubuntu)

        Hope it makes sense 🙂

        Thanks again,


      • stringofthoughts said

        Hello Marc,

        I think grub-install will solve your problem. Since you don’t ‘ve multiple disk it shouldn’t be a problem.

        $ sudo grub-install /dev/sda

        after this follow the steps from the blog as you were doing earlier. (eg. sudo grub and find stage1 commands)

        Let me know …… Good luck 🙂

      • Marc said


        Thanks for your reply 🙂

        I still couldn’t fix my GRUB issues though. Basically after typing sudo grub-install /dev/sda, it returned:

        grub-probe: error: cannot find a device for /boot/grub

        No path or device is specified.
        Try ”grub-probe –help” for more information.
        Auto-detection of a filesystem module failed.
        Please specify the module with the option ‘–modules’ explicitly.

        I do not know if it means anything but I cannot mount the hdd either due to a similar filesystem error. Also, any ideas on how could all this GRUB 17 error happened? I never tried to install any other OS or partition the disk or similar… Would it be easier for me to just reinstall the whole system?

        Thanks for your advice,


      • stringofthoughts said


        If you can reinstall i think you should do it. Backup your data and reinstall the system. Your problem seems complex and requires closer look which is impossible through blog messages. Since you asked whether it’ll be easier to reinstall all I can tell you, assuming that you know how to reinstall, that it’ll save your time and will definitely solve your grub issue 😛

        I ‘ll try to emulate the situation on my test system to find out the problem. I ‘ll let you know

        I’m sorry … Good luck !!!

      • Alastair McAlpine said


        Can I suggest that if you are running from a live CD, you may need to set-up your internet connection to allow the computer access to the files. As its a live CD you need to do this each and every time you run it, because it is not saving any preferences as it would when you are running from the Hard drive

        Just a though!!


  12. sidney myall said

    Very helpful. Worked alright.
    Thanks for screen shot as well

  13. […] To fix this, follow this site’s instructions. […]

  14. john crisp said

    None of these formats work for me??
    Ubuntu list is there in sudo fdisk -l
    then I can’t get beyond sudo fdisk /dev/sda it responds with list of menus of which none work?
    system: HP compaq presario V2630 amd with xp home in main partition, then karmic 9.10 in 2nd.
    If i delete the Ubuntu partition in partition magic, will it revert to windows MBR or will I completely BRICK my laptop?
    Thanks for help/suggestions.
    John in Dallas

  15. srikraju said


    While booting I am getting this error “GRUB loading , please wait…. Error 17 ” I am not able to do anything plz help…………..

  16. u said

    thank you mann, you really rull, just made my day better, keep up the good work 🙂

  17. James said

    I am trying to fix what began with the error 17. I have looked over your instructions and the problem I face is that my partition order was never wrong. I tried running the command anyway, but (of course) received “Nothing to do. Ordering is correct already”.

    The other steps in your solution all seem to hinge on the order having been incorrect.

    I have a thread running over at Ubuntu where you can find a lot of information:


    Any help (either here or there) you might be able to offer will be greatly appreciated.

  18. albert said

    well i got the error 17 but i got no cd drive to put in a cd can i do it with a usb

  19. JohnnyMonroe said

    Thank you so much! very helpful.

  20. Nitin agrawal said

    thank u very much…
    u have saved me from installing the whole mandriva linux again..

  21. Craig said

    Thanks. I got into trouble while using parted magic. A lot of other solutions didn’t work for this install because it is Ubuntu 10.04, upgraded since 9.04. This meant I still had grub as opposed to grub-pc.

    This solution saved my hide.


  22. […] I'm guessing you have the SATA/IDE cables in the wrong spot or your partitions are wrong. http://stringofthoughts.wordpress.co…-debianubuntu/ Seccond boot attempt: Your getting a wrong root FS, either your root FS isn't supported, you have […]

  23. Sasha King said

    helpful stuff, thank you. myself I have just found this cool CD for booting Windows at at windowsbootcd.com, testing it right now.

  24. Greg said

    Just upgraded from ubuntu 8.0 to 10.10 and ran into grub error 17. Being a little shaky on my hard core linux skills, I made a mistake while setting the partition usage manually (I have one large HD with both windows and linux on it). Turns out that I set Grub to install on one of the partitions rather than the drive itself (that is sda5 rather than sda or sd0). That fixed my problem strait away, so if the excellent instructions of using fdisk return “nothing to fix”, check that you have grub installed on the drive itself, not a partition.

  25. campeon_x said

    Hi stringofthoughts!



  26. Caroline said

    thank you- years later your post helped me today to figure out what is wrong with my computer. and i have win7, no idea how it happened, but thank you, thanks you!!!!

  27. Eric said

    Your post is still alive!!

    Thank you very much.


  28. Alip said

    Moving Windows XP partitions around with EASEUS Partition Master on a dual booting machine (Ubuntu 11.10 with Grub 1) messed up my partition table. Twice. 🙂 A million thanks!


    P.S. To get the correct digits for (hdX,Y), you can also use
    grub> find /boot/grub/stage1


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: