![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
|
Tutorials & Tips The place to find Ubuntu related Tips & Tricks. |
|
|
Thread Tools | Display Modes |
|
|
#1 | ||||
|
Ubuntu addict and loving it
![]() Join Date: Apr 2008
Beans: 4,565
|
HowTo: Revert from grub2 to Legacy Grub.
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! (I'd appreciate any feedback regarding success or failure following these steps on a 64 bit machine.) ************* 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: 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 (version 9.04 or earlier) on hand 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: Code:
sudo mv /boot/grub /boot/grub_backup Code:
sudo mkdir /boot/grub 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: Quote:
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: 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: Quote:
Now install legacy grub: Code:
sudo apt-get install grub Now: 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: Code:
sudo fdisk -l Quote:
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: Code:
sudo grub Then: Code:
find /boot/grub/stage1 Code:
root (hd0,2) Code:
setup (hd0) If correct you should see an output like: Quote:
If that failed you will likely not be able to boot your machine until we get it straightened out! Next just type: 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: 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! *********************************************** 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 chroot /mnt Code:
lsb_release -a Code:
grub-install /dev/sdX Code:
grub-install --recheck /dev/sdX Code:
exit Code:
sudo umount /mnt/dev && sudo umount /mnt/proc && sudo umount /mnt Code:
sudo apt-get install lilo Code:
sudo lilo -M /dev/sdX mbr Last edited by kansasnoob; 1 Day Ago at 11:34 AM.. Reason: Stopped purging os-prober and added warning about software sources |
||||
|
|
|
|
|
#2 |
|
GMO Free Ubuntu French Roast.
![]() Join Date: Sep 2006
Location: France.
My beans are hidden!
Ubuntu 9.10 Karmic Koala
|
Re: HowTo: Revert from grub2 to Legacy Grub.
Sorry it took so long for the tutorial to be approved. Thanks for you patience
As kansasnoob stated, please stick with grub2
__________________
| Guide to Forum features | Formating text on UF with BB code tags | PUU | PUW | My blog | Linux user #413984 ; Ubuntu user #178 J'aime les fraises. Please do not blindly run commands. |
|
|
|
|
|
#3 |
|
Just Give Me the Beans!
![]() Join Date: Aug 2009
Beans: 82
|
Re: HowTo: Revert from grub2 to Legacy Grub.
Another source of info:
Revert to Grub 1 -- community documentation If you uninstalled grub2 and now grub doesn't work, here's a detailed explanation of installing grub from an ordinary Ubuntu CD |
|
|
|
|
|
#4 | |||
|
Ubuntu addict and loving it
![]() Join Date: Apr 2008
Beans: 4,565
|
Re: HowTo: Revert from grub2 to Legacy Grub.
Quote:
It does not create a new /boot/grub directory so you end up with mixed legacy grub and grub2 files which effects the operation of startupmanager and can also have adverse effects on boot times. And I believe I went above and beyond trying to explain what each step of the procedure does. BTW I intentionally used the _ (underscore) to rename/move the grub directory because no one else does that. That way if someone does have trouble following my instructions I should easily be able to see what they did right or wrong. The official documentation also falls short in the "legacy grub" setup area. They simply say: Quote:
Quote:
Quite simply, mine is better. (No humble pie here). And with 294 views of this HowTo with no complaints, and 3,252 views of the original: http://ubuntuforums.org/showthread.php?t=1247994 I'd think I'd be hearing a lot of complaints and I'm not. I do wish we could get someone like meierfra or caljohnsmith to help tackle some of the multi-boot/multi-drive problems with both grubs! I've been getting in over my head there but no one else kicks in! Maybe next spring I'll have enough money to build a spare multi-drive test system so I can test more scenarios. |
|||
|
|
|
|
|
#5 | |
|
A Carafe of Ubuntu
![]() |
Re: HowTo: Revert from grub2 to Legacy Grub.
Quote:
A LOT of users could care less about a Grub Bootsplash capability, fancy text or even colors. We only care about getting our systems booted up as fast as possible. Why care what the screen looks like if after a couple of seconds your looking at the system boot screen? I can provide a picture of my boot process when I return home if you want it.
__________________
----Seems all the hardware manufacturers are getting lazy and cheap and cowing down to Microcrap's wishes to make everything plug-n-pray.--- |
|
|
|
|
|
|
#6 | |
|
Ubuntu addict and loving it
![]() Join Date: Apr 2008
Beans: 4,565
|
Re: HowTo: Revert from grub2 to Legacy Grub.
Quote:
|
|
|
|
|
|
|
#7 |
|
First Cup of Ubuntu
![]() Join Date: Nov 2009
Beans: 1
|
Re: HowTo: Revert from grub2 to Legacy Grub.
Hi! I decided to revert to legacy grub to try to fix a problem I've never had with bootloaders until the new GRUB 2 with the latest Ubuntu 9.10 release.
Basically, after one or two reboots, in either OS (I'm dual booting Ubuntu and Windows 7 and have been since the Beta of W7), suddenly grub stops working. It'll say "Grub is loading..." or whatever then restart, not even let me choose an OS, essentially locking me out of my system. I'm about to can Ubuntu for now altogether, because I need my Windows stuff for work, but I certainly don't want to do this, so someone reccomended this tutorial to me, and I've gotten pretty far. I've installed the old grub, and am at the point where I am "in" it in the terminal, and I get the part where you have to type: "setup (hd0)" now here is where I start to get errors, mostly "Error 12: Invalid device requested." When I do the find /boot/grub/stage one, it returns "(hd0,6)" Am I doing something wrong? Is there a different way to fix my bootloader problem? |
|
|
|
|
|
#8 | |
|
Ubuntu addict and loving it
![]() Join Date: Apr 2008
Beans: 4,565
|
Re: HowTo: Revert from grub2 to Legacy Grub.
Quote:
http://ubuntuforums.org/showthread.php?t=1291280 |
|
|
|
|
|
|
#9 |
|
Has an Ubuntu Drip
![]() Join Date: Apr 2006
Beans: 785
Ubuntu 9.04 Jaunty Jackalope
|
Re: HowTo: Revert from grub2 to Legacy Grub.
Heya thanks for howto.
Now my Acer Aspire One boots 100% of the time. And if there is a system lock up / I run out of battery, grub1 does not get disconfigured and it will still boot! . Seriously, is there really a good reason to use grub2 besides liking all sorts of random headaches?
__________________
Vista: Because XP was too good for Microsoft's standard. |
|
|
|
|
|
#10 |
|
Just Give Me the Beans!
![]() |
Re: HowTo: Revert from grub2 to Legacy Grub.
May I start by saying thanks for this ;D However, you missed out one essential part- you didn't install grub anywhere and hence when you reach the part that saying
sudo update-grub nothing happens. You must first sudo apt-get install grub ;D I didn't realise you'd missed this till I thought about it lol
__________________
Aptana Studio = pure win. One for all those web devs out there. |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|