Posted: Fri 09 Apr 2010, 21:05 Post subject:
How to Work with GRUB4DOS

It looks like the next generation of Puppies will use GRUB4DOS as the bootloader. The Puppy Universal Installer in Quirky gives you two options during a hard drive install. If your computer already has a Linux bootloader in play, the PUI supplies the appropriate GRUB entry and leaves you to update the menu.lst file.

But if you need to install a bootloader from scratch, you must also run the GRUB4DOS setup. This program provides two choices.

1. Write the GRUB4DOS boot code onto the MBR, thus erasing the original DOS/Windows code. Then write the two support files, grldr and menu.lst, to the root of the first partition. There is no option to use a different partition.

2. Don't touch the MBR, but write the two support files to the first partition, which is probably Windows. This method assumes that you want to dual-boot with Windows and leaves you to modify the WinXP boot.ini file or the Vista BCD mechanism.

For those users who want either a Puppy-only install or a co-exist install with Windows, these choices are sufficient. But many users want the flexibility of installing GRUB into a different configuration. The following article discusses three scenarios.

A - Installing GRUB4DOS on a Different Drive

1. Write the bootloader code onto the MBR with the command

Code:

bootlace.com --time-out=0 /dev/sdX

where X is the target drive.

2. Copy the file /usr/lib/grub4dos/grldr to the root of the target partition. You don't need to use the traditional /boot/grub directory structure.

3. Write your menu.lst file to the same location as grldr. GRUB4DOS recognizes the same syntax as legacy GRUB. Or you can use the code generated by the PUI and saved in /tmp/NEWGRUBTEXT.

B - Installing GRUB4DOS onto a Partition Boot Sector

The safest way to dual-boot with Windows is to not touch it at all! In this scenario, you will put all the GRUB4DOS files on a different partition. By flagging that partition as bootable, you can run a multi-OS setup without making any changes to the MBR or Windows. You can manage your boot files in a Linux environment independent of Windows.

In legacy GRUB, you could install the Stage1 code onto an MBR or a partition boot sector with identical functionality. However, this is not true with GRUB4DOS, so a slighly different approach is needed.

1. Download and install the attached grubinst-1.1.pet. It contains one program, grubinst, which is saved in /usr/sbin.

2. Run Gparted. You must allocate one of your primary partitions to act as a dedicated boot partition. Make it small (100 MB) and format it as ext2. Flag this partition as bootable.

3. Copy the file /usr/lib/grub4dos/grldr into your new boot partition.

4. Put your menu.lst file in the boot partition.

As usual, you can launch Windows with the entry

Code:

title Windows
rootnoverify (hd0,0)
chainloader +1

5. Open a terminal window and type

Code:

grubinst -p=X /dev/sda

where X is the number of the boot partition counting from zero. This writes the GRUB4DOS boot code into the partition boot sector instead of the drive's MBR. For example, if you have Windows in the first partition, your boot files in the second partition and Puppy in the third partition, you would use

Code:

grubinst -p=1 /dev/sda

6. Perform a final sanity check.
a. You have the standard DOS/Win boot code on your MBR.
b. You have flagged your boot partition as bootable.
c. You have copied grldr and menu.lst into the boot partition.
d. You have installed the GRUB4DOS boot code to its boot sector.

C - Using GRUB4DOS to Boot a Flash Drive

The standard bootloader for USB devices is syslinux. But using GRUB4DOS instead lets you work with the familiar menu.lst syntax.

I am trying this.
I got success with vfat/ntfs partitions but it seems not work for ext2/3.
Has someone got success with ext2/3 partitions?_________________Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html

I am trying this.
I got success with vfat/ntfs partitions but it seems not work for ext2/3. :

bootlace.com for ext2 partition worked, but it seems access always hd0.
It doesn't work if the partition is on hd1... _________________Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html

It works if the partition is on (hd0), the boot disk.
But it needs swaping map if the partition is on another disk than the boot disk.
EDIT: It seems reasonable. Because basically, the boot disk is selected by BIOS, partition selected by MBR and the PBS sees only the partition...

It also works with ext3, but does not for ext4._________________Downloads for Puppy Linux http://shino.pos.to/linux/downloads.htmlLast edited by shinobar on Fri 24 Dec 2010, 07:42; edited 3 times in total

I have to report something that puzzled me and I needed some time to figure that out. Until now I always had used the labels of the drive icons in my puppy install in anything releated with grub without problem.

Probably this is a well known fact and ignorant as I am I just missed it until now, but maybe if somebody reads this it can spare some time.

Ok here I noticed that something is wrong, because on my desktop the last partition is the 10 GB ext 2 partition, where as the 2nd partition is the 2 GB FAT partition.

I checked it in GParted and voila:
/dev/sdaX numbering and Icon numbering do NOT match!
I then repeated to install the grubloader to the partition with

Code:

grubinst -p=1 /dev/sda

and some other variations, but still it was not possible to boot from the Linux partition. The grub4dos failure of handling linux partitions is surly a bug, I wonder if the devs are aware of the problem?

I also noticed that still there is the script
grub-install, as well as grub in the directory /usr/sbin. I suppose this is "legacy" grub and this is used by universal installer etc...

I make things easy for myself.
All the machines I use at home have a boot selection from the BIOS and all happen to have a version of Windows (but that actually doesn't matter because Hiren's boot CD will boot into XP/DOS/WIN98/Linux in ram)
I use the supplied with 0.4.4 grubinst_gui.exe from Windows and it gives a nice easy window with all needed options in it- disk and partitions are drop down box lists.
I have used it to install to several disks in a partition mbr and to many USB sticks and disks (both partitioned and superfloppy).
I haven't tried EXTn partitions as all my Puppies are frugal and co-exist with portable apps and data which need to be used by Windows and Wine.
Some of my older PC don't natively support booting from USB and that can be got round by using the PLoP boot manager instead (an option available on Hiren's CD) which WILL reboot??/simulate boot from USB.
PLoP is even more powerful than Grub4DOS and has its own install, but is quite complicated so I tend to only use it from Hiren's to get a boot from USB when not natively available._________________"Just think of it as leaving early to avoid the rush" - T Pratchett

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum