| View previous topic :: View next topic |
| Author |
Message |
gentian Tux's lil' helper

Joined: 26 Mar 2012 Posts: 113
|
Posted: Tue Apr 03, 2012 6:15 am Post subject: How to Uninstall Grub Legacy and Install Grub 2? |
|
|
Hello everyone,
Since I am migrating from another distro, I would like to know the steps of getting rid grub legacy and installing grub2. There are sufficient steps to install grub2 on the gentoo wiki, but there is no mention how I can completely wipe grub legacy from my system and the /boot directory.
Any help would be much appreciated.
thanks. |
|
| Back to top |
|
 |
avx Advocate


Joined: 21 Jun 2004 Posts: 2063
|
Posted: Tue Apr 03, 2012 9:11 am Post subject: |
|
|
| Code: | | dd if=/dev/zero of=/dev/sdX bs=446 count=1 | Make sure you use this on the correct disk! After that, just delete the directory.
In theory, grub2 should just overwrite the contents in the boot-sector, but if you want to be sure, that's one way to go - I'm sure Google finds other options, too. _________________ ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Last edited by avx on Tue Apr 03, 2012 9:52 am; edited 2 times in total |
|
| Back to top |
|
 |
gentian Tux's lil' helper

Joined: 26 Mar 2012 Posts: 113
|
Posted: Tue Apr 03, 2012 9:45 am Post subject: |
|
|
| avx wrote: | | Code: | | dd if=/dev/null of=/dev/sdX bs=446 count=1 | Make sure you use this on the correct disk! After that, just delete the directory.
In theory, grub2 should just overwrite the contents in the boot-sector, but if you want to be sure, that's on way to go - I'm sure Google finds other options, too. |
Wouldn't I need to get rid of grub-legacy first? Should I uninstall it? Would be also grateful if you could decode the meaning of this for me..
| Code: | | dd if=/dev/null of=/dev/sdX bs=446 count=1 |
|
|
| Back to top |
|
 |
avx Advocate


Joined: 21 Jun 2004 Posts: 2063
|
Posted: Tue Apr 03, 2012 9:57 am Post subject: |
|
|
First, sorry, meant /dev/zero.
"Uninstalling" in terms of the bootloader only means to remove the support files on disk, ie config files and such, not the bootloader itself. The bootloader sits in some space before the beginning of the first partition on the disk, thus it can't be easily seen, when not looking with a hexeditor on the raw device.
The dd command overwrites the space the bootloader resides in with zeros, thus killing it. If you want more information, just ask google about "dd grub 446". _________________ ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. |
|
| Back to top |
|
 |
i92guboj Moderator


Joined: 30 Nov 2004 Posts: 9464 Location: Córdoba (Spain)
|
Posted: Tue Apr 03, 2012 11:19 am Post subject: |
|
|
Just note that after zeroing the boot sector you'll be unable to boot from that disk, until you install a new bootloader so make sure you do it all quick enough. If your computer is rebooted or there's an electric blackout in the middle of the process you will need a boot disk, so make sure you have one and one that can grant you access to the internet in case you need help. _________________ Gentoo Handbook | My website |
|
| Back to top |
|
 |
John R. Graham Administrator


Joined: 08 Mar 2005 Posts: 6423 Location: Somewhere over Atlanta, Georgia
|
Posted: Tue Apr 03, 2012 12:39 pm Post subject: |
|
|
| gentian wrote: | | Wouldn't I need to get rid of grub-legacy first? Should I uninstall it? | Well, not necessarily first, but, yes, eventually. Just unmerge it like any other package.
- John _________________ This space intentionally left blank. |
|
| Back to top |
|
 |
Arkhelion Tux's lil' helper

Joined: 07 Sep 2010 Posts: 127 Location: France
|
Posted: Tue Apr 03, 2012 2:35 pm Post subject: |
|
|
I'm not sure it's clear whether you want to uninstall a gentoo grub install or uninstall an existing grub from your former distro. If it's the latter, then just skip the first step.
Let's try these "steps" :
| Code: | #emerge --unmerge grub
#rm -rf /boot/grub
#dd if=/dev/zero of=/dev/sdX bs=446 count=1 ##### CHANGE WITH YOUR BOOT DISK
#echo "=sys-boot/grub-2.00_beta3 **" >> /etc/portage/package.keywords ##### CHANGE WITH WANTED VERSION
#emerge --verbose grub
#grub2-install [--no-floppy] /dev/sdX ##### CHANGE WITH YOUR BOOT DISK / PUT --NO-FLOPPY IF YOU DON'T HAVE A FLOPPY DISK ON THAT MACHINE
#grub2-mkconfig -o /boot/grub2/grub.cfg |
The grub2-install should overwrite the boot sector if you use the same disk, so there should be no need to clean it with dd (though you could/should do it if you change the boot disk).
If you happen to have to reboot in the middle of the process... then load a LiveCD, chroot and keep going... _________________ Arkhelion |
|
| Back to top |
|
 |
gentian Tux's lil' helper

Joined: 26 Mar 2012 Posts: 113
|
Posted: Tue Apr 03, 2012 8:15 pm Post subject: |
|
|
| Arkhelion wrote: | I'm not sure it's clear whether you want to uninstall a gentoo grub install or uninstall an existing grub from your former distro. If it's the latter, then just skip the first step.
Let's try these "steps" :
| Code: | #emerge --unmerge grub
#rm -rf /boot/grub
#dd if=/dev/zero of=/dev/sdX bs=446 count=1 ##### CHANGE WITH YOUR BOOT DISK
#echo "=sys-boot/grub-2.00_beta3 **" >> /etc/portage/package.keywords ##### CHANGE WITH WANTED VERSION
#emerge --verbose grub
#grub2-install [--no-floppy] /dev/sdX ##### CHANGE WITH YOUR BOOT DISK / PUT --NO-FLOPPY IF YOU DON'T HAVE A FLOPPY DISK ON THAT MACHINE
#grub2-mkconfig -o /boot/grub2/grub.cfg |
The grub2-install should overwrite the boot sector if you use the same disk, so there should be no need to clean it with dd (though you could/should do it if you change the boot disk).
If you happen to have to reboot in the middle of the process... then load a LiveCD, chroot and keep going... |
Thanks for the detailed answer. Now I have another issue. I need to add my win entry into grub2 and I get the: "error: no such partition" message. My steps here:
1) edit /etc/grub.d/40_custom
2) added menuentry "Windows" {
insmod chain
set root=(hd0,0)
drivemap -s hd0 hd1
chainloader +1
}
3) grub2-mkconfig -o /boot/grub2/grub.cfg |
|
| Back to top |
|
 |
BillWho Veteran


Joined: 03 Mar 2012 Posts: 1576 Location: US
|
Posted: Wed Apr 04, 2012 4:49 am Post subject: |
|
|
gentian,
This is my entry for grub2. Haven't booted it since last year
| Code: | menuentry "Windows 7 (loader) (on /dev/sda2)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(/dev/sda,msdos2)'
search --no-floppy --fs-uuid --set=root B05E98FC5E98BD12
chainloader +1
}
|
The fs-uuid is the the windows 7 partition
| Code: | root@gentoo-gateway conf.d # blkid|grep B05E98FC5E98BD12
/dev/sda2: LABEL="Win7" UUID="B05E98FC5E98BD12" TYPE="ntfs"
|
Good luck  |
|
| Back to top |
|
 |
Arkhelion Tux's lil' helper

Joined: 07 Sep 2010 Posts: 127 Location: France
|
Posted: Wed Apr 04, 2012 9:15 am Post subject: |
|
|
In grub2 you normally don't have to add a custom entry for windows. Just emerge os-prober package and it should find just fine your windows installation during grub2-mkconfig. _________________ Arkhelion |
|
| Back to top |
|
 |
gentian Tux's lil' helper

Joined: 26 Mar 2012 Posts: 113
|
Posted: Wed Apr 04, 2012 11:44 am Post subject: |
|
|
| Arkhelion wrote: | | In grub2 you normally don't have to add a custom entry for windows. Just emerge os-prober package and it should find just fine your windows installation during grub2-mkconfig. |
That's what I did, but os-prober won't find my win partition :/ Do I need to just run grub2-mkconfig after emerging os-prober?
The entry shows up fine on my Debian box though.
| Code: | ### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set e07c5c228c0bf0d0
chainloader +1
} |
|
|
| Back to top |
|
 |
Arkhelion Tux's lil' helper

Joined: 07 Sep 2010 Posts: 127 Location: France
|
Posted: Wed Apr 04, 2012 12:05 pm Post subject: |
|
|
At least that worked on my wife's box, emerge os-prober, then grub2-mkconfig and it found the windows 7 install _________________ Arkhelion |
|
| Back to top |
|
 |
gentian Tux's lil' helper

Joined: 26 Mar 2012 Posts: 113
|
Posted: Wed Apr 04, 2012 12:13 pm Post subject: |
|
|
| Arkhelion wrote: | | At least that worked on my wife's box, emerge os-prober, then grub2-mkconfig and it found the windows 7 install |
:/ |
|
| Back to top |
|
 |
Arkhelion Tux's lil' helper

Joined: 07 Sep 2010 Posts: 127 Location: France
|
Posted: Wed Apr 04, 2012 12:40 pm Post subject: |
|
|
If you try to boot from your windows disk, does it boot (I mean directly, not by grub)?
The underlying question is: Can Grub not finding your windows install be due to the lack of boot sector on that disk? _________________ Arkhelion |
|
| Back to top |
|
 |
gentian Tux's lil' helper

Joined: 26 Mar 2012 Posts: 113
|
Posted: Wed Apr 04, 2012 12:58 pm Post subject: |
|
|
| Arkhelion wrote: | If you try to boot from your windows disk, does it boot (I mean directly, not by grub)?
The underlying question is: Can Grub not finding your windows install be due to the lack of boot sector on that disk? |
I can't boot from my win disk. All my Operating Systems are on the same disk and grub is installed on MBR. |
|
| Back to top |
|
 |
Arkhelion Tux's lil' helper

Joined: 07 Sep 2010 Posts: 127 Location: France
|
Posted: Wed Apr 04, 2012 2:43 pm Post subject: |
|
|
Hm... that could be the problem. I'm not sure winboot can boot without being on the MBR. Maybe someone else can tell.
EDIT : I can find on google users explaining how to multiboot from winboot using EasyBCD, and installing Grub on a partition (and not on the MBR). I didn't find any solution involving winboot anywhere but the MBR. _________________ Arkhelion |
|
| Back to top |
|
 |
|