Linux mouse freezes after suspend

24,603

Solution 1

This issue goes back at least a couple of years. It's a problem for a lot of Asus owners, but it's not entirely specific to Asus devices. Also, it's not Debian-specific — though in your case both Ubuntu and Mint have Debian roots.

It's a tricky one because it seems everyone's mileage varies with each proposed solution (and they all have slight hardware variances). There are countless threads trying to solve it.

Notable bug threads on Launchpad (depending on your Asus model):

Applicable bug thread on Kernel.org:

Assuming you don't want to patch your kernel, there are a couple potential runtime solutions you can try.

(Note: You can open a terminal with Ctrl+Alt+T)

Disable/Enable the Mouse Driver:

You can remove and then re-insert your mouse driver module with the following commands:

sudo modprobe -r psmouse
sudo modprobe psmouse

Disable/Enable via Xinput:

Find your trackpad ID with the following command:

xinput --list

Once you have your device ID—I'll call it 12 for this example—try disabling and enabling the device with:

xinput --disable 12
xinput --enable 12

(Replace 12 with your trackpad's device ID)

Alternative:

As an aside, you may want to try hibernating instead of suspending. Supposedly the problems aren't as prevalent with hibernation.

Solution 2

I can confirm a similar issue with my touchpad on HP ProBook 450 G6 with Ubuntu 18.04, it was very laggy after suspend.

What worked for me: create /lib/systemd/system-sleep/touchpad:

#!/bin/sh

case $1 in
  post)
    /sbin/rmmod i2c_hid && /sbin/modprobe i2c_hid 
  ;;
esac

make file executable chmod +x /lib/systemd/system-sleep/touchpad and test (suspend computer and wake-up again)

Solution 3

What I do to restart the touchpad driver is similar to what Tom Hale suggested. I created a script called touch_restart.sh:

#!/bin/bash
$sudo rmmod i2c_hid && $sudo modprobe i2c_hid

and then you can always execute it quickly with: echo "su_pass"|sudo -S sh touch_restart.sh

Also, it seems that disabling "Disable touchpad when typing" increases the periods between each touchpad freeze (it freezes very often on my Asus laptop).

Solution 4

On Lenovo v145 15AST Ubuntu 20.04 with Logitech Bluetooth mouse, I created script

/lib/systemd/system-sleep/KickPebbleMouse.sh

Which uses rfkill

#!/bin/sh
# put this in /lib/systemd/system-sleep/
# kick the bluetooth because mouse is doesn't work after suspend.

case $1 in
    post)
        sleep 1
        btid=`rfkill --output ID,DEVICE| grep hci | sed -n -E 's/^ //;1p' | cut -d" " -f1`
        rfkill block ${btid}
        sleep 2
        rfkill unblock ${btid}
    ;;
esac

edit1: --- Added sed into pipline to remove leading space when ID's are less than 2 digits (ie <10)

edit2: --- Since the upgrade of the kernel (which I installed 11-Nov-2020) also included an update of the firmware, this solved the Stuck mouse after suspend problem, But I still can't use the wifi that is builtin to the same chip. [rtl8821ce]

See the Kernel and Firmware version change below.

Previous kernel boot:

$ journalctl -b -3 |grep -i -e "Linux version \| bluetooth.* version"
Nov 04 10:24:52 lenou2004 kernel: Linux version 5.4.0-52-generic (buildd@lgw01-amd64-060) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #57-Ubuntu SMP Thu Oct 15 10:57:00 UTC 2020 (Ubuntu 5.4.0-52.57-generic 5.4.65)
Nov 04 10:24:53 lenou2004 kernel: Bluetooth: hci0: RTL: rom_version status=0 version=1
Nov 04 10:24:54 lenou2004 kernel: Bluetooth: hci0: RTL: fw version 0x826ca99e

Newer kernel boot:

$ journalctl -b -2 |grep -i -e "Linux version \| bluetooth.* version"
Nov 11 11:38:06 lenou2004 kernel: Linux version 5.4.0-53-generic (buildd@lcy01-amd64-007) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #59-Ubuntu SMP Wed Oct 21 09:38:44 UTC 2020 (Ubuntu 5.4.0-53.59-generic 5.4.65)
Nov 11 11:38:08 lenou2004 kernel: Bluetooth: hci0: RTL: rom_version status=0 version=1
Nov 11 11:38:08 lenou2004 kernel: Bluetooth: hci0: RTL: fw version 0x829a21e4
Nov 11 11:44:32 lenou2004 kernel: Bluetooth: hci0: RTL: rom_version status=0 version=1
Nov 11 11:44:32 lenou2004 kernel: Bluetooth: hci0: RTL: fw version 0x829a21e4

edit3 --- The original problem has returned, I haven't kept track when it first occurred. Current Kernel/firmware:

journalctl -b  |grep -i -e "Linux version \| bluetooth.* version"
Dec 12 11:36:25 lenou2004 kernel: Linux version 5.4.0-58-generic (buildd@lcy01-amd64-004) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #64-Ubuntu SMP Wed Dec 9 08:16:25 UTC 2020 (Ubuntu 5.4.0-58.64-generic 5.4.73)
Dec 12 11:36:27 lenou2004 kernel: Bluetooth: hci0: RTL: rom_version status=0 version=1
Dec 12 11:36:27 lenou2004 kernel: Bluetooth: hci0: RTL: fw version 0x829a21e4
Share:
24,603

Related videos on Youtube

jowijowi
Author by

jowijowi

Updated on September 18, 2022

Comments

  • jowijowi
    jowijowi over 1 year

    Today I finally decided to switch from Windows to Ubuntu. I fully install Ubuntu, but everytime my notebook goes in sleepmode and wakes up my mouse will not work anymore. When I do a reboot it works fine until I let it sleep (even if it's for 10sec).

    So I tried switching to Mint, however even with Mint I had the same problem. I have been trying to fix it all day without success.

    Notebook: Asus laptop

    On a similar forum post this was the fix:

    sudo apt-get install --reinstall xserver-xorg-input-all
    

    However this did not work for me.

    • lacostenycoder
      lacostenycoder about 2 years
      I'm having this problem with left mouse button dies after sleep. None of the answers here worked for me. Did any for you?
  • cheneym
    cheneym about 6 years
    Disable/Enable the Mouse Driver worked for me (sudo modprobe -r psmouse / sudo modprobe psmouse). Hint: I added this to my ~/.gnomerc so it is called every time I log in.
  • LedHead
    LedHead over 4 years
    Just got an HP Probook 440 G6 and installed Xubuntu 18.04, and had the same issue. Blindly followed these instructions with zero attempt at understanding why :) Works great now! +1
  • Arya
    Arya about 4 years
    On ubuntu.18.04, xinput --disable 12 and xinput --enable 12 worked for me.
  • Shashank Hegde
    Shashank Hegde about 4 years
    Dell Latitiude. xinput --disbale 11 and xinput --enable 11 worked for me. Ubuntu 16.04! Thanks a lot.Was searching for this answer for almost a week
  • Ryan
    Ryan over 2 years
    Thanks for your answer, but I couldn't get this working. I wonder if you might know the answer to this: askubuntu.com/q/1358360/48214
  • Ryan
    Ryan over 2 years
    I really appreciated this answer, but unfortunately none of these steps fixed my scroll wheel issue. Would you mind taking a look? I'd appreciate it! askubuntu.com/q/1358360/48214
  • Ryan
    Ryan over 2 years
    Thanks for your answer, but I couldn't get this working. I wonder if you might know the answer to this: askubuntu.com/q/1358360/48214 I appreciate you taking a look.
  • Ryan
    Ryan over 2 years
    Thanks for your answer, but I couldn't get this working. I wonder if you might know the answer to this: askubuntu.com/q/1358360/48214 I appreciate you taking a look.
  • X Tian
    X Tian over 2 years
    The bluetooth began working again after system wake-up from sleep after a few kernel upgrades, so I disabled my script, and since about 6 weeks ago the Wifi portion of that chip started working after an upgrade to Linux 5.11.0 (still Ubuntu but now 20.04.3).
  • Mark Stewart
    Mark Stewart over 2 years
    Thanks for your answer; just curious, did you have that problem before, and your answer worked, or is it an educated guess?
  • gilad barak
    gilad barak over 2 years
    Worked for me. should work for you too, let me know if not.