Page 1 of 8 123 ... LastLast
Results 1 to 10 of 76

Thread: HowTo: Revert from grub2 to Legacy Grub.

  1. #1
    Join Date
    Apr 2008
    Beans
    11,707

    HowTo: Revert from grub2 to Legacy Grub.

    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:

    Code:
    cat /etc/apt/sources.list
    Feel free to send me a brief PM pointing me to your specific thread here on the forums if need be.

    *************

    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:

    Code:
    sudo mv /boot/grub /boot/grub_backup
    Now we'll create a new grub directory:

    Code:
    sudo mkdir /boot/grub
    To be certain those two commands were effective you can run the command:

    Code:
    ls /boot
    Note: that's a lower case L.

    You can see highlighted in the sample output below that we now have both grub and grub_backup in the boot directory:

    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
    Likewise if you run:

    Code:
    ls /boot/grub
    You should see that the grub directory is currently empty because we haven't reinstalled grub yet.

    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
    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.

    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:

    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?
    Yes, you do! We've created a backup anyway.

    Now install legacy grub:

    Code:
    sudo apt-get install grub
    You'll notice that installing grub also reinstalls grub-common, that's normal behavior, we just wanted to "purge" the configuration files.

    Now:

    Code:
    sudo update-grub
    You'll be asked if you want to create a /boot/grub/menu.lst - yes, you do, so type y and enter!

    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
    (BTW that's a lower case L.) The pertinent part is in bold in this example:

    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
    Since /dev/sda is where I'd want grub to be installed, I'd run this command:

    
    Code:
    sudo grub-install /dev/sda
    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!

    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
    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!

    Then:

    
    Code:
    find /boot/grub/stage1
    That will provide an output like (hd0,2) which you'll need to use in the next step:

    
    Code:
    root (hd0,2)
    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:
    setup (hd0)
    There I've used the hd0 (that is a zero) from the (hd0,2) output from the "find" command.

    If correct you should see an output like:

    
    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.
    Again, this would be a good time to create a word document of Terminal progress as recommended above just for future troubleshooting purposes because:

    If that failed you will likely not be able to boot your machine until we get it straightened out!

    Next just type:

    Code:
    quit
    To exit the Grub shell.

    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
    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.

    **************************************************

    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
    Code:
    lsb_release -a
    (Just to be sure you're in the right place)

    Code:
    grub-install /dev/sdX
    Code:
    grub-install --recheck /dev/sdX
    Code:
    update-grub
    Code:
    exit
    Code:
    sudo umount /mnt/dev && sudo umount /mnt/sys && sudo umount /mnt/proc && sudo umount /mnt
    To restore a Windows MBR with nothing but an Ubuntu Live CD:

    Code:
    sudo apt-get install lilo
    Code:
    sudo lilo -M /dev/sdX mbr
    If simply running "update-grub" fails to find other OS's in grub2 try:

    Code:
    sudo apt-get install --reinstall libdebian-installer4
    Code:
    sudo os-prober
    Code:
    sudo update-grub
    Last edited by Elfy; June 30th, 2012 at 01:33 PM. Reason: Stopped purging os-prober and added warning about software sources

  2. #2
    Join Date
    Sep 2006
    Location
    France.
    Beans
    Hidden!
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    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
    | My old and mostly abandoned blog |
    Linux user #413984 ; Ubuntu user #178
    J'aime les fraises.
    Nighty night me lovelies!

    | Reinstalling Ubuntu ? Please check this bug first ! |
    | Using a ppa ? Please install ppa-purge from universe, you may need it should you want to revert packages back |
    | No support requests / username changes by PM, thanks. |
    [SIGPIC][/SIGPIC]

  3. #3
    Join Date
    Aug 2009
    Beans
    229
    Distro
    Ubuntu Development Release

    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. #4
    Join Date
    Apr 2008
    Beans
    11,707

    Re: HowTo: Revert from grub2 to Legacy Grub.

    Quote Originally Posted by julianb View Post
    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
    Unfortunately the official documentation falls short.

    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:

    #

    With grub installed, the user must still create the menu.lst and stage1/stage2 files by running the following two commands.

    1.

    sudo update-grub
    *

    Generates menu.lst
    o Tab to "Yes" when prompted.
    2.

    sudo grub-install /dev/sdX
    * Choose the correct device (sda, sdb, etc), normally the one on which Ubuntu is installed.
    *

    Creates the stage1 & stage2 files in /boot/grub and writes to the MBR.

    # Reboot
    With no mention of the typical:

    sudo grub
    find /boot/grub/stage1
    root (hdx,y)
    setup (hdx)
    quit
    Which is essential!

    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. #5
    Join Date
    Mar 2007
    Location
    Youngsville, NC
    Beans
    90
    Distro
    Kubuntu

    Re: HowTo: Revert from grub2 to Legacy Grub.

    Quote Originally Posted by kansasnoob View Post
    Someone will undoubtedly ask, "why would I want to revert to legacy grub"?
    Because a lot of us are now experiencing Boot times of over a minute to a minute and a half (Mine over 70 Seconds) to get to the login screen when it used to take 23 or so seconds?

    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. #6
    Join Date
    Apr 2008
    Beans
    11,707

    Re: HowTo: Revert from grub2 to Legacy Grub.

    Quote Originally Posted by old_salt View Post
    Because a lot of us are now experiencing Boot times of over a minute to a minute and a half (Mine over 70 Seconds) to get to the login screen when it used to take 23 or so seconds?

    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.
    So, did my method of reverting work for you?

  7. #7
    Join Date
    Nov 2009
    Beans
    2

    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. #8
    Join Date
    Apr 2008
    Beans
    11,707

    Re: HowTo: Revert from grub2 to Legacy Grub.

    Quote Originally Posted by SeraphProfeta View Post
    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?
    The most helpful thing I could see to troubleshoot this is the results of the Boot Info script as described here:

    http://ubuntuforums.org/showthread.php?t=1291280

  9. #9
    Join Date
    Apr 2006
    Beans
    996
    Distro
    Ubuntu 12.04 Precise Pangolin

    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?
    Xye incredibly difficult puzzle game with minimal graphics. Also at playdeb
    Got a blog: Will Stay Free

  10. #10
    Join Date
    Aug 2008
    Location
    England
    Beans
    90
    Distro
    Lubuntu 12.10 Quantal Quetzal

    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

Page 1 of 8 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •