Changing location of bootloader in Ubuntu post-install

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

Changing location of bootloader in Ubuntu post-install

Postby Marrea » Mon Jul 18, 2005 10:16 pm

I've installed Ubuntu alongside Windows XP as a dual boot. I have Grub located on a floppy disk but now want to put it on the first sector of the boot partition - and then use the WinXP NTLDR to boot either Windows or Ubuntu.

In SuSE, I believe you can change the bootloader location in YaST but I can't find anything similar in Ubuntu. Do I have to use the installation CD in rescue mode? Will there be an option to change the bootloader location there?
User avatar
Marrea
LXF regular
 
Posts: 1873
Joined: Fri Apr 08, 2005 9:32 pm
Location: Chilterns, West Hertfordshire

RE: Changing location of bootloader in Ubuntu post-install

Postby dandnsmith » Tue Jul 19, 2005 7:09 am

Read the man pages for grub and grub-install.
There are some pages on the web describing how to do the dual boot - the first thing you need is a copy of the grub first-stage boot file where ntldr can access it (FAT or NTFS partition).
Derek
dandnsmith
LXF regular
 
Posts: 314
Joined: Fri Apr 15, 2005 10:01 am
Location: Berks, UK

Postby Marrea » Tue Jul 19, 2005 10:42 am

Many thanks. I'm reasonably clued up about sorting out NTLDR and boot.ini. My main problem is that, in Ubuntu specifically, I have no idea how to move the location of Grub from a floppy disk to the boot partition. Do I use the installation CD's rescue mode? If so, how? Or, with the Grub floppy in the drive after having booted into Ubuntu, can I simply copy Grub across somehow? I assume I need to get in by some method and run

# grub-install /dev/hda2

and that the command will need to pick up Grub either from the CD or the floppy but I don't know how exactly to do this and I'm afraid the man pages don't really help me much.

The procedure I always follow to set up WinXP/SuSE dual boots is:

1. During installation, I change the default bootloader location (MBR) to the boot sector of the boot partition
2. After basic installation has finished and the system reboots (with the CD still in the drive) I choose
3. Installation, I select the language, then I choose Boot installed system
4. The installation completes and I log-in to SuSE
5. Then, in a terminal, as root, I copy the linux boot sector onto a floppy as follows:

# mount /dev/fd0
# dd if=/dev/hda3 bs=512 count=1 of=/media/floppy/bootsect.lnx
# umount /dev/fd0

6. I reboot, which takes me straight into WinXP
7. I copy bootsect.lnx to the root directory of C drive
8. I edit boot.ini in Notepad to add
c:\bootsect.lnx="Linux"
at the end as a last line
9. I reboot again and then have the option of either WinXP or Linux on the XP boot menu

However this is made very easy by the fact that SuSE has a nice graphical installer from which it is immediately obvious how to proceed after the initial reboot.

Not so with Ubuntu's text installer, where I am completely lost. When I installed the first time, I put Grub on the boot sector of the boot partition (as is my practice with SuSE) but then of course after the first part of installation was completed, Ubuntu spat the CD out and obviously the computer booted straight into Windows.

I then couldn't fathom out from Ubuntu's text installer how to get back in to complete the installation. So I started the installation all over again and this time put Grub on a floppy, which did enable me to get back in after the initial reboot and thus complete the installation.

Unfortunately this means I am now stuck with having to use a floppy every time I want to access Ubuntu, which is a bit of a pain. Hence my desire to move Grub on to the boot sector of the boot partition. But I don't know how to do this. I have tried using the installation CD with the rescue option at the boot prompt. It runs through the language and keyboard selection, followed by the network settings. Then I come to a screen which says:

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

At this stage I do not know how to proceed. I am assuming part2 refers to hda2 which is my Ubuntu root partition, but if I select this all that happens is I get a blank blue screen and the whole thing just hangs. My partitions are as follows: hda1 is WinXP, hda2 is root, hda3 is extended, hda5 is swap.

All I really want to know is, specifically for Ubuntu, if you have Grub on a floppy disk how do you then transfer that to the boot sector?

I don't want to put Grub on the MBR because I am using a Toshiba Satellite 1800 laptop, with no WinXP CD provided - only a "restore" CD, so if my MBR gets messed up I have no way of doing a fixmbr

I really like the look of Ubuntu but I must say I find its documentation sadly lacking on matters such as this. I've obviously been spoilt by using SuSE and YaST too long !
User avatar
Marrea
LXF regular
 
Posts: 1873
Joined: Fri Apr 08, 2005 9:32 pm
Location: Chilterns, West Hertfordshire

Postby Marrea » Tue Jul 19, 2005 9:40 pm

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 ! :D
Last edited by Marrea on Wed Jul 20, 2005 9:25 am, edited 1 time in total.
User avatar
Marrea
LXF regular
 
Posts: 1873
Joined: Fri Apr 08, 2005 9:32 pm
Location: Chilterns, West Hertfordshire

Postby jjmac » Wed Jul 20, 2005 12:16 am

I wasn't going to post as you already have it solved, but couldn't help it :)

>>
# mount /dev/fd0
# dd if=/dev/hda3 bs=512 count=1 of=/media/floppy/bootsect.lnx
# umount /dev/fd0
>>

Thats curious, your copying to the floppys mount !. I wouldn't have thought of that :D. And will have to remember it for the future. An excellent trick.

>>
All I really want to know is, specifically for Ubuntu, if you have Grub on a floppy disk how do you then transfer that to the boot sector?
>>

As yourv'e already figured, it's just the reverse of copying from the device. "dd" can be used directly between two devices. It isn't necessary to mount the device. To copy to the MBR, or any sector it would just be "if=<dev/file> of=<device>". A direct device copy dosen't give you any benifits that may come with having it as part of a fs on the floppy, but then, you could just do the same ... ie; copy directly from the floppy to a file on your mounted system.

Copying out the MBR diectly to a floppy will provide a good standby too (of course).



jm
http://counter.li.org
#313537

The FVWM wm -=- www.fvwm.org -=-

Somebody stole my air guitar, It happened just the other day,
But it's ok, 'cause i've got a spare ...
jjmac
LXF regular
 
Posts: 1996
Joined: Fri Apr 08, 2005 1:32 am
Location: Sydney, Australia

Postby Marrea » Wed Jul 20, 2005 12:20 pm

jjmac wrote:
Thats curious, your copying to the floppys mount !. I wouldn't have thought of that :D. And will have to remember it for the future. An excellent trick.


It's something I came across on a website early on when I was first experimenting with dual booting WinXP and SuSE. I merely followed the instructions laid out there to the letter, and it's always worked well for me.

Thanks for your other comments, informative as ever. :wink:
User avatar
Marrea
LXF regular
 
Posts: 1873
Joined: Fri Apr 08, 2005 9:32 pm
Location: Chilterns, West Hertfordshire

Postby jjmac » Thu Jul 21, 2005 12:18 pm

It's funny really, iv'e used dd to copy out to disk, as a file for backups, quit a lot. Sometimes one per edit :roll:, but it never entered my mind in terms of a floppy (grin)



jm
http://counter.li.org
#313537

The FVWM wm -=- www.fvwm.org -=-

Somebody stole my air guitar, It happened just the other day,
But it's ok, 'cause i've got a spare ...
jjmac
LXF regular
 
Posts: 1996
Joined: Fri Apr 08, 2005 1:32 am
Location: Sydney, Australia


Return to Help!

Who is online

Users browsing this forum: Google [Bot] and 1 guest