How to make Logitech Anywhere MX work in Ubuntu 12.X?

Update 2021: This has not been a problem for a real while. I recently accepted the "update your system" since this is (and was) in some sense the correct answer. Remember to use Solaar if you need to play with the USB Unifying device pairing, not needed for out-of-the-box mice.


I have a Logitech Anywhere MX mouse (wireless), when I connect it to the computer it doesn't work.

The mouse works in other computers with Windows and with Fedora 17 and Fedora 19, but it doesn't work in two different computers with Ubuntu 12.04 and 12.10. Moreover these same computers work with another Microsoft wireless mouse.

So I think the combination of Logitech MX and Ubuntu doesn't play well.

The dmesg log entry looks like this:

[  578.845838] usb 3-2: Product: USB Receiver
[  578.845841] usb 3-2: Manufacturer: Logitech
[  578.851625] logitech-djreceiver 0003:046D:C52B.0009: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:00:14.0-2/input2
[  578.851899] logitech-djreceiver 0003:046D:C52B.0009: logi_dj_probe:logi_dj_recv_query_paired_devices error:-32
[  578.854518] logitech-djreceiver: probe of 0003:046D:C52B.0009 failed with error -32

Instead of the expected (taken from Fedora):

[154344.634520] usb 2-1.2: Manufacturer: Logitech
[154344.647935] logitech-djreceiver 0003:046D:C52B.000D:
hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on
usb-0000:00:1d.0-1.2/input2
[154344.653788] input: Logitech Unifying Device. Wireless PID:1017 as
/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.2/0003:046D:C52B.000D/input/input21
[154344.654192] logitech-djdevice 0003:046D:C52B.000E: input,hidraw1:
USB HID v1.11 Mouse [Logitech Unifying Device. Wireless PID:1017] on
usb-0000:00:1d.0-1.2:1

UPDATE: I would say that at this point, solaar is the way to go. So I accepted a previous answer suggesting this.


I enhanced the script up top and then also added a udev rule to fire whenever the mouse was plugged in. I am using a Logitech Performance MX but the rule should be similar.

#!/bin/bash

# loop up to 10 times trying to fix the mouse insertion
for i in {1..10}
do

  # exit the script if there was no mouse error
  if [ `dmesg | grep "logitech-djreceiver" | tail -1 | grep -c "failed with error -32"` -eq 0 ]; then
    echo "No logitech receiver error...exiting" ;
    exit 0 ;
  else
    # try to reload the mouse driver
    echo `date`" Error detected, trying reload of logitech hid driver" ;
    rmmod hid_logitech_dj ;
    modprobe hid_logitech_dj ;
    sleep 1 ;
  fi

done

This tries up to 10 times to reload the driver before exiting.

I named the script /usr/bin/mousefix and did a chmod +x.

Here is the udev rule, a line that can be added to /etc/udev/rules.d/10-local.rules

SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{manufacturer}=="Logitech", ATTRS{product}=="USB Receiver", ACTION=="add", RUN+="/usr/bin/mousefix"

Hope this helps somebody else. It seemed like an easier thing to do to have the script run whenever the usb connected.


You only need to update the system if you are using 12.04 or 12.10.

I have had several questions related to the Anywhere Mouse and the Touch Mouse M600

Is Logitech's Unifying receiver supported?

Can I use the Logitech Touch Mouse M600?

I even participated in this launchpad bug: https://bugs.launchpad.net/linux/+bug/958174 where several solutions like:

sudo modprobe -r hid_logitech_dj
sudo modprobe hid_logitech_dj

were mentioned but at the end, updating the system fixed all issues with both mouses.

There is even a askubuntu answer about it here: Logitech M515 does not work after upgrade to 12.04

But for all 4 computers I tested this, the solution was to activate all repositories by default not activated (universe, multiverse, proposed, backport), do an update and upgrade. Reboot and the mouse should work out of the box perfectly.

If by chance doing this does not fix the problem, then doing a diagnostic to it will help, for example:

  1. After rebooting disconnect/connect the Logitech Receiver. Open a terminal and type dmesg to see the last lines that will mention the receiver. See if an error appeared.

  2. Type lsusb. You should see a line similar to the one below if everything was detected correctly:

    Bus 002 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver

  3. Turn on/off the mouse (The on/off switch in the mouse is below) and test.

This has been tested in USB 2.0 and 3.0 ports. To make sure (at least for most users) that this work, ALL repositories have to be activated. Like the following 3 images:

Here we see main, universe, restricted and multiverse activated. I also changed the server from my country to MAIN

enter image description here

Here I activated since they were off, the Canonical and 3rd party repositories.

enter image description here

Here wee see proposed and backports activated (Beside security and updates).

enter image description here

After all that I did a sudo apt-get update && sudo apt-get upgrade. Rebooted the PC and done.

The mouse should work every time while turned on, but if this fails, I see a couple or reasons why:

  • The Anywhere MX mouse actually drains the batteries faster than other mice I have tested. In my tests, Anywhere MX uses 2x more battery than the Touch Mouse M600 and at least 20x more than the Logitech V450. For example, using it everyday, can use the Anywhere MX for 1.5 months to 2 months. The Touch Mouse lasts around 4 to 5 months. The V450 lasts clearly a full year up to 16 months. So check the batteries. I suspect this is due to the Darkfield Technology.

  • The Anywhere MX mouse when turned on a green light will flash for about 3 seconds then turn off. This does not mean the mouse if off, it just means that the mouse batteries are good. If the lights were red then you need to change them. In either case, the light will turn on with green or red then turn off to preserve the batteries.

  • The switch to turn on/off the mouse below can be switch any amount of times when using Ubuntu, but it is better to turn the mouse off when not using it. This way it will last longer. For example when sleeping, going to work, etc..

  • Certain BIOS options might have an impact on the mouse. Check your motherboard's BIOS for USB options. Play with them just in case the mouse does not work.

  • Change the USB port where the receiver is connected. Some ports (Like the front ports) are known to really suck at having high power devices on them.


Solaar worked for me in 12.04. In terminal type:

sudo add-apt-repository ppa:daniel.pavel/solaar  
sudo apt-get update  
sudo apt-get install solaar  

Once installed, open Solaar from the Dash menu and click on in the upper left corner. The click on in the lower right corner and follow the directions.

If you had the logitech devices paired to another computer before, you may first need to unpair the logitech devices from the other computer(s). After that reboot Ubuntu without logitech receiver in USB, start Solaar from Dash / menu, plug in logitech receiver, click 'add new devices' and switch new device on/off to be recognized. Repeat for each device.

Once paired the devices are recognized every time you start ubuntu (Solaar is automatically installed in 'startup applications').

Also check this link as source http://www.webupd8.org/2013/07/pair-unpair-logitech-unifying-devices.html or for more trouble shooting


There is a workaround, using this script (copy this into a .sh script, chmod +x this file and run as root:

#!/bin/bash
while :; do dmesg|grep logitech-djreceiver|tail -1|grep -q -c "failed with error -32" || exit; 
echo -n `date`" Driver Reload" ; 
rmmod hid_logitech_dj ; 
modprobe hid_logitech_dj ; 
dmesg|grep logitech-djreceiver|tail -1 ; sleep 1; done

Or download mousefix.sh which is a link on this page here:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1039143/comments/55

This fix works by removing and re-adding (rmmod + modprobe) hid_logitech_dj which is the module responsible for the unifying receiver. It does this in a while loop once a second until it is finally recognized.

There is apparently a Linux Kernel bug around using this receiver on an XHCI (USB 3) port and newer versions of the Linux Kernel. It probably works fine on USB2 ports. (?)

Here is the lengthy thread about this issue, where the developers and a lot of other people have been working to sort out this issue.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1039143

Props to Jelle Foks for figuring this out. Had been driving me insane for ages.

As I leave my receiver in all the time, I run this script at boot, and resume-from-sleep for an "automatic" fix and it has been working great the last little bit.

Let me know if this works.