1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Grub Error 21 help

Discussion in 'Linux and Unix' started by Spickett120, Apr 26, 2010.

Thread Status:
Not open for further replies.
Advertisement
  1. Spickett120

    Spickett120 Thread Starter

    Joined:
    Apr 26, 2010
    Messages:
    2
    I recently installed linux mint to a seagate 500G external hardrive, my laptop has windows 7 installed on the internal hd. after installation i cannot boot to win 7 without the external hard drive plugged in because of grub error 21, when plugged in everything works fine could someone please help me out here
     
  2. TerryNet

    TerryNet Moderator

    Joined:
    Mar 23, 2005
    Messages:
    79,845
    First Name:
    Terry
    You've described that you set up a dual boot of OSes on the internal and external drives, and it is working.

    What is it that you want to do?
     
  3. Spickett120

    Spickett120 Thread Starter

    Joined:
    Apr 26, 2010
    Messages:
    2
    I know what i did im the one who did it i just need to know how to get xp to boot without the external hd plugged in
     
  4. TerryNet

    TerryNet Moderator

    Joined:
    Mar 23, 2005
    Messages:
    79,845
    First Name:
    Terry
    I'm not expert on this, but I believe you can use Grub to repair the bootloader (just don't have the external drive connected at the time), or the Windows 7 DVD to repair the boot for Windows 7 and/or XP, or the XP CD to repair the boot for XP.

    Or see the links in saikee's signature.
     
  5. cancon

    cancon

    Joined:
    Jul 22, 2005
    Messages:
    1,152
    I would advise downloading and burning Super Grub Disc on a Blank CD. Then plug in your hard disk and boot from Super grub disk. Select the smiley face which is similar to :)))), and push enter. Reboot your computer and try it.
     
  6. cancon

    cancon

    Joined:
    Jul 22, 2005
    Messages:
    1,152
    I think he's looking to have XP work regardless of whether or not the external drive is connected, and ubuntu only work when it is connected.

    Re-installing GRUB into the MBR of his laptop's internal HD while having the external HDD connected should solve his problem, as it will scan all media for installed OSes and list them.
     
  7. TerryNet

    TerryNet Moderator

    Joined:
    Mar 23, 2005
    Messages:
    79,845
    First Name:
    Terry
    I defer to you, Danny. Was just trying to see if I could help until somebody more qualified came along. Thanks.
     
  8. saikee

    saikee

    Joined:
    Jun 11, 2004
    Messages:
    3,888
    The explanation

    The Linux Mint was installed after Win7 so in order for Linux to boot the installer placed Grub in the MBR of the internal disk as it is automatically detected first and gets the first boot disk status. The rest of the Grub is in the external disk's Linux Mint partition.

    When the external disk is unplugged Grub is broken and cannot find its home in the Win7 internal disk so the error would be issued as a complaint.

    The Cure - two methods showed below. A third is possible if LInux MInt does not use Grub2

    (1) Instruct Bios to boot the external disk first whenever it is plugged. It is a pain in the arsx to change the Bios every time the external disk is to be booted as some mobo automatically switches back to the internal disk if the external disk is absent. You need to restore Win7's MBR and restore Grub in the MBR of the external disk. The procedures are given in Task B7 and B5 respectively in the Just Booting tips of my signature.

    (2) Let Win7's bootmgr to dual boot. This relieves Grub from its task. This method needs the following steps

    (a) Make Linux Mint bootable by another boot loader - Task D2 of Just booting tips refers. Technical this is to make Linux Mint "chainloadable"
    (b) Copy the first 512 bytes of the Linux Mint partition and place it in the C:\ drive of Win7. You need to mount the Win7 partition first while working with Linux Mint. The file has to be copied only by dd command. A full description is given here. This is one sector of the hard disk copying.
    (c) Edit bootmgr's configuration file to include Linux. Details available in the above link.
    (d) Restore Win7's MBR. Task B7 of my Just booting tips refers.
    Your Win7 from this point onward will dual boot both systems.

    In summary

    To mount Win7, say it is sda1, on mounting point /mnt/C_drive
    Code:
    sudo su
    mkdir /mnt/C_drive
    mount /dev/sda1 /mnt/C_drive
    To copy the first 512 bytes of Linux Mint partition say it is in sdb1 and call the copied data as Linux_Mint.bin.
    Code:
    dd if=/dev/sdb1 of=/mnt/C_drive/Linux_Mint.bin bs=512 count=1
    To ask Win7 for a GUID number for booting Linux (after booting to Win7 and in Command Prompt or terminal mode to run as admin). The command to use is just bcdedit.exe
    Code:
    bcdedit /create /d "Linux_Mint_in_sdb1" /application BOOTSECTOR
    Win7 will respond with something like

    "The entry {c4c13df3-7949-11dc-98f8-81e4e48608ff} was successfully created."

    The red bit is the GUID number required in the following commands
    Code:
    bcdedit /set[COLOR="Red"] {c4c13df3-7949-11dc-98f8-81e4e48608ff}[/COLOR] device boot
    bcdedit /set[COLOR="Red"] {c4c13df3-7949-11dc-98f8-81e4e48608ff}[/COLOR] PATH \Linux_Mint.bin
    bcdedit /displayorder [COLOR="Red"]{c4c13df3-7949-11dc-98f8-81e4e48608ff}[/COLOR] /addlast
    The above will add Linux Mint as the last booting option in Win7 boot menu. If the external disk is not present the bootmgr will not know so Win7 can continue to be usable.

    Explanation of the MS boot loader bootmgr behaviour

    MS systems are not designed to support other operating systems so they can't read a Linux partition to locate its boot loader Grub. If a user wans a MS system to boot Linux the user must put the information on a plate and present it to Win7 inside the C:\ drive as the bugger is either too lazy to come out or not intelligent enough to find it itself. The bit of information required is the first 512 bytes of the Linux which should have previously arranged to have Grub installed there.

    In the actual booting Win7 bootmgr takes the first control. If the user wants Win7 the bootmgr will load it. However if the user wants Linux then the bootmgr will load up Grub and bugger off itself. Grub will assume control then.
     
  9. cancon

    cancon

    Joined:
    Jul 22, 2005
    Messages:
    1,152
    Aaah. That makes a lot of sense. Well spotted ;)(y)
     
  10. saikee

    saikee

    Joined:
    Jun 11, 2004
    Messages:
    3,888
    If the OP has a floppy drive I wouldn't bother with any repair but make a Grub floppy. Similarly one can do it with a Grub CD.

    If I find the Win7 doesn't boot because the external disk has been unplugged I just slip in the Grub floppy and fire up the Win7 with these commands (assuming Win7 is in the first partition of the internal hard disk)
    Code:
    root (hd0,0)
    chainloader +1 boot
    The above is for a Grub floppy made from Grub1. The equivalent commands for Grub2 is slightly different.
    Code:
    set root=(hd0,1)
    chainloader +1
     boot
    See this thread to make a Grub1 floppy or CD for Grub1 and for Grub2 try this.

    Early Linux Mint uses Grub1 but there has been reports that the latest ones might have Grub2. To find out which one just check the /boot/grub directory. Grub1 uses menu.lst but Grub2 has only grub.cfg as the configuration file. Distros are forced into Grub2 if they want to offer Ext4 filing system which Grub1 can't read.

    If the above commands specify "root (hd0)" and "set root=(hd0)" without the partition number the MBR will be fired up. Grub2 does not count the partition number from zero as Grub1 does.

    Put Grub on a floppy or a CD will solve at least all the booting problems for any PC user. I have been searching for an installed PC operating system that cannot be booted up by a humble Grub floppy but haven't found one yet! Both Grub1 and Grub2 can be installed on itself in a floppy or a CD.
     
  11. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/919360

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice