1

I have Windows 11 KVM(libvirt) guest. It can be shutdown by virsh shutdown if it is login, otherwise cannot.

"Allow system to be shut down without having to log on" is enabled. That is actually the default.

enter image description here

Anyone has clue?

Update:

If I start the VM, without login, virsh shutdown works.

However, if I RDP into the box, sign out, then virsh shutdown does not work anymore.

John Siu
  • 3,787
  • 2
  • 19
  • 24

1 Answers1

2

That's because after logging out via RDP, the session is remaining active or holding resources that prevent virsh shutdown from working properly. This is common in virtual environments with remote sessions.

Fix: Configure Windows to end disconnected RDP sessions immediately.

  • Go to Local Group Policy Editor (gpedit.msc).
  • Navigate to: Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Session Time Limits.
  • Enable Set time limit for disconnected sessions and set it to 0 minutes.

This forces the session to end, allowing virsh shutdown to work as expected.

ELSE

If the previous fails, you can try by disabling "Sign-in info is used to automatically finish setting up after an update" in Settings > Accounts > Sign-in options. This setting can prevent the shutdown command from working as expected post-logout.

Max Haase
  • 1,123