Downgrading grub2

Help with issues regarding installation of Debian

Downgrading grub2

Postby Grimnar » 2010-03-10 01:27

So I'm running Grub 1.97 on some of my computers. And one of them I could temper and test things out with. And one of them are kinda production, but still runs squeeze. (Long story)
So the one I can temper with, I wanna downgrade grub2 to grub 0.97.
How can this be done? I just tried a little bit this evening but when I boot I still see the grub2 screen.

I wanna go back to the ages when /dev/sda1 was /dev/sda1 not all this:

Code: Select all
menuentry "Debian GNU/Linux, with Linux 2.6.32-trunk-amd64" {
   insmod ext2
   set root=(hd0,1)
   search --no-floppy --fs-uuid --set 6966f3e7-ad5b-4980-825e-a2eoad37a3c2
   echo   Loading Linux 2.6.32-trunk-amd64 ...
   linux   /boot/vmlinuz-2.6.32-trunk-amd64 root=UUID=6996f3e7-ad5b-4980-825e-a2edad37a3c2 ro  quiet
   echo   Loading initial ramdisk ...
   initrd   /boot/initrd.img-2.6.32-trunk-amd64

crap.

Can that be done? And I have this problem with the production server changing /dev/sda1 at every boot. So this is kinda the reason I want to downgrade. /dev/sda1 should be /dev/sda1 at every boot! Not changing all the time. Makes building raid that much harder.

:D
User avatar
Grimnar
 
Posts: 173
Joined: 2008-03-30 16:24

Re: Downgrading grub2

Postby nadir » 2010-03-10 01:46

http://wiki.ubuntuusers.de/Grub_2_durch_Grub_ersetzen
the commands are highlighted, so you don't need to speak german, just use the commands.
the rest is buntu-speak-chit-chat anyway.
if i recall correct i did it that way, it didn't work for the first time, after i smashed a few times on it i was back to grub-legacy.
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.
User avatar
nadir
 
Posts: 5964
Joined: 2009-10-05 22:06
Location: away

Re: Downgrading grub2

Postby Grimnar » 2010-03-10 01:49

Thanks alot!

by the way: http://translate.google.com/translate?j ... l=de&tl=en

:D

Still, I'm norwegian! :D
User avatar
Grimnar
 
Posts: 173
Joined: 2008-03-30 16:24

Re: Downgrading grub2

Postby nadir » 2010-03-10 01:52

Still, I'm norwegian! :D

aha. thats good. :-)
i hope it will work (as said: i remember that i had a bit of trouble, but just did it again and again)
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.
User avatar
nadir
 
Posts: 5964
Joined: 2009-10-05 22:06
Location: away

Re: Downgrading grub2

Postby Grimnar » 2010-03-10 01:54

Yeah, well. It sure makes me install
Code: Select all
grub grub-common grub-pc

again. grub-common = grub 1.97
But we will see :)
User avatar
Grimnar
 
Posts: 173
Joined: 2008-03-30 16:24

Re: Downgrading grub2

Postby Grimnar » 2010-03-10 02:12

That did not go as planned :D

Code: Select all
GNU GRUB version 1.98XX
Minimal BASH-like line editing is supported. For the first word, TAB list possible command completitions. Anywhere else TAB lists possible device or file completitions.

grub>_



And this one came after I did this according to the page:

Code: Select all
Cleanup These are files in the / boot / grub / and / etc / grub.d, which can be manually deleted if necessary.
User avatar
Grimnar
 
Posts: 173
Joined: 2008-03-30 16:24

Re: Downgrading grub2

Postby logan » 2010-03-11 18:54

I just reinstalled my work machine the other day using an old lenny cd and then upgraded to squeeze. I thought the installer said it it'd clean up any files in /boot/grub when I uninstalled grub-pc, but that didn't happen (or it left a heck of alot behind). I got rid of *.mod, *.lst (except for menu.lst), *.img, as well as *.o, grub.cfg, grubenv, some .png file, and unicode.pf2.

Make sure you update-grub after uninstalling grub-pc and installing grub-legacy, so you get 0.97 on the mbr.
logan
 
Posts: 269
Joined: 2008-03-29 18:09

Re: Downgrading grub2

Postby kansasnoob » 2010-03-11 19:09

You peeked my interest because I wrote the following HowTo for Ubuntu and having just installed Squeeze I decided see what differences there might be (there were a few so don't follow that!):

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

One major difference was package names. While the package "grub" is still in the repos installing it automatically upgrades to grub2, so the correct package name is "grub-legacy".

The second major difference was the need to run "update-grub" twice, once before the "grub-install /dev/XYZ" to create a device.map and again after "grub-install /dev/XYZ" to create a menu.lst.

Also, mostly due to subtle differences in Debian's CLI, infamiliarity with package names, etc. I chose to handle the package management part of this using Synaptic. Synaptic is great if you're unfamiliar with package names and such, I just clicked on Search and typed in grub, that made it easy to see just what I was dealing with :)

So it went like this (all commands run as root):

Code: Select all
mv /boot/grub /boot/grub_backup


Code: Select all
mkdir /boot/grub


I then check the directory structure like this:

Code: Select all
ls /boot


Example (you can see that I have both the /boot/grub and /boot/grub_backup):

Code: Select all
config-2.6.32-trunk-686      initrd.img-2.6.32-trunk-686.bak
grub                         System.map-2.6.32-trunk-686
grub_backup                  vmlinuz-2.6.32-trunk-686
initrd.img-2.6.32-trunk-686


I then went to Synaptic and marked grub, grub-common, and grub-pc for complete removal so it gets rid of the old configuration files (Note: you may find that the package "grub" is not installed, but I had fiddled using the CLI before realizing the package name difference as explained above).

I applied that, you'll be warned about having no bootloader, etc. but I wanted to get rid of it. After that was complete I installed grub-legacy which also reinstalls grub-common, now it's back to the Terminal (as root):

Code: Select all
update-grub


That created a device.map.

Code: Select all
grub-install /dev/XYZ


I assume you know where you want to install grub? Obviously the "XYZ" needs to be replaced with the proper device, eg: mine was /dev/hda. Then we repeat:

Code: Select all
update-grub


That time it created a menu.lst, now we need to use a grub shell:

Code: Select all
grub


Be patient and you'll see the prompt change to grub>, then run:

Code: Select all
find /boot/grub/stage1


Mine returned:

Code: Select all
grub> find /boot/grub/stage1
 (hd0,4)
 (hd0,6)
 (hd0,8)
 (hd0,11)
 (hd0,17)


And I know Debian is on (hd0,17) so I then (Note: those are zeros):

Code: Select all
root (hd0,17)


Code: Select all
setup (hd0)


If all went well you should see:

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.


Then just run:

Code: Select all
quit


I then checked to see how /boot/grub was populated:

Code: Select all
ls /boot/grub


Example:

Code: Select all
root@lance-desktop:/home/lance# ls /boot/grub
default        fat_stage1_5  menu.lst~         reiserfs_stage1_5  stage2
device.map     jfs_stage1_5  menu.lst.backup  splashimages    xfs_stage1_5
e2fs_stage1_5  menu.lst      minix_stage1_5   stage1


I then also installed "startupmanager" because I like it, and also "usplash" while I was there.

It worked out fine for me, no problem booting, now to change it back :)

I hope that's helpful.
kansasnoob
 
Posts: 17
Joined: 2010-03-10 04:19

Re: Downgrading grub2

Postby kansasnoob » 2010-03-11 19:45

Going back the other way was no problem at all, I used purely CLI now that I knew the package names:

mv /boot/grub /boot/grub_legacy
mkdir /boot/grub
apt-get --purge remove grub-legacy grub-common startupmanager
apt-get install grub-pc (answer yes to all questions)
update-grub (found all OS"s):

Generating grub.cfg ...
Found background image: moreblue-orbit-grub.png
Found linux image: /boot/vmlinuz-2.6.32-trunk-686
Found initrd image: /boot/initrd.img-2.6.32-trunk-686
Found Microsoft Windows XP Home Edition on /dev/hda1
Found Ubuntu 9.10 (9.10) on /dev/hda12
Found Ubuntu lucid (development branch) (10.04) on /dev/hda3
Found Ubuntu 9.04 (9.04) on /dev/hda5
Found Linux Mint 7 Gloria - Main Edition (7) on /dev/hda7
Found Ubuntu 8.04.4 LTS (8.04) on /dev/hda9
Found Microsoft Windows XP Home Edition on /dev/hdb1
Found Fedora release 12 (Constantine) on /dev/hdb2
done


And while I was asked during the install/configuration process I trust nothing so I:

grub-install /dev/sda

Rebooted fine. I love grub2 :)
kansasnoob
 
Posts: 17
Joined: 2010-03-10 04:19

Re: Downgrading grub2

Postby Grimnar » 2010-03-11 23:59

Thats cool. But at the end there;

Generating grub.cfg ...


That indicates grub 1.97? I thought grub 0.97 used menu.lst instead of grub.cfg?
User avatar
Grimnar
 
Posts: 173
Joined: 2008-03-30 16:24

Re: Downgrading grub2

Postby kansasnoob » 2010-03-12 00:54

Grimnar wrote:Thats cool. But at the end there;

Generating grub.cfg ...


That indicates grub 1.97? I thought grub 0.97 used menu.lst instead of grub.cfg?


Yeah, that's wrong. I mean something is wrong. Give me a few minutes.

But also don't just post bits and pieces of the terminal output, post it all so we can see what you're doing.

I'll be back.
kansasnoob
 
Posts: 17
Joined: 2010-03-10 04:19

Re: Downgrading grub2

Postby kansasnoob » 2010-03-12 01:05

Well the first thing is I need to know just what steps you wer following when that occurred.

Maybe I wasn't clear, but my first post in this thread was reverting grub2 to grub-legacy. The one after that was going from grub-legacy back to grub2. Maybe I shouldn't even have included the second post, but I was reporting my results.

Sorry if I was unclear about that. Give me a few minutes to type some commands so we can see what we have.
kansasnoob
 
Posts: 17
Joined: 2010-03-10 04:19

Re: Downgrading grub2

Postby Grimnar » 2010-03-12 01:35

Thats great! My pc which I could temper with Debian made a booboo, see earlier post. So I have to reinstall (to save time)
So I'll be running Debian AMD 64 Squeeze. And I will post the options for grub I have. And I'm going to re-read posts you have made in this thread. I was away all day today, and I need my sleep now. 02:33 here in Norway right now :D

So give me a few hours and I'll be back and posting! :)
User avatar
Grimnar
 
Posts: 173
Joined: 2008-03-30 16:24

Re: Downgrading grub2

Postby kansasnoob » 2010-03-12 01:58

Well you can see what's installed by running:

Code: Select all
aptitude show <package-name>|head -4


Since you want to know about grub, grub-pc, grub-common, and grub-legacy you could combine the commands with space&& space as such:

Code: Select all
aptitude show grub|head -4 && aptitude show grub-pc|head -4 && aptitude show grub-common|head -4 && aptitude show grub-legacy|head -4


Example:

Code: Select all
lance@lance-desktop:~$ aptitude show grub|head -4 && aptitude show grub-pc|head -4 && aptitude show grub-common|head -4 && aptitude show grub-legacy|head -4
Package: grub
State: not installed
Version: 0.97-59
Priority: optional
Package: grub-pc
State: not installed
Version: 1.98~20100115-1
Priority: extra
Package: grub-common
State: installed
Automatically installed: yes
Version: 1.98~20100115-1
Package: grub-legacy
State: installed
Automatically installed: no
Version: 0.97-59


Then to see what files/directories look like:

Code: Select all
ls /boot


Code: Select all
ls /boot/grub


A typical grub-legacy /boot/grub looks like this:

Code: Select all
default        grub.cfg      menu.lst.backup                 splashimages
device.map     jfs_stage1_5  menu.lst_backup_by_grub2_prerm  stage1
e2fs_stage1_5  menu.lst      minix_stage1_5                  stage2
fat_stage1_5   menu.lst~     reiserfs_stage1_5               xfs_stage1_5


A typical grub2 (grub-pc) /boot/grub looks like this:

Code: Select all
915resolution.mod            gcry_rmd160.mod     part_sun.mod
acpi.mod                     gcry_seed.mod       parttool.lst
affs.mod                     gcry_serpent.mod    parttool.mod
afs_be.mod                   gcry_sha1.mod       password.mod
afs.mod                      gcry_sha256.mod     password_pbkdf2.mod
aout.mod                     gcry_sha512.mod     pbkdf2.mod
ata.mod                      gcry_tiger.mod      pci.mod
ata_pthru.mod                gcry_twofish.mod    play.mod
at_keyboard.mod              gcry_whirlpool.mod  png.mod
befs_be.mod                  gettext.mod         probe.mod
befs.mod                     gfxterm.mod         pxeboot.img
biosdisk.mod                 gptsync.mod         pxecmd.mod
bitmap.mod                   grldr.img           pxe.mod
blocklist.mod                grub.cfg            raid5rec.mod
boot.img                     grubenv             raid6rec.mod
boot.mod                     gzio.mod            raid.mod
bsd.mod                      halt.mod            read.mod
bufio.mod                    handler.lst         reboot.mod
cat.mod                      handler.mod         reiserfs.mod
cdboot.img                   hashsum.mod         relocator.mod
chain.mod                    hdparm.mod          scsi.mod
charset.mod                  hello.mod           search_fs_file.mod
cmp.mod                      help.mod            search_fs_uuid.mod
command.lst                  hexdump.mod         search_label.mod
configfile.mod               hfs.mod             search.mod
core.img                     hfsplus.mod         serial.mod
cpio.mod                     iso9660.mod         setjmp.mod
cpuid.mod                    jfs.mod             sfs.mod
crc.mod                      jpeg.mod            sh.mod
crypto.lst                   kernel.img          sleep.mod
crypto.mod                   keystatus.mod       tar.mod
datehook.mod                 linux16.mod         terminal.lst
date.mod                     linux.mod           terminal.mod
datetime.mod                 lnxboot.img         terminfo.mod
device.map                   loadenv.mod         test.mod
diskboot.img                 locale              tga.mod
dm_nv.mod                    loopback.mod        true.mod
drivemap.mod                 lsmmap.mod          udf.mod
echo.mod                     ls.mod              ufs1.mod
efiemu32.o                   lspci.mod           ufs2.mod
efiemu64.o                   lvm.mod             uhci.mod
efiemu.mod                   mdraid.mod          usb_keyboard.mod
elf.mod                      memdisk.mod         usb.mod
example_functional_test.mod  memrw.mod           usbms.mod
ext2.mod                     minicmd.mod         usbtest.mod
extcmd.mod                   minix.mod           vbeinfo.mod
fat.mod                      mmap.mod            vbe.mod
font.mod                     moddep.lst          vbetest.mod
fshelp.mod                   msdospart.mod       vga.mod
fs.lst                       multiboot2.mod      vga_text.mod
functional_test.mod          multiboot.mod       video_fb.mod
gcry_arcfour.mod             normal.mod          video.lst
gcry_blowfish.mod            ntfscomp.mod        video.mod
gcry_camellia.mod            ntfs.mod            videotest.mod
gcry_cast5.mod               ohci.mod            xfs.mod
gcry_crc.mod                 part_acorn.mod      xnu.mod
gcry_des.mod                 part_amiga.mod      xnu_uuid.mod
gcry_md4.mod                 part_apple.mod      zfsinfo.mod
gcry_md5.mod                 part_gpt.mod        zfs.mod
gcry_rfc2268.mod             partmap.lst
gcry_rijndael.mod            part_msdos.mod


You'll notice that everything is in alphabetical order. If it's huge like the last example then just look for a menu.lst. If there's a menu.lst in that bunch then you have a problem.

If you have mixed grub-pc and grub-legacy files in the /boot/grub directory neither will work properly. That's why I always start with making a new /boot/grub directory.

Now, it's hard to give you more specific directions without the full output from the terminal of those commands. My first set of instructions was for reverting from grub2 to grub-legacy. The next post was just me reporting that it was easy to go back the other way.

So if you need more specific help post the output of:

Code: Select all
aptitude show grub|head -4 && aptitude show grub-pc|head -4 && aptitude show grub-common|head -4 && aptitude show grub-legacy|head -4


And these two:

Code: Select all
ls /boot
ls /boot/grub


And also post the output of the Boot Info Script:

http://bootinfoscript.sourceforge.net/

The instructions are there but I do things a bit different, for instance if I downloaded to the Desktop I run:

Code: Select all
cd Desktop


Then "su" + password to become root and :

Code: Select all
bash boot_info_script055.sh


The output will be long so it should be placed in CODE tags.

This can be done, sorry if I confused you.
kansasnoob
 
Posts: 17
Joined: 2010-03-10 04:19

Re: Downgrading grub2

Postby kansasnoob » 2010-03-12 02:01

Grimnar wrote:Thats great! My pc which I could temper with Debian made a booboo, see earlier post. So I have to reinstall (to save time)
So I'll be running Debian AMD 64 Squeeze. And I will post the options for grub I have. And I'm going to re-read posts you have made in this thread. I was away all day today, and I need my sleep now. 02:33 here in Norway right now :D

So give me a few hours and I'll be back and posting! :)


It's all good! I may be tending goats (seriously) when you're asking questions.

Although we're worlds apart we can help each other :)
kansasnoob
 
Posts: 17
Joined: 2010-03-10 04:19

Next

Return to Installation

Who is online

Users browsing this forum: No registered users and 12 guests

fashionable