Edit thread closed.
Information available at https://help.ubuntu.com/community/Gr...to_GRUB_Legacy
Someone will undoubtedly ask, "why would I want to revert to legacy grub"? My answer is, "I hope you don't". Grub 2 is the way of the future and I'd bet that a year from now nearly everyone will think of legacy grub as downright prehistoric! If you're new to Ubuntu I believe you'll find Grub 2 to be no more complicated than legacy grub, and the documentation continues to improve. I know 20 months ago legacy-grub was confusing to me.
That said I originally undertook this just as a matter of curiosity, I multi-boot and I'm a control freak! I knew that installing via the Alternate CD allowed installing with no boot-loader at all (or Lilo) and I've since learned that you can do somewhat likewise using the Live CD. Also legacy grub is quite familiar to me and the real beauty of Ubuntu, or Linux in general, is the ability to customize it to your hearts content (yeah, and even break it)! I should note here that I've only been able to test this on i386 since I have no 64 bit machines!
*************
Caution: check software sources before proceeding! As of 01/09/2010 I've encountered several problems with the packages "grub" and "grub-common" (or even "grub-pc") not being available for installation during this procedure (particularly with the Australian server).
So before proceeding go to Synaptic Package Manager and click on Reload. When it's done click on Search and type grub, make sure that the packages grub, grub-pc, and grub-common are all available there.
If they're not we need to straighten out the software sources. Since we're in Synaptic I'd begin by just clicking on Settings > Repositories and change to the Main Server. Also be certain that all four of the Ubuntu repos are checked, but that the CD-ROM box is NOT checked.
Then click on reload again, and Search, type grub and check again to see that grub, grub-pc, and grub-common are all three there! If not DO NOT proceed, I'll need to see the output of:
Feel free to send me a brief PM pointing me to your specific thread here on the forums if need be.Code:cat /etc/apt/sources.list
*************
So, on with business, please read this in it's entirety before beginning. If you have any doubts ask questions here on the forums before beginning and make sure you have everything you need! You don't want to get part way through this and find you're unable to complete it! Since we're working on the boot-loader I recommend at the very least having an Ubuntu Live CD on hand (9.04 or prior) that you know works so we can work from it if need be. If any of these steps fail to complete successfully you will most likely be unable to boot your system! Not to worry though if you have a Live CD, that's briefly explained in Appendix #1, and Appendix #2 describes very briefly how to reverse the steps outlined here.
Some prior knowledge regarding Legacy Grub is helpful and you must know how your system is partitioned, how many drives you have, etc. so I recommend figuring that out before you even begin! The following link is a great resource or, if in doubt, ask questions here at the forums.
http://members.iinet.net.au/~herman5...b_with_Live_CD
I will not go into detail about editing the menu.lst here other than providing an example of my own boot entries. (See Appendix #3) Again this is a great resource:
http://members.iinet.net.au/~herman5....html#menu.lst
I highly recommend using copy-n-paste to run these commands. It can also be quite useful to keep a record of what happens in the terminal by simply keeping Abiword or Open Office Word open and "copy-n-pasting" the results of various steps into a document, then saving that document when done. That way if something goes haywire we can use that to troubleshoot what went wrong. I always put a copy in my Yahoo mailbox so I can access it easily from any computer or even the Live CD.
So, when you're ready, let's begin:
Step #1: Rename the existing grub directory and create a new one.
We want to rename the existing /boot/grub directory for use as a backup so go to the Terminal and run the command:
Now we'll create a new grub directory:Code:sudo mv /boot/grub /boot/grub_backup
To be certain those two commands were effective you can run the command:Code:sudo mkdir /boot/grub
Note: that's a lower case L.Code:ls /boot
You can see highlighted in the sample output below that we now have both grub and grub_backup in the boot directory:
Likewise if you run:lance@lance-desktop:~$ ls /boot
/boot:
abi-2.6.31-11-generic memtest86+.bin
config-2.6.31-11-generic System.map-2.6.31-11-generic
grub vmcoreinfo-2.6.31-11-generic
grub_backup vmlinuz-2.6.31-11-generic
initrd.img-2.6.31-11-generic
You should see that the grub directory is currently empty because we haven't reinstalled grub yet.Code:ls /boot/grub
Alternatively you can go to Places > Computer > Filesystem > Boot, you should see the folders named "grub" and "grub_backup".
Step #2: Remove Grub 2 packages, purge configuration files, and install legacy Grub packages.
It is a good idea to purge any old Startup Manager configuration files so:
If it says "not installed so not removed" that's OK, we just wanted to be sure no old configuration files messed with us later on.Code:sudo apt-get --purge remove startupmanager
Just FYI 'grub-pc' is grub2 and 'grub' is legacy grub.
First remove grub2:
Code:sudo apt-get --purge remove grub-pc grub-common
You'll be confronted with this text:
Yes, you do! We've created a backup anyway.Do you want to have all GRUB 2 files removed from /boot/grub?
Your system would be then unbootable if you don't install another bootloader. Remove GRUB 2 from /boot/grub?
Now install legacy grub:
You'll notice that installing grub also reinstalls grub-common, that's normal behavior, we just wanted to "purge" the configuration files.Code:sudo apt-get install grub
Now:
You'll be asked if you want to create a /boot/grub/menu.lst - yes, you do, so type y and enter!Code:sudo update-grub
Step #3: Physically install and setup Legacy Grub.
Now you must actually "install" legacy grub if you're going to use your new legacy grub to boot with and you must know where. In my case I have only one hard drive and I can see how it's recognized by Ubuntu by running the command:
(BTW that's a lower case L.) The pertinent part is in bold in this example:Code:sudo fdisk -l
Since /dev/sda is where I'd want grub to be installed, I'd run this command:lance@lance-desktop:~$ sudo fdisk -l
[sudo] password for lance:
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x63056305
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2104 16900348+ 7 HPFS/NTFS
/dev/sda2 2883 9729 54998527+ 5 Extended
/dev/sda3 2105 2882 6249285 83 Linux
/dev/sda5 4214 5012 6417967+ 83 Linux
/dev/sda6 5013 7434 19454683+ 83 Linux
/dev/sda7 7435 8199 6144831 83 Linux
/dev/sda8 8200 9576 11060721 83 Linux
/dev/sda9 9577 9729 1228941 82 Linux swap / Solaris
/dev/sda10 2883 4213 10691194+ 83 Linux
Partition table entries are not in disk order
Note: If you're at all unsure about where to install grub then ask for help here on the forums! Better to be sure of what you're doing than to play the trial and error game!Code:sudo grub-install /dev/sda
This would be a good time to create a word document of Terminal progress as recommended above if needed for troubleshooting purposes.
Now we need to open a Grub shell as root so run the command:
Note: I've noticed while working in a grub shell that the enter key in the numerical block of the keyboard doesn't always work properly, so use the enter key just above the right shift key!Code:sudo grub
Then:
That will provide an output like (hd0,2) which you'll need to use in the next step:Code:find /boot/grub/stage1
You see I've used (hd0,2) from the "find" command, of course you'll use whatever the output was in your specific case. Then:Code:root (hd0,2)
There I've used the hd0 (that is a zero) from the (hd0,2) output from the "find" command.Code:setup (hd0)
If correct you should see an output like:
Again, this would be a good time to create a word document of Terminal progress as recommended above just for future troubleshooting purposes because:Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...* 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 d (hd0) (hd0)1+15 p (hd0,1)/boot/grub/stage
2 /boot/grub/menu.lst"... succeeded
Done.
If that failed you will likely not be able to boot your machine until we get it straightened out!
Next just type:
To exit the Grub shell.Code:quit
If successful you're done! Time to reboot and see what happens. I hope you read this all first and kept a text record of the terminal just in case something went haywire.
Step #4: Install Startup Manager and lock package versions if desired.
Of course if you want to use startupmanager install it:
But I should say that I've had ongoing problems keeping startupmanager working in Karmic. It's working right now after following the above steps so I rather think it might be wise to go to Synaptic and choose to "lock version" both "grub" and "grub-common", but I've chosen not to so I can monitor for changes (ie: breakage) and I'll report such here if and when that happens.Code:sudo apt-get install startupmanager
**************************************************
Appendix #1:
I'd mentioned above being able to "fix" things using a Live CD. I posted briefly about that here:
http://ubuntuforums.org/showpost.php...2&postcount=10
Of course you'll need to know what partition to mount, what commands to run, etc. And, as mentioned above, this is where a printed record of terminal progress comes in handy! Literally every step necessary to repair or install and setup either legacy grub or grub2 can be completed using a Live CD if you know what to do! Of course if you haphazardly mount the wrong partition you can also destroy things and lose data really fast.
**************************************************
Appendix #2:
OK, so imagine you've changed to legacy grub and now you want to switch back to grub2 (should be self explanatory, same logic applies):
sudo mv /boot/grub /boot/grub_legacy (we already used the name: grub_backup)
sudo mv /boot/grub_backup boot/grub (or sudo mkdir /boot/grub if you want to start fresh)
sudo apt-get --purge remove grub grub-common
sudo apt-get install grub-pc
sudo update-grub
sudo grub-install /dev/sda (replace /dev/sda with your proper destination)
Seems simple without my rambling verbosity, eh? I can now "flip" from one to the other in about 15 minutes - but not blindfolded.
**************************************************
Appendix #3:
This is what my Karmic /boot/grub/menu.lst boot entries look like (of course I had to manually add the lines to boot Win XP, Jaunty, and Mint Gloria):
## ## End Default Options ##
title Ubuntu karmic (development branch), kernel 2.6.31-11-generic
uuid d3d589c9-29e6-463e-9c99-806ec3646dea
kernel /boot/vmlinuz-2.6.31-11-generic root=UUID=d3d589c9-29e6-463e-9c99-806ec3646dea ro quiet splash
initrd /boot/initrd.img-2.6.31-11-generic
quiet
title Ubuntu karmic (development branch), kernel 2.6.31-11-generic (recovery mode)
uuid d3d589c9-29e6-463e-9c99-806ec3646dea
kernel /boot/vmlinuz-2.6.31-11-generic root=UUID=d3d589c9-29e6-463e-9c99-806ec3646dea ro single
initrd /boot/initrd.img-2.6.31-11-generic
### END DEBIAN AUTOMAGIC KERNELS LIST
# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Home Edition
rootnoverify (hd0,0)
savedefault
makeactive
chainloader +1
# This entry automatically added by the Debian installer for an existing
# linux installation on /dev/sda5.
title Ubuntu 9.04, kernel 2.6.28-15-generic (on /dev/sda5)
root (hd0,4)
kernel /boot/vmlinuz-2.6.28-15-generic root=UUID=6ceb25f1-5904-490b-a7cc-d14b9d63c3b7 ro quiet splash
initrd /boot/initrd.img-2.6.28-15-generic
savedefault
boot
# This entry automatically added by the Debian installer for an existing
# linux installation on /dev/sda5.
title Ubuntu 9.04, kernel 2.6.28-15-generic (recovery mode) (on /dev/sda5)
root (hd0,4)
kernel /boot/vmlinuz-2.6.28-15-generic root=UUID=6ceb25f1-5904-490b-a7cc-d14b9d63c3b7 ro single
initrd /boot/initrd.img-2.6.28-15-generic
savedefault
boot
# This entry automatically added by the Debian installer for an existing
# linux installation on /dev/sda7.
title Linux Mint 7 Gloria, kernel 2.6.28-15-generic
root (hd0,6)
kernel /boot/vmlinuz-2.6.28-15-generic root=/dev/sda7 ro quiet splash
initrd /boot/initrd.img-2.6.28-15-generic
quiet
savedefault
boot
# This entry automatically added by the Debian installer for an existing
# linux installation on /dev/sda7.
title Linux Mint 7 Gloria, kernel 2.6.28-15-generic (recovery mode)
root (hd0,6)
kernel /boot/vmlinuz-2.6.28-15-generic root=/dev/sda7 ro single
initrd /boot/initrd.img-2.6.28-15-generic
savedefault
boot
**************************************************
I've found this syntax to work better for adding Karmic to another existing grub menu.lst:
title Ubuntu 9.10, kernel 2.6.31-11-generic (on /dev/sda3)
root (hd0,2)
kernel /boot/vmlinuz-2.6.31-11-generic root=UUID=d3d589c9-29e6-463e-9c99-806ec3646dea ro quiet splash
initrd /boot/initrd.img-2.6.31-11-generic
savedefault
boot
title Ubuntu 9.10, kernel 2.6.31-11-generic (recovery mode) (on /dev/sda3)
root (hd0,2)
kernel /boot/vmlinuz-2.6.31-11-generic root=UUID=d3d589c9-29e6-463e-9c99-806ec3646dea ro single
initrd /boot/initrd.img-2.6.31-11-generic
savedefault
boot
Rather than this:
title Ubuntu karmic (development branch), kernel 2.6.31-11-generic
uuid d3d589c9-29e6-463e-9c99-806ec3646dea
kernel /boot/vmlinuz-2.6.31-11-generic root=UUID=d3d589c9-29e6-463e-9c99-806ec3646dea ro quiet splash
initrd /boot/initrd.img-2.6.31-11-generic
title Ubuntu karmic (development branch), kernel 2.6.31-11-generic (recovery mode)
uuid d3d589c9-29e6-463e-9c99-806ec3646dea
kernel /boot/vmlinuz-2.6.31-11-generic root=UUID=d3d589c9-29e6-463e-9c99-806ec3646dea ro single
initrd /boot/initrd.img-2.6.31-11-generic
No idea why!
***********************************************
Just NOTES
My "failsafe" method for installing or reinstalling grub2 to a drives mbr if other methods have failed:
Code:sudo mount /dev/sdXY /mnt && sudo mount --bind /dev /mnt/dev && sudo mount --bind /proc /mnt/proc && sudo mount --bind /sys /mnt/sys && sudo chroot /mnt(Just to be sure you're in the right place)Code:lsb_release -a
Code:grub-install /dev/sdXCode:grub-install --recheck /dev/sdXCode:update-grubCode:exitTo restore a Windows MBR with nothing but an Ubuntu Live CD:Code:sudo umount /mnt/dev && sudo umount /mnt/sys && sudo umount /mnt/proc && sudo umount /mnt
Code:sudo apt-get install liloIf simply running "update-grub" fails to find other OS's in grub2 try:Code:sudo lilo -M /dev/sdX mbr
Code:sudo apt-get install --reinstall libdebian-installer4Code:sudo os-proberCode:sudo update-grub
Bookmarks