94

This is a weird one. For some reason, last night my mouse partially stopped working. Movement is fine, but the mouse buttons don't work. Mainly it's the left button, but occasionally the right click and scroll-wheel fail too.

Initially I thought it could be the mouse itself (the left button seemed to get a bit "soft" recently), but I tried another mouse and had the same issue. Both are USB wireless optical mice. The keyboard is working okay 95%, only problem is Alt+Tab doesn't seem to work. Both keys work fine independently.

At the time it happened I was using Chrome, I dragged to scrollbar to scroll and when I released the mouse it was still holding scrollbar.

I'm using Ubuntu 9.10, I upgraded weeks ago and everything was working fine so I don't think it's related to that. I also hadn't run any updates (I have now just in case something fixed it). But no luck.

Any ideas?

2
  • 1
    To those trying to figure out why this happens, I observed that Spotify for Ubuntu seems to trigger this. Leave a Spotify client open for too long without playing anything (generally overnight) then go back to play something. Clicking on the green "Play" button of playlists causes the clicks to register no more.
    – skytreader
    Jan 28, 2016 at 7:25
  • kill and disable xfce4-screensaver solves the problem for me
    – sify
    Aug 21, 2023 at 8:41

14 Answers 14

92

Got this one too. The odd thing is, it doesn't take clicks from my mouse, but it fully recognizes my touchpad.

Anyway, opening a terminal (e.g., with Ctrl+Alt+T) and typing:

metacity --replace &

will make it work if you're using compiz. If you want compiz back, type:

compiz --replace &

and the mouse will work again.

It's easier getting to the terminal if you have Gnome-Do or if you assign a hotkey to it (like the super/windows key or tilde (~).

WARNING: Don't stop metacity/compiz commands once started or you'll be in worse situation than you were before.

WARNING 2: The above command can force to log out, but still it's useful for issues like:

  • command key (super key) doesn't work
  • left click doesn't work
13
  • 7
    If you stop the metacity --replace command, you'll be in a worse position than when you started, with even less functionality working. As a warning to others, don't stop the metacity process once started. I found this out the hard way.
    – Dennis
    Oct 18, 2011 at 10:29
  • 3
    Better to run the command from Alt+F2 if that works, so you don't have to worry about closing the terminal.
    – Nick
    Oct 6, 2014 at 9:53
  • 6
    And for newer versions: unity --replace
    – jmiserez
    Oct 6, 2014 at 10:43
  • 9
    perfect for me , but it s strange that in 2015 with a mature os ( ubuntu 15 ) there are still issues like this . Jun 16, 2015 at 7:22
  • 8
    This is a workaround, not a solution. Any ideas about how to fix it permanently?
    – jvriesem
    Feb 22, 2016 at 21:17
26

Some things to try:

  • Switch to and from a virtual terminal Ctrl + Alt + F1,Alt + F7.
  • Activate the screen-lock Ctrl + Alt + L to hopefully reset the X11 window manager.
  • Restart the window manager with something like ( DISPLAY=0.0 marco --replace ). You need to replace marco with whatever window manager you are running (compiz, unity, metacity, ...).
  • Close any virtual machines, VNC clients, games, etc. that might have grabbed the mouse. For example: killall vmplayer might initiate a virtual-machine suspend operation.
5
  • 2
    Switching to a text mode and back worked for me on Ubuntu 15.10 Mine is a fairly vanilla install and config, and the problem occurred after a regular startup, not after any particular updates that I can recall.
    – John T
    Apr 27, 2016 at 23:05
  • 3
    Switching to a virtual terminal worked in 16.10 as well. Thanks, you just saved med a restart :-)
    – Kimble
    Apr 24, 2017 at 18:03
  • 3
    restarting Virtual Machine (windows) worked for me.
    – Champ
    Aug 22, 2017 at 15:46
  • 3
    Is there a permanent fix for this? It happens to me every 15-20 minutes now and switching to virtual terminal fixes it. May 24, 2018 at 9:28
  • So @Kimble ... why would switching to and from a virtual terminal fix this? Ubuntu 16.10, very vanilla install, and that was the only solution on this (and other) page(s) that worked.
    – Evan
    Aug 10, 2020 at 16:32
25

For what it's worth, I went into the package manager and searched for, 'mouse'. After that, I clicked on all the already installed applications (there aren't that many) and reinstalled all of 'em. Then I searched for 'keyboard' and did the same thing. Not much change there, either. Finally, I searched for 'input' and found a file called, 'inputattach'. Reinstalled it and my mouse problems are solved. Works like it did on the day I installed 10.04. It's so nice to have a mouse that behaves itself and works like it should, again.

I'm a relatively new Ubuntu user, but instead of asking a lot of questions and then waiting for someone to reply, I decided to try and do something about it on my own, and solved my mouse problems (computer mouse, that is...;)

What the file re-installation cleared up, was the need to click several times to open up a folder, having to hold the button down for sometimes as long as three or four seconds before the click would be activated, or having to right click to open a folder or open a file with a particular application.

Just wanted to share this with you since the 'input' of my mouse now seems to once again, be completely and fully 'attached' to my computer.

5
  • 2
    I had the same exact problem described here, <kbd>alt</kbd><kbd>tab</kbd> plus mouse functions frozen (not only clicks are not working but also the shape of the mouse is not changing and they where always unfrozen after <kbd>Ctrl</kbd><kbd>Q</kbd> over firefox and then <kbd>Alt</kbd><kbd>F1</kbd> over the desktop to activate menus). I just reinstalled the inputattach package, as @Cubby described and the problems stopped.
    – user67774
    Feb 16, 2011 at 2:49
  • 2
    Upvoted for solving your own problem, and sharing the solution with others.
    – Jake
    Jul 13, 2011 at 18:20
  • 6
    tl;dr sudo apt get install --reinstall inputattach Nov 12, 2016 at 14:24
  • 1
    sudo apt-get install --reinstall inputattach; # work like a charm) Lubuntu(Ubuntu) 18.04. Tnx! Nov 13, 2018 at 14:24
  • This is happening with 20.04 too
    – Jus12
    Feb 12, 2023 at 3:17
15

from personal experience (Ubuntu 14.04, logitech wireless mouse) :

2 ways to get it working again for a short time 1 - unplugging and replugging the mouse, 2 - alt-F1 to switch to text mode then alt-F7 (or F8) to switch back to graphics

very recently completely removing "mousetweeak" seems to have resolved a particularly nasty case of "no left click"

my problems used to be infrequent and unplugging the mouse would fix it for a few days, but the most recent case had me working the USB plug every 2 minutes.

for now after the above mentioned uninstall - it seems to be working

EDIT: spoke too soon, problem persists

5
  • 1
    Switching to a text mode and back worked for me. Ubuntu 15.10, fairly vanilla instal and config.
    – John T
    Apr 27, 2016 at 23:04
  • Why did switch to text mode and comes back make it work? OMG! Works perfectly thanks, lol
    – deFreitas
    May 17, 2016 at 3:19
  • 2
    as of Ubuntu 16.04 the switching is done CTRL-alt-F1 / [CTRL]-alt F7 (ctrl needed on the way out of the GUI, optional on the way back)
    – Frank N
    Oct 19, 2016 at 0:15
  • Removing mousetweaks did it for me on Ubuntu 18.04! sudo apt remove mousetweaks
    – flo5783
    Mar 3, 2021 at 19:32
  • Actually, removing mousetweaks just helped a little... it seems it was the mouse in the end (logitech wireless, worked very well for 2 years but now seems glitchy).
    – flo5783
    Mar 3, 2021 at 21:10
10

I found that this was just a problem with the mouse. The left button has pretty much stopped working. Other buttons seemed to stop working because the left button gets "jammed". After restarting with the other mouse plugged in, it worked fine.

Damn, I seem to have gone through so many mice and/or keyboards recently...

3
  • 3
    ha! sadly, hardware problems like this are never the first thing we think of. it must be the software, mice don't go bad... :) Dec 10, 2009 at 1:58
  • A variation on "just a problem with the mouse" - I got my wireless mouse to work again after switching it off (little slider on the underside) and back on.... Simple thing but easy to forget or just no know there is such a switch, and I'd wasted a couple hours on software hackery and reboots beforehand... :-(.
    – Tony D
    Jan 9, 2016 at 1:54
  • I have the same problem, but for some reason my mouse works find if I boot into Windows. It is really stupid to have exactly this answer as accepted.
    – h22
    Feb 18, 2016 at 18:47
3

I just had this exact behaviour, caused by Nautilus catching a keypress combo & opening a dialog behind several other windows.

  • mouse movement but no click detected
  • across all input devices
  • regardless of window chosen
  • keyboard inputs & shortcuts all fine, could run machine
  • CTRL-ALT-F1 gave alternate X login, keyclicks accepted on the login screen
  • Logged back into session, no mouse input.

Whilst closing windows to prepare for a restart, I found what appeared to be a nautilus popout menu, I think for creating a folder. This was apparently not near a folder window. Mousing over the popout menu caused it to highlight & I was able to ESC to cancel it.

And with that the mouse input devices work again.

This is a patched 20.04LTS, multimonitor, virtualbox guest running (but shutdown when I found the entry).

So worth checking that there are no errant popup dialogs or open menus hiding behind your open windows before starting to reinstall things.

2
  • 1
    This saved me! I had a question modal popup open after I clicked on the parent program too soon after the modal popup appeared. Jul 22, 2022 at 13:20
  • Interesting... upvoted even though I just rebooted so can't check if this is what is my problem. I just know that "it" happens always exactly when I try to open the fluxbox menu and then accidently click left and/or let go of mouse8 (that I did bind to opening the fluxbox menu). What I DID try however was seeing that 1) fluxbox was still running and 2) didn't see any mouse events. But it is possible that it told X to grab the mouse and then never let it go even though there isn't a popup anymore...
    – Carlo Wood
    Jan 2, 2023 at 16:09
2

Mostly this may be reason :

The bug is well known. Look for example here:

Bug Link

A common workaround is exporting GDK_NATIVE_WINDOWS=1 before running the application with click problems.

(source)

2

From the bug mentioned by Joe above (emphasis mine):

So here the bug and workarounds.

For example on youtube, whilst it recognises my mouse moving over various buttons, actual mouse clicks are not recognised. I can navigate using 'tab' but this is very painful. I can also right click. The problem doesn't occur with other flash players, e.g. swfdec-mozilla.

WORKAROUND 1: Disable compiz
WORKAROUND 2: Remove flashplugin-nonfree / flashplugin-installer and install from adobe
WORKAROUND 3: Open a terminal and enter:

   gksudo gedit /usr/lib/nspluginwrapper/i386/linux/npviewer

Then add: export GDK_NATIVE_WINDOWS=1 before the last line of text.

Note: The only workaround for Chrome/Chromium users is to disable compiz.

2

I've had, perhaps a similar issue, thought I would chime in on what I did that seems to have worked. BTW, I'm using a wireless Logitech trackball on Ubuntu 10.04.

My issue was that the left button on my Logitech wireless trackball mouse would give me lots of problems. Sometimes it would be severe, sometimes barely noticeable. Clicking would sometimes register as a left click, sometimes register as a double click, and many, many times it would fail to register at all. Dragging and dropping and copy and paste became almost impossible. I could almost never manage to highlight text. In short, life with this mouse became unbearable. This problem affected all programs and windows.

I assumed the problem was with the mouse, even though I've only had it since June or July this year (2010). I focused my efforts on trying to fix the mouse. In the end, I essentially gimped up this mouse trying to make it work, but to no avail.

Finally, I stopped using the mouse completely, and switched to a wired trackball that had never previously given me any problems before. However, after using the wired mouse for a few days, I started to notice that it was having the exact same problem. So, then I realized that in all likelihood, this is a problem with 10.04.

After looking around online for some time trying to come across a solution that worked for me, I stumbled across the post above about using metacity --replace. So, based on that, I was pretty certain that Compiz was the root of my mouse issues. After playing around with Ubuntu Tweak, one of the menu options, "Enable Metacity's compositing feature", mentioned that I had to manually disable visual effects in appearance.

So, after disabling Visual Effects (System>Preferences>Appearance>Visual Effects then select None), the mouse is suddenly working again. I don't know if this will be a permanent solution or if it will start giving me problems again, but I thought I'd mention this solution.

2

If you are running the gnome variant or the new unity that used gnome as the default:

alt + f2
gnome-shell --replace

Happened to me while experimenting with a graphics API (vulkan). I have seen it happen other time as well

1

It would happen to my ubuntu 10.04 every now and then too, and it only worked again after I clicked the touchpad button. However, it has never happened again ever since I changed my touchpad setting. I deactivated the tap-click of my touchpad, and now the "real" mouse never stalls.

1

For anyone using i3, restarting i3 fixed it for me (ctrl+shift+r)

My symptom was mouse movement working but not clicking.

0

Did not have any mouse issues until a recent update manager update. Suspected my wireless mouse, but had the same effects with a regular wired mouse: left mouse button would work on and off.

Reinstalling the xorg mouse input drivers which were already installed by default (xserver-xorg-input-mouse, xserver-xorg-input-evdev) did not change anything, but, seeing how many mouse drivers were installed by default made me wonder: will I ever use a Synaptics Touchpad on this desktop? I realized this is not Gentoo, and, many unnecessary drivers are installed by default to Ubuntu work across a wide hardware spectrum.

What solved my issue was to uninstall all xorg mouse drivers for devices which were very unlikely to ever be connected to my system. As soon as the superfluous drivers were uninstalled, my mouse clicks were back to normal.

I would also like to add that I have never needed the workaround mentioned above, i.e. setting the GDK_xxxxx environment variable. I have been running Compiz and Chrome on this system without ever needing this workaround. The only application that does not appear to like the mouse in conjunction with Compiz is Blender3d.....mouse clicks in this application are off by some 20 pixels vertically.

0

My problem was on a linux laptop. I had it hooked up to external screens and an external keyboard with the laptop lid closed. That's my normal work setup. When mouse clicking stopped working, I was just about to restart the computer, so I opened up my laptop lid (external mouse still didn't work) and clicked on the power options. As soon as i did that, my external mouse click started working again. Super weird.

You must log in to answer this question.

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