1

If I unplug the Thunderbolt 3 dock while Ubuntu is suspended, Ubuntu freezes with a black screen when I next try to resume.

Can this be fixed?

There are some errors and a stack trace in syslog:

pcieport 0000:03:02.0: can't change power state from D3hot to D0 (config space inaccessible)
thunderbolt 0000:04:00.0: can't change power state from D3hot to D0 (config space inaccessible)
Call Trace:
 <TASK>
 usb_hcd_pci_remove+0xac/0x110
 xhci_pci_remove+0x72/0xb0 [xhci_pci]
 pci_device_remove+0x3b/0xb0
 __device_release_driver+0x1a8/0x2a0
 device_release_driver+0x29/0x40
 pci_stop_bus_device+0x74/0xa0
 pci_stop_bus_device+0x30/0xa0
 pci_stop_bus_device+0x30/0xa0
 pci_stop_and_remove_bus_device+0x13/0x30
 pciehp_unconfigure_device+0x7e/0x140
 pciehp_disable_slot+0x6c/0x100
 pciehp_handle_presence_or_link_change+0xb7/0x110
 pciehp_ist+0x19a/0x1b0
 ? irq_forced_thread_fn+0x90/0x90
 irq_thread_fn+0x25/0x70
 irq_thread+0xdc/0x1b0
 ? irq_thread_fn+0x70/0x70
 ? irq_thread_check_affinity+0x100/0x100
 kthread+0x127/0x150
 ? set_kthread_struct+0x50/0x50
 ret_from_fork+0x1f/0x30
 </TASK>
$ uname -r
5.15.0-52-generic
Mic
  • 224

1 Answers1

0

As discussed here: https://answers.launchpad.net/ubuntu/+question/704136#5 the workaround is to avoid the crash by unloading the crashing driver upon suspend and then reload it on resume.

Install this script (from here) and the issue is resolved:

#!/bin/bash

Original script was using /bin/sh but shellcheck reporting warnings.

NAME: custom-xhci_hcd

PATH: /lib/systemd/system-sleep

CALL: Called from SystemD automatically

DESC: Suspend broken for USB3.0 as of Oct 25/2018 various kernels all at once

DATE: Oct 28 2018.

NOTE: From comment #61 at: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998

TMPLIST=/tmp/xhci-dev-list

Original script was: case "${1}" in hibernate|suspend)

case $1/$2 in pre/) echo "$0: custom-xhci_hcd - going to $2..." echo -n '' > $TMPLIST for i in `ls /sys/bus/pci/drivers/xhci_hcd/ | egrep '[0-9a-z]+:[0-9a-z]+:.$'; do # Unbind xhci_hcd for first device XXXX:XX:XX.X: echo -n &quot;$i&quot; | tee /sys/bus/pci/drivers/xhci_hcd/unbind echo &quot;$i&quot; &gt;&gt; $TMPLIST done ;; post/*) echo &quot;$0: custom-xhci_hcd - waking up from $2...&quot; for i incat $TMPLIST`; do # Bind xhci_hcd for first device XXXX:XX:XX.X: echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/bind done rm $TMPLIST ;; esac 111

Mic
  • 224