Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 28 Jul 2014, 08:35
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to Work with GRUB4DOS
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Author Message
rcrsn51


Joined: 05 Sep 2006
Posts: 8912
Location: Stratford, Ontario

PostPosted: 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.

1. Use the method from Part A where the device is probably /dev/sdb.

2. Make a menu.lst file like the following
Code:
timeout 0
default 0
#
title Puppy 4.3.1 on USB
find --set-root --ignore-floppies /pup-431.sfs
kernel /vmlinuz pmedia=usbflash
initrd /initrd.gz
grubinst-1.1.pet
Description 
pet

 Download 
Filename  grubinst-1.1.pet 
Filesize  22.43 KB 
Downloaded  497 Time(s) 
Back to top
View user's profile Send private message 
shinobar


Joined: 28 May 2009
Posts: 2596
Location: Japan

PostPosted: Mon 26 Apr 2010, 17:50    Post subject: Re: How to Work with GRUB4DOS  

Thanks rcrsn51 for the article. but i don't get it why you do not use the GUI, grub4dosconfig for A and C.
rcrsn51 wrote:
A - Installing GRUB4DOS on a Different Drive
C - Using GRUB4DOS to Boot a Flash Drive

Just select the drive at the top window of the Grub4DosConfig.
Tik on 'Search within only this drive' if you like for C.

If you have not the grub4dosconfig install it. Grub4DosConfig
grub4dos_en.png
 Description   
 Filesize   5.91 KB
 Viewed   3302 Time(s)

grub4dos_en.png

Back to top
View user's profile Send private message Visit poster's website 
shinobar


Joined: 28 May 2009
Posts: 2596
Location: Japan

PostPosted: Thu 23 Dec 2010, 01:44    Post subject: Installing bootloader for GRUB4DOS on Partition superblock
Subject description: seems not work for ext2/3
 

Code:
grubinst -p=X /dev/sda

I am trying this.
I got success with vfat/ntfs partitions but it seems not work for ext2/3. Crying or Very sad
Has someone got success with ext2/3 partitions?

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
shinobar


Joined: 28 May 2009
Posts: 2596
Location: Japan

PostPosted: Thu 23 Dec 2010, 04:22    Post subject: Re: Installing bootloader for GRUB4DOS on PBS
Subject description: seems not work for ext2/3
 

shinobar wrote:
Code:
grubinst -p=X /dev/sda

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... Crying or Very sad

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
emil

Joined: 10 Nov 2009
Posts: 614
Location: Austria

PostPosted: Thu 23 Dec 2010, 04:56    Post subject: test results  

I tested it in a n ext2 partition with bootflag set.

Code:
grubinst -v -p=4 /dev/sda
Part FS: 0B (FAT32)
Part Leng: 4192965
Start sector: 0x......
Image type: FAT32
Install mode


Somhow it thinks its FAT32

It couldn't boot from that, although after boot I get blank screen with "E2", so filesystem should be ext2.

I also tried instructions on the grub4dos homepage, but somehow it is not working as it should.
emil
Back to top
View user's profile Send private message Visit poster's website 
shinobar


Joined: 28 May 2009
Posts: 2596
Location: Japan

PostPosted: Thu 23 Dec 2010, 06:02    Post subject: Re: test results  

emil wrote:
I tested it in a n ext2 partition with bootflag set.

Code:
grubinst -v -p=4 /dev/sda
Part FS: 0B (FAT32)
Part Leng: 4192965
Start sector: 0x......
Image type: FAT32
Install mode


Somhow it thinks its FAT32

grubinst has the command:
Code:
grubinst -l /dev/sda

Maybe shows same id as:
Code:
fdisk -l /dev/sda

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
shinobar


Joined: 28 May 2009
Posts: 2596
Location: Japan

PostPosted: Thu 23 Dec 2010, 06:21    Post subject: grubinst on ext2 partition  

I am testing USB flash with partition fresh created by gparted.
Code:
# grubinst -v -p=0 /dev/sdb
Part Fs: 83 (Ext2)
Part Leng: 2104452
Start sector: 0x3F
Image type: EXT2/EXT3
Install mode

# hexdump -n 512 /dev/sdb1
shows something written.
But get 'I/O error' at boot from the PBS.

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
rcrsn51


Joined: 05 Sep 2006
Posts: 8912
Location: Stratford, Ontario

PostPosted: Thu 23 Dec 2010, 07:14    Post subject:  

The only way I could get GRUB4DOS to work like this was to use a SMALL ext2 partition as a separate boot partition.

It's because of this problem that legacy GRUB continues to be useful.
Back to top
View user's profile Send private message 
shinobar


Joined: 28 May 2009
Posts: 2596
Location: Japan

PostPosted: Thu 23 Dec 2010, 07:26    Post subject: PBS of vfat  

rcrsn51 wrote:
The only way I could get GRUB4DOS to work like this was to use a SMALL ext2 partition as a separate boot partition.

PBS way should work if the second partition is vfat(or ntfs).

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
shinobar


Joined: 28 May 2009
Posts: 2596
Location: Japan

PostPosted: Thu 23 Dec 2010, 09:00    Post subject: bootlace.com for ext2 PBS
Subject description: it works for the boot disk but...
 

bootlace.com can write the bootloader on ext2 parrtition boot sectors:
Code:
bootlace.com --floppy=0 --sectors-per-track=63 --heads=255 --start-sector=63 --total-sectors=1052226 /dev/sdb1

Each numbers can get from 'fdisk' command:
Code:
# fdisk -ul /dev/sdb

Disk /dev/sdb: 4043 MB, 4043309056 bytes
255 heads, 63 sectors/track, 491 cylinders, total 7897088 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63     2104514     1052226   83  Linux

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.

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html

Last edited by shinobar on Fri 24 Dec 2010, 07:42; edited 3 times in total
Back to top
View user's profile Send private message Visit poster's website 
emil

Joined: 10 Nov 2009
Posts: 614
Location: Austria

PostPosted: Thu 23 Dec 2010, 09:12    Post subject: something peculiar - difference in drive numbering  

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.

Today I noticed that I had used the wrong drive when I did shinobars
Code:
grubinst -l /dev/sda

command.
I got the following partition-list
# id base leng
0 07 3F EA60903 (120001M)
1 83 1BDBE226 140249A (10245M)
2 83 EE60407 CF5DE1F (106172M)
3 0B EA60942 3FFAC5 (2047M)

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...
Back to top
View user's profile Send private message Visit poster's website 
shinobar


Joined: 28 May 2009
Posts: 2596
Location: Japan

PostPosted: Thu 23 Dec 2010, 09:37    Post subject: Re: something peculiar - difference in drive numbering  

emil wrote:
/dev/sdaX numbering and Icon numbering do NOT match!

Interesting. I see such a case sometimes.
You can check the order also by 'fdisk' command.
Code:
fdisk -l /dev/sda

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
NeverThere


Joined: 24 Nov 2010
Posts: 18

PostPosted: Fri 31 Dec 2010, 19:43    Post subject:  

Assuming that it wasn't already posted somewhere, here is a very well put together tutorial for Grub4Dos.

Grub4dos Guide

-
Back to top
View user's profile Send private message 
Burn_IT


Joined: 12 Aug 2006
Posts: 958
Location: Tamworth UK

PostPosted: Wed 05 Jan 2011, 06:25    Post subject:  

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.

_________________
I can't remember the last time I forgot something!
Back to top
View user's profile Send private message 
shinobar


Joined: 28 May 2009
Posts: 2596
Location: Japan

PostPosted: Fri 21 Jan 2011, 07:41    Post subject: Grub4DosConfig PBS install support  

Now the grub4dos-0.4.4.v1.6.9.1 (Update: 21 Jan 2011) supports partition boot sector install.
http://www.murga-linux.com/puppy/viewtopic.php?t=51697

Note: PBS of reiserfs is not supported. PBS of ext4 support requires extlinux and chan.c32 of version 4.0 and later.

_________________
Google Chrome portable
Downloads for Puppy Linux http://shino.pos.to/linux/downloads.html
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

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


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1050s ][ Queries: 13 (0.0078s) ][ GZIP on ]