![]() |
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/sda1Code:
VFS: Cannot open root device "sda1" or unknown-block(0,0): error -6Code:
qemu: error reading initrd /home/arun/kernel/linux/arch/x86_64/boot/bzImage/initramfsThanks! |
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. |
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. |
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? |
Quote:
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. |
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. |
| All times are GMT -5. The time now is 04:24 AM. |