Are all of your usb devices disconnecting periodically, for seemingly no reason? Here's the fix
Posted by lasercat_pow@reddit | linux | View on Reddit | 49 comments
Turns out this happened due to some well-meaning but ill-conceived code which made it to the linux kernel. The idea is that it saves power by disabling usb devices. The reality is, it wreaks havok for desktop users.
To see if this is affecting you, execute this command:
cat /sys/module/usbcore/parameters/autosuspend
If you get back a
2
then you're affected. If you don't notice anything wrong, you don't need to do anything. But if, like me, your keyboard and mouse, etc stop working sometimes, you can disable it for now by simply writing a -1 to that file, as root:
echo -1 > /sys/module/usbcore/parameters/autosuspend
to make the change permanent, edit
/etc/default/grub
and add
usbcore.autosuspend=-1
to the end of the command in
GRUB_CMDLINE_LINUX_DEFAULT
don't forget to
sudo update-grub
after (thanks /u/Zenklops)
Swecar@reddit
Hi,
Sorry for joining in on an old post, but I'm experiencing this exact issue. As it happens I have been running Arch (installed though a GUI) for a while but never really experienced any problems so I have not had to do deep dives into debugging and problem fixing. Hence I still consider myself pretty new to Arch and definitely have next to no knowledge of the deep workings.
I just essentially did this solution after searching the web for a while and running
tr ' ' '\n' < /proc/cmdlinereturns
BOOT_IMAGE=/boot/vmlinuz-linux-zenroot=UUID=cec434df-5ca4-4d42-a5c0-0428fbc41377rwquietloglevel=3audit=0nvme_load=yesusbcore.autosuspend=-1which shows that the autosuspend=-1 have been added to the grub default command. Additionally
returns -1. However, the issue still persists. No clear error message (to me with limited knowledge in the details) in the logs (journalctl, dmeg, udevadm monitor) but for the expected chatter of usb devices dis- and reconnecting.
My current kernel version is
7.0.3-zen1-2-zen.Any tips on where I can continue looking?
F3yce@reddit
Hi guys! I hope someone reads this soon! I'm getting super-duper annoyed at this point, so I NEED HELP!
Here are the details:
I'm using a laptop (ASUS g14 2021, Ryzen5900HS, 3060/6GB, 24GBRAM, 2TBNVME) with dual boot Win11 and Bazzite.
I had 3 main partitions (not mentioning the system-related ones):
- Win11OS NTFS 200GB,
- a secondary NTFS for Win11 around 1,7TB, and
- a BTRFS for Bazzite 100GB.
All was working fine, than i decided to get more space for Bazzite for games, so my very first idea was using win11 disk makager to shrink the second NTFS drive, and turn it into a secondary btrfs for Linux.
But windows told me that I can only shrink around 77GB, because of some system necessary files in the way.
Sooooo I went to Gparted live from and USB stick and tried the same, with 200GB this time.
After several hours (approx. \~4.5h) the shrinkage concluded, BUT than ALL drives marked with exclamanation marks, and after I exited Gparted, i got continuous SQUASHFS errors.
So after a restart, right now, I CANNOT use ANY USB peripherials besides the built-in touchpad and keyboard, because whatever I plug in it keeps disconnecting and hangs the OS. The funny thing is, it looks like it does not affected flash drives, because those are mounted/recognized properly.
I tested both Win11 and Linux, the issue persist the same way i described above.
I tried the above fix by the OP, but faced several problems during it, like "permission denied" and "sudo: update-grub: command not found"
Please bear with me I'm NOT a Linux expert, but i have enough experience to easily to follow clear instructions, and execute them properly if anyone could point me at the proper direction!
Just someone please do so!
lasercat_pow@reddit (OP)
Since this issue only happened after you changed the partitioning, it stands to reason it's different from the issue I was describing in this post.
A good first step would be to read your logs:
also:
and hit G (capital g) and wait a bit, then page up and see if you can find any clues about what happened.
Probably a reinstall would fix this, but I would advise backing up your files first. I think fucking up your system with a repartition is kind of a rite of passage with linux users, so you're definitely not the first one to do something like this.
F3yce@reddit
I'm completely aware that you stated a bit different situation, but at first my devices produced the very same symptoms about USBs, and since after a few hours of search this was the closest to my issue, so I took the bravery to write here and not starting a different thread, sorry then.
Meanwhile I bakced up all my data, i did a "little" troubleshooting, and somehow my laptop's cooling pad - that passes through a single USB - messes up alone the whole USB scene. In windows if I connect with another device plugged in the pad and then and disconnect it - all other devices looks like working properly. But in linux if I connnect it with another device plugged in it, it messes up completely every USB device, and renders everything unusable besides touchpad, only restart makes them come back.
I tried all 3 commands, the 1st resulted in : "/var/log/syslog: No such file or directory"
Here are the other 2 results.
https://drive.google.com/file/d/1205SXlR2Jecxzyt9teDrmu3BnHNy1pqj/view?usp=drive_link
https://drive.google.com/file/d/1g5VtAjgS1sJoVTLKYVus0WCSzuE8ydrN/view?usp=drive_link
I couldn't paste everything what journalctl listed out, I mean, from right after the partitioning, but it contains what happens when i plug in the pad. Not sure If you could read out any important data of it.
Also I'm getting a feeling not only the USBs messed up but maybe a few other things, since the systems felt a little bit less stable since the issues started.
So if you can't say anything viable to me (absolutely no offense), tomorrow I may wipe my NVME and start building up the whole dual boot from scratch, since I'm getting pretty annoyed and upset about this, and also it has been a good year since i did a reinstall, and maybe it's a sign to do it again (I do it averagely once a year anyways).
ThinkLocalActLocal@reddit
Tried to do this for a fix but got "permission denied" now what?
ThinkLocalActLocal@reddit
ran sudo -i and this seemed to work ok now, fwiw. thanks folks
lasercat_pow@reddit (OP)
glad you got it sorted. I was banned for a bit there for wishing ill against the gestapo -- so it goes in the modern corpo media I guess
ThinkLocalActLocal@reddit
reading upthread and seeing bits about sudo, etc. I'll keep trying
sheet-lightning@reddit
You absolute legend - that fixed my problems self-hosting Immich! Thank you!
After about 12 hours the power was being cut to the USB ports, and my older photos are stored on an external USB drive (unpowered). So the container kept falling over when it couldn't reach the drive.
I can kind of see why this is in the linux code for the desktop edition (I'm using Mint) - and probably people using Server editions will not have this problem. But I'm a normie and need that GUI - no server editions for me 😂
thankmelater4321@reddit
Could you share what your full grub command nano editor page looks like please? Mine was pre filled with:
GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash”
Also what should I expect to see when I run the cat command again?
I still get the result of 2
IbilisSLZ@reddit
The exact answear is few comments below (I recon what OP wrote was notr verbose enough).
Basically change your:
GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash”
to
GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash usbcore.autosuspend=-1”
No_Masterpiece7686@reddit
same issue rn buton windows lmfao :]
lasercat_pow@reddit (OP)
Power settings in Windows can usually sort that unless it's a weird bios setting, but it's probably not the bios.
No_Masterpiece7686@reddit
thing is I've tried so many different things (powers settings, reinstalling drivers, reinstalling windows reinstalling all apps that come up in event viewer and a couple more stuff im too lazy to note) before asking on reddit in r/windowshelp. on there someone said to reset the bios which seemed to have fixed a lot of stuff BUT the thing I was looking for. It's been bugging me out for so long. plus its not only usb that decides to shit itself, its everything(LAN, apps freeze, wallpaper and then also usb)
sorry for this long ass rant but its been bugging me forever now lmao :,]
lasercat_pow@reddit (OP)
Maybe this will help? https://support.microsoft.com/en-us/topic/usb-devices-may-stop-functioning-correctly-when-multiple-devices-connected-to-the-same-usb-hub-go-into-selective-suspend-99b5ae85-69cb-4f94-adce-5698ba44804f
It's a registry setting
No_Masterpiece7686@reddit
I currently dont have access to my system and I will try this once I can actually get to it. kinda weird how you are the most helpful out of all the people I asked and the first one to show me a support page regarding a similar issue.
r/windowshelp ain't shit, my post is dead😭
thanks tho, will try that once I can.
JC5MB@reddit
For Fedora there are two minor differences:
instead of ```GRUB_CMDLINE_LINUX_DEFAULT``` the name is ```GRUB_CMDLINE_LINUX```
Instead of ```sudo update-grub```, use ```sudo grub2-mkconfig -o /boot/grub2/grub.cfg```
Seeared@reddit
Literally clueless, never done anything like this before so sorry about the questions
So after adding usbcore.autosuspend=-1
It looks like
GRUB_CMDLINE_LINUX_DEFAULT=* loglevel-3 quiet splash plymouth.ignore-serial-consoles module_blacklist=tpm log_buf_len=4M and_tonnu=off andgpu.gttsize=8128 Land-speed _dev=1 audit=® fbcon-vc:4-6 fbcon=rotate: 1"usbcore.autosuspend=-1
I just pasted it on the end after everything else, but it isn’t highlighted purple like everything else.
If that placement is correct, how do I save this change/where do I type “sudo update-grub” to apply the change?
Seeared@reddit
Have this issue on steam deck, checked and got back a 2.
When I try to enter the fix, I get hit with “permission denied”
Any work arounds?
lasercat_pow@reddit (OP)
You need to use sudo to escalate your privileges
Seeared@reddit
Immediately realised that, im an idiot lmao. Thank you for responding so quick 3 years later tho!
AwwesomeDerg@reddit
Bruh the post is 3 years old. The problem is even older. Yet here I am with all my usb ports stop working 2-4 times a day, reading this in 2025. They still haven't fixed it.
lasercat_pow@reddit (OP)
Have you tried using xset? Ie:
I also like to edit systemd logind so my lappy keeps running when the lid is closed:
AwwesomeDerg@reddit
Oh, "they" I mean those who code the kernel. I just disabled autosuspend and don't know yet if it worked, need more time to be sure. Thank you in advance! God bless people like you.
Tough-Habit-3867@reddit
Bump
Xijit@reddit
So I tried this with my Steam Deck because it isn't talking to any devices I plug in to the USB port: I get power delivery into and out of the Deck, and I get video out, but no ethernet or peripheral function.
The CAT command line returned "2".
The Echo line produced a permission denied message, that sudo couldn't get around.
So I went for the Grub Default option and was able to get autosuspend permanently set to -1.
But that still didn't solve the issue ... I inspected the pins as best I could with a magnifying glass, but none of them look damaged or shorted.
Any other advice on a potential solution?
Powertix@reddit
Did you eventually found a solution? I'm on the same boat. It gets frustrating on mouse and keyboard.
NoBoysenberry2620@reddit
Take my upvote. Thank you so much <3
r__warren@reddit
This is not working on my Ubuntu Mate 22.04.2 install. I am using the MM731 wireless mouse with 2.4Ghz receiver. The mouse will randomly freeze even with this fix on the Grub command line.
Shaffle@reddit
This has been causing me some headaches, so I checked my syslog after a disconnect.. looks like the
fwupdservice ran just before everything disconnected. I'm gonna disable that service and see if it resolves the issue.Prosciuttolo@reddit
Old thread but I had the same issue. Cooler Master mm731, and it kept disconnecting randomly on my Linux mint and debian machines, while using the 2.4 GHz mode with dongle.
I tried this method but it didn't work. I think I finally found a solution, albeit it requires utilizing windows.
Basically what I did was:
So far it looks like the mouse memorized the setting and it hasn't disconnected since. I'll keep testing and update this post if something new happens.
canadianrooster13@reddit
any ideas why my USB speaker keeps disconnecting on idle and reconnects when I touch the computer again?
i tried your fix and
shows -1.
but it is still happening. It seems to have improved, such as the speaker will "wake up faster upon movement", but something is still disconnecting after some idle time.
lasercat_pow@reddit (OP)
Try changing these two lines in
/etc/systemd/logind.conf:
and
canadianrooster13@reddit
Thanks for your response and sorry for the follow-up noob question -
All commands in /etc/systemd/logind.conf seem to be inactive. below are the ones similar to the ones you mentioned:
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=suspend
HandleLidSwitchDocked=ignore
LidSwitchIgnoreInhibited=yes
should I add a
[ LidSwitchIgnoreInhibited=no ]
and a
HandleLidSwitch=ignore ]
without the # in this document? And do I need a grub update + reboot afterwards?
lasercat_pow@reddit (OP)
Uncomment them (remove the leading '#') and reboot -- no grub update needed here thankfully
canadianrooster13@reddit
Thanks again for the clarification.
The solution did not work.
Speculating, I don't think the issue is related to the lid switch (I actually leave the lid closed all the time and use an external HDMI monitor.
Something is cutting off the usb speaker after some idle time and as soon as I shake the mouse and the monitor wakes in the lock screen, the speakers wake up again.
I leave my speakers playing ambient music while working, so the constant cutting off is distracting.
lasercat_pow@reddit (OP)
These might help: https://www.audiosciencereview.com/forum/index.php?threads/how-to-disable-power-savings-in-linux.40511/
canadianrooster13@reddit
My friend, you should rename to laser GOAT!
editing the parameter below fixed it for me.
cat /sys/module/snd_hda_intel/parameters/power_save
thanks a lot!
lasercat_pow@reddit (OP)
Awesome! Glad I could help.
noix81@reddit
I still have the same disconnection problem. Have you found a solution to the problem?
canadianrooster13@reddit
Still persisting unfortunately.
WoodenLittleBoy@reddit
This solution did not fix my problem, but it did break all of my NFS shares.
(Beelink S12 and Yottmaster JBOD)
55555-55555@reddit
Found this and I'll say thank you for the fix.
drsort@reddit
Thank you friend. <3
AdhesivenessMassive2@reddit
I just switched of powersaving for USB devices problem fixed 😊👍
DADDYPORSCHE@reddit
Can you let me know how you did it? cause If I remove laptop charger then it id disabling all my usb ports
Taso_I@reddit
i keep getting "permission denied" :(
lasercat_pow@reddit (OP)
try prefixing those commands with sudo, or acquire a root shell first with
su rootDADDYPORSCHE@reddit
su root shows su: Authentication failure, and just using sudo doesnt work