LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-14-2005, 11:57 PM   #1
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
discussion of stage2 file homey and aus9


Homey

homey on another thread asked for a test of grub stage2 file error and asked for instructions similar to this
commands run in a terminal

a) fdformat /dev/fd0
b) su to root mode
c) mke2fs -m 0 /dev/fd0
d) dd if=/boot/grub/stage1 of=/dev/fd0 bs=512 count=1
e) dd if=/boot/grub/stage2 of=/dev/fd0 bs=512 seek=1

I tested for both my mdk 10.1 grub files and my old grub files I think were from a linux format cd

on reboot mdk grub files gave loading stage2 Read error and hangs

on reboot of other grub files no error message
loading stage2 file then nothing.....no grub command editor mode

2) So I thought I will embed stuff the way of my howto for booting large kernels for your wisdom its this
source my howto
http://www.linuxquestions.org/questi...hreadid=237511

A made a msdos floppy
....fdformat /dev/fd0
....mkfs.msdos /dev/fd0
B Create floppy folder structure /boot/grub/
C copied stage1/stage2/and special menu.lst file to folder grub
D then open a terminal and in su mode moved /boot/grub to different folder so I am truly using floppy files, don't forget to move this folder back before rebooting. heh heh
E change to grub command by typing "grub"
then set pathway for files by "root (fd0)
then embed grub stage1 so it finds stage2 files by "setup (fd0)"
output looks like this
GNU GRUB version 0.95 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename. ]

grub> root (fd0)
Filesystem type is fat, using whole disk

grub> setup (fd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/fat_stage1_5" exists... no
Running "install /boot/grub/stage1 (fd0) /boot/grub/stage2 p /boot/grub/menu.lst
"... succeeded
Done.


F special menu file is
title floppy
root (fd0)
pause "insert vmlinuz floppy and press enter"
kernel /vmlinuz root=/dev/sda3 ro # note the pathway has been already set to floppy
pause "insert initrd floppy and press enter"
initrd /initrd.img

Change to bzImage or kernel depending on your distro....delete initrd pause if you don't need it

naturally my second floppy is a ordinary msdos floppy with my kernel renamed as vmlinuz
And floppy 3 has only initrd.img

3) Now I created floppy 1 using mdk 10.1 stage files 1 &2
and another floppy 1 with my other stage 1 & 2 files

4) Reboot gave these results

floppy 1 using mdk 10.1 success menu appears grub starts and prompts for my floppy 2 etc

floppy 1 using non-mdk 10.1 same success.

5) and of course I have had not errors with mdk on hd boot up.

6) I am arrogant in thinking I am right (yet again) but can you point me to some posts where you think its a stage2 issue?

I have read another post when someone thought because they used grub-install that was why they did not have to re-run grub like you have to re-run lilo........but if I am right you will see when you look at the terminal output
"install /boot/grub/stage1 (fd0) /boot/grub/stage2 p /boot/grub/menu.lst
"... succeeded

......grub still has to code where to find stage 2 (or stage1.5 ) etc files

so at this stage I am not concerned.
 
Old 01-15-2005, 12:50 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Thanks aus9,
So that problem showed up for you also. Then it would seem to be something different about stage2 as I never saw that error before.

If I wanted a menu on this floppy ( which I don't ) , I would use this method...
This gives you the boot menu just like it was installed on the hard drive.
Code:
fdformat /dev/fd0
mke2fs -m 0 /dev/fd0
mount -t ext2 /dev/fd0 /mnt/floppy
mkdir -p /mnt/floppy/boot/grub
cp -pa /boot/grub/* /mnt/floppy/boot/grub
umount /mnt/floppy

Create a text file called /home/stuff ....

cat > /home/stuff << EOF
root (fd0)
#the following is all one line
install /boot/grub/stage1 d (fd0) (fd0)/boot/grub/stage2 0x8000 p (fd0)/boot/grub/menu.lst
#
quit
EOF

Install grub to the floppy disk with this command:

grep -v ^# /home/stuff | grub --batch
Or, I could go one better an use my grub boot cdrom. I don't know if anyone noticed but there is now a iso9660_stage1_5 file in the /boot/grub folder.
Following the example of RIP cd, I can use that to make my multi boot cdrom.
mkisofs -R -b boot/grub/iso9660_stage1_5 -no-emul-boot \
-boot-load-size 32 -boot-info-table -o boot.iso cdbuild

Here is an example of my latest multi boot cdrom menu.

Code:
	color light-gray/blue black/light-gray
title *=*=*=*=*=*=*=*=*=*=*=*=* CDROM BOOT MENU *=*=*=*=*=*=*=*=*=*=*=*=*=*=*
root (hd0)
title Windows
	rootnoverify (hd0,0)
	chainloader +1
title Fedora Core
	root (hd1,1)
	kernel /boot/vmlinuz ro root=/dev/hdb2 rhgb quiet
	initrd /boot/initrd.img
title Rescue CD V0.2.15
kernel /boot/vmlinuz1 acpi=off root=/dev/ram0 init=/linuxrc nokeymap vga=785
initrd=/boot/initrd1
title Insert Linux V1.2.17
kernel /isolinux/vmlinuz ramdisk_size=100000 init=/etc/init lang=en apm=power-off hdc=scsi hdd=scsi vga=791 nomce quiet BOOT_IMAGE=insert
initrd=/isolinux/miniroot.gz
title RIP Linux V11.6
kernel /boot/kernel devfs=nomount vga=normal nokeymap init=/linuxrc root=/dev/ram0 rw
initrd=/boot/initrd.gz
title Feather Linux V0.7.1
kernel /isolinux/linux24 ramdisk_size=100000 nodma init=/etc/init lang=us apm=power-off vga=791 nomce quiet BOOT_IMAGE=knoppix
initrd=/isolinux/minirt24.gz
title Slax Linux V4.2.0
kernel /boot/vmlinuz2 max_loop=255 init=linuxrc livecd_subdir=/ load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=9999 root=/dev/ram0 rw
initrd=/boot/initrd2.gz
title Puppy Linux V9.8
kernel /boot/vmlinuz3 root=/dev/ram0 PFILE=pup001-none-262144
initrd=/boot/image3.gz
title Freedos V9
kernel /boot/memdisk
initrd=/images/freedos.img
title Ranish Tool V2.44
kernel /boot/memdisk
initrd=/images/ranish.img

Last edited by homey; 01-15-2005 at 07:29 AM.
 
Old 01-15-2005, 06:40 PM   #3
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Original Poster
Rep: Reputation: Disabled
homey

1) can you remember any posts where the stage2 file is an issue?

2) I don't test or use soooo many distros but my howto already has a howto burn to cdr
 
Old 01-15-2005, 07:11 PM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
The latest one is in Linux-General by qwijibow
 
Old 01-15-2005, 07:18 PM   #5
bogus__13
LQ Newbie
 
Registered: Jan 2005
Distribution: Fedora Core 3, Knoppix 3.8, Berry Linux 0.54
Posts: 14

Rep: Reputation: 0
Unhappy

hello people....
i have Fedora Core 3 Grub version 0.95
i get the following error:
Grub Loading stage2Read Error
 
Old 01-15-2005, 07:30 PM   #6
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Quote:
Grub Loading stage2Read Error
Hi bogus__13


If you can, would you get the RIP linux live cd. Boot up with the RIP cd and mount the ( / ) of your Fedora system so you can get to it. For example: Where Fedora is on /dev/hdb2 ....
Type the command: mkdir /mnt/fed
Then type the command: mount /dev/hdb2 /mnt/fed -t ext3

Edit: I changed the directory path....
Then type: cd /usr/share/grub/i386-cp
Note: that is still at the RIP cd.

Then type: cp stage2 /mnt/fed/boot/grub

Reboot and see how that works.
I have no luck getting anyone to believe there is a problem with the grub stage2 and I would be interested if this works for you.

Last edited by homey; 01-15-2005 at 09:22 PM.
 
Old 01-15-2005, 07:34 PM   #7
bogus__13
LQ Newbie
 
Registered: Jan 2005
Distribution: Fedora Core 3, Knoppix 3.8, Berry Linux 0.54
Posts: 14

Rep: Reputation: 0
Smile

Hey, homey

i will try that out....
it may take me a bit though
 
Old 01-15-2005, 08:58 PM   #8
bogus__13
LQ Newbie
 
Registered: Jan 2005
Distribution: Fedora Core 3, Knoppix 3.8, Berry Linux 0.54
Posts: 14

Rep: Reputation: 0
hey homey,
I'm new to this forum, but I'm not totally new to linux. I was able to figure some things out. When you boot to the RIP V11.6 cd the stage2 is in a differnet location then what you said.
So here is what i did:
mkdir /mnt/test
mount /dev/hda2 /mnt/test
cd /
ls
cd usr/share/grub/i386-pc
cp stage2 /mnt/test/boot/grub

Then i rebooted and guess what!! No more grub error

ty for your help
 
Old 01-15-2005, 09:20 PM   #9
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Glad you got it going.
Sorry about the wrong folder info. It shows up in a different location when you view it from a working system. I did try it and you're right, when you boot up into RIP V11.6 , the stage2 in in /usr/share/grub/i386-cp.
Next thing is people will ask why I don't just download a new version of grub? . Because V0.95 is the newest ( far as I know ) and I just stumbled onto a stage2 which does work. So hey, I don't care where it came from if it works.

Last edited by homey; 01-15-2005 at 09:25 PM.
 
Old 01-15-2005, 09:34 PM   #10
bogus__13
LQ Newbie
 
Registered: Jan 2005
Distribution: Fedora Core 3, Knoppix 3.8, Berry Linux 0.54
Posts: 14

Rep: Reputation: 0
homey,
'tis no problem about the wrong folder.
That is some info. that i will be putting in my notes.
 
Old 01-16-2005, 01:06 AM   #11
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Original Poster
Rep: Reputation: Disabled
message deleted as new distros have a stage2 file

Last edited by aus9; 05-06-2005 at 02:12 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DISCUSSION: Basic Samba Network File Sharing cdabb LinuxAnswers Discussion 17 01-27-2019 03:05 PM
DISCUSSION: Setting File and Directory Permission in Unix/Linux munawer_hassan LinuxAnswers Discussion 1 03-23-2010 11:40 AM
DISCUSSION: File sharing with OS X using Ubuntu 5.04 LinuxAnswers Discussion 1 05-21-2007 11:42 PM
DISCUSSION: USB Bluetooth and mobile file transfers Hammett LinuxAnswers Discussion 7 05-09-2006 07:32 AM
homey>>>> (more help please..) the snucka Linux - Software 1 01-13-2005 04:03 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration