LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-04-2009, 08:09 AM   #1
miguelg
Member
 
Registered: Oct 2009
Location: UK
Distribution: Xubuntu
Posts: 31

Rep: Reputation: Disabled
GRUB error 21 when external drive disconnected


Hey there,

I've installed Ubuntu on my external HDD (I'll refer to it as HDD2 from now on) and it is just wonderful. The only problem I had was with the graphics driver which, with some help from the net, is now fixed.

However, I'm now getting an error 21 from GRUB when I start up my laptop and the HDD2 is disconnected (Windows is installed in the HDD1.)

Since a laptop is meant to be mobile and it's a real pain in the back side having to carry around my bulky HDD2 (lol) just so it boots up, I'd like to ask you guys:

- what I can do to remove GRUB from the HDD1 primary partition so Windows can boot up with no hassle, effectively restoring the boot sector to the way it was;

- how I can set GRUB up on the external HDD2 so Ubuntu boots up.

Basically I'd like to be able to control where to boot up from, from the BIOS. (I recently discovered there are some hidden menu options in the BIOS that allow me to boot up from USB devices)

I would research the net myself and try this out but I'm actually a little weary of doing so because I lost data on the HDD2 back when I was repartitioning it for Ubuntu. So I don't really feel confident or courageous enough to mess up with the boot sector.

Thanks for you time.
 
Old 11-04-2009, 08:23 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
I see you asking a question, but then saying you're not going to attempt the solution.....???

Assuming that you can configure your BIOS to boot from an external drive, then:

1. Install GRUB to the external drive. Simply boot into Ubuntu and open a terminal. Then:
Code:
## First, I am assuming that your external drive is seen as #2.  To check, do "fdisk -l"
sudo grub    ## starts the grub shell
root (hd1,0)   ##this assumes that your /boot directory is on the first partition (grub counts from 0)
setup (hd1)
2. Use your Windows disk to re-install the Windows bootloader. Boot from the CD, enter recovery mode, and enter "fixmbr".

You can now switch between OSes using the BIOS settings
 
Old 11-04-2009, 08:26 AM   #3
miguelg
Member
 
Registered: Oct 2009
Location: UK
Distribution: Xubuntu
Posts: 31

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pixellany View Post
I see you asking a question, but then saying you're not going to attempt the solution.....???
lol, no. What I meant was I wasn't willing to dig the net in search for a solution for fear of possibly screwing everything up. Linux is new for me.

Quote:
Originally Posted by pixellany
Assuming that you can configure your BIOS to boot from an external drive, then:

1. Install GRUB to the external drive. Simply boot into Ubuntu and open a terminal. Then:
Code:
## First, I am assuming that your external drive is seen as #2.  To check, do "fdisk -l"
sudo grub    ## starts the grub shell
root (hd1,0)   ##this assumes that your /boot directory is on the first partition (grub counts from 0)
setup (hd1)
2. Use your Windows disk to re-install the Windows bootloader. Boot from the CD, enter recovery mode, and enter "fixmbr".

You can now switch between OSes using the BIOS settings
Thanks man, will try this out as soon as I can.
 
Old 11-04-2009, 08:35 AM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 7,266

Rep: Reputation: 1368Reputation: 1368Reputation: 1368Reputation: 1368Reputation: 1368Reputation: 1368Reputation: 1368Reputation: 1368Reputation: 1368Reputation: 1368
The default for Ubuntu is to install the stage1 file of Grub to the master boot record on the first drive, which in your case is the laptop drive with windows on it. The mbr is not on the windows partition.

If you have vista or win 7, do the following:

Boot up from Vista Installation DVD and select Repair Your Computer option (its below Install Icon). Select Windows Vista -- Command Prompt.
Execute this at command prompt:
Code:
bootrec.exe /fixmbr
bootrec.exe /fixboot

I believe you need the full installation CD/DVD not a Recovery CD/DVD.
If you don't have it, you can use EasyBCD which you can download here:

http://neosmart.net/dl.php?id=1

Read the Instructions for Use here:

http://neosmart.net/wiki/display/EBC...r+with+EasyBCD


If you're using xp, use the CD/DVD and select Recovery and type:

fixmbr
 
Old 11-04-2009, 08:39 AM   #5
miguelg
Member
 
Registered: Oct 2009
Location: UK
Distribution: Xubuntu
Posts: 31

Original Poster
Rep: Reputation: Disabled
Thanks for your post yancek.

I take it I should fix the master boot record after I've taken the steps that pixellany above suggested?
 
Old 11-04-2009, 08:42 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
My second step IS fixing the master boot record---yancek is just giving more detail.

You can do it the other way around, but then you'll need to use a live CD to install the Linux (grub) bootloader.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Don't rsync to disconnected external drive MurdinE Linux - General 2 08-08-2009 02:13 PM
Grub Error 21 with USB External Hard Drive and Other Problems drubru Linux - Newbie 7 05-16-2009 07:03 PM
Grub Error 21 - Installing Linux on a 2nd, External Drive Reidja7 Linux - Software 2 06-09-2007 12:52 AM
External Hard Drive GRUB Error magcius Linux - Hardware 4 05-15-2007 06:37 PM
GRUB Error 17 when installing Ubuntu on an External Drive nrbelex Linux - Software 1 11-16-2005 08:06 AM


All times are GMT -5. The time now is 05:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration