VirtualBox

Ticket #2537 (closed defect: fixed)

Opened 5 years ago

Last modified 10 months ago

ALT key state not reset when leaving guest -> fixed as of VirtualBox 4.2.14

Reported by: bughunter2 Owned by:
Priority: major Component: other
Version: VirtualBox 2.0.4 Keywords:
Cc: Guest type: other
Host type: Windows

Description (last modified by michael) (diff)

It regularly happens that when leaving the guest I can't press Windows + E key to open "My Computer" (on the host).

This is caused by the ALT key state being set (possibly other keys are also affected by the bug).

I've tested the bug with the following guests:

  • Windows 95
  • Arch Linux

Change History

comment:1 Changed 5 years ago by hege

comment:2 Changed 5 years ago by bughunter2

Seems fixed in VirtualBox 2.2.4 (although it's not listed in the changelog), can others confirm this?

comment:3 Changed 5 years ago by bughunter2

Aw, I found out it still occurs. For a second it seemed to be fixed, but I'm afraid it isn't.

comment:4 Changed 5 years ago by ian@…

Okay, this problem of loosing the keyboard focus in XP guests on a linux host, described IMHO best in #2412, is really annoying, and occurs quite frequently for myself in windowed or fullscreen in my configuration which is Linux Host 2.2.4 r47978 with XP guest and latest guest tools. It seems to occur semi-frequently whenever my Linux Host skype (or other background tool) brings a message on top of the guest, after which getting/retaining the keyboard focus in the guest is never consistent. In each case a combo of switching in/out of the window using the host-key and/or stimulating mouse and key actions in/out of the guest during the switches resolves it eventually, but never consistently. Notably, when I return to the guest, I get one successful keypress most of the time, and then no more functioning keyboard (mouse is always fine). This has been the case for as long as I can remember (certainly the 2.1+ virtualbox non-ose under Ubunutu intrepid and jaunty).

Literally sometimes I type short email messages one character at a time in my XP host by vbox-Host-Key, compiz-window-switch out of VBox, then back to VBox, type one key and repeat; Until my one line message is typed. People with Skype on Linux must really be annoyed by this.. moreso than the blackberry usb filter issues I imagine (number 2 on my wishlist).

Let me know how I can help

comment:5 Changed 5 years ago by ian@…

After switching to VirtualBox 3.0, it appears that guest control keyboard issues are not directly related to vbox, but likely a more benign symptom of various gnome apps stealing keyboard focus intermittently (like skype). In terms of recovery of the keyboard, I have noticed that when it does "go" or not take the focus back to the guest on mouse click, that the little green arrow in the keyboard capture indicator light is also not green. Clicking on the titlebar at this point seems to be the only consistent way to get the focus back into the guest (and change the little capture indicator back to green). In fullscreen I have not found a solution without coming out of fullscreen to rectify.

comment:6 Changed 5 years ago by spbrereton

For me the problem is that I lose everything in the host.

Running VB 3.0.6 on Ubuntu Karmic Koala (was running Jaunty, but upgraded it to see if it would fix the problem) with a Windows XP Guest.

I also suffer from the bug that won't allow me to set/change the HostKey (currently it's set to right win, but RightWin+F doesn't give me Fullscreen (Host+F) but a search box, so the Virtualbox SW is clearly not getting the keypress (although the guest is).

I wasn't able to use my trackpad in the host until I inserted a USB Mouse.

If I shut down the VB, the host system has full access to the mouse/trackpad and keyboard.

It was all perfectly after the install. And even after I installed the Guest Additions (which I've uninstalled and reinstalled to try and fix the problem). Inserting an USB keyboard also allows me to use the host, but clearly this is not idea for a laptop user to have to carry a mouse and keyboard (or shutdown the guest when attempting to use the host).

comment:7 follow-ups: ↓ 8 ↓ 9 Changed 4 years ago by NGrey

It looks like a lot of people commenting on the bug aren't really experiencing it. The problem is that, after being in the VM for a bit, when you switch back to the guest OS the Alt key is considered depressed by all of the host software until I press it myself to free it. I can't say that it happens all of the time, but it happens the majority of the time to me. It has occurred to me on the following machines:

  1. a Lenovo x61T laptop (Santa Rosa chipset, 1.8Ghz Core2Duo L7700, 8GB of Ram, no USB devices other than the internal bluetooth and fingerprint reader, none of which are passed on to the guestOS) running Windows 7 Ultimate x64 at 1024x768 res using VirtualBox 3.1.0 and 3.1.2-56127 with a Windows XP SP3 guest.
  2. a desktop (Core2Quad Q6600, Foxconn BlackOps X48 motherboard, 4Gb of DDR3 2000 ram running at 1066, USB mouse, PS2 keyboard, various other USB peripherals) running Windows 7 Ultimate x64 at 1280x1024 res using VirtualBox 3.1.2-56127 with a Windows XP SP3 guest.


In both cases my host key is set to Scroll Lock, and both VMs were upgraded from prior versions (although Virtualbox was a fresh install on the desktop and an uninstall/install upgrade on the laptop).

I shall try to find more information about what triggers the issue, but please do investigate. For anyone who switches between the host and guest OSes a lot, this bug is pretty obnoxious. I've accidentally sent emails, closed unsaved documents, etc because VirtualBox makes the host OS think that I'm holding down the Alt key when I switch out. Even when I haven't used the Right Alt key in the VM.

comment:8 in reply to: ↑ 7 Changed 4 years ago by NGrey

Coorection of previous comment:

It looks like a lot of people commenting on the bug aren't really experiencing it. The problem is that, after being in the VM for a bit, when you switch back to the host OS the Alt key is considered depressed by all of the host software until I press it myself to free it.

comment:9 in reply to: ↑ 7 ; follow-up: ↓ 10 Changed 4 years ago by RobertB

Replying to NGrey:

The problem is that, after being in the VM for a bit, when you switch back to the guest OS the Alt key is considered depressed by all of the host software until I press it myself to free it.

I found that pressing Left-Alt will NOT get the Alt key to be considered released, but pressing Right-Alt in the guest OS will. Moreover, I found this problem in the guest OS, I don't think I saw it in the host OS.

My system: Dell desktop running Ubuntu 9.10 (kernel 2.6.31), VirtualBox 3.1.4 r57640 with a Windows XP guest.

comment:10 in reply to: ↑ 9 Changed 4 years ago by NGrey

Replying to RobertB:

Replying to NGrey:

The problem is that, after being in the VM for a bit, when you switch back to the guest OS the Alt key is considered depressed by all of the host software until I press it myself to free it.

I found that pressing Left-Alt will NOT get the Alt key to be considered released, but pressing Right-Alt in the guest OS will. Moreover, I found this problem in the guest OS, I don't think I saw it in the host OS.

My system: Dell desktop running Ubuntu 9.10 (kernel 2.6.31), VirtualBox 3.1.4 r57640 with a Windows XP guest.

Further investigation has shown that both the right and left ALT keys can get stuck. The odd thing is that none of the other modifier keys appear to get stuck when transitioning from the guest to the host.

Also, if you're encountering a situation where the Alt key is depressed upon entering the guest OS, you should probably open a new bug, as this one is leaving the guest and returning to the host. Although you should definitely link it to this one.

comment:11 Changed 4 years ago by lmatdeewrgovau

ALT key getting stuck in my host after being in VBox guest.

I'm using VBox 3.1.6 with Guest Additions, Windows 7 guest, host is Dell desktop running Window XP SP3.

For clarity: HOST is where my ALT key gets stuck, after leaving Guest.

I didn't figure out any magical key combination to get unstuck, and have had to restart my host. Pressing Alt again did not fix it (nor trying lots of other things, including sliding mouse in and/or out of guest with Alt still pressed). Happened a few times in the last couple of days.

For me this bug is worse than obnoxious.

If a suggestion above helps me get unstuck without having to reboot I will post again.

comment:12 Changed 4 years ago by DidrikM

Time to revive this one. The issue is pretty simple once you understand it. Reproduction for Windows: (I'm using 7, but I'm assuming anything from XP and up will work.)

  1. Open the On-Srceen Keyboard under Accessories>Ease of Access. (This is not needed to reproduce the bug, but helps visualize what's going on. Please use your physical keyboard rather than the OSK for the instructions below.)
  2. Alt+tab to a running VirtualBox machine using only the keys alt and tab. Note that alt does not get stuck when doing this.
  3. Alt+tab to a running VirtualBox machine and switch to the VB window by clicking on the thumbnail or, indeed, the window itself. At this point, the alt key is stuck.

It's important to note what happens at this point. You may press and release the alt key for as many times as you wish when the VM is focused - the VM silently eats those key presses and the OS still thinks the key is pressed. It's not until the VM loses focus that you can actually feel the effects of this bug, which may lead you to (incorrectly) assume that the bug actually doesn't "happen" until the focus capture is released from the VM.

It should be noted that this bug is not limited to alt, but affects left ctrl, and the logo ("win") key as well. For these keys (as well as alt, of course) it can be reproduced this way:

  1. Focus any application except VB. (The task bar will do, for example.)
  2. Press and hold your desired modifier key.
  3. Give VB focus by using the mouse. (Prerably also capturing input focus.)
  4. Release your modifier.
  5. Optionally, do anything you want inside the VM to convince yourself that these key presses don't affect the outside world.
  6. Press right ctrl (or whatever your host key is) to release capture from the VM.
  7. Now, that key will still be stuck from the OS's point of view.

Some specifics:

  • This can be done both for left and right ctrl, even when right ctrl = host. However, OSK's monitoring of the key is incorrect, so the ctrl key can be shown in OSK as released even when it isn't and vice versa. (This is a bug in OSK that can be triggered independently of the VB bug, by holding one ctrl key and pressing and releasing the other.)
  • In the case of alt, it seems that it's only captured on the OS level and doesn't affect the menu accelerators or keyboard shortcuts in applications. It only affects e.g. the ctrl+tab shortcut in Web browsers and other tabbed applications, which will instead be interpreted as ctrl+alt+tab, which is a feature that works like alt+tab, except that it will not switch over focus to the selected application when ctrl and alt are released, but allows you to browse the active applications with tab or arrow keys and then press enter. This is a useful feature when used on its own, but I digress.
  • When doing the same procedure with alt gr, (and don't touch any other modifiers while the VM is has capture focus) host applications will think that ctrl+shift is pressed, so you could for example press just the J or M key to insert a line break or I to insert a tab. (Same as ctrl+shift+m/j/l which is analogous to the ctrl+m/j/l control characters in a UNIX terminal, but once again, I digress.)

Lastly I should add that you can typically kill the stuck key simple by pressing and releasing it once.

Hoperfully this long text will shed some light on the issue, and I'm hoping that someone will have a look at it now that it is (hopefully) fully understood.

comment:13 Changed 4 years ago by spbrereton

maybe the wrong place to ask, but how do I unsubscribe from this ticket? it's not relevant for me.

comment:14 Changed 3 years ago by NGrey

This bug also affects me on an Arch Linux x86_64 host (WinXP guest). So from everyone's comments, it occurs across multiple guests and hosts. DidrikM's comments seem pretty helpful in reproducing it.

Could we get someone to release all modifier keys (L/R Alt, L/R Ctrl, Shift, Win/Super, AltGr) in the host once the guest receives focus? It may not be a complete fix for the bug but it would be an usable workaround. Either that or wait for the keys to be released before grabbing focus.

@spbrereton: I don't believe any of us who are actively updating have permissions to change the CC list for the ticket, and Trac software doesn't have an easy way for users to manage their own subscriptions. We'll have to wait for someone at Oracle to pay attention, which doesn't seem very likely given that they've ignored this bug for over two years in multiple tickets.

comment:15 Changed 22 months ago by robert@…

Since I don't seem to have the possibility to CC myself to this ticket, I need to add this comment to express that I'm also regularily affected by this bug: the host's Ctrl key gets stuck. However, I have not been able to reproduce the bug as described in comment:12.

I am using Windows 7 64-bit both as guest and host and (still) VB 4.1.8, will upgrade to 4.1.18 now.

comment:16 Changed 20 months ago by matk

I am currently being affected by the problem. I'm running VirtualBox 4.1.20r80170 on a Windows7 64bit Host. Using a Ubuntu 10.04 guest, I get the Alt key stuck when moving from the Guest OS back to the Host. As described in comment 12, pressing of the Left Alt key 2 times removes the problem. I'm also finding the mouse scroll wheel not working in the Guest OS, but when I move back to the Host OS, press the Alt key 2 times and move mouse back to Guest OS, the scroll wheel works again.

I'm also running VirtualWin v4.3 to provide multiple desktops on the Host OS, with Ctrl-Alt-<arrow keys> mapped to provide desktop switching. When I use Ctrl-Alt-<right arrow> to switch desktops, when the VirtualBox window appears, it takes focus and the Ctrl-Alt-<arrow> events are handled by the Guest OS, and I have to select another Host OS window to get desktop switching via hotkeys to work again. Maybe this is having an affect on the release of the Alt key.

comment:17 Changed 20 months ago by kamil.szot

To get unstuck:

Press all Ctrl, Shift and Alt keys at the same time and release them all at roughly the same time.

Should work. If it does not get unstuck try again.

That's the trick for unstucking Alt key in Windows that my friend taught me around 15 years ago. Funny it's still useful.

Version 0, edited 20 months ago by kamil.szot (next)

comment:18 Changed 18 months ago by tlundqvist

I can confirm this problem. Currently using virtualbox 4.1.22. Running a linux guest with a windows 7 64-bit host. I have had this problem for a long time. I cannot unstuck inside guest window. Clicking on something windows (like desktop background or task bar) and hitting alt unstucks the key.

comment:19 Changed 17 months ago by Lmtd

I run

  • Host:Windows 7 64-bit
  • Guest: Ubuntu LTS

I notice this problem most because I use VirtuaWin. I press Alt+Ctrl+g to go to desktop 1 (and Alt+Ctrl+v to go to desktop 4 where my guest is running). I press Alt+Ctrl+Super+g to move an application to desktop 1. All this works as designed unless I am using the guest. Of course, I first press the Host key, then I press Alt+Ctrl+g to go to desktop 1 and read e-mail or something, but the effect is sending the guest to desktop 1...sometimes. That means that the super key is stuck. Otherwise, I press the host key then try to access the start menu (perhaps to open PowerShell) and when I press the super key, nothing happens. I've found that when this is the case, Alt is the most common culprit.

In either case, I tap the stuck key (which I guess appropriately sends the key-up event to Windows), then I can proceed as usual.

[edit]

I would be remiss to leave out the fact that this doesn't happen all the time. A few notes on reproduction. I use the framebuffer (tty1 usually) and tmux and irssi. The problem is most likely to happen when I have been using these programs for a while. I would like to say, "Just press alt in the guest, then host key, and the alt key is stuck" or something simple like that, but it doesn't seem to be that simple :-(

Last edited 14 months ago by Lmtd (previous) (diff)

comment:20 Changed 12 months ago by michael

  • Status changed from new to closed
  • Resolution set to duplicate
  • Description modified (diff)
  • Summary changed from ALT key state not reset when leaving guest to ALT key state not reset when leaving guest -> duplicate of #2613

I will close this as a duplicate of #2613. Please re-open if you disagree.

comment:21 Changed 10 months ago by michael

  • Status changed from closed to reopened
  • Resolution duplicate deleted

comment:22 Changed 10 months ago by michael

  • Status changed from reopened to closed
  • Resolution set to fixed
  • Summary changed from ALT key state not reset when leaving guest -> duplicate of #2613 to ALT key state not reset when leaving guest -> fixed as of VirtualBox 4.2.14

Bug #2613 was for Linux hosts, not Windows hosts.

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use