Issue with System Shutdown on NixOS: "kvm: Exiting hardware virtualization"

Hello everyone,

I recently installed NixOS on my Asus ROG Strix G513QM laptop, transitioning from a dual-boot setup to a single-boot configuration with NixOS. However, I’ve encountered a persistent issue during system shutdown where the process halts with the message: “kvm: Exiting hardware virtualization.”

Expected Outcome:

The laptop should shutdown when performing a shutdown from the OS.

Actual Outcome:

During shutdown, the process does not complete and stops at the message: “kvm: Exiting hardware virtualization.” Currently, the only workaround that partially addresses the issue is using the nomodeset kernel parameter, which isn’t ideal.

Steps Tried:

  1. Installed Nvidia drivers through the NixOS hardware configurations using the predefined Asus settings (<nixos-hardware/asus/rog-strix/g513im>).

  2. Attempted various configurations and tweaks suggested in forums and documentation, with no change in the shutdown behavior.

System Information (neofetch):

  • OS: NixOS 23.11.6418.e402c3eb6d88 (Tapir) x86_64

  • Kernel Version: 6.1.86

  • CPU: AMD Ryzen 7 5800H with Radeon Graphics (16) @ 3.200GHz

  • GPU 1: AMD ATI Radeon Vega Series / Radeon Vega Mobile Series

  • GPU 2: NVIDIA GeForce RTX 3060 Mobile / Max-Q

I am new to NixOS, so detailed guidance on how to diagnose and possibly fix this issue would be highly appreciated. If more information is needed, I am ready to provide it.

Thank you in advance for your assistance!

This is a kernel issue which IIRC arrived after 5.15 and has popped up on all sorts of distros. This is the closest I have seen to a fix, but I have yet to test it out myself: [SOLVED] - shutdown hangs on 'kvm: exiting hardware virtualization' | Proxmox Support Forum

Hello,

Thank you for taking the time to respond and share this solution. I had come across it before and attempted to implement it on my system, which is running systemd-boot. I even explored how to switch to GRUB on NixOS, but didn’t see any positive changes, so I decided not to proceed further at that time. However, I’m encouraged by your suggestion, and I plan to give it another try tonight. I’ll update the thread with any new findings. Thanks again for your help!

1 Like