13

How can we disable USB autosuspend on Ubuntu 18.04 for all USB devices and/or specific ones?

Previous questions on this subject are outdated (How can I disable usb-autosuspend for a specific device? and How to disable auto power off of usb devices like usb mouse?)

Edit: This question is completely unrelated to Two USB ports stopped working because my USB ports have not stopped working completely, but apparently and momentarily suspended for just a few (mili)seconds

3
  • 1
    Possible duplicate of 2 usb ports stopped working Nov 13, 2019 at 19:35
  • @RaelGugelminCunha, if possible, please remove the duplicate flag Nov 13, 2019 at 19:48
  • @paulo-coghi-reinstate-monica exactly same issue (disable auto suspend for usb devices), exactly same fix (disable it on grub). Nov 13, 2019 at 23:16

4 Answers 4

13

Update, 20201014: Just received validation (see comment from "Blackbird") that this solution continues to work in 20.04. Thanks Blackbird for the useful feedback!

This reference seems to be authoritative on disabling usb autosuspend.

Although the USB autosuspend is a feature designed to preserve battery life, its' 18.04 default is "enabled", whether or not the device Ubuntu is being installed on even has a battery.

Further, in order for autosuspend to be more help than harm, it appears that the USB device's driver needs to support autosuspend. Hence all the posts- yours' included- seeking to disable the "feature".

In 18.04 on my device, I scripted disabling autosuspend persistently in /etc/default/grub like so:

sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/&usbcore.autosuspend=-1 /' /etc/default/grub

update-grub

systemctl reboot

The sed expression just prepends "usbcore.autosuspend=-1" with a trailing space after the initial quote mark to ensure it always matches whatever your particular GRUB_CMDLINE_LINUX_DEFAULT options look like.

If you execute cat /sys/module/usbcore/parameters/autosuspend after a reboot, you'll remark the "-1" preference (disabled) is retained.

Anyhoo, hope this helped you out-

16
  • 1
    This simply did not work for me. My USB device (Yamaha eletric piano) still quits after about 30 seconds. The referenced article, while informative, does not make clear how to disable autosuspend altogether.
    – Paul A.
    Oct 24, 2019 at 13:07
  • 1
    The fact that the piano works fine in Windows 10 (same machine) and recovers briefly after a reboot certainly indicates that the fault does not lie with the piano. I believe that autosuspend can be done selectively -- which might have something to do with the fact that the USB hard drive doesn't autosuspend but the piano apparently does. I also read somewhere that enablement of autosuspend was only recently set to default to enabled.
    – Paul A.
    Oct 26, 2019 at 0:57
  • 4
    This solution also works for Ubuntu 20.04.
    – Blackbird
    Oct 14, 2020 at 11:33
  • 3
    @Blackbird I updated my answer to include your feedback. Really appreciate you taking the time to provide useful feedback to improve the answer!
    – F1Linux
    Oct 14, 2020 at 11:42
  • 2
    Hi @pishpish- In regards to not responding to Humpity, my answer- the only answer- to this question is GRUB specific. I made no warranties for any other configuration. Humpity wanted an answer for non-GRUB. There's nothing stopping you or somebody else adding a NEW answer for Humpity. Whenever I solve a problem for myself and I feel the solution might benefit a wider audience, I knowledge share to avoid a gazillion folks- OK, 12,000 users at time of writing- all solving the same problem individually.
    – F1Linux
    Apr 27, 2021 at 11:14
1

The solution above DID NOT help in my case (Ubuntu 21.10), but I found working solution for me: https://hackology.co.uk/2015/selective-usb-power-saving-linux-laptop/

From comments by the author:

Create a file for udev like this:

sudo nano /etc/udev/rules.d/92-usb-input-no-powersave.rules 

with the content of:

ACTION=="add", SUBSYSTEM=="input", TEST=="power/control", ATTR{power/control}="on"
0
1

Change this file /etc/default/grub and edit this line

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.autosuspend=-1 pci=noearly acpi_no_static_ssdt acpi_sleep=nonvs amd_immu=force_isolation"

This solution worked for me.

0
  1. Create a file:

    sudo nano /var/lib/gdm3/.config/92-usb-input-no-powersave.rules
    
  2. with the content of:

    ACTION=="add", SUBSYSTEM=="input", TEST=="power/control", ATTR{power/control}="on"
    
  3. Run

    sudo chown gdm:gdm /var/lib/gdm3/.config/92-usb-input-no-powersave.rules
    
1
  • 1
    @Genere - hello and welcome to askubuntu; please try to provide more explanation; why run these commands? (and, most importantly, what they are doing) maybe add some references :) keep it up! May 13, 2022 at 19:16

You must log in to answer this question.

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