LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-19-2009, 09:38 PM   #1
ssenuta
Member
 
Registered: Mar 2006
Location: NYS
Distribution: Mandriva-2006
Posts: 123

Rep: Reputation: 16
Help converting grub-legacy to grub2


I currently boot Mandriva-2009.1 with grub-0.97 & would like to
boot it with grub-1.96. I installed the Mandriva grub2-1.96-1
RPM package but can't get grub2 to boot my system.

Here is what I tried:
/usr/sbin/grub-install --grub-setup=/bin/true /dev/sdb
boot to grub-legacy prompt (grub>)
grub> root (hd0,0) ..grug-legacy ext3 partition /dev/sdb1
grub> kernel /boot/grub/core.img ..This gives error
grub> boot

Since the above doesn't work I haven't tried:
/usr/sbin/grub-install /dev/sdb
update-grub -o /boot/grub/grub.cfg

I fear the 2nd set of commands won't boot either & mess up he existing grub-legacy
boot sector. The 1st command set leaves the grub-legacy boot sector in place so
I can still boot Mandriva.

If anyone has Mandriva-2009.1 booting with grub2, please let me know how you
did it.
 
Old 08-19-2009, 11:27 PM   #2
firewiz87
Member
 
Registered: Jan 2006
Distribution: OpenSUSE 11.2, OpenSUSE 11.3,Arch
Posts: 240

Rep: Reputation: 37
Quote:
Originally Posted by ssenuta View Post
Here is what I tried:
/usr/sbin/grub-install --grub-setup=/bin/true /dev/sdb
boot to grub-legacy prompt (grub>)
grub> root (hd0,0) ..grug-legacy ext3 partition /dev/sdb1
grub> kernel /boot/grub/core.img ..This gives error
grub> boot
What you did seems to be alright.
What error did you get??

Quote:
Originally Posted by ssenuta View Post
Since the above doesn't work I haven't tried:
/usr/sbin/grub-install /dev/sdb
update-grub -o /boot/grub/grub.cfg
Your steps didnt mention the creation of grub.cfg file.... which is the file in grub2 that is similar grub.conf or menu.lst in grub-legacy.

The grub.cfg file is needed by grub2.you can also generate the grub.cfg file automatically by the command
Code:
grub-mkconfig -o /boot/grub/grub.cfg
that is you will have to execute that command..... i dont think that the above command will do anything to your existing files.... so it should be safe...
You do not have to do grub-install unless you want to replace your existing boot loader with grub2.

anyway keeping a backup of your /boot is a good idea.....

More details can be found at :
http://grub.enbug.org/TestingOnX86

Last edited by firewiz87; 08-19-2009 at 11:52 PM.
 
Old 08-20-2009, 10:51 PM   #3
ssenuta
Member
 
Registered: Mar 2006
Location: NYS
Distribution: Mandriva-2006
Posts: 123

Original Poster
Rep: Reputation: 16
Help converting grub-legacy to grub2

grub> kernel /boot/grub/core.img ..This gives: Error 15: File not found

I did not make a "grub.cfg" because I am trying to "manually" boot grub2
from the boot prompt (grub>) after booting my grub-legacy (floppy) boot disk to the grub shell

Actually, I did make a grub.cfg file but it only contains a "global section" & no "menuentry section(s)" That is because there is no existing /etc/default/grub file.

If I can get grub2 to boot manually then I'll create a /etc/default/grub configuration file & run 'update-grub" to get a proper grub.cfg.

**********************************************************************
Also, since posting this thread, I succeeded in making a grub2 "boot-floppy. It boots to a grub2 shell prompt but so far I cannot get it to
actually boot Mandriva ..Grub2 complains: "unknown filesystem"

Here are the commands I used to make the boot-floppy":
mount -t ext2 /dev/fd0 /mnt/floppy
/usr/sbin/grub-install--root-directory=/mnt/floppy /dev/fd0

Here are the commands I am trying to boot my hdd with from the floppy:
linux (hd0)/vmlinuz-2.6.30 root=/dev/sdb2 ro resume=/dev/sdb5

Note: Grub2 complains about unknown filesystem even though
vmlinuz is on an ext3 partition (/dev/sdb1) & the
rootfs files are on an ext4 partition (/dev/sdb2)

linux (hd0,1)/vmlinuz-2.6.30 root=/dev/sdb2 ro resume=/dev/sdb5

Note: Grub2 complains about unknown device
vmlinuz is on an ext3 partition (/dev/sdb1) & the
rootfs files are on an ext4 partition (/dev/sdb2)

Here is the output fo the grub2 shell "ls" command:

grub> ls -l
Device fd0: filesystem type ext2
Device hd0: partition table
Device hd1: partition table
Device hd2: partition table
************************************************************************
Thank you for replying to my post.

Last edited by ssenuta; 08-21-2009 at 12:17 PM.
 
Old 08-22-2009, 01:24 PM   #4
firewiz87
Member
 
Registered: Jan 2006
Distribution: OpenSUSE 11.2, OpenSUSE 11.3,Arch
Posts: 240

Rep: Reputation: 37
Grub-legacy prompt -> call the grub2 image -> end up in grub2 prompt (since there is no grub.cfg)
Well you are trying to do this rt??

make sure you give the root command before the kernel command in grub-legacy prompt.

You might already know this but beware GRUB 2 counts partitions from 1 and not from 0 like GRUB Legacy! So, increase the numbers
 
Old 08-29-2009, 10:04 AM   #5
ssenuta
Member
 
Registered: Mar 2006
Location: NYS
Distribution: Mandriva-2006
Posts: 123

Original Poster
Rep: Reputation: 16
Solved: Help converting grub-legacy to grub2

I finally succeeded in booting from a grub floppy & went on to install grub2 on my hard drive.via grub-install.

Here are the commands I used to install Grub2:

grub-install --modules="linux boot" /dev/sdb ..install to hard-drive
grub-install --modules="linux boot pc" --root-directory=/mnt/floppy /dev/fd0 ..install to floppy.

The problem was that Grub2 was not loading certain modules. After I loaded the necessary modules to /boot/grub/core.img, everything worked fine.

Here is my current output from the lsmod command:
grub> lsmod
_chain
biosdisk
pc ..partmap module
ext2 ..access to ext2 ext3 & ext4 filesystems
fshelp
boot ..starts boot process
linux ..used tobacess Linux rootfs
_linux ..used to access Initrd files
normal ..Normal mode Grub Shell

Thank you all for reading this post.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing GRUB or GRUB2 from scratch williamv2 Linux - Newbie 10 03-31-2009 09:31 PM
grub problem and looking for grub2 docs m-jackson Linux - Newbie 1 10-27-2006 02:18 AM
Grub Legacy or Grub2? RAVC Linux - Software 2 01-21-2006 09:43 AM
LXer: Moving to OpenOffice: Batch Converting Legacy Documents LXer Syndicated Linux News 0 01-12-2006 01:16 AM
Error 18 when trying to boot with GRUB or GRUB2 DaneM Linux - Software 6 09-20-2005 02:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:28 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