LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   How do you get back into Ubuntu if you don't put Grub on the MBR? (https://www.linuxquestions.org/questions/ubuntu-63/how-do-you-get-back-into-ubuntu-if-you-dont-put-grub-on-the-mbr-344017/)

Marrea 07-17-2005 01:05 PM

How do you get back into Ubuntu if you don't put Grub on the MBR?
 
I haven't been able to find any information about this so far and as very few people seem to use the Window XP boot loader to dual boot Windows and Linux I don't hold out much hope of advice!

However, here goes.

As is my habit with SuSE 9.2/Windows XP on my main laptop, I want to use the Windows XP boot loader to dual boot Win XP and Ubuntu on my second machine. Therefore during installation I put Grub on the first sector of the boot partition rather than the MBR. I now need to get back into Ubuntu after the initial boot to finish the installation and copy the Linux boot sector so I can add it to the Windows C drive where boot.ini will find it. I can't do this because obviously the computer boots straight back into Windows.

It's so simple in SuSE. After the initial boot, with the installation CD still in the drive you just choose "Boot installed system" and it boots into SuSE and completes the installation, after which you can then copy the Linux boot sector on to a floppy, go back into Windows, copy the boot sector into the C drive, add an entry to boot.ini, reboot and hey presto the Win boot loader gives you the choice of Win or Linux. No worries about Grub possibly messing up your MBR and no third party boot loader required.

With Ubuntu I've tried reinserting the CD and using the rescue option at the boot command but get nowhere. It reaches

Enter a device you wish to use as your root file system
/dev/discs/disc0/part1
/dev/discs/disc0/part2
/dev/discs/disc0/part3
/dev/discs/disc0/part5

When I select /dev/discs/disc0/part2 (which I assume is the right choice, Win XP being on the first partition, and Ubuntu root on the second), I get a message about no root being found and then I end up with a blue screen and the whole thing hangs.

I've also tried using a Knoppix CD but it always hangs when it gets to
Scanning for Hard disk partitions and creating /etc/fstab ...

I'm using a Toshiba Satellite 1800 laptop.

Incidentally, I already have Ubuntu installed on a dual-boot system with Windows 98 on an old spare desktop and I use Boot Magic as the bootloader there. Unfortunately, my Toshiba does not seem to like Boot Magic and will not play ball.

BaptismOfFire 07-17-2005 01:43 PM

Try this. Use a net install of debian on to your desired partition, putting grub in /dev/hda2 (if it is the secondary partition on you primary drive) (which is where mine is installed. Get the base of deb installed (when asked for package selection, just press enter without selecting anything) Then install Ubuntu over the top.

I cannot guarantee that the above process will work, however, it comes from the following experiences of my own.

I have 1 200gb disk. On my pri partition I have XP, secondary is Debian, tertiary is Ubuntu.

When installing debian I put grub in /dev/hda2. When install Ubuntu to my third partition I still put grub in hda2. This just added Ubuntu to the top of the Grub menu, But I still had the Win XP loader to start.

If the above process does not work, create a small partition at the start of your free space, install deb there then install Ubuntu to the rest of the drive.

Marrea 07-17-2005 01:52 PM

Thanks. I'll certainly give this a try.

Also, since my initial post I have had a thought - if during installation I put Grub on a floppy that would get me back in, wouldn't it? Then I suppose subsequently I could change the location of Grub and put in on the first sector of the boot partition.

I'll have a play around and see how I get on. Probably won't have time until next weekend now, though.

Thanks again.

Marrea 07-18-2005 07:31 AM

Just to report that I tried the floppy disk method last night and that worked, ie got me back in so Ubuntu could finish the installation.

Now I need to try and move Grub to the first sector of the boot partition (it's too much of a fiddle booting from a floppy each time). Is there an easy way to do this? In SuSE you can use YaST to change the bootloader location, but I don't know my way around Ubuntu well enough yet. Once I've done that I can (hopefully!) add Ubuntu to the Windows NTLDR as a boot option.

BaptismOfFire 07-18-2005 04:51 PM

my machine is borked atm, but with my dual instal of win/lin, when checking the b oot details unde win (i forget how I got there) there was a line for the grub loader, so yes, you can add it manually.

i just can't remember how. however, if you used my above method, in theory your system will dual boot automatically

Marrea 07-19-2005 04:43 PM

Quote:

Originally posted by Marrea


Now I need to try and move Grub to the first sector of the boot partition (it's too much of a fiddle booting from a floppy each time).

Hi

Just reporting back to say I've done some more research on Grub and have now sorted this out. It involved running

setup (hd0,1)

on the Grub command line

and then of course doing the subsequent copying of the linux boot sector to the Windows C drive and editing boot.ini.

There's an excellent section on Grub in "Linux in a Nutshell" (O'Reilly) which sets out the complete procedure.

So that's another little bit of Linux I've learned about today !

Rick485 07-20-2005 06:45 PM

I have only been using Ubuntu for few days but just wanted to comment that you are not the only one here who has used that unusual method for booting Linux. I use that method on one of my two computers but, not on my newer AMD Athlon 64 computer which has Ubuntu on it. My older computer has Windows 2000 and I later added Slackware Linux, Vector Linux and Red Hat 9 Linux, each on seperate partitions. I let Windows 2000 keep what it's bootloader had in the MBR and then when installing Linux I had had it install Grub to the first sector of the Linux root partition. Like you, I used the "dd" command with the appropriate extra parameters to copy what Grub had on the 1st sector of the boot partition to a bootable image file which I later copied to the Windows drive C. Then, I then booted up into Windows and edited the Windows boot.ini file so that the Windows boot loader would list Linux as a choice. That unusual method is described in a Linux book that I have on my shelf.

It sounds like you have already solved your problem but just wanted to mention my similar experiences. I was using a different Linux distro but, at one point I ran into a similar problem and had no boot disk, but was able to insert a Knoppix disk and mount the appropriate partitions and used the Knoppix "dd" command to create the image file and temporarily copy it onto a floppy disk. Unfortunately, in your case the Knoppix disk would not not boot up properly for you. Another possible alternative to using a Knoppix disk would have been to use a Slackware installation disk as an emergency recovery disk because it gives access to the command line before anything is actually installed onto the hard disk. But anyway, it sounds like you have probably already solved your problem.

When I installed Ubuntu on my newer AMD Athlon 64 computer several days ago I used a another different but slightly unusual method of booting Linux. I told the intallation program not to install Grub to the MBR and it then asked me if I wanted to install Grub on the 1st sector of the Ubuntu root partition instead. On that computer I did not want the Ubuntu installation program to replace Slackware's Grub boot loader or it's Grub 1st stage which was already on the MBR, so I had Ubuntu install it's own boot loader to the 1st sector of the root partition instead. I then edited the /boot/grub/menu.lst file on the Slackware partition so that Slackware's Grub boot loader would chainloaded Ubuntu's Grub boot loader if Ubuntu is selected. That is another weird and less commonly used method of booting Linux but, it also works well. In my case I did not need to move Grub to the 1st sector of the root partiton because I had the Ubuntu installion program install it there in the first place.

Marrea 07-21-2005 06:27 AM

Hi Rick485

Many thanks for your interesting comments.

I have always thought using the NTLDR to boot Linux (as opposed to the other way round - using Grub/LILO to boot Windows) is a very neat solution and I originally found the method on a website somewhere when I was first learning how to dual boot SuSE and Windows XP. Since then, I have seen it on numerous websites. It is also recommended in the "Linux in a Nutshell" book I referred to in my posting of 18 July, and Novell themselves lay out the procedure in a Technical Information Document on their SuSE website.

The problem with this method of course is that once you have decided to put Grub on the first sector of the root partition if your distro then does a subsequent reboot before finishing its installation you are stuck, because without taking special measures you cannot boot back into Linux. With SuSE's graphical installer though you don't have this problem because after initial reboot the CD remains in the drive and you simply choose "Installation", followed by "Boot installed system" (after selecting your language) from the menu you are presented with. The root partition is detected automatically and the system is booted from it. You can then complete your installation and do the necessary copying of the Linux boot sector before rebooting into Windows in order to add this to the root directory of the C:\ drive.

Unfortunately, not being used to Ubuntu or its text based installer I foolishly didn’t consider beforehand how I was going to get back in after the initial reboot. In fact I didn't even know if there would be a reboot somewhere during the installation. As a consequence I ended up only being able to boot into Windows, with my Ubuntu installation unfinished.

So I thought the best thing to do would be a fresh installation, this time putting Grub on a floppy which at least would give me a way of booting into Linux. However, I didn't want the inconvenience of permanently having to stick a floppy in every time I wanted to use Ubuntu, which I why I wanted to find out how to change Grub's location to (in my case) /dev/hda2.

Now I have discovered that this can be done quite simply on the Grub command line (which I knew virtually nothing about before - the menu doesn't even display itself on my SuSE 9.2 !) I can apply this newly acquired knowledge to any other distro I may try in the future. As long as I get Grub on a floppy during installation I can then subsequently move its location to Linux's root partition.

Quite frankly, I don't think my Toshiba's Trident Cyberblade graphics card is suited to Linux. I can't install FC4 (at least not in GUI mode; although I can do so in text mode), nor can I get Knoppix or Linspire Live to load. Knoppix won't get past trying to create /etc/fstab and Linspire Live just scrambles my screen and hangs.

I also have an HP Pavilion laptop which dual boots my SuSE 9.2 with WinXP and this seems to be much happier with Linux. Knoppix and Linspire Live run fine on it and I'm pretty certain FC4 would load. The latter did at least get through the initial installation stages in graphical mode and did not hang with a frozen white screen as happened with the Toshiba when I tried to install it prior to deciding to have a go with Ubuntu. However, SuSE is my main distro and I have it updated and set up just the way I want it so I backed out of letting FC4 go any further. I only tried it out on the HP Pavilion after it wouldn't install on the Toshiba to check whether maybe the CDs I had burned from downloaded ISOs were faulty. But I think not. I think it is a conflict with the Toshiba's graphics.

Your info about being able to use Slackware as an emergency rescue disk is very useful as I was not aware of this, having no experience so far with this particular distro. Also the procedure you describe of using Slack to chainload Ubuntu is very interesting. I am going to keep your posting somewhere safe in case I ever need to use the methods you describe in the future.

Cheers.


All times are GMT -5. The time now is 07:06 AM.