Operating System - Linux
1752822 Members
4429 Online
108789 Solutions
New Discussion юеВ

Re: mouse breaks when using KVM on Ubuntu

 
Peter A. Laudenslager
Occasional Advisor

mouse breaks when using KVM on Ubuntu

Hi all,

I have a number of workstations on my desk with various operating systems, and a Belkin KVM switch connecting the workstations to on keyboard, mouse, and display. I have two identical Compaq Presarios on the KVM switch, one with Windows, and one with Ubuntu Linux. The Windows machines work fine with the KVM switch, but the Linux machine doesn't seem to like it as much.

I can boot Linux with that machine selected on the KVM, and everything is fine - the mouse and keyboard work well. However, if I switch to another system, then come back to the Linux machine, the keyboard still works, but the mouse is broken. The pointer moves when the mouse moves, but it jumps all over the screen, and gets random button clicks.

I have tried adjusting the mouse properties (like acceleration), but this doesn't help. The random button clicks make it seem like it is running the wrong mouse driver (movement of the mouse is misinterpreted as a button click).

I have tried this under both GNOME and KDE, and got exactly the same results. Is there a better mouse driver that will tollerate the KVM better?

FYI, the keyboard and mouse connections are all PS2 (although the KVM also supports USB).

Thanks for any ideas!
10 REPLIES 10
Steven E. Protter
Exalted Contributor

Re: mouse breaks when using KVM on Ubuntu

Shalom,

Get a different mouse. It makes no sense, but thats how I fixed this problem.

The mouse and the kvm can't play well together. Get as generic and widely used a mouse as you can afford. $5 solved my issue.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Peter A. Laudenslager
Occasional Advisor

Re: mouse breaks when using KVM on Ubuntu

Thanks Steven,

That actually makes a ton of sense - and I have the original mouse that came with the machine (pre KVM switch) sitting in the closet.

Thinking longer term, though, there has to be a way to make this work with the switch. It has been a long time since I saw servers in a data center with dedicated mice. Is the problem just my low-end KVM switch? I rarely have trouble with my Windows machines - maybe that is due to plug & play support in the mouse driver?

Adding a dedicated mouse will definitely solve my problem quickly and easily - thanks for the quick response.
Andrew Bruce
Valued Contributor

Re: mouse breaks when using KVM on Ubuntu

Hi Peter,

I suspect that it is an issue with X (sitting below the WM, so KDE, Gnome, etc. will make no difference), hotplugging PS2, and the mouse.

In fact, as I think about it, I'm not sure PS2 was originally intended to be a hotpluggable interface - could be completely wrong though...

I run Fedora Core 4 on my work laptop. If I unplug the (PS2) mouse and plug it back in, it stops working.

My USB mouse, however, works fine.

Under WinXP I don't have any problems.

I haven't look into it more, as I am not in the habit of unplugging a PS2 mouse, but, for what it's worth, I'm betting that a change in your X configuration may fix the problem.

Then again, a $5 mouse is probably cheaper than 5 hours of your time, right? ;-)
I Love it when a plan comes together!
Peter A. Laudenslager
Occasional Advisor

Re: mouse breaks when using KVM on Ubuntu

Maybe the real issue is the PS2. I could probably try using USB between the switch and the computer. That would certainly be better than beating my brains out over the ultimate mouse driver.

As a geek, I feel compelled to fix the problem, rather than band-aid it. However, I say that looking up at half-finished crown molding and listening to the downstairs toilet running continuously. Come to think of it - debugging that toilet is a lot like this problem. I replaced the thing that I was sure was causing the problem, then fixed something else that I broke, then fixed the only other thing it could be. Yesterday I went back to the store to get the only part I haven't yet replaced. At this point the toilet is now filled with brand new, high-end components, but it still leaks, and makes more noise than it used to.
Maybe I should just plug in another mouse and move on . . .
Steven E. Protter
Exalted Contributor

Re: mouse breaks when using KVM on Ubuntu

Some mice just don't work.

Glad its not hapening to you any more. I found it very annoying when it happened.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Peter A. Laudenslager
Occasional Advisor

Re: mouse breaks when using KVM on Ubuntu

Thanks, everyone for your help.

The solution is to switch my PS2 mouse to a USB mouse connection from the KVM switch.

A work-around is to connect a dedicated PS2 mouse to the machine.

The root cause seems to be that the X server doesn't support plug-and-play for PS2 mice.
Matti_Kurkela
Honored Contributor

Re: mouse breaks when using KVM on Ubuntu

It would be better to say that PS2 is not designed for hot-plugging.

All PS2 mice can work in a "basic PS2 mouse" mode: no scroll wheel and only 2 or 3 buttons. This is the default mode when the mouse gets power. To activate the wheel and/or any extra buttons, the mouse must receive a special reset code. This switches the mouse to "advanced" mode and changes the mouse data protocol a little.

Some KVMs may stop feeding power to the mouse when switching from one system to another. This causes the mouse to reset to the "basic" mode. The system has no way of detecting that the mouse has reverted to the basic mode: if the system has detected a mouse with "advanced" capabilities and sent it the proper reset code, it will expect the mouse to be still in advanced mode... and will mis-interpret the mouse data.

With Linux, there is a simple way to force the system to reset the mouse. Just switch to the text console mode by pressing Ctrl-Alt-F1, _release all keys_, then return to the graphics mode by pressing Ctrl-Alt-F7. The return to the graphics mode will cause the mouse to be reset, and the mouse will work again.

Another way to force a mouse reset on Linux is to restart the text-mode mouse service, the "gpm" daemon. Usually that can be done with "sh /etc/init.d/gpm restart".

In the newer 2.6.xx series kernels, there is a way to eliminate the problem altogether. The "psmouse" kernel module can be made to reset the mouse automatically if it detects invalid mouse protocol packets, or it can be forced to ignore the existence of advanced PS2 modes and to use the basic PS2 mode only. Run "modinfo psmouse" to see if your kernel has these functions. Look for parameters named "resetafter" and "proto".
MK
Peter A. Laudenslager
Occasional Advisor

Re: mouse breaks when using KVM on Ubuntu

That explains a lot, Matti - thanks!

I tried switching into text mode and back to graphics mode. The hotkeys worked to change modes, but the mouse still wasn't happy.

Next I tried the gpm reset command, but couldn't find gpm on my system. I looked in the init.d; when I did't find it there, I looked for anything similar running (ps ax). I couldn't find anything that looked promising, so I moved on.

Finally, I tried the modinfo psmouse, which has the options you mentioned. However, I am not sure how to edit these options. I looked at the man page on modinfo, and it looks like modinfo is read-only. Should I go find the filename mentioned in the modinfo and edit it with a text editor?
Matti_Kurkela
Honored Contributor

Re: mouse breaks when using KVM on Ubuntu

The psmouse.ko is a binary file, so you cannot edit it directly.

The configuration system for kernel module parameters changed a bit with 2.6 kernel series: before, the parameters were specified in /etc/modprobe.conf; now you can create an arbitrary number of files in /etc/modprobe.d/ and they will all be read automatically. The old-style file should still work, although it is not recommended to use it anymore.

So, the best solution would be to create a file (you can name it as you wish) in /etc/modprobe.d/ and put in it a line like:

options psmouse proto=bare

or whatever options you wish to use.

To make the options take effect, you must either remove and reload the "psmouse" module (which will require stopping everything that is accessing the mouse) or reboot.

The "modinfo" tool is just a way to check the availability and short description of module parameters. See "man modprobe" and "man modprobe.conf" for more information about kernel module configuration.
MK