LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Help converting grub-legacy to grub2 (https://www.linuxquestions.org/questions/linux-general-1/help-converting-grub-legacy-to-grub2-748898/)

ssenuta 08-19-2009 09:38 PM

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.

firewiz87 08-19-2009 11:27 PM

Quote:

Originally Posted by ssenuta (Post 3650290)
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 (Post 3650290)
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

ssenuta 08-20-2009 10:51 PM

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.

firewiz87 08-22-2009 01:24 PM

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

ssenuta 08-29-2009 10:04 AM

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.


All times are GMT -5. The time now is 08:02 PM.