Unable to shut down the machine after installing the KVM switcher

The host machine may fail to shut down because active KVM virtual machines or the libvirt daemon are preventing a clean shutdown; resolving this requires gracefully shutting down VMs or using forceful...

Unable to shut down the machine after installing the KVM switcher

The host machine may fail to shut down because active KVM virtual machines or the libvirt daemon are preventing a clean shutdown; resolving this requires gracefully shutting down VMs or using forceful commands if necessary.

Common Causes

When a KVM switcher is installed, the host may hang during shutdown because:

  • Active virtual machines (VMs) are still running and not receiving shutdown signals from the host .
  • The libvirt daemon (libvirtd) is stopping slowly or hanging, delaying the host shutdown .
  • Misconfigurations in VM shutdown scripts or systemd units prevent proper propagation of shutdown commands to VMs .

Recommended Solutions

1. Gracefully Shut Down VMs Before Host Shutdown

  • Use virsh shutdown <vm_name> to send a proper ACPI shutdown signal to each VM .
  • For multiple VMs, you can script the shutdown:

virsh list --state-running --name | xargs -n1 virsh shutdown

  • Wait for VMs to fully power off before shutting down the host . 2. Force Shutdown Only if Necessary
  • If a VM is unresponsive, use virsh destroy <vm_name> to forcefully stop it. This is similar to pulling the power cord and may risk filesystem corruption, so use it as a last resort .
  • Optionally, add the --graceful flag with virsh destroy to flush disk caches before powering off . 3. Check libvirt and Systemd Services
  • Ensure the libvirt daemon is running properly:

systemctl status libvirtd

  • If stopping libvirtd hangs, try shutting down all VMs first, then stop the service before host shutdown .
  • Avoid stopping libvirtd mid-session without shutting down VMs, as it may prevent restarting the service without a full reboot . 4. Automate VM Shutdown During Host Poweroff
  • Create a systemd service or shutdown script that gracefully shuts down all VMs before the host powers off .
  • Example systemd unit snippet:

Description=Shutdown all KVM VMs before host shutdownBefore=shutdown.target reboot.targetType=oneshotExecStart=/usr/local/bin/shutdown_vms.shWantedBy=multi-user.target

  • The shutdown_vms.sh script should iterate over running VMs and issue virsh shutdown commands. 5. Additional Tips
  • Ensure your VMs have the QEMU guest agent installed for better shutdown communication.
  • Backup important VM data regularly, especially if using forceful shutdowns .
  • If the host still fails to power off, check for BIOS/ACPI settings that may interfere with power management. By following these steps, you can ensure that your host machine shuts down cleanly even after installing a KVM switcher, while minimizing the risk of VM data loss or corruption.
Information
Mar 03, 2026

Two minutes boot and impossible Shutdown which always ends with: kvm

How do I know the list of linux compatible drivers installed (to try to replace them)? Important data that righty put this

Information
Dec 17, 2025

kvm virtualization

When using virt-install, you can specifiy the events by adding --events=on_reboot=restart,on_poweroff=restart,on_crash=restart to

Information
Mar 05, 2026

Windows VM''s do not shut down properly when running as KVM

Resolution Need to change Windows power setting for ''display'' to ''never'' sleep. To change the power configuration: Control Panel ->

Contact Us 4,824
Information
May 12, 2026

Start, Shutdown, Reboot, or Remove KVM

The virsh destroy command doesn''t delete or remove the KVM configuration or its disk images. It only forces the running KVM

Contact Us 5,928
Information
Mar 13, 2026

Troubleshooting Common KVM Issues Across Distributions

Kernel-based Virtual Machine (KVM) is a widely used virtualization solution in the Linux ecosystem, offering a robust

Contact Us 1,268
Information
Mar 20, 2026

Libvirt Cannot Stop Reboot Force Shutdown or Destroy Guest

I am running libvirt (KVM?) on Ubuntu and I have two guests (both ubuntu server) that I cannot access or control. That is, if I view

Contact Us 7,945
Information
Jun 09, 2026

Virsh Commands Cheatsheet for KVM Management

You need a working KVM hypervisor with libvirt installed and the libvirtd service running. If you have not set this up

Contact Us 4,187
Information
Feb 11, 2026

Anyone have KVM/libvirt/QEMU graceful shutdown of VM on host

After adding "resume=/dev/md0" to the "/etc/default/grub" GRUB_CMDLINE_LINUX_DEFAULT, and "resume" after

Contact Us 1,474
Information
Dec 03, 2025

KVM switch puts laptop to sleep

Could the KVM switch not "like" the computer and the laptop thinks it''s supposed to shut off after a few minutes or

Contact Us 1,499
Information
Nov 25, 2025

UBUNTU shutdown prevent : kvm exiting hardware virtualization

I do have this problem after automatic software update. The laptop doesn''t shutdown normally and I should shut it

Contact Us 6,681
Information
Jan 02, 2026

KVM Switches General Troubleshooting | StarTech

Use the video cable, KVM switch, video source, and video destination in another setup to see if the problem is with the components

Contact Us 2,162
Information
Apr 03, 2026

Unable to shutdown

When I see this message, indicating that there are no running guests, my machine actually does shut down. I found this thread

Contact Us 4,701
Information
Jun 12, 2026

20.8. Shutting off, Shutting down, Rebooting, and Forcing a Shutdown

You can control the behavior of how the guest virtual machine reboots by modifying the on_shutdown parameter in the guest virtual

Contact Us 2,256
Information
Jan 26, 2026

How to forcefully shutdown a guest VM using virsh command on Linux

Explains how to force a guest KVM VM to stop or shutdown using virsh command line option from host server on

Contact Us 2,043
Information
Jul 15, 2026

Cannot shutdown the host when QEMU/KVM is installed

It''s possible it is not receiving the shutdown command if you issue it from libvirt/qemu. Then try to shut down your

Contact Us 6,351
Information
Oct 09, 2025

Why Isn''t My KVM Switch Working? Let''s Troubleshoot!

Before giving away the money, you may wonder if this KVM switch would work as you like

Information
Apr 11, 2026

UBUNTU shutdown prevent : kvm exiting hardware virtualization

This isn''t normal. I thought the problem was with docker but after uninstalling it it didn''t pose a problem. I have no

Contact Us 7,831
Information
Jun 30, 2026

KVM libvirt virt-manager virtual machine crashes reliably during OS

This is the message i get when trying to shut down the virtual machine that just stopped responding during install of

Contact Us 1,988
Information
Dec 30, 2025

Start, Shutdown, Reboot, or Remove KVM

The following information describes how to shut down an active KVM instance on a local or remote host using the virsh shutdown

Contact Us 7,694
Information
Nov 08, 2025

KVM User''s Guide

It only forces the running KVM instance to shut down, similarly to pulling the power cord on a physical machine. However, in unique

Contact Us 2,981
Information
Nov 26, 2025

Why can''t I shutdown running kvm instance?

I am not using SELinux, so in /etc/libvirt/qemu nf I changed security_driver to none. Afterwards I destroyed the machine (libvirt

Contact Us 2,072
Information
Jan 04, 2026

It is normal for proxmox to be unable to send shutdown/reboot signal to vms, I always had to strait stop my VM

Contact Us 7,288
Information
Jun 30, 2026

VM from qemu/kvm doesn''t shutdown properly / Kernel

It seems as though dnsmasq doesn''t stop after the shutdown. I don''t claim to know much about dnsmasq or if there''s

Contact Us 3,437
Information
Feb 15, 2026

KVM Switch Causes Remote Reboots To Stall

My server is connected to a monitor via a KVM switch, which in this case is enabled for another machine at the time of

Contact Us 3,711
Information
Aug 16, 2025

How to I gracefully shutdown my kvm virtual machines when

At the moment I am using these scripts to gracefully shutdown my kvm virtual machines, and it works! But only as

Contact Us 4,122
Information
Jul 15, 2026

Can KVM suspend or shutdown guests automatically on host shutdown?

Instead it''s better to shut down guests by hand before doing a reboot. For a while I had a script that replaced shutdown and reboot.

Contact Us 5,683
Information
Jul 25, 2025

hi after a fresh 7.1-8 installation my proxmox isnt''t able to reboot or shutdown. it hangs on: kvm exiting hardware

Contact Us 1,038

High-Density Interconnect & AI Infrastructure Insights

Need High-Density Interconnect Solutions?

Contact us today for product inquiries, custom assemblies, or technical support