Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Enabling KVM for AMD leads to boot hang
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
MadWhiteCat
n00b
n00b


Joined: 09 Mar 2025
Posts: 8

PostPosted: Sun Mar 09, 2025 8:52 pm    Post subject: Enabling KVM for AMD leads to boot hang Reply with quote

Hello everyone,

I've been following Gentoo QEMU setup instructions.
I enabled "Virtualization -> KVM for AMD processors support" kernel option (I have Ryzen 7 9800X3D), as well as virtualization support (SVM Mode) in BIOS.
After building kernel and rebooting, the system hangs indefinitely at either "Setting system clock using the hardware clock" or "Activating swap devices" - seemingly random on each reboot.

What made no difference:
- Setting "KVM for AMD processors support" as built-in or module
- Enabling other kernel options suggested in the QEMU guide (Intel module and "Useful kernel configuration options")

I also checked that I have IOMMU enabled in BIOS and valid IOMMU groups according to this Arch Wiki guide.

Tried seeing if anything useful appears in /var/log/rc.log (I enabled logging in /etc/rc.conf), but it seems that writing starts after these failure points. The log file wasn't updated on unsuccessful boots - I checked its contents from my Windows installation after a failed Gentoo boot.

What can I do to debug this further? Has anyone seen a similar problem before?


Last edited by MadWhiteCat on Mon Mar 10, 2025 2:55 pm; edited 2 times in total
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6241
Location: Dallas area

PostPosted: Sun Mar 09, 2025 9:06 pm    Post subject: Reply with quote

Did you set IOMMU_DEFAULT_PASSTHROUGH
_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
MadWhiteCat
n00b
n00b


Joined: 09 Mar 2025
Posts: 8

PostPosted: Sun Mar 09, 2025 9:39 pm    Post subject: Reply with quote

Tried this now, rebuilt kernel - still got stuck at "Activating swap devices".
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6241
Location: Dallas area

PostPosted: Sun Mar 09, 2025 9:48 pm    Post subject: Reply with quote

sounds like not all of the kvm stuff is set or set right.

Best to have kvm as a separate module, but kvm_amd needs to also be set the same way (both modules or both built in)

wgetpaste your .config file and maybe something will show there.
_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
MadWhiteCat
n00b
n00b


Joined: 09 Mar 2025
Posts: 8

PostPosted: Sun Mar 09, 2025 10:39 pm    Post subject: Reply with quote

Tried building everything as module, no difference.
Here's my .config - https://0x0.st/8SsR.txt
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5482
Location: Bavaria

PostPosted: Mon Mar 10, 2025 11:28 am    Post subject: Reply with quote

MadWhiteCat,

first of all: Welcome to Gentoo Forums! :D

You miss two very important settings - please enable both:
Code:
# CONFIG_X86_AMD_PLATFORM_DEVICE is not set
# CONFIG_IRQ_REMAP is not set

These settings should not be related to your problem but I mention it, because I have seen them:
Code:
1.
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
2.
CONFIG_BLK_DEBUG_FS=y
3.
# CONFIG_LRU_GEN is not set
4.
CONFIG_EXTRA_FIRMWARE=""
5.
CONFIG_SYSFB_SIMPLEFB=y
6.
CONFIG_I2C_I801=y
# CONFIG_PINCTRL is not set

1. see: https://wiki.gentoo.org/wiki/User:Pietinger/Experimental/Manual_Configuring_Current_Kernel#Default_CPUFreq_governor
2. disable it
3. enable it for better performance (see also in linked article from above)
4. If you use an initramfs then it is okay if this is empty
5. Should not be necessary (and makes more problems than it helps; you have FB_EFI and FB_VESA enabled)
6. You have an AMD machine; so you will need another i2c-module (I801 is for Intel machines) ... but ... i2c needs PINCTRL; without it i2c will not work ... if you dont have any i2c devices (or sensors) you can disable all.
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
MadWhiteCat
n00b
n00b


Joined: 09 Mar 2025
Posts: 8

PostPosted: Mon Mar 10, 2025 1:38 pm    Post subject: Reply with quote

pietinger, thanks a lot! Enabling those two options was the solution.
I will also check out the rest of the guides you linked for improved kernel settings.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5482
Location: Bavaria

PostPosted: Mon Mar 10, 2025 2:31 pm    Post subject: Reply with quote

MadWhiteCat wrote:
pietinger, thanks a lot! [...]

You are very Welcome! :D

Have fun with Gentoo. 8)
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
MadWhiteCat
n00b
n00b


Joined: 09 Mar 2025
Posts: 8

PostPosted: Mon Mar 10, 2025 2:57 pm    Post subject: Reply with quote

Update: Sorry for the confusion, it turns out I was loading the old kernel (grub-mkconfig replaced first entry which had new kernel with old one)... The boot hang is still there when I load my latest build.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5482
Location: Bavaria

PostPosted: Mon Mar 10, 2025 3:07 pm    Post subject: Reply with quote

MadWhiteCat wrote:
[...] The boot hang is still there when I load my latest build.

Please describe exactly where it hangs (and what has already been started before) ... perhaps with a photo.
We would need also the content of /boot/grub/grub.cfg
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
MadWhiteCat
n00b
n00b


Joined: 09 Mar 2025
Posts: 8

PostPosted: Mon Mar 10, 2025 5:17 pm    Post subject: Reply with quote

Here's a photo: https://ibb.co/PsSMmtv1
And here is my grub.cfg: https://0x0.st/8Sbn.cfg
"vmlinuz-6.13.6-gentoo-working" is the backup I've been loading instead of "vmlinuz-6.13.6-gentoo", again, sorry about that.

I also tried setting rc_parallel="YES" in rc.conf and got a lot of services timed out waiting for swap:
https://ibb.co/sJyq8z9f
https://ibb.co/fY2Wkwny

Disabling swap service gets the boot stuck on the next step - "Mounting local filesystems".
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6241
Location: Dallas area

PostPosted: Mon Mar 10, 2025 6:43 pm    Post subject: Reply with quote

If I read the grub config properly you have
Code:
amd_iommu=on

which is overriding the pass-through option in the config file.
That might be part of the problem.


And have you updated the initrd when you rebuilt the kernel
Code:
/boot/amd-uc.img

_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
MadWhiteCat
n00b
n00b


Joined: 09 Mar 2025
Posts: 8

PostPosted: Mon Mar 10, 2025 7:25 pm    Post subject: Reply with quote

Removed
Code:
amd_iommu=on
from grub config, hang still occurs.
Checked the file dates,
Code:
/boot/amd-uc.img
is indeed updated along with a newly built kernel.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6241
Location: Dallas area

PostPosted: Mon Mar 10, 2025 7:41 pm    Post subject: Reply with quote

Is this a desktop or laptop, model name/number if you know what it is off hand.

And if kvm is turned off does it boot?
_________________
UM780, 6.12 zen kernel, gcc 13, openrc, wayland
Back to top
View user's profile Send private message
MadWhiteCat
n00b
n00b


Joined: 09 Mar 2025
Posts: 8

PostPosted: Mon Mar 10, 2025 8:38 pm    Post subject: Reply with quote

Desktop PC. Hardware, if relevant: AMD Ryzen 7 9800X3D, NVIDIA 2080 Ti, MSI MAG X870E TOMAHAWK WIFI Motherboard. Gentoo on SSD.

And yes, simply disabling KVM makes it boot normally without changing any other options.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum