Reputation: 1185
I installed Ubuntu18.04
desktop in a kvm-qemu virtualization setup and it is working. I found that there is a direct kernel boot option in virt-manager settings for a virtual machine. I want to debug the kernel using gdb from the host.
Please help in finding the kernel
path and initrd.img
file path.
Is kernel path same as arch/x86/boot/bzImage
?. Is it possible to copy the initrd.img
file inside the guest (/boot/ directory
) to the host machine?
Thanks!
Upvotes: 5
Views: 7942
Reputation: 982
Despite a comment above, using the Direct Boot option is one of the only ways to get an Ubuntu cloud image to run on virt-manager: https://askubuntu.com/questions/1375589/what-are-the-different-versions-available-as-ubuntu-cloud-images
So, there is no way to point those fields to the internal kernel files. But you can use them like they would be normally in any machine by configuring the Virt-manager bios to recognize them. I'm trying to troubleshoot that currently. Basically, it goes Bios>MBR/GPT(bootloader not easily accessible files except using tools like fdisk, cdisk, parted)>Grub. The boot partition, whichever has /boot/grub on it, has to be flagged as 'boot'. Gparted is one way to see that flag, cfdisk also.
You can point those fields to your own kernel files, they are usually roughly compatible. Then use root=/dev/sda(X)
adjust to your own root path. Get in and use tools like update-grub
or efiboot
to configure the image.
EDIT: I finally found the way to make the internal kernel files work for booting the VM in virt-manager. Basically, either install the non-kvm, generic kernel version using apt install linux-image-$(uname -r)
and change kvm to generic (~90Mb), or use the kvm kernel and ssh into the VM using systemctl enable [email protected] && systemctl start [email protected]
, then virtsh console <vm-name>
.
https://askubuntu.com/questions/576437/virsh-ssh-into-a-guest-vm
Upvotes: 2
Reputation: 91
Please help in finding the kernel path and initrd.img file path.
To find currently running kernel you can do this: cat /proc/cmdline
.
It contains "Kernel command line parameters" and you should find there path to the currently running kernel file. More info: https://manpages.debian.org/jessie/systemd/kernel-command-line.7.en.html
There should be no problem with copying files from guest to host machine, unless I misunderstood your question. There are few ways, you could copy it over ssh, or you could share some directory between host and guest or check this out: https://askubuntu.com/questions/858649/how-can-i-copypaste-from-the-host-to-a-kvm-guest not sure what are your requirements here?
Upvotes: 2