You are not logged in.

#1 2017-02-10 14:43:03

alogim
Member
Registered: 2015-08-25
Posts: 43

ArchLinux freezes when removing/attaching USB

I noticed that when I attach my printer (even if it switched off but connected to the power) my system freezes. I have to reboot and keep the printer switched on in order to use it. Again, as soon as I detach the printer's USB, the system freezes.
On the opposite, If I switch off the printer keeping the USB in, the system does not freeze.

I also tried with my keyboard, it is a Trust GXT 18. If I detach the USB, my system freezes, and I have to hard reboot it in order to be able to work. I tested the same devices on Windows and on other Linux distros, Arch is the only one behaving so strangely.

I have an Asrock Z77-Pro4 as motherboard. I tried with both the front USBs and the rear USBs, both 3.0 and 2.0 ones, but it looks like that does not matter.
It also happens when removing the audio cable of my stereo.

I checked my journal, but it looks nothing useful is there, it just stops outputting whatsoever until I hard reboot it.

Here is one of the logs when I had to hard reboot.

Last edited by alogim (2017-02-10 14:50:06)

Offline

#2 2017-02-10 19:21:18

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 79,182

Re: ArchLinux freezes when removing/attaching USB

Define "freeze", does the system echo to pings?
Ignoring the audio cable thing (ordinary jack plug??), I'd start investigation by blacklisting xhci_hcd (usb 3.0, system should fully work, but limited to usb 2.0 speed)

Offline

#3 2017-02-11 11:37:39

alogim
Member
Registered: 2015-08-25
Posts: 43

Re: ArchLinux freezes when removing/attaching USB

seth wrote:

Define "freeze", does the system echo to pings?

The system freezes in the sense that I can not do anything. Mouse, keyboard and screen are like if they are stopped: for example, even Caps Lock does not work anymore when I am in that state. I really can not input anything. The screen is like when you are watching amovie and pause it, removing and re attaching the VGA cable simply returns the same idle frame.

seth wrote:

Ignoring the audio cable thing (ordinary jack plug??), I'd start investigation by blacklisting xhci_hcd (usb 3.0, system should fully work, but limited to usb 2.0 speed)

If I am not mistaken, as explained here, I should create a file like this:

/etc/modprobe.d/no_xhci_hcd.conf
---------------------------------------------------------
# Do not load the 'xhci_hcd' module on boot.
blacklist xhci_hcd

However, I just saw that

xhci_hcd

module is used by

xhci_pci

. Shall I disable that as well?

Last edited by alogim (2017-02-11 11:41:49)

Offline

#4 2017-02-11 14:08:34

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 79,182

Re: ArchLinux freezes when removing/attaching USB

The approach is correct and sufficient - blacklisting xhci_hcd will implicitly prevent xhci_pci from being loaded.

For further investigation, please really try whether the system responds to network calls - if so, it's *FAR* easier to figure the actual problem. Investigating on a fully frozen kernel is nothing you would not want to avoid by all means ;-)
(The keyboard is likely wired via usb, so even if only the usb stack is borked, things expectably won't work)

Offline

#5 2017-02-11 18:51:27

alogim
Member
Registered: 2015-08-25
Posts: 43

Re: ArchLinux freezes when removing/attaching USB

seth wrote:

The approach is correct and sufficient - blacklisting xhci_hcd will implicitly prevent xhci_pci from being loaded.

Blacklisting only xhci_hcd was not enough, since xhci_pci still loaded it, so I used the suggestion in the wiki:

install xhci_hcd /bin/false

Now, when I detach my keyboard the system does not freeze anymore (I can see the clock still working on the desktop), but my mouse does not work. As soon as I re attach my keyboard, system freezes again.
EDIT: it would appear as if my system sometimes decides to freeze and sometimes it does not (when removing the USB). It still freezes when re attaching it. Note that both my keyboard and mouse are in USB 2.0 ports.

Last edited by alogim (2017-02-11 18:59:41)

Offline

#6 2017-02-11 19:48:53

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 79,182

Re: ArchLinux freezes when removing/attaching USB

Ping the box from some other system (can even be a smartphone, there're several apps for android and ios which provide ping/trace/even nmap)
If the ping times out, the kernel is completely stuck, otherwise ensure to install and enable sshd, so you can ssh into the box.

If not, move to VT1 (ctrl+alt+f1), log in and run "dmesg -w", then try to cause the freeze. Maybe you can spot something interesting there.

Also please dump&post lsusb, maybe some freaky usb device causes this (despite not being the trigger itself) - just poking around here, though.

Offline

Board footer

Powered by FluxBB