34

My bluetooth mouse won't stay connected. This happened recently in 16.04, and I subsequently upgraded to 18.04, but the problem persists.

From bluetoothctl you can see everytime I move the mouse it connects, then just disconnects immediately.

$ bluetoothctl
Agent registered
[bluetooth]# list
Controller 18:5E:0F:99:9B:EC brendan-HP-ENVY-m7-Notebook [default]
[bluetooth]# devices
Device 00:00:00:00:51:00 Bluetooth Mouse
Device 68:64:4B:3B:C7:E4 68-64-4B-3B-C7-E4
[CHG] Device 00:00:00:00:51:00 Connected: yes
[CHG] Device 00:00:00:00:51:00 Connected: no
[CHG] Device 00:00:00:00:51:00 Connected: yes
[CHG] Device 00:00:00:00:51:00 Connected: no
[CHG] Device 00:00:00:00:51:00 Connected: yes
[CHG] Device 00:00:00:00:51:00 Connected: no
[CHG] Device 00:00:00:00:51:00 Connected: yes
[CHG] Device 00:00:00:00:51:00 Connected: no

I've followed other threads suggesting to update to the latest bluez5 version, but no dice....

Any help would be appreciated.

graham
  • 10,436
brercia
  • 441
  • What is the output of grep -i usb /var/log/syslog – stumblebee Sep 14 '18 at 03:51
  • @brercia Have you already found a solution? I have a similar problem: https://askubuntu.com/questions/1130207/bluetooth-mouse-keyboard-disconnect-constantly-ubuntu-18-04 – sunwarr10r Apr 01 '19 at 08:57
  • @saitam Unfortunately none of the methods below worked for me. Ive since switched back to mouse with a tail. – brercia Apr 16 '19 at 22:02
  • Get the bluetooth manager from the app store, it might show you some information you was missing – sunwarr10r Apr 17 '19 at 05:08

6 Answers6

30

I had the same issue on 18.04 with my Microsoft Sculpt Comfort Mouse and tried all the steps mentioned here and elsewhere, but nothing helped. It constantly disconnected & reconnected after sleep or a reboot.

I finally found a solution on reddit:

Set UserspaceHID=true in /etc/bluetooth/input.conf and restart the bluetooth service (or reboot). After that, mouse stayed connected finally.

https://www.reddit.com/r/archlinux/comments/8ywe3q/bluetooth_mouse_cannot_reconnect_after_disconnect/

  • The patch which integrated the setting UserspaceHID which includes some reasoning what it is good for: https://www.spinics.net/lists/linux-bluetooth/msg47685.html – SimonSimCity Jul 23 '20 at 07:19
  • I have tried the WiFi Powersave = 2 fix, and the Idle Timeout = 0 fix, et cetera, but the UserspaceHID=true in /etc/bluetooth/input.conf fix has been the only one working consistently. Thank you. I'm using a Dell Precision M6800 -- Network Controller: Intel Wireless 7260 (rev bb) (via lspci). This issue appears to be persistent among Dell users. – rellimmot Jul 29 '21 at 15:39
  • 1
    This didn't work for me on 20.04.3 with logitech triathalon mouse – Brent Sandstrom Nov 11 '21 at 14:12
  • 1
    This worked for me on 22.04 (Pop!OS) with a Microsoft Surface Mouse. But restarting the Bluetooth service was not enough. I had to reboot also to stop the disconnects. – MidnightJava Jul 12 '23 at 14:00
  • Worked for me with a Sony WH-1000XM3 with Ubuntu 22.04 (at least for now) – Marcel Nov 24 '23 at 17:02
14

I had the same problem with a Logitech M535 under 18.04. Pairing it differently, via terminal, is what resolved it for me:

  • Unpair everything
  • Set the mouse to discoverable
  • run bluetoothctl (list the MAC address, of your mouse, a number like 00:1F:28:FE:04:82)
  • run pair <MAC> (within bluetoothctl which paired the device)

You might also want to trust the device with

trust <MAC>

When done, just type quit

Restart your computer, your mouse should now connect automatically after sleep or restart.

Please also note

Before all of that, I also updated bluez from 5.48 to 5.50, it is known to bring some fixes, I have no idea if it's needed but it certainly can't hurt:

First of all, open the terminal and check the current bluez version in your system with the following command:

dpkg --status bluez | grep '^Version:'

In my case, I received version: 4.48-0ubuntu0ppa. Add the following repository to get the last version of bluez (5.50 as of Sept 28, 2018):

sudo add-apt-repository ppa:bluetooth/bluez
sudo apt-get update

After running the command you should be able to update to bluez 5.50 via:

sudo apt upgrade

The following links contain more details about the bugs in bluez 4.48 and potential solutions: bluez bug description and bluez bug solution.

Travis
  • 413
  • Please do not repost the same answer to multiple questions. If the questions are all similar enough to each other, please flag those questions as duplicates of this one, but please don't repost the same answer to many questions. – Thomas Ward Sep 28 '18 at 15:53
  • 1
    Ok, sorry, I did not knew that, I am pretty new. But to be fair, the problem is resolvable by the same procedure. – Travis Sep 29 '18 at 07:55
  • Thank you for posting this answer! Can confirm this helped me with exactly same issue with my M337. The key thing seems to be to reboot after trusting the mouses mac, if I suspended the laptop before rebooting the mouse would still not reconnect, but after rebooting where-ever bluez persists that trust setting seemed to have been done. – Maks Apr 17 '19 at 23:15
  • Thanks! worked for me on 18.04 when trying to connect to Boise speakers – MikeDoho Jan 05 '20 at 22:36
3

Same problem here - fixed as described below:

  • Ubuntu 18.04.2 (to be complete Dell Latitude 5290 2-in-1 - I think/from other postings irrelevant)

  • Bluetooth Mouse (to be complete HP Z5000 - also irrelevant what I saw so far)

Paired using graphical interface yields the following:

  • Mouse works, however, as soon as the laptop falls asleep/reboots or even sporadically mouse does not work any more - re-animated by pressing the connect button and hitting the "System Settings -> Bluetooth -> HP Bluetooth Mouse Z500 -> Connection" button, one to several times.
    • Could also reproduce behaviour with manually disconnecting mouse in "bluetoothctl". After move mouse tries to connect, falls back immediately.

After following the procedure described above:

$ bluetoothctl ... [NEW] Device xx:yy:zz:...:www HP Bluetooth Mouse Z5000

[bluetooth]# remove xx:yy:zz:...:www [bluetooth]# scan on [NEW] Device xx:yy:zz:...:www HP Bluetooth Mouse Z5000 [bluetooth]# pair xx:yy:zz:...:www [bluetooth]# trust xx:yy:zz:...:www [bluetooth]# connect xx:yy:zz:...:www

Everythings fine - even without hacking /etc/bluetooth/input.conf Works like a charm on reboot / sleep / manually "disconnect" in "bluetoothctl"

Hope this helps, Klaus

Maybe somebody has more insight in what's the diff between pairing via GNOME system settings and with the "bluetoothctl" command line tool.

klar
  • 161
  • I have the same problem - on a Dell XPS 15 with a Logitech MX Master. This sounds different to the original problem of the mouse constantly disconnecting and reconnecting. Could be a problem with Dell hardware? – Tom Anderson Nov 30 '20 at 09:37
3

I had this same problem (in my case, on Ubuntu 20.04 and up) for months and finally found a solution that works permanently. There are lots of recently reported issues with bluetooth devices staying connected and needing to constantly restart the bluetooth service/stack to get it work again (and sometimes wont work until a reboot). I have no idea if/how/when this got introduced, but the solution makes sense now, and explains why it was so hard for me to find a solution that worked.

So the core issue seems to be related to combined bluetooth/wifi cards, in my case from Intel. The surprising bit is that it has to do with WiFi power management, and not power management related to bluetooth or USB. I noticed my Wifi would also stop working on occasion and decided to start looking into that. To my surprise, I noticed there was some reports of people having this issue with Bluetooth and WiFi.

Disabling WiFi power management in NetworkManager fixed both issues for me:

https://askubuntu.com/a/1077559/364896

I was able to remove all other changes/settings I tried before to fix this problem, and none of them were needed except this. Bluetooth and Wifi are both rock solid (3 days w/ no issue at all), and im able to enable all other power saving features. For some reason the power saving features in TLP related to wifi all work fine, its just the power saving mode that NetworkManager uses that seems to cause the trouble.

My guess here is that NetworkManager may change powersaving state too often. Although this would only break WiFi on occasion, it would knock out bluetooth constantly after just a small period of inactivity. The wifi and bluetooth share some parts of the radio, so I'm assuming the bluetooth state was effected more easily. I'm still using wifi powersave through TLP, but its enabled/disabled only when I change from battery to power, and it seems to cause no issue.

0

I'm no techie so didn't fancy editing files so just found the Bluetooth manager I was used to (Blueman for GNOME using bluez D-BusBackend) in Ubuntu Software installed it then found & setup my mouse in a jiffy, after using it for a while or at next reboot you will be asked if you trust this devise just click always trust & thats it & ignore the manager that comes with Ubuntu from now on, it worked perfect for me anyway and at 63 if I can do it anyone can lol

0

Run :

sudo apt-get install pavucontrol pulseaudio-module-gconf pulseaudio-module-zeroconf
Arun Joseph
  • 125
  • 5