With mouse integration turned off, both my mouse and touchpad get randomly stuck on invisible randomly placed lines while in a guest OS?

Solution 1:

This is a complete shot in the dark here, but I've got a theory.

First of all, I have no experience with VirtualBox on Linux hosts (but I do on macOS hosts, with both Debian and Windows 7/10 guests), and I virtually always have mouse integration on since I don't personally run into issues with it. This is all based on a guess as to how things work under the hood.

Now with the disclaimer out of the way, on to my theory. In your question, you said:

The behavior is similar to being on the edge of a screen and not being able to go past that edge.

Do you think it's possible that this is not just coincidental similar behavior, but actually exactly what's going on? With mouse integration off you have to click on the guest os's window to take over the guest's cursor, and the host's cursor disappears. Then, to regain control of the host's cursor you press the meta key, correct?

What if, under the hood, VirtualBox only hides the host cursor when you take control of the guest, but does not lock its position. Then, it feeds the host cursor's movement (but not the data from your physical mouse) to the guest OS, which moves the guest's cursor accordingly. Meanwhile, the host's cursor is invisible but still moving around your host's screen. When the invisible host cursor hits the edge of your monitor, it stops moving, but this doesn't necessarily coincide with the edge of your guest's virtual monitor, so you can't move the guest cursor any further in that direction.


Ok, how would we try to test if this is at all true? Here's a couple ideas to try:

  1. Reproduce the issue in your guest OS, stop moving your mouse, and press meta. Now, find your host's cursor while moving your mouse as little as possible. Is it along the edge of your monitor corresponding to the direction you couldn't move the mouse in?

  2. Go into your guest's windows settings, and set your cursor speed as low as it will go. Then see if the cursor becomes confined to an invisible box in the guest OS.

  3. Try moving your guest's virtual monitor window to different places around your host's screen. See if any particular window location on the host's monitor are more prone to causing the issue. My first guess would be that putting the window in one of the corners would be more likely to cause trouble.


As I said, this is a complete shot in the dark, and I'd think there's a 99% chance that this is an interesting idea with no real truth behind it. But if there is something to this, that gives us a massive head start on finding the root cause of your problem.

Solution 2:

This problem seems to be related to several posts on the internet.

The post Win 10 1903 Mouse Integration issues from 2019 talks about a "ghost cursor", where it seems that a second cursor appears and is causing problems with the displayed cursor. It looks like an offset was added between the displayed cursor and the effective cursor. The solution in the post was to change the color of the cursor to red, which seems to cause VirtualBox to re-initialize the cursor position and gets rid of this offset.

I found a similar post from 2017 with more manipulations of the cursor that help:
How to fix mouse cursor out of sync with VirtualBox Ubuntu Server 16.04.3 LTS VM?:

  • Resizing the VirtualBox window and then maximizing it
  • Setting the VM to full-screen then returning to windowed mode
  • Ensuring that the VirtualBox mouse is defined as PS/2.

In conclusion, it seems that any change that causes the mouse or the VM screen to be recalculated in a new mode will work for getting rid of the offset that is somehow introduced into mouse-position calculations by VirtualBox.

This is certainly a VirtualBox bug, and you may signal it in the VirtualBox forums. However, it seems to have been present for years and to have been signaled in many forms, but without any fix.