LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-27-2012, 06:51 PM   #1
PaulFC5
Member
 
Registered: Feb 2008
Location: Auckland, Aotearoa/NZ
Posts: 98

Rep: Reputation: 13
Question How to convert a GRUB2 entry back into GRUB1 format?


Hi there most respected/excellent linux uplines:

Only a small - but slightly annoying/niggling problem that I have which I'm sure one of youse will be able to answer in a few seconds offof the top of your head :-) - of course I've googled it, but no luck so far:

I need to ask how to backwardsconvert a GRUB2 entry into GRUB1 - ie back into the "old" GRUB - so that the appropriate OS will boot up OK.
All the googled results go the other way - ie how to convert 1>2 - with mkgrub, osprober etc etc - but there doesn't seem to be anything about going the other (archaic = me :-) ) way.

I've just installed Ubuntu12.04 64bit desktop - to give it a try out, and quite impressive it is too! - onto a 60G partition on a 1TB whirlygig drive and it naturally wrote a GRUB2 loader into the MBR at the front of that hdd/sdd.
(AAMOI 60G is my "standard" OSpartition size.)
The Ubuntu12 installer recognized that the two "automatic" winDoze7 partitions and an 800G NTFS "dump"/storage partition were already there and complained about the lack of a dedicated swap partition - but with 2G of RAM I wouldn't expect that to be a problem.
However I would perhaps have expected it to have done an LVMtype install (as FC14 does) with a logical swap sub-partition - and I'm also slightly worried about the lack of a "root" password - possibly more "hackable"??.

But then I re-plugged-in my whizzy 90G OCZ solidstatedrive with two OS partitions on it - Fedora14 (25-ishG) from which I write this, and XPsp3 (60-ishG).
I had unplugged this ssd because I didn't want to have its "old" GRUB (exFC14) overwritten by the Ub12 installer - I prefer GRUB1 - it's much more "configurable"/user-friendly - as too, it seems to me, is FC14 compared to the newer/later Fedoras.
So then I tried to write/copy/convert the GRUB2 entry on the 1TB whirlygig Seagate into the ssdrive's GRUB1 MBR (from "root" in FC14) as follows:

The full GRUB2 entry, which boots up 7 and Ubuntu12.04 just fine, on the 1TB whirlygig Seagate (when it's the only hdd/sdd) is:

> menuentry 'Ubuntu, with Linux 3.2.0-25-generic' --class ubuntu --class gnu-linux --class gnu --class os {
> recordfail
> gfxmode $linux_gfx_mode
> insmod gzio
> insmod part_msdos
> insmod ext2
> set root='(hd0,msdos3)'
> search --no-floppy --fs-uuid --set=root 62ce83f3-8da6-4cfe-bf5c-f41a9d22c39f
> linux /boot/vmlinuz-3.2.0-25-generic root=UUID=62ce83f3-8da6-4cfe-bf5c-f41a9d22c39f ro quiet splash $vt_handoff
> initrd /boot/initrd.img-3.2.0-25-generic

which, for GRUB1, I converted/simplified to:

> title Ubuntu 12.04LTS T260612
> root (hd1,3)
> kernel /boot/vmlinuz-3.2.0-25-generic root=UUID=62ce83f3-8da6-4cfe-bf5c-f41a9d22c39f ro quiet splash $vt_handoff
> initrd /boot/initrd.img-3.2.0-25-generic

Which seems OK - and I'm sure I have had that sort of conversion working before at some stage.
But when selecting that entry in GRUB1 it just comes up with:
> Error17: Cannot mount selected partion
> Press any key to continue...
and back to the GRUB menu.

So: I seem to remember that there is some way to either:
(1) tell it to chainload the 1TB whirlygig's GRUB2'd MBR into the 90G ssd's GRUB/MBR to getat/bootup the Ubuntu12 OSpartition
or
(2) to write/execute? something like:
> load(hd1) (hd0)
> (hd0) (hd1)
or
(3) do I have to tell it that it's an msdos partiton or something like that? - which it isn't - it's ext2or4 I'm pretty sure.

Any ideas please anybody? :-[ :-)

T verymuch IA

PaulW

AMD 64x2 2.8G(=2.6true??) CPU
Asus M2N-MX SE-Plus m/b
2G DDR RAM
90G OCZ ssd with FC14 and XPSP3 - XP seems much better for audio - none of the pops and clicks that 7 always produces
ITB Seagate sdd with 2x win7 partitions, 800Gstorage/"dump" partiton, and Ubuntu12.04
EN8500GT vidcard
MAudio MA-192 soundcard - has been very good for 3 years or so - a lovely sounding card, but I now think that the Asus Xonar STX in another SATA3 box that I've just buit (purely for for curiosity) is slightly better - maybe a few db better S/N ratio
 
Old 06-27-2012, 09:42 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Probably the simplest thing to do is to go to the site below and read the instructions for the bootinfoscript, download it and run it and post the output (results.txt file) here. It would be a good idea to save this for future reference as it has a lot of detailed information about drives/partitions and boot files. Have both drives plugged in when you run it:

http://sourceforge.net/projects/bootinfoscript/

You indicate that the entry in Ubuntu Grub2 which boots Ubuntu has this entry:

Quote:
set root='(hd0,msdos3)'
Just below that you indicate the entry in the Grub Legacy you tried is:

Quote:
root (hd1,3)
If Ubuntu is on (hd0,msdos3) that would mean sda3. The difference between Grub Legacy and Grub2 is that partitions are numbered from zero in Grub Legacy and numbered from one in Grub2. Both Grubs number drives from zero. You could edit the Fedora 14 grub.conf file and change than line to: root (hd0,2) and see if it boots.

The entry I use to boot Ubuntu 11.04 on sda5 with Grub2, booting from Grub Legacy is:

Quote:
title Ubuntu-11.04
root (hd0,4)
kernel /boot/grub/core.img
#savedefault
#boot
You would need to verify there is an actual core.img file in the /boot/grub directory of Ubuntu and it should be there. The last two lines which are commented out (#savedefault, #boot) probably aren't necessary.
 
Old 06-28-2012, 12:59 AM   #3
PaulFC5
Member
 
Registered: Feb 2008
Location: Auckland, Aotearoa/NZ
Posts: 98

Original Poster
Rep: Reputation: 13
Smile Solved - Converting GRUB2 entry back into GRUB1 format



Thanx very much for that yancek

Now working fine! - quad-booting all OK just as I was wanting - 2 x linuxes, 2 x winDoze.

As you suggested bootinfoscript-061 was the solution!
After I spent an hour or so figuring out how to run/extract a .tar.gz in FC14 - no rpm available for an idiot like me .
The answer to that being not to muck around with the su -, sudo, and cd xyz bizzos but to just simply log on as root (which one can do by deleting out a line in/etc/pam.d/somethingorother) and extract/run it.

bootinfoscript's Results.txt told me that it was actually hd1,2 where the Ubuntu12.04 OS was - I'd forgotten that I'd made the linux "try-it-out" 60G partition before I'd filled up the rest of the drive with the NTFS dump/storage area.

So it was (hd1,2) and not hd1,3) as I was trying to use.
It seems that the order in which partitions are made defines their numbering - something I've just had made clear to me! And to be a bit more careful of all the various labelling/numbering conventions

GRUB(1) didn't like me calling it sdb3 - gave me "Error11:Unrecognised device string" - so that (sdb....) is obviously a GRUB2 numbering convention.

I've done this rather lengthy "Solved" post in case anyone else winds up with the same prob I was having. And have attached the first lot of the results for this reason.

That bootinfoscript might also be useful for figuring out why a win7 copypartition (that I've done using an image copy - for safety/backup) won't boot up by itself - only offof a Hiren's BootCD - "Boot off hard drive" from there = fine .
In spite of all the bootrec /fixboot /fixmbr rebuildbcd etc etc.

Thanx again

Cheers
PaulW

Resutls.txt first part:
Quote:
Boot Info Script 0.61 [1 April 2012]


============================= Boot Info Summary: ===============================

=> Grub Legacy0.97 is installed in the MBR of /dev/sda and looks at sector
138354087 on boot drive #1 for the stage2 file. A stage2 file is at this
location on /dev/sda. Stage2 looks on partition #2 for
/boot/grub/grub.conf..
=> Grub2 (v1.99) is installed in the MBR of /dev/sdb and looks at sector 1 of
the same hard drive for core.img. core.img is at this location and looks
for (,msdos3)/boot/grub on this drive.

sda1: __________________________________________________________________________

File system: ntfs
Boot sector type: Windows XP: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows XP
Boot files: /boot.ini /bootmgr /Boot/BCD /ntldr /NTDETECT.COM

sda2: __________________________________________________________________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Fedora release 14 (Laughlin)
Kernel on an ()
Boot files: /boot/grub/menu.lst /boot/grub/grub.conf /etc/fstab

sdb1: __________________________________________________________________________

File system: ntfs
Boot sector type: Windows Vista/7: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files: /bootmgr /Boot/BCD

sdb2: __________________________________________________________________________

File system: ntfs
Boot sector type: Windows Vista/7: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows 7
Boot files: /Windows/System32/winload.exe

sdb3: __________________________________________________________________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 12.04 LTS
Boot files: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sdb4: __________________________________________________________________________

File system: ntfs
Boot sector type: Windows XP: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files:

============================ Drive/Partition Info: =============================

Drive: sda _____________________________________________________________________

Disk /dev/sda: 90.0 GB, 90028302336 bytes
255 heads, 63 sectors/track, 10945 cylinders, total 175836528 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sda1 * 63 125,033,894 125,033,832 7 NTFS / exFAT / HPFS
/dev/sda2 125,033,895 175,831,424 50,797,530 83 Linux


Drive: sdb _____________________________________________________________________

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sdb1 * 2,048 206,847 204,800 7 NTFS / exFAT / HPFS
/dev/sdb2 206,848 125,032,447 124,825,600 7 NTFS / exFAT / HPFS
/dev/sdb3 1,830,638,880 1,953,520,064 122,881,185 83 Linux
/dev/sdb4 125,033,895 1,830,638,879 1,705,604,985 7 NTFS / exFAT / HPFS
 
  


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
difference between GRUB1 and grub2 nsrihari Linux - Newbie 3 02-05-2012 01:26 AM
Lilo vs grub1 vs grub2 honeybadger Linux - General 8 12-03-2010 11:42 AM
grub4dos is grub2 or grub1? zoombee Linux - General 10 07-29-2010 05:25 AM
How do I need to format grub entry to boot from grub2 into grub legacy? mitchell7man Linux - Software 6 04-03-2010 03:03 AM
grub1 floppy chainload grub2 pavel989 Linux - General 3 02-02-2010 10:58 AM

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

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