AppVM HVM won’t boot with VM kernel

I’m trying to create an HVM AppVM that uses its own kernel. I’m using the fedora-37 template.

The VM fails to boot when I do this (it’s fine when using the Qubes provided kernel).

I think the issue is that I need to run grub-install on the guest, so that it can boot in BIOS mode with its own kernel.

However, my understanding is that changes like grub-install won’t persist across VM restarts.

I considered making my own template that has the grub-install change, but then I would lose the easy upgrades I get from using standard templates.

What can I do?

Did you try it like this?

Both debian-9 and fedora-26 templates already have grub and related tools preinstalled so if you want to use one of the distribution kernels, all you need to do is clone either template to a new one, then:

qvm-prefs <clonetemplatename> virt_mode hvm
qvm-prefs <clonetemplatename> kernel ''

If you clone your template and set its virt_mode/kernel to use in VM kernel then you won’t lose the ability to upgrade it. You’ll still be able to upgrade this cloned template in the same way as your other templates.

Have you tried this? Maybe it works for those old template versions, but I can’t get it to work with debian-12 or fedora-37. Still stuck :-/

I’ve just tried it with debian-12 template and in works for me on Qubes OS 4.2.
Clone debian-12 template to debian-12-in-vm-kernel.
Change debian-12-in-vm-kernel kernel to (provided by qube) (none for Qubes OS 4.1) and virtualization mode to HVM.
Create AppVM based on this template.
Start AppVM and it works.

I followed these directions exactly but the VM fails to start. The VM console shows it stuck at initramfs. Could you confirm that your AppVM is using its own kernel, and it can run a terminal?

Yes, I can run the terminal and it has its own kernel:

user@tstvm:~$ uname -r
6.1.0-13-amd64

How much initial memory do you have in your AppVM?
You can also upload the VM log, maybe there will be some clues.

Did you disable “Include in memory balancing”?

I reinstalled the template and your directions worked. I don’t know why that is the case. Thank you for your help!