Kernel Panic after Yum Update – CentOS with Hyper-V Linux Integration Components

I am runnning CentOS 5.5 in a VM on Hyper-V. I created a fresh installation. I then installed Hyper-V Linux Integration Components. After Installing them I ran yum update.

After running a “yum update”, and rebooting I received this error.

Unable to access resume device (/dev/VolGroup00/LogVol01)
mount: could not find filesystem '/dev/root'
setuproot: moving /dev failed: No such file or directory
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!

During the yum update process, it updated my kernel. Kernels that are installed after Hyper-V Linux Integration Components don’t always mesh well together. Here is how I fixed my issue.

While booting, grub will ask you to hit any key to boot into the menu.

Hit any key and you will see a list of the Linux kernels on your machine.

Mine looks like:

CentOS (2.6.19-194.26.1.el5)
CentOS (2.6.18-194.el5)

The first one(newest) is booting by default and causing the issues. I will select my old kernel for the time being so that I can boot into linux and fix the issue with the new kernel.

So I will select CentOS (2.6.18-194.el5) and boot into linux. At this point, it should boot into linux normally.

Now, virtually put in your Linux Integration Components V2.1 CD into the VM.
As root, run:

mkdir /opt/linux_ic_v21_rtm
cp -r /media/CDROM/* /opt/linux_ic_v21_rtm
cd /opt/linux_ic_v21_rtm
grep -ilR uname * | xargs sed -i 's/uname \-r/echo "2.6.19-194.26.1.el5"/g'
make && make install
reboot

Replace 2.6.19-194.26.1.el5 with the kernel that is giving you grief. If you forgot which kernel it was you can double check the /boot/grub/grub.conf file. Chances are its the one on the top.

After the reboot, it should be able to boot into the new kernel.

Resources:
crazystick at https://www.centos.org/modules/newbb/viewtopic.php?topic_id=23873

17 Responses to “Kernel Panic after Yum Update – CentOS with Hyper-V Linux Integration Components”


  • Thanks. This worked for me too.

  • another approach is to do it once.

    cut and paste that below into a file in the integration tools directory (which you have extracted on the guest). Leave this script there with the tools, and use it at all times.

    <<< script
    #!/bin/bash
    kernel_version=`rpm -q kernel | tail -n 1 | sed 's/kernel-//g'`
    makefile=Makefile.$kernel_version
    sed "s/uname -r/$kernel_version/g" $makefile
    make -f $makefile all install
    <<< end of script

    Be sure to make the script executable. Then just run it. 🙂
    Next kernel upgrade. Just run it again 😀

    • Ooops. Need to update the scripts/ too. Thus, we replace uname itself, which should solve all. Make a new file in the top of the integration tools directory called uname (and make executable) with the following:

      #!/bin/bash
      rpm -q kernel | tail -n 1 | sed ‘s/kernel-//g’

      Then, go to the integration tools directory and call make with the current directory as the first path argument:

      root# PATH=.:$PATH make all install

      Done. No modifying any of the integration tools, just trick it. Solution should work similarly with updated integration tools too. 🙂

  • Thanks for the post!

    Hugo, can you make a step by step guide please? Something to copy&paste that then i´ll can put in a script because i have a lot of VMs with Centos (and this problem).

    Thanks in advance.

  • Great stuff, had started to think it was toast. Bookmarked.

    Cheers!

  • AWESOME!! this fixed it, you have to do this every kernel upgrade. I was going crazy, thought it was ubuntu then moved to centos and it stopped. Once i upgraded centos’s kernel the panic happened again. This fixed it. THANK U!!!! SOmeone should make microsoft document this.

  • to prevent yum update from updating the kernel edit the yum.conf file (/etc/yum.conf) and add the following line.
    exclude=kernel*

  • Thanks, this worked for me as well.

    You are a lifesaver! I was really worried as this certain VM runs our OTRS helpdesk software and is really important.

    Cheers

  • Hi all,

    I have Xen HVM VM, and facing this issue after upgrading from Centos 5.5 to 5.7

    Could I do this trick to fix my VM issue?

    Kind regards,

  • I suppose since version 3.2 (now 3.4) of Integration Components, this work-around is not longer possible? They IC are now in RPM format – there is no more source. Thus there is no ability to “make” and the instructions no longer apply?

    • I haven’t had a kernel panic using the rpm package yet, however, the instructions most likely no longer apply to it. The above basically just does a reinstall for your latest kernel. If you are getting a kernel panic with the rpm version, I would start by removing and reinstalling the rpm.

      • Hi Devin – thanks. The problem only occurs AFTER a Kernel update when you attempt to boot the NEW Kernel. The problem apparently is, that the NEW Kernel needs drivers (disk/IDE?) from the IC before it can boot to the file system.

        Since it doesn’t boot, how would one uninstall the RPM there?
        Also, since the likely problem is that the NEW Kernel doesn’t HAVE the IC components in the first place – it seems as if there really is nothing to “un”-install.

        The problem is that the original/working Kernel required that the Integration Components be supplied DURIGN the initial Linux install. But whenever a new Kernel update is supplied, it of course lacks those IDE drivers.

        I guess what we’re looking for is some way to boot the new Kernel but somehow have it “load” the missing IC drivers as part of the boot process?

        • In the process above, you boot to the original/working Kernel, and then install the IC for the new Kernel. Assuming your original Kernel still works, you should be able to remove and reinstall the rpm from there. I’m not sure if reinstalling the rpm will work, but it would be a good place to start.

          • Devin – thanks for your patience with a Linux newbie!

            This all sounds good – but I’ve looked through the RPM commands/documentation/tutorials I could find – and can’t figure out how I can “install the IC for the new Kernel” while I’m booted in the old Kernel?

            Is there an RPM command option that lets me specify which Kernel I want to install the IC package into?

            The original posting in this thread was accomplishing that using an old version of the Integration Components when they still included source code and the doing a MAKE to build a new kernel. All recent versions of the IC are in RPM without source?

  • Andy, what I’m hoping is that something in the new RPM will be able to handle multiple different kernels, but I don’t know. Like I said, I haven’t had this issue yet, nor do I have a test environment to try it out. So my suggestion is to start testing with the simplest solution of removing and reinstalling the rpm in the old kernel. I’m not sure if it will work, and if it doesn’t, then try and see how to install IC for the new Kernel.

    Just FYI, it would probably be a good idea to take a snapshot of your VM before you do this type of work.

  • Just did a yum update on an older CentOS 5.7 machine running Integration Services.

    Thankfully I did a Hyper-V snapshot before updating as neither of the kernels that existed after the upgrade can get past the Kernel panic message.

    What is the best strategy for approaching this situation? The VM is snapshotted (not a word I know) every week and hasn’t been rebooted in 300 something days (it’s a PBX that has no external connections) so I know it will keep on running with this old kernel but at some point I would like to do the upgrade.

  • Bullseye!!!
    Devin, You are a legend.

    I was upgrading a RHEL 5.5 VM to RHEL 5.8 hosted in Windows Server 2008 R2 Hyper-V.
    After running yum update the VM failed to boot with the newly installed kernel and it was booting successfully with the old kernel. I was quiet sure it was something to do with Hyper-V drivers (Hyper-V Linux Integration Services) but this blog took me in the right direction and i fixed my issue with the new kernel.

Leave a Comment