[SOLVED] lost boot partition: how to reinstall?

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

[SOLVED] lost boot partition: how to reinstall?

Postby magfan » Jul 25th, '12, 15:39

I just lost my boot partition and I was unable to repair it. How can I reinstall everything which belongs in in /boot from within the Mageia-rescue system? I know I need grub and at least one kernel image but I do not know how to install them...
Last edited by magfan on Jul 27th, '12, 09:36, edited 1 time in total.
magfan
 
Posts: 334
Joined: Apr 3rd, '12, 12:33

Re: lost boot partition: how to reinstall?

Postby gohlip » Jul 26th, '12, 04:23

Why do we live? To prove not everything in nature has a purpose.
gohlip
 
Posts: 573
Joined: Jul 9th, '12, 10:50

Re: lost boot partition: how to reinstall?

Postby magfan » Jul 26th, '12, 13:58

OK, installing grub works. But still I miss the kernel images to boot. How can I force to reinstall them?
magfan
 
Posts: 334
Joined: Apr 3rd, '12, 12:33

Re: lost boot partition: how to reinstall?

Postby gohlip » Jul 26th, '12, 16:01

Right, I am not too clear about grub is now installed but kernel image not there to boot.
If you can boot into Mageia, but new kernel is not there, just go to Mageia Control center and install new kernel and don't forget to go to "boot --> set up boot" after that.

If you mean grub is there (only grub prompt "grub>"), with no menu at all, try typing this and press enter after each line.
grub> kernel (hd0,x)/boot/vmlinuz BOOT_IMAGE=linux root=/dev/sdax nokmsboot ro vga=788
grub> initrd (hd0,x)/boot/initrd.img
grub> boot

where (hd0,x) and /dev/sdax is Mageia partition - (careful that (hd0,x) is /dev/sda(x+1)) ie, if Mageia is in sda3,, you use (hd0,2) and /dev/sda3 in the kernel line.

And if somehow it doesn't boot - most likely due to initramfs failure when installing kernel, type in this
grub> kernel (hd0,x)/boot/vmlinuz-3.3.6-desktop-2.mga2 BOOT_IMAGE=linux root=/dev/sdax nokmsboot ro vga=788
grub> initrd (hd0,x)/boot/initrd-3.3.6-desktop-2.mga2.img
grub> boot


Again, don't forget to make sure kernel is reinstalled at Mageia Control Center and go to "boot --> set up boot" after that.
Why do we live? To prove not everything in nature has a purpose.
gohlip
 
Posts: 573
Joined: Jul 9th, '12, 10:50

Re: lost boot partition: how to reinstall?

Postby doktor5000 » Jul 26th, '12, 17:42

gohlip wrote:Right, I am not too clear about grub is now installed but kernel image not there to boot.
If you can boot into Mageia, but new kernel is not there, just go to Mageia Control center and install new kernel and don't forget to go to "boot --> set up boot" after that.

If i understood correctly, /boot was wiped, in that case there's no kernel to boot and mcc is not available.

@magfan: You need to know which kernel packages were installed, e.g.
Code: Select all
rpm -qa | grep kernel
and then just reinstall them via
Code: Select all
urpmi --replacepkgs kernel_packages_to_install

Should even be possible to do just that directly via substitution:
Code: Select all
urpmi --replacepkgs $(rpm -qa | grep kernel)
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18058
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: lost boot partition: how to reinstall?

Postby gohlip » Jul 26th, '12, 19:06

doktor5000 wrote:If i understood correctly, /boot was wiped, in that case there's no kernel to boot and mcc is not available.


@doktor5000, Good to point out this might be the case. But if so, wouldn't he has to chroot from a livecd to get back any kernel?
@magfan, sorry for this digression.
Why do we live? To prove not everything in nature has a purpose.
gohlip
 
Posts: 573
Joined: Jul 9th, '12, 10:50

Re: lost boot partition: how to reinstall?

Postby magfan » Jul 26th, '12, 21:28

doktor5000 wrote:
gohlip wrote:Right, I am not too clear about grub is now installed but kernel image not there to boot.
If you can boot into Mageia, but new kernel is not there, just go to Mageia Control center and install new kernel and don't forget to go to "boot --> set up boot" after that.

If i understood correctly, /boot was wiped, in that case there's no kernel to boot and mcc is not available.

@magfan: You need to know which kernel packages were installed, e.g.
Code: Select all
rpm -qa | grep kernel
and then just reinstall them via
Code: Select all
urpmi --replacepkgs kernel_packages_to_install

Should even be possible to do just that directly via substitution:
Code: Select all
urpmi --replacepkgs $(rpm -qa | grep kernel)


Yes, /boot was completely wiped. From where do I have to call
Code: Select all
urpmi --replacepkgs
? If I use Mageia-Rescue-System and do a chroot the required kernel packages are not found.

And there is still something strange with the kernel packages. According to
Code: Select all
rpm -qa
I have only
Code: Select all
kernel-*-server-*
installed. But when I call
Code: Select all
dracut -f -d st
it creates an
Code: Select all
initrd-*-desktop-*
. Can I simply rename it? The module st (for tapes) is not loaded automatically. So I will have to use dracut.
magfan
 
Posts: 334
Joined: Apr 3rd, '12, 12:33

Re: lost boot partition: how to reinstall?

Postby doktor5000 » Jul 26th, '12, 23:34

magfan wrote:Yes, /boot was completely wiped. From where do I have to call
Code: Select all
urpmi --replacepkgs
? If I use Mageia-Rescue-System and do a chroot the required kernel packages are not found.

Yes, inside the chroot of your broken installation. And you need to setup networking there to install other packages ...
(At first i thought the broken installation was still running, and you want to switch to rescue mode by rebooting, so maybe i misunderstood a bit there)

And what do you mean, the required kernel packages are not found - you mean urpmi doesn't find them? Sure, because the chroot doesn't have repositories set up.
Let's just clear up the first part, then we can look at your dracut issue.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18058
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: lost boot partition: how to reinstall?

Postby Ken-Bergen » Jul 27th, '12, 00:29

magfan wrote:
And there is still something strange with the kernel packages. According to
Code: Select all
rpm -qa
I have only
Code: Select all
kernel-*-server-*
installed. But when I call
Code: Select all
dracut -f -d st
it creates an
Code: Select all
initrd-*-desktop-*
. Can I simply rename it? The module st (for tapes) is not loaded automatically. So I will have to use dracut.
Thoughts.
Even though rpm reports kernel-server-XXX as installed it's not really there after wiping /boot.

Code: Select all
dracut
as you used it would build and install the currently running kernel.

Can you now boot into the system with the new initrd?
Ken
Ken-Bergen
 
Posts: 1019
Joined: Mar 30th, '11, 02:45
Location: Chilliwack, BC, Canada

Re: lost boot partition: how to reinstall?

Postby magfan » Jul 27th, '12, 09:36

Well there were several additional problems:

1. a certain driver (r8169) was not loaded in rescue mode and I was unable to load it manually
2. mcc in console mode does not let me specify a proxy; so even with a working network card setting up an online repository would fail


Finally I came up with a "brute force" solution:

1. resizing existing partitions with gparted on Knoppix to gain space for a new partition
2. installing Mageia 2 from DVD with the wiped /boot partition mounted as /boot, the rest in "/".
3. reboot once to see whether everything works (it did!)
4. reboot into Mageia-rescue-system to edit menu.lst to use the old root partition ("/") and reinstall boot loader
5. booting into my old Mageia installation


One good thing is that now I have a spare partition which I may use later for a fresh install of Mageia 3 in case the online upgrade fails. Some people may remember that I had several issues with upgrading from mga1 to mga2...
magfan
 
Posts: 334
Joined: Apr 3rd, '12, 12:33


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest