Announcement

Collapse
No announcement yet.

USB stops working after relogin and other random times.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    USB stops working after relogin and other random times.

    Hi!
    First of all - I am not super familiar with Linux. Used mostly windows, but after announcement of Recall feature decided to ditch it completely and finally move to Linux. I do have some experience with Raspberry Pi's but I want to learn more. So now, to the issue:
    Sometimes, randomly, my USB stops working. My mouse and keyboard are connected to USB hub from TP-Link, model UH720. Additionally, I have aliexpress random keyboard with some programmable keys and 2 knobs to control volume and zoom mostly. Extra keyboard is connected straight to Motherboard where keyboard and mouse are wireless and their receivers are connected to the hub. Hub is powered from mains and connected to USB 3 port in my motherboard.

    I've started to see some small issues last week, when sometimes when typing not all the letters would show up. Keyboard is wireless, but I've had it for around a year with the same setup and had no issues like that on Windows.

    I recently noticed that sometimes randomly USB hub will stop working and the only way to make it work is to restart whole PC. When restarting, it doesn't want to shut down normally, the system will start shutting down but then throw some errors on the black screen during the sequence.
    From what I could read about it, it seems it's in some kind of loop of trying to contact USB devices and just can't reach them. I'd post a picture of it, but can't really replicate the fault, but it happens at least once a day, sometimes 10 minutes after I relog to the system, sometimes it happens randomly, even when actively using the USB. The issue involves everything connected through USB as when I get the receiver and try to connect it straight to motherboard - still no response. Even wired keyboards, nothing.

    Any ideas how can I troubleshoot that issue, do you require any more information or how do I even proceed from that?

    My PC Specs:
    AMD Ryzen 7 3700x, Asus TUF X470-Plus Gaming, Radeon 6750XT, 32GB RAM.

    When installing Kubuntu I had the black screen issue and disabled quiet splash.
    Additionally, did the steps recommended after install here:
    https://www.kubuntuforums.net/forum/...s-installation

    Thank you for your help!

    #2
    Is it actually "random" or is it happening when power saving kicks in?

    I would start by checking dmesg output the next time it happens and see if anything looks related.

    You could also try to adding usbcore.autosuspend=-1 as a boot option and see if that helps.​

    Please Read Me

    Comment


      #3
      Originally posted by oshunluvr View Post
      Is it actually "random" or is it happening when power saving kicks in?

      I would start by checking dmesg output the next time it happens and see if anything looks related.

      You could also try to adding usbcore.autosuspend=-1 as a boot option and see if that helps.​
      Hi, yes, it just happens totally randomly, today it happened when I was playing game, around 30 mins or 1h after I turned on my PC. I did not logged out or anything. It always starts with keyboard not detecting some clicks. Problem is, I can't check much when it happens as it cuts off my keyboard and mouse. Even if I keep them connected directly to USB on motherboard it just stops working. Only thing I can do at this time is to press power button on my PC for it to shut down.

      So it happened today again and I managed to take a quick photo:
      https://ibb.co/L6rYZJZ

      Couple of lines on the bottom just keeps going like that and prevents system shudown. Only thing I can do at this point is to unplug PC and restart it.

      Comment


        #4
        dmesg content is saved and time stamped. Once you reboot, open Konsole and enter:

        sudo dmesg

        Review the output for thing referencing USB.

        Please Read Me

        Comment


          #5
          Originally posted by oshunluvr View Post
          dmesg content is saved and time stamped. Once you reboot, open Konsole and enter:

          sudo dmesg

          Review the output for thing referencing USB.
          I did, can't really see anything that would trigger anything bad. I might be absolutely wrong, so here's a dump:
          https://pastebin.com/GXcvX953

          Comment


            #6
            That looked like 5 seconds worth right after booting up. You would need to review the previous dmesg if it's rotating your log every time you boot. Try these:

            Code:
            cat /var/log/dmesg.0 |grep -i usb
            cat /var/log/syslog | grep -i usb
            What you're looking for is anything related to USB that's an error or "disconnect" message.

            Please Read Me

            Comment


              #7
              Originally posted by oshunluvr View Post
              That looked like 5 seconds worth right after booting up. You would need to review the previous dmesg if it's rotating your log every time you boot. Try these:

              Code:
              cat /var/log/dmesg.0 |grep -i usb
              cat /var/log/syslog | grep -i usb
              What you're looking for is anything related to USB that's an error or "disconnect" message.
              Hi, finally managed to use those commands while the USB was starting to fail. I noticed it starts to not detect all the letters, after that it just stops. Here's a dump from 1st command:
              https://pastebin.com/fYTc3esa

              And 2nd. Not full, konsole doesn't show everything:
              https://pastebin.com/yUt68TRH

              I've noticed in the 2nd one that there's soe errorss as "port1: unable to enumerate USB device". Is that related to it? And how can I fix it?

              Comment


                #8
                Your problem is likely here:
                Code:
                [ 1.417574] kernel: usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.​
                [ 1.481416] kernel: usb: port power management may be unreliable
                I suspect the "unable to enumerate" is related to the power issue. "LPM" is "Link Power Management"

                You said "hub is powered from mains" but I'm unfamiliar with that term. You mean it's plugged into an external power supply?

                If so - and just guessing here - the kernel is trying to manage the USB power when it shouldn't be. If it's getting power from a USB connection - then it's probably under powered.

                There is a way - I believe - to turn off LPM to test, and then if this helps you can make it permanent. The way you turn it off is on a per-device kernel parameter that uses the USB id to disable LPM. This is the kernel parameter:
                Code:
                usbcore.quirks=<vid1>:<pid1>:k​
                where "vid" is vendor ID and "pid" is product ID.

                First, to get the ID's, open Konsole and type:
                Code:
                lsusb
                You'll get a bunch of lines like this:
                Code:
                Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 3.0 root hub
                The 2x4 digit hex numbers are the IDs. In the above line "1d6b" is the vendor ID and "0002" is the product ID. You'll need to figure out which "root hub" is your hub. An internet search using the IDs should tell you which it is. Then you need to add the boot parameter to boot up.

                To test it before making it permanent (which I highly recommend) you will need to access the GRUB menu at boot time, edit the boot line to add the parameter, then continue the boot. If you do not currently get a GRUB menu when you boot, you can hold SHIFT or ESC down during boot up and the menu should show up. When you see the menu, press "E" to edit and the boot line for your current kernel (the first line in the boot menu) should open up in a simple text editor. Move the cursor down and over with the arrow keys until you are at "quiet splash". Then add the "usbcore.quirks..." parameter using your USB hub's IDs as I outlined above after "quiet splash" then press F10 to boot.

                If you didn't make any typos and it boots without error, then test your hub to see if the problem has gone away.

                If it DOESN'T help, then you'll have to keep looking for a solution.

                If it HAS helped, then you will need to add the usbquirks parameter to /etc/default/grub. Open that file with Kate, look for
                GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" and add the parameter after splash and inside the quotes. Save it and run "sudo update-grub" in Konsole and from then on the parameter will be loaded at boot.

                Please Read Me

                Comment


                  #9
                  Originally posted by oshunluvr View Post
                  Then add the "usbcore.quirks..." parameter using your USB hub's IDs as I outlined above after "quiet splash" then press F10 to boot.
                  To be clear, that means that "quiet splash" should look like "quite splash usbcore.quirks=<vid1>:<pid1>:k​" where, again, vid1 and pid1 are replaced with values identified with lsusb. Using Oshunluvrs values, it would look like "quiet splash usbcore.quirks=<1d6b>:<0002>:k"​
                  Windows no longer obstructs my view.
                  Using Kubuntu Linux since March 23, 2007.
                  "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                  Comment


                    #10
                    Originally posted by oshunluvr View Post
                    Your problem is likely here:
                    Code:
                    [ 1.417574] kernel: usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.​
                    [ 1.481416] kernel: usb: port power management may be unreliable
                    I suspect the "unable to enumerate" is related to the power issue. "LPM" is "Link Power Management"

                    You said "hub is powered from mains" but I'm unfamiliar with that term. You mean it's plugged into an external power supply?

                    If so - and just guessing here - the kernel is trying to manage the USB power when it shouldn't be. If it's getting power from a USB connection - then it's probably under powered.

                    There is a way - I believe - to turn off LPM to test, and then if this helps you can make it permanent. The way you turn it off is on a per-device kernel parameter that uses the USB id to disable LPM. This is the kernel parameter:
                    Code:
                    usbcore.quirks=<vid1>:<pid1>:k​
                    where "vid" is vendor ID and "pid" is product ID.

                    First, to get the ID's, open Konsole and type:
                    Code:
                    lsusb
                    You'll get a bunch of lines like this:
                    Code:
                    Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 3.0 root hub
                    The 2x4 digit hex numbers are the IDs. In the above line "1d6b" is the vendor ID and "0002" is the product ID. You'll need to figure out which "root hub" is your hub. An internet search using the IDs should tell you which it is. Then you need to add the boot parameter to boot up.

                    To test it before making it permanent (which I highly recommend) you will need to access the GRUB menu at boot time, edit the boot line to add the parameter, then continue the boot. If you do not currently get a GRUB menu when you boot, you can hold SHIFT or ESC down during boot up and the menu should show up. When you see the menu, press "E" to edit and the boot line for your current kernel (the first line in the boot menu) should open up in a simple text editor. Move the cursor down and over with the arrow keys until you are at "quiet splash". Then add the "usbcore.quirks..." parameter using your USB hub's IDs as I outlined above after "quiet splash" then press F10 to boot.

                    If you didn't make any typos and it boots without error, then test your hub to see if the problem has gone away.

                    If it DOESN'T help, then you'll have to keep looking for a solution.

                    If it HAS helped, then you will need to add the usbquirks parameter to /etc/default/grub. Open that file with Kate, look for
                    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" and add the parameter after splash and inside the quotes. Save it and run "sudo update-grub" in Konsole and from then on the parameter will be loaded at boot.
                    Hi. So, Pressing Esc or Shift didn't worked for me to see the GRUB, maybe because the keyboard is connected to the hub. I edited grub to give me 5s to react and it's fine. Managed to get to it on boot, but can't find anything related to quiet-splash. When I press "E" to change parameters I've got something like this:
                    https://ibb.co/CHYKtPJ

                    I can't really find anything saying Quiet-Splash. As I've said before, I did had an issue when I installed Kubuntu that gave me only black screen after I've restarted the system so had to reinstall it and I believe disable Quiet Splash. In my Grub file it says GRUB_CMDLINE_LINUX_DEFAULT=' ' but at least I can use my PC. And yes, connected to the mains means basically connected externally to the wall outlet. Can you let me know where to put your command to test it in my specific case?

                    Thanks!

                    Comment


                    • oshunluvr
                      oshunluvr commented
                      Editing a comment
                      Put the usbcore,quirks part after "ro" with a space between them.

                    #11
                    On some operating systems, and the kind of GUI being used (and hardware connectivity) can effect USB hubs. I had one USB hub where only one USB port on it would work, after changing OS and GUI, it worked again (it worked previously with Win7 as well). Another system with a USB hub with power plug, the USB dongle for the mouse and keyboard would stop working, and I would remove the dongle and put it into a different port, and it would work again, soon a update fixed it. Another time I got a USB drive read error during boot up, power issue, so I unplugged and re-plugged all the connections and it solved the problem. I think one was solved by a firmware update from Canonical, the other was solved by changing the OS, and yet another was solved by making sure the connections were clean and tight. If it is low power USB hub and there is a lot of devices plugged into it, it can cause problems.

                    Comment


                      #12
                      I did tried what you all told me. Nothing really changed. BUT. I noticed, when this bug happens and I take wired keyboard and connect it directly to motherboard to any USB - None of them works. When I plug in USB drive - Nothing. When I unplug everything completely from USB and reinsert one of the devices (mouse, drive, whatever) - no response. It seems like all of the USB ports are simply dying. I did not had it happen on Linux Mint or Windows, so it makes me think it might be something related specifically to Kubuntu.

                      I'll try to use wired keyboard for a while as from what I noticed, it's the first one to let me know that the issue is starting.

                      Any more ideas that I can try? Is there any USB debugging option in a system?

                      Comment


                        #13
                        The kernel is the first thing I would think of. I would boot the earlier kernel you have on your machine, and if no change I would install older kernels and try them until I found one that works. You probably on -35 which myself and a couple others have had issues with or -41.

                        You could even jump back a whole series and install 6.2.0-39 and see if anything changes.

                        Please Read Me

                        Comment


                          #14
                          For last 2 days I've been using simple USB wired keyboard. So far, despite it happening every single day, it did not happened single time. I think it might be related to wireless receiver of the keyboard. I don't think it's anything physical, it probably just doesn't like kubuntu. Well, I can use this keyboard for some other PC, I'll stick to the wired one for now.

                          Thanks for your help!

                          Comment

                          Working...
                          X