Bug 2094260

Summary: RHEL 9 kernel panic on Packer launched qemu-kvm
Product: Red Hat Enterprise Linux 9 Reporter: Marko Myllynen <myllynen>
Component: kernelAssignee: Virtualization Maintenance <virt-maint>
kernel sub component: KVM QA Contact: liunana <nanliu>
Status: CLOSED NOTABUG Docs Contact:
Severity: unspecified    
Priority: unspecified CC: berrange, chayang, coli, darcari, dgilbert, imammedo, jinzhao, juzhang, nilal, prarit, virt-maint, vkuznets
Version: 9.0   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-06-27 09:49:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
installer kernel panic none

Description Marko Myllynen 2022-06-07 09:57:22 UTC
Created attachment 1887429 [details]
installer kernel panic

Description of problem:
When trying to create a RHEL 9 VM with Packer + Qemu builder running on RHEL 7.9, the installer fails due to kernel panic. See the attached screenshot for the output. The relevant part of qemu-kvm command line is:

/usr/libexec/qemu-kvm -m 4096M ... -machine type=pc,accel=kvm -smp cpus=2,sockets=2

If configuring Packer to add "-cpu host" to qemu-kvm command line then the installer starts normally. Another user reported the same issue elsewhere and fixed this slightly differently: https://discuss.hashicorp.com/t/packer-qemu-kvm-redhat-9-kernel-panic/39886.

I'm not sure what's the root cause for this so I'm filing the issue for both Red Hat and Packer, hopefully either or both sides can be tweaked to fix this issue. Thanks.

Version-Release number of selected component (if applicable):
RHEL 9.0 / Packer 1.8.1

Comment 1 Marko Myllynen 2022-06-07 09:58:56 UTC
This is the corresponding issue at Packer GitHub:

https://github.com/hashicorp/packer/issues/11839

Comment 8 Nitesh Narayan Lal 2022-06-16 15:59:34 UTC
Summarizing the above private discussion:

The reported kernel panic is a result of using the default CPU model with qemu which is 'qemu64' which is deprecated.

From Daniel's private comment above:
Direct invocation of qemu-kvm is not supported in RHEL. We expect the user to launch the VM via libvirt, usually recommended with an mgmt tool which should only enable/use the supported option.
For more details please refer to:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/configuring_and_managing_virtualization/introducing-virtualization-in-rhel_configuring-and-managing-virtualization

[quote]
While QEMU is an essential component of the architecture, it is not intended to be used directly on RHEL 9 systems, due to security concerns. Therefore, using qemu-* commands is not supported by Red Hat, and it is highly recommended to interact with QEMU using libvirt. 
[/quote]


We do have Bug#2060839 to deprecate CPU models like "kvm64" / "qemu64" on 9.1 from RHEL.

Hence, I think we can close the bug as "NOTABUG" or as DUP of Bug#2060839.

Any thoughts/concerns?
Also, adding Igor to see if he has any additional thoughts.

Comment 9 Marko Myllynen 2022-06-21 17:32:00 UTC
Thanks for looking into this.

The above statement sounds good however in case if it's not possible to use libvirt (in all situations or in the short-term), would we have a suggestion how to invoke qemu-kvm to avoid kernel panic? I suspect using libvirt instead of qemu-kvm might require longer discussion and larger effort with Packer so I wonder do we have a temporary solution to allow Packer to build RHEL 9 images while they consider using libvirt?

In any case, once we close this BZ I'll pass the info to the Packer/Qemu upstream ticket mentioned above.

Thanks.

Comment 10 Dr. David Alan Gilbert 2022-06-21 17:41:30 UTC
(In reply to Marko Myllynen from comment #9)
> Thanks for looking into this.
> 
> The above statement sounds good however in case if it's not possible to use
> libvirt (in all situations or in the short-term), would we have a suggestion
> how to invoke qemu-kvm to avoid kernel panic? I suspect using libvirt
> instead of qemu-kvm might require longer discussion and larger effort with
> Packer so I wonder do we have a temporary solution to allow Packer to build
> RHEL 9 images while they consider using libvirt?
> 
> In any case, once we close this BZ I'll pass the info to the Packer/Qemu
> upstream ticket mentioned above.
> 
> Thanks.

As you said in the initial comment, -cpu host  works; that should generally be fine
unless they plan live migration in a hetoregenous environment.

Comment 11 Marko Myllynen 2022-06-21 18:03:53 UTC
(In reply to Dr. David Alan Gilbert from comment #10)
> 
> As you said in the initial comment, -cpu host  works; that should generally
> be fine unless they plan live migration in a hetoregenous environment.

Thanks for confirming. Packer definitely does not migrate anything, it's just an image building tool.

Comment 15 Nitesh Narayan Lal 2022-06-24 12:59:59 UTC
Thanks, Daniel. 
Marko, are we good in closing this BZ now? If so, can you please in closing it?

Thanks

Comment 16 Marko Myllynen 2022-06-27 09:49:04 UTC
Thanks all, based on the above comments and the earlier BZ#2060839 I'm closing this as NOTABUG. I'll also provide a summary to the Packer upstream issue about this.