Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am very new in linux so please try to be "basic" with me
I recently removed ubuntu from my portable hard drive, and then had grub loading problems.
Last time i tried to do this the grub files somehow got half installed on my internal hdd's mbr and half on the external portable hard drive. Because of that when i booted without the phd plugged in this would show:
Grub loading stage 1.5
I fixed that and now i am wondering if it is possible to install Ubuntu 9.04 on my portable hard drive (which i frequently take out and carry around with me) so that when it is plugged in Ubuntu will boot and when the portable hard drive is unplugged the windows dual boot screen will show? Btw, I currently have a windows vista and windows 7 dual boot.
I have had experience in running Ubuntu persistently, and that is what i don't want to do.
If i am not being clear enough just post in something and i will try to answer it.
It is possible, but (more) difficult with the default Ubuntu install CD than it should be. Ubuntu (by default) treats its users much like M$oft does - you don't get the option to choose what you might really want.
I prefer to use the "alternate" install CD. With that you can choose what you want to install - and where. Not as straightforward, but you can do what you want, how you want.
If you still have Ubuntu on the external, boot the Ubuntu liveCD, and plug the external in. Then do this to write the boot code to the external
Grub unfortunately consists of two parts (as you have discovered); one part in the MBR and one part in /boot. It's the reason I prefer LiLo as it fits completely in the MBR and therefore will not show the symptoms that you describe.
The trick is that you must install the bootloader itself (let's say the first part of grub) in the MBR of the portable disk. And next you can use the BIOS to select from what to boot; e.g. USB HD first, CD/DVD second and internal HD last. This sequence will take care of automatically booting from external HD if it's connected; disadvantage is that if you have a memory stick in the PC when it boots, it might throw errors if it's not bootable.
Alternative is not to boot automatically from USB, but selecting the USB HD as boot device when you need it.
Distribution: Mandriva 2009 X86_64 suse 11.3 X86_64 Centos X86_64 Debian X86_64 Linux MInt 86_64 OS X
Ubuntu gives you the option to install GRUB on any disk
After you make you're choice on which disk or partition where to install
comes the next sreen , on that screen you find A option ADVANCE .
Use this option to make the choice where to install GRUB.
In you're case I think the external drive.
Edit once the menu.lst of UBUNTU to remove the lines fore you're windows.
As long as the computer can boot from the external and the external is set as the first boot device it will boot of course only UBUNTU
You use the advanced installation options in Ubuntu to install GRUB in the Linux root partition on the external hard disk.
In grub you do something like this.
If you install grub to the MBR of the external drive then you do this.
In either case, replace "hd1" with the correct ID for the external drive.
hd1 Second hard disk
hd2 Third hard disk
hd3 Fourth hard disk
You then copy the superblock (boot sector) from the Linux root partition into a file so that Vista can chain to the GRUB boot loader.
There are a few ways to copy the boot sector to a file. In Linux you can use the "dd" command. You can also download a program called "dskprobe" that is included with the Windows XP Support tools. It works in Vista as well as XP.
That will create a file called "bootsect.lnx" in the "/tmp" directory. You then have to copy the file somehow to Windows Vista's root directory. Change "/dev/sdb1" if your Linux root partition has some other device name.
Using "dskprobe" in Vista, open the physical drive for read access. Read sector 0 of the external disk drive. Select the option to view the partition table and click the "Go" button next to the relative sector of the first partition. Change the view mode to "bytes". Click Save As in the menu and save the block in a file. For example, "bootsect.lnx". You have to set the file type to "all file types" or it will have a ".dsk" extension. If you installed to the MBR then don't click the "Go" button. Just save the first sector (partition table) that you read from the external drive.
To add the boot block file to the Vista boot menu you use the "BCDEDIT" command. In the start menu, click on Accessories and then right-click on "Command Prompt". Click on "Run as administrator". Use these commands to add the boot sector file.
Note the long number displayed for the ID of the new entry. You can drag the mouse cursor over it and copy it to the clipboard so that you can paste into commands. Replace "ID" below with the actual ID number displayed.
You can think of booting like a number of bus stops along the way to your operating system. The first bus stop after the BIOS in the computer is the Master boot Record (MBR) containing the partition table on the first hard disk.
There are four other bus stops on each hard disk. Each Primary Partition can have a Partition Boot Sector with boot software.
Usually the software in the MBR will decide where to go next based on the "Boot" flag (also called Active). One partition is usually marked as the Active Boot partition. The MBR software will go to the active Partition Boot Sector next. Since there can be four Primary partitions on a hard disk there can be four choices. The first one that is marked as the Active Boot partition will be selected. Windows Setup installs this default MBR code and then marks the partition containing the Windows "bootmgr" as the Active Boot partition.
When you install GRUB directly to the MBR (default) then grub is started after the MBR, and the Active Boot partition designation is ignored. GRUB can chain to a Partition Boot Sector (for example the Windows partition) using the "chainloader" command. You can think of the grub menu as another bus stop.
When you install GRUB to a Partition Boot Sector then GRUB only starts first if that partition is on the first hard disk and marked as the Active Boot Partition. Other than that you have to have something else (Windows "bootmgr") chain to the Partition Boot Sector containing GRUB. The menu for the Windows "bootmgr" is another bus stop where you can select a destination.
Here is how booting works after installing Windows.
The BIOS goes to the Master Boot Record. The Master Boot Record sees that Primary Partition 0 (first partition) is marked as Active and goes to Partition Boot Sector 0. The software in that Partition Boot Sector loads the Windows "bootmgr". The "bootmgr" boot loader loads and starts Windows Vista.
Here is how booting works after doing a default installation of Ubuntu.
You can boot either Linux or Vista. In both cases the software in the MBR of the first hard disk loads grub and ignores the Active Boot flags for the partitions. To boot Linux, grub loads Linux directly. Since grub does not know how to load Windows it has to "jump" to the Partition Boot Sector for Windows (Partition Boot Sector 0). As usual, Partition Boot Sector 0 (first partition) contains software that starts the Windows "bootmgr". The "bootmgr" loads Windows Vista.
If you installed Ubuntu on the external drive using the default MBR installation then you got this.
In both cases grub on the external disk is loaded first. The external disk must be connected in order to boot.
To avoid that problem you can avoid installing grub to the MBR of the first hard disk. That is controlled by the "setup" command in grub when you install grub. For example, if you installed grub to the Linux root partition on the second hard disk then booting works like this.
It really doesn't matter where you install grub on the external hard disk as long as you copy the correct sector into the "bootsect.lnx" file. The Vista "bootmgr" cannot chain directly to boot sectors like grub and it can only load a copy of a boot sector from a file.
There are lots of different ways to configure booting since you can install a boot loader into the MBR of any hard disk or any of the Partition Boot Sectors on any hard disk. That's five places per hard disk! I usually avoid installing anything but the standard (boot active partition) code in an MBR. For example, I might install grub to the second primary partition and then just change the "Boot" flag to the second primary partition. That would do the same thing (in essence) since grub would start first.
The advantage to this approach is that if you remove Linux you can easily change the Boot flag using "fdisk" or "cfdisk" to make the Windows "bootmgr" start first again. Just using "setup (hd0,1)" instead of "setup (hd0)" will install grub to the partition boot sector of the second partition.
If you keep the different bus stops in mind you can more easily understand booting.
MBR (first hard disk - first boot softwrae)
PBS0 - First Primary Partition on First Hard Disk
PBS1 - Second Primary Partition on First Hard Disk
PBS2 - Third Primary Partition on First Hard Disk
PBS3 - Fourth Primary Partition on First Hard Disk
In GRUB these have different names.
Every hard disk has these five boot sectors / boot records. It is ONLY the MBR on the first hard disk that is started by the BIOS. From there everything depends on what software has been written into the various boot sectors and what choices a user makes from the menus. You can still follow the whole process based on which boot sectors or boot loader programs are loaded, and it's even possible to answer the menu questions to go in circles depending on how things are configured.
Also beware if you change the default boot hard disk in the BIOS. That usually changes BIOS drive designations. For example, if you set the external hard disk as the default boot disk it will probably be known as (hd0) and not (hd1).
When you install grub, the default software it uses will work with any drive ID. As long as the grub menu uses partition UUIDs rather than device IDs it will also work.
If your grub boot menu has names like (hd0,1) or (hd1,0) then you might have to change those if you try to boot the external hard disk by making it the default boot drive in the BIOS. For example, if you install Ubuntu with the external drive as (hd1) and (hd1) is put in the menu then it won't boot when the drive is the default drive (hd0).
Distribution: Mandriva 2009 X86_64 suse 11.3 X86_64 Centos X86_64 Debian X86_64 Linux MInt 86_64 OS X
The OP should only beware of one think when he install UBUNTU on the external drive and put GRUB on the external drive that at that moment the external is the first boot HD .
I did this trick for at least 20 times , installing a OS in that way it works just fine
BTW use a real linux text editor to edit the menu.lst