I'm running QEMU/KVM on Debian Testing x64 with this command:

kvm -m 1024 -hda win7.img -cdrom win7x86.iso -boot d -net user

But when I click inside the virtual machine, QEMU captures my mouse and won't let it go. I thought the key combination to free the mouse was Right Ctrl, but nothing happens when I press it. I also tried appending the -usbdevice tablet or -usbdevice mouse options:

kvm -m 1024 -hda win7.img -cdrom win7x86.iso -boot d -net user -usbdevice tablet


kvm -m 1024 -hda win7.img -cdrom win7x86.iso -boot d -net user -usbdevice mouse

but the situation is the same. I'm using QEMU emulator version 1.7.0 (Debian 1.7.0+dfsg-2).

7 Answers 7


Keyboard methods

  1. If using the SDL frontend of QEMU:

    You can release focus using the Left Ctrl+ Left Alt. Notice you have to use the left keys!

  2. If using the GTK frontend of QEMU (default since QEMU 1.5):

    Press Ctrl+ Alt+ G

Focus free method

See my question I posted on this exact thing on ServerFault. The Q&A is titled: Any way to release focus on a KVM guest in virt-manager without having to click Ctrl_L + Alt_L?. This will allow you to no longer have to use the keyboard to release focus between the host and the guest.

There are 2 methods discussed in answers to the question. The first involves adding another mouse, the other makes use of Spice which allows for smooth focus transitions between the host and the guest.

  • I think the method he is looking for actually is ctrl_l+alt_l. He mentions in the post he was just trying to use ctrl.
    – jordanm
    Commented Jan 3, 2014 at 4:56
  • @jordanm - thanks I thought that was obvious from my link, I added it here as well.
    – slm
    Commented Jan 3, 2014 at 5:02
  • @slm Thanks for the tip. That SF question is super helpful too!
    – Michael A
    Commented Jan 3, 2014 at 12:18
  • If you are using Spice Client, then the hotkey is Shift+F12 for releasing the mouse pointer and Shift+F11 to switch full-screen mode. Commented Jan 4, 2016 at 12:24
  • 1
    Ctrl+Alt+G works for my Debian 11.6+LXDE. It's displayed on top of the QEMU window. Commented Mar 15, 2023 at 18:54

Depending on which linux guest you have, install the qemu-guest-agent package, run systemctl enable qemu-guest-agent, stop your vm, and then according to this RH KB article, add the following to your vms xml config:

<channel type='unix'>
  <target type='virtio' name='org.qemu.guest_agent.0'/>

Then restart your vm. If you can mouse into the vm, mouse out, even copy/paste.

  • not working even with this config Commented Mar 9, 2019 at 11:57

if someone has using qemu in osx, then he needs to press control+option+g to get the mouse pointer back to the host.

  • 4
    The first answer already has this solution.
    – user232326
    Commented Aug 20, 2018 at 15:46
  • 1
    ctrl + alt + g works on MacOS. Thank you.
    – Pathros
    Commented Nov 2, 2018 at 15:39
  • 1
    The user in the question is running Debian, not macOS. Your answer therefore seems irrelevant to the question unless you can confirm that it would also solve it for Debian.
    – Kusalananda
    Commented Jan 15, 2021 at 10:30
  • Yep Mr @Kusalananda, but I use QMU on a mac and the search brought me to that question, and it has solved my problem. Like me, several other mac users came to this question the same way. but I can remove the answer, no problem. Commented Jan 15, 2021 at 21:26
  • If you're on MacOS using a USB keyboard; you'll need to go back to the built-in keyboard and hit fn + ctrl + option + g.
    – Niko
    Commented May 20, 2021 at 17:56

The suggestions did not work for me in the QEMU/KVM gui display on Ubuntu. What did work was to set the hotkeys/Grab Keys in the Virtual Machine Manager interface (preferences of the VM) before running the VM. My settings:

  • Graphical Console Scaling: Fullscreen only
  • Resize guest with window:on
  • Grap Keys: left Ctrl button + right Alt button
  • Force console shortcuts:checked

Note: to set the Grab keys... the instructions are to press "change" then select and hold your grab key combination then and only then select "ok". Clearly I should have read this the first time, as I lost control of the VM haha.

In the VM, in maximised mode

  • hold down the hotkey/grab keys and navigate with the mouse to the centre top of the vm screen. ( Navigating to the top works now ... dunno why... but all good)
  • The Virtual Machine Manager toolbar should show. Had some instances, where it was a bit slow. I also adjusted my CPU and memory allocation in the host because initially it was very laggy.

Happy hacking... "meant in old school venacular when it was just messing with stuff you didn't know"

Oh, and I am using the http://virt-manager.org/ from RedHat.

  • My KVM's Virtual Machine Mavager doesn't have a "Force console shortcuts" checkbox (my manager is 4.0.0). In my preferences "Console" tab theres this: - Graphical console scaling: Fullscreen only - Resize guest with window: On - Grab keys_ Control_L+Alt_L [Change...] - SPICE USB Redirection: Manual redirect only - Console autoconnect: checked Commented Mar 6, 2023 at 13:29

To enable automatic transition at the edges ("seamless mode") just install spice-vdagent on the guest. This needs a somewhat current Linux distribution, YMMV. on Ubuntu 18.04 with virt-manager it works like a charm.

sudo apt-get install spice-vdagent

Then, reboot guest


this is what worked for me on Mac OS X

On your Mac, exit X11/Xquartz and create an ~/.Xmodmap file containing this:

clear Mod1 keycode 66 = Alt_L keycode 69 = Alt_R add Mod1 = Alt_L add Mod1 = Alt_R

Start X11/Xquartz once more and virt-manager should release your mouse pointer if you hold the left control key and left option at the same time.

found it here https://major.io/2013/03/20/virt-manager-wont-release-the-mouse-when-using-ssh-forwarding-from-os-x/

  • 1
    The user in the question is running Debian, not macOS. Your answer therefore seems irrelevant to the question unless you can confirm that it would also solve it for Debian.
    – Kusalananda
    Commented Jan 15, 2021 at 10:29

Here, on macOS BigSur 11.1, leftcontrol-right⌘command works...

  • 1
    The user in the question is running Debian, not macOS. Your answer therefore seems irrelevant to the question unless you can confirm that it would also solve it for Debian.
    – Kusalananda
    Commented Jan 15, 2021 at 10:29
  • @Kusalananda: Arguably, answers to questions not specifying an OS or platform (here: "How do I get my mouse back from QEMU/KVM?") are not irrelevant just because they cover a different environment than mentioned for context in the body. Since the answer is useful (I personally googled it after I forgot the sequence), how should it be provided to not trigger a downvote? Should I have posted that same question verbatim again & specify macOS in the body? Or have a moderator add "Debian" to this question's title & post another one with "macOS" in the title?
    – Marcin
    Commented Mar 17, 2021 at 17:52
  • In this case, an edit suggestion to an already existing answer that covers Debian seems appropriate. Such an answer would then answer the question for the platform mentioned in the question, and then go on to provide additional info for some other platforms, e.g. macOS.
    – Kusalananda
    Commented Mar 17, 2021 at 18:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .