Recreate initrd from rescue system

Hi all,

Due to a mess up during a kernel update (2.6.34-12 to 2.6.34.4), I uninstalled the 2.6.34-12 kernel using

rpm -e kernel-2.6.34-12

Unfortunately, since then, I can’t boot : the Opensuse entry was missing in Grub. I edited /boot/grub/menu.lst using the rescue system provided by the Opensuse 11.3 install cd.

That didn’t work since, if I have a vmlinuz-2.6.34.4-0.1-desktop file in /boot/grub/, I’m missing the corresponding initrd file (initrd-2.6.34.4-0.1-desktop). Pretty much what is discussed here :

http://forums.opensuse.org/english/news/tech-news/446068-opensuse-11-3-kernel-update-2-6-34-4-0-1-initrd-broken.html

The question is : can I recreate this file using the command mkinitrd (or by any other means) from the rescue system of the install DVD. I read somewhere that

mkinitrd -k vmlinuz-X.X.X. initrd-X.X.X.

should do the trick, but it didn’t : it stops with a message :

getopts: usage: getopts optstring name [arg]
Don't refresh the bootloader. You may have to do that manually!

Actually, this message is displayed even if I do “mkinitrd --help” :wink:

Any thoughts for me ?

Cheers !

Go to Installation instead of rescue and follow this:
Picasa Web Albums - caf4926 - DVD Kernel Fix

Thanks !

That worked, but I’m still unable to perform this bloody kernel update :

linux:~ # zypper ref
Repository 'openSUSE-11.3-Non-Oss' is up to date.
Repository 'openSUSE-11.3-Oss' is up to date.
Repository 'openSUSE-11.3-Update' is up to date.
All repositories have been refreshed.
linux:~ # zypper up
Loading repository data...
Reading installed packages...

The following packages are going to be upgraded:
  kernel-desktop preload-kmp-desktop 

2 packages to upgrade.
Overall download size: 32.3 MiB. After the operation, additional 132.0 KiB will be used.
Continue? [y/n/?] (y): y
Retrieving package kernel-desktop-2.6.34.4-0.1.1.x86_64 (1/2), 32.3 MiB (129.3 MiB unpacked)
Retrieving delta: ./rpm/x86_64/kernel-desktop-2.6.34_2.6.34.4-12.3_0.1.1.x86_64.delta.rpm, 10.1 MiB
Retrieving: kernel-desktop-2.6.34_2.6.34.4-12.3_0.1.1.x86_64.delta.rpm [done (1.8 MiB/s)]
Applying delta: ./kernel-desktop-2.6.34_2.6.34.4-12.3_0.1.1.x86_64.delta.rpm [done]
Installing: kernel-desktop-2.6.34.4-0.1.1 [97%]


It’s been stuck here for 15 min now …

I forced the use of the DVD as source
Are you still stuck. It can take a little while sometimes.

On 2010-09-12 12:06, AKoine wrote:

> Retrieving: kernel-desktop-2.6.34_2.6.34.4-12.3_0.1.1.x86_64.delta.rpm [done (1.8 MiB/s)]
> Applying delta: ./kernel-desktop-2.6.34_2.6.34.4-12.3_0.1.1.x86_64.delta.rpm [done]
> Installing: kernel-desktop-2.6.34.4-0.1.1 [97%]

>
> It’s been stuck here for 15 min now …

You could try installing the failing package using “rpm -v --install whatever”, to see where exactly
it is stuck.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Minas Tirith))

Yeah, this is still a problem even over many releases and years.

To fix the missing initrd in /boot, if it is missing and vmlinuz is present, you can use the rescue system and mkinitrd:

mkdir /mnt/sdaX
mount /dev/sdaX /mnt/sdaX
chroot /mnt/sdaX
mount /dev
mount /proc
mount /sys
mkinitrd

…where sdaX is your root partition. You may also need to fix the symbolic links vmlinuz and initrd in /boot, and or make changes to your menu.lst file.

I’ve used this several times to recover after a botched kernel update. The safe way to handle kernel updates, until a regular fix is implemented, is to suspend composting and then rerun the kernel update. ‘hwinfo --framebuffer’ is unstable on my hardware when compositing is enable, and this is used by mkinitrd during the update process.

On 2011-05-14 23:36, mhdominguez wrote:
>
> Yeah, this is still a problem even over many releases and years.

Notice that you are replying to a post over half a year old - and dead :slight_smile:

> Code:
> --------------------
> mkdir /mnt/sdaX
> mount /dev/sdaX /mnt/sdaX
> chroot /mnt/sdaX
> mount /dev
> mount /proc
> mount /sys
> mkinitrd
> --------------------

Hum, no.

Code:

mount --bind /dev /mnt/sdaX/dev

etc.

Otherwise, the idea is a good one.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

ha! The thread might be dead, but the problem is still VERY alive…at least, it occurred in my last automatic kernel update (2.6.34.8-0.2) a week ago.

Indeed…5 openSUSE12.1 machines updated last week, one failed to boot. Symptom was that grub started up to the prompt but didn’t offer anything to boot.
Updating grub didn’t work. Booting from CD revealed that initrd-<version> was missing and there was a dead initrd link, plus a useless menu.lst (all entries deleted). Since the above commands are apparently also not in the right order, here’s what worked for me. On this system the root file system is /dev/sda2, thus I keep it included for clarity:


cd /mnt 

mkdir sda2 

mount /dev/sda2 sda2 

mount --bind /dev /mnt/sda2/dev 

mount --bind /proc /mnt/sda2/proc 

mount --bind /sys /mnt/sda2/sys 

chroot /mnt/sda2 

mkinitrd 

ln -s initrd-3.1.10-1.16-desktop initrd

cd /boot/grub  

-> edit menu.lst 



In my case there was a “good” backup copy menu.lst.old. I copied
this to menu.lst and edited the kernel and initrd numbers to the new ones (I wonder if the better approach would be to refer to the links?).
For completeness, if grub is messed up (shouldn’t be in this case), a method to
get it back to work from the grub command line (assuming sda2 being the root partition):


find /boot/grub/stage1  -> found (hd0,1) -> means sda2 

root (hd0,1) 

setup (hd0)         -> either install in MBR 

setup (hd0,1)       -> or in sda2 reboot


 

Hope it helps someone…

I had a somewhat similar problem a year ago. I describe how I dealt with it here: Rescuing Susie