LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 06-26-2012, 01:28 AM   #1
chekhov_neo
LQ Newbie
 
Registered: May 2010
Location: Bangalore
Distribution: Ubuntu
Posts: 22

Rep: Reputation: 2
how do I create an initramfs for a Debian guest running in kvm


Hello there!

I am new to kvm, qemu and kernel hacking. I tried to set up a Debian guest running inside a kvm. I was able to install it and it booted up successfully. Now I have the latest kernel source from kernel.org. I compile it and try to load this kernel in the Debian box like this:

Code:
kvm -smp 2 -m 512 -kernel /home/arun/kernel/linux/arch/x86_64/boot/bzImage -append "root=/dev/sda1
However it results in a kernel panic with the following error:

Code:
VFS: Cannot open root device "sda1" or unknown-block(0,0): error -6
After some googling I understand that I have to give the initramfs via -initrd switch of kvm command. So I created the initramfs using the mkinitramfs tool. But qemu does not load it:

Code:
qemu: error reading initrd /home/arun/kernel/linux/arch/x86_64/boot/bzImage/initramfs
How to properly create the initramfs for the Debian host?

Thanks!
 
Old 06-27-2012, 04:52 AM   #2
honeybadger
Member
 
Registered: Aug 2007
Location: India
Distribution: Slackware (mainly) and then a lot of others...
Posts: 855

Rep: Reputation: Disabled
Me had a filed day with this. It is about the newer kernels changing the partition names so when it 'was' hdb1 in my case it turned into sda1. I think you are looking at a simillar issue.
Hope this helps.
 
Old 06-28-2012, 05:52 PM   #3
chekhov_neo
LQ Newbie
 
Registered: May 2010
Location: Bangalore
Distribution: Ubuntu
Posts: 22

Original Poster
Rep: Reputation: 2
hello honeybadger, thank you for responding. I tried with various combinations: /dev/sda, /dev/sda1, (hd0,msdos1).
None of them worked. The last one was the one present the grub configuration corresponding to the stock kernel.
 
Old 06-29-2012, 11:52 AM   #4
honeybadger
Member
 
Registered: Aug 2007
Location: India
Distribution: Slackware (mainly) and then a lot of others...
Posts: 855

Rep: Reputation: Disabled
Can you tell what the kernel version number was when it was orignally installed and what is the version number that you are installing now (latest eaning 3.4.x something).
If you are using debain 5 then this kernel could possibly be the newer ones and thus causing confusion of the device names.
Do you have a live cd/dvd that can help us here to understand what exactly is going on here.
How did you make the kernel? Was it 'make oldconfig' or did you manually configure the kernel?
 
Old 07-02-2012, 06:17 PM   #5
chekhov_neo
LQ Newbie
 
Registered: May 2010
Location: Bangalore
Distribution: Ubuntu
Posts: 22

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by honeybadger View Post
Can you tell what the kernel version number was when it was orignally installed and what is the version number that you are installing now (latest eaning 3.4.x something).
If you are using debain 5 then this kernel could possibly be the newer ones and thus causing confusion of the device names.
Do you have a live cd/dvd that can help us here to understand what exactly is going on here.
How did you make the kernel? Was it 'make oldconfig' or did you manually configure the kernel?
The stock kernel version is 2.6.32 and I'm trying to install 3.4.4.
I installed the stock OS from a Debian 6 iso.
I used a custom minimal config that results in a small bzimage size.

I'm guessing the problem is in recognizing the root file system. I tried to use the initramfs of the host system. This time, I didn't face the error as before but the boot failed saying "could not load module /lib/mod/linux-3.4.4/module.dep". Then I copied the corresponding module files to /lib/mod/ from the host to the VM. It still gave the above error.

This is why I doubt that it is not recognizing the file system correctly.
 
Old 07-03-2012, 03:01 AM   #6
honeybadger
Member
 
Registered: Aug 2007
Location: India
Distribution: Slackware (mainly) and then a lot of others...
Posts: 855

Rep: Reputation: Disabled
All of what you did seems correct. But then a file system recognised by 2.4.x kernels and not by the 3.4.x kernel is something that would kill linus . I belive that you should have two kernels (the old one would be vmlinx.old I believe for debian) try booting using that kernel. Just link it to vmlinuz.
When I installed slackware 13.0 by mbr was hdb and my root was hdb1. I installed the 2.4.47 (that was the last of the 2.4.x series) and I could not boot I had the same issues like you. You would also find that post on this forum , When I booted up with a live (and newer) distro I found out that the boot sector was now sda and the root was at sda1. I made the changes to grub and well everything just worked fine.
Hope this helps.
 
  


Reply

Tags
initramfs, kernel panic, kvm, qemu



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
QEMU running on Ubuntu vmware guest cannot find /dev/kvm jerrywrice_fabnexus Linux - Virtualization and Cloud 3 03-25-2012 03:16 AM
LXer: Set up Spicevmc Channel on Ubuntu 11.04 as KVM Server and spice-vdagent as a KVM guest LXer Syndicated Linux News 0 06-15-2011 07:10 PM
KVM with Ubuntu guest - guest crashes when some apps are 'full screened' TonyRogers Linux - Virtualization and Cloud 0 05-15-2011 12:18 PM
Has anyone attempted running OS/2 guest under KVM (or other host)? kaza Linux - Virtualization and Cloud 3 05-16-2010 02:53 PM
KVM: Mouse under Windows Guest performs way better than under Centos Guest martdj Linux - Virtualization and Cloud 3 03-29-2010 04:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 02:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration