Sandisk Mini USB Disconnects when Laptop Suspends on Battery
https://askubuntu.com/questions/1559554/sandisk-mini-usb-disconnects-when-laptop-suspends-on-battery
I have a 128Gb Sandisk mini USB device that I am using for extra storage on an old Lenovo V145-15AST (model 81MT) running Xubuntu 24.04.2.
I have it mounted using fstab and everything works as intended.
# mount Sandisk 128Gb USB
/dev/disk/by-uuid/3936-3889 /media/Sandisk auto x-gvfs-name=USB-Sandisk,x-gvfs-show,uid=1000,gid=1000 0 1
Initially, the presence of the USB drive would cause the system to hang when waking from suspend, but only when running on battery power. The following command
echo "XHC0" | sudo tee /proc/acpi/wakeup
fixed the problem, so that is now automated on startup.
Then I noticed that the USB device would just "disappear" if I left it suspended on battery for longer than an hour. I assume that is to do with power states and entering a deeper suspend/freeze. So I tried disabling auto-suspend by editing GRUB.
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.autosuspend=-1"
And checking
cat /sys/module/usbcore/parameters/autosuspend
gives -1 on a reboot.
lsusb gives the following:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 0438:7900 Advanced Micro Devices, Inc. Root Hub
Bus 002 Device 003: ID 0bda:c024 Realtek Semiconductor Corp. Bluetooth Radio
Bus 002 Device 004: ID 13d3:5a02 IMC Networks EasyCamera
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 0781:5583 SanDisk Corp. Ultra Fit
So I added the below rule to /etc/udev/rules.d/92-usb-input-no-powersave.rules
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0781", ATTR{idProduct}=="5583", TEST=="power/control", ATTR{power/control}="on"
I also tried with SUBSYSTEMS=="usb", but the USB device is still powered off after an hour. (again, this only happens on battery power).
udevadm info -a /dev/sda
outputs the below:
looking at device '/devices/pci0000:00/0000:00:10.0/usb3/3-3/3-3:1.0/host0/target0:0:0/0:0:0:0/block/sda':
KERNEL=="sda"
SUBSYSTEM=="block"
DRIVER==""
ATTR{alignment_offset}=="0"
ATTR{capability}=="0"
ATTR{discard_alignment}=="0"
ATTR{diskseq}=="53"
ATTR{events}=="media_change"
ATTR{events_async}==""
ATTR{events_poll_msecs}=="-1"
ATTR{ext_range}=="256"
ATTR{hidden}=="0"
ATTR{inflight}==" 0 0"
ATTR{integrity/device_is_integrity_capable}=="0"
ATTR{integrity/format}=="none"
ATTR{integrity/protection_interval_bytes}=="0"
ATTR{integrity/read_verify}=="0"
ATTR{integrity/tag_size}=="0"
ATTR{integrity/write_generate}=="0"
ATTR{mq/0/cpu_list}=="0, 1, 2, 3"
ATTR{mq/0/nr_reserved_tags}=="0"
ATTR{mq/0/nr_tags}=="2"
ATTR{partscan}=="1"
ATTR{power/async}=="disabled"
ATTR{power/control}=="auto"
ATTR{power/runtime_active_kids}=="0"
ATTR{power/runtime_active_time}=="0"
ATTR{power/runtime_enabled}=="disabled"
ATTR{power/runtime_status}=="unsupported"
ATTR{power/runtime_suspended_time}=="0"
ATTR{power/runtime_usage}=="0"
ATTR{queue/add_random}=="1"
ATTR{queue/atomic_write_boundary_bytes}=="0"
ATTR{queue/atomic_write_max_bytes}=="0"
ATTR{queue/atomic_write_unit_max_bytes}=="0"
ATTR{queue/atomic_write_unit_min_bytes}=="0"
ATTR{queue/chunk_sectors}=="0"
ATTR{queue/dax}=="0"
ATTR{queue/discard_granularity}=="512"
ATTR{queue/discard_max_bytes}=="0"
ATTR{queue/discard_max_hw_bytes}=="0"
ATTR{queue/discard_zeroes_data}=="0"
ATTR{queue/dma_alignment}=="511"
ATTR{queue/fua}=="0"
ATTR{queue/hw_sector_size}=="512"
ATTR{queue/io_poll}=="0"
ATTR{queue/io_poll_delay}=="-1"
ATTR{queue/io_timeout}=="30000"
ATTR{queue/iosched/async_depth}=="4"
ATTR{queue/iosched/fifo_batch}=="16"
ATTR{queue/iosched/front_merges}=="1"
ATTR{queue/iosched/prio_aging_expire}=="10000"
ATTR{queue/iosched/read_expire}=="500"
ATTR{queue/iosched/write_expire}=="5000"
ATTR{queue/iosched/writes_starved}=="2"
ATTR{queue/iostats}=="1"
ATTR{queue/iostats_passthrough}=="0"
ATTR{queue/logical_block_size}=="512"
ATTR{queue/max_discard_segments}=="1"
ATTR{queue/max_hw_sectors_kb}=="512"
ATTR{queue/max_integrity_segments}=="0"
ATTR{queue/max_sectors_kb}=="512"
ATTR{queue/max_segment_size}=="65536"
ATTR{queue/max_segments}=="2048"
ATTR{queue/minimum_io_size}=="4096"
ATTR{queue/nomerges}=="0"
ATTR{queue/nr_requests}=="4"
ATTR{queue/nr_zones}=="0"
ATTR{queue/optimal_io_size}=="0"
ATTR{queue/physical_block_size}=="512"
ATTR{queue/read_ahead_kb}=="128"
ATTR{queue/rotational}=="1"
ATTR{queue/rq_affinity}=="1"
ATTR{queue/scheduler}=="none [mq-deadline] "
ATTR{queue/stable_writes}=="0"
ATTR{queue/virt_boundary_mask}=="0"
ATTR{queue/wbt_lat_usec}=="75000"
ATTR{queue/write_cache}=="write back"
ATTR{queue/write_same_max_bytes}=="0"
ATTR{queue/write_zeroes_max_bytes}=="33553920"
ATTR{queue/zone_append_max_bytes}=="0"
ATTR{queue/zone_write_granularity}=="0"
ATTR{queue/zoned}=="none"
ATTR{range}=="16"
ATTR{removable}=="1"
ATTR{ro}=="0"
ATTR{size}=="240328704"
ATTR{stat}==" 265 28681 35982 5139 1 0 1 3 0 2477 5143 0 0 >
ATTR{trace/act_mask}=="disabled"
ATTR{trace/enable}=="0"
ATTR{trace/end_lba}=="disabled"
ATTR{trace/pid}=="disabled"
ATTR{trace/start_lba}=="disabled"
looking at parent device '/devices/pci0000:00/0000:00:10.0/usb3/3-3/3-3:1.0/host0/target0:0:0/0:0:0:0':
KERNELS=="0:0:0:0"
SUBSYSTEMS=="scsi"
DRIVERS=="sd"
ATTRS{blacklist}=="SKIP_IO_HINTS"
ATTRS{cdl_enable}=="0"
ATTRS{cdl_supported}=="0"
ATTRS{delete}=="(not readable)"
ATTRS{device_blocked}=="0"
ATTRS{device_busy}=="0"
ATTRS{dh_state}=="detached"
ATTRS{eh_timeout}=="10"
ATTRS{evt_capacity_change_reported}=="0"
ATTRS{evt_inquiry_change_reported}=="0"
ATTRS{evt_lun_change_reported}=="0"
ATTRS{evt_media_change}=="0"
ATTRS{evt_mode_parameter_change_reported}=="0"
ATTRS{evt_soft_threshold_reached}=="0"
ATTRS{inquiry}==""
ATTRS{iocounterbits}=="32"
ATTRS{iodone_cnt}=="0x3d1f"
ATTRS{ioerr_cnt}=="0x4"
ATTRS{iorequest_cnt}=="0x3d1f"
ATTRS{iotmo_cnt}=="0x0"
ATTRS{model}==" SanDisk 3.2Gen1"
ATTRS{power/async}=="enabled"
ATTRS{power/autosuspend_delay_ms}=="-1"
ATTRS{power/control}=="on"
ATTRS{power/runtime_active_kids}=="0"
ATTRS{power/runtime_active_time}=="31342045"
ATTRS{power/runtime_enabled}=="forbidden"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/runtime_usage}=="2"
ATTRS{queue_depth}=="2"
ATTRS{queue_type}=="simple"
ATTRS{rescan}=="(not readable)"
ATTRS{rev}=="1.00"
ATTRS{scsi_level}=="8"
ATTRS{state}=="running"
ATTRS{timeout}=="30"
ATTRS{type}=="0"
ATTRS{vendor}==" USB "
ATTRS{vpd_pg0}==""
ATTRS{vpd_pg80}==""
ATTRS{vpd_pg83}==""
ATTRS{vpd_pgb0}==""
ATTRS{wwid}=="t10. USB\0\0\0\0 SanDisk 3.2Gen10002321502222516"
looking at parent device '/devices/pci0000:00/0000:00:10.0/usb3/3-3/3-3:1.0/host0/target0:0:0':
KERNELS=="target0:0:0"
SUBSYSTEMS=="scsi"
DRIVERS==""
ATTRS{power/async}=="enabled"
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_kids}=="1"
ATTRS{power/runtime_active_time}=="31342046"
ATTRS{power/runtime_enabled}=="enabled"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/runtime_usage}=="0"
looking at parent device '/devices/pci0000:00/0000:00:10.0/usb3/3-3/3-3:1.0/host0':
KERNELS=="host0"
SUBSYSTEMS=="scsi"
DRIVERS==""
ATTRS{power/async}=="enabled"
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_kids}=="1"
ATTRS{power/runtime_active_time}=="31342153"
ATTRS{power/runtime_enabled}=="enabled"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/runtime_usage}=="0"
looking at parent device '/devices/pci0000:00/0000:00:10.0/usb3/3-3/3-3:1.0':
KERNELS=="3-3:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="uas"
ATTRS{authorized}=="1"
ATTRS{bAlternateSetting}==" 1"
ATTRS{bInterfaceClass}=="08"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bInterfaceProtocol}=="62"
ATTRS{bInterfaceSubClass}=="06"
ATTRS{bNumEndpoints}=="04"
ATTRS{physical_location/dock}=="no"
ATTRS{physical_location/horizontal_position}=="left"
ATTRS{physical_location/lid}=="no"
ATTRS{physical_location/panel}=="unknown"
ATTRS{physical_location/vertical_position}=="upper"
ATTRS{power/async}=="enabled"
ATTRS{power/runtime_active_kids}=="1"
ATTRS{power/runtime_enabled}=="disabled"
ATTRS{power/runtime_status}=="unsupported"
ATTRS{power/runtime_usage}=="0"
ATTRS{supports_autosuspend}=="0"
looking at parent device '/devices/pci0000:00/0000:00:10.0/usb3/3-3':
KERNELS=="3-3"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="9"
ATTRS{bMaxPower}=="896mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0100"
ATTRS{bmAttributes}=="80"
ATTRS{busnum}=="3"
ATTRS{configuration}==""
ATTRS{devnum}=="4"
ATTRS{devpath}=="3"
ATTRS{idProduct}=="5583"
ATTRS{idVendor}=="0781"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}==" USB"
ATTRS{maxchild}=="0"
ATTRS{physical_location/dock}=="no"
ATTRS{physical_location/horizontal_position}=="left"
ATTRS{physical_location/lid}=="no"
ATTRS{physical_location/panel}=="unknown"
ATTRS{physical_location/vertical_position}=="upper"
ATTRS{power/active_duration}=="31341730"
ATTRS{power/async}=="enabled"
ATTRS{power/autosuspend}=="-1"
ATTRS{power/autosuspend_delay_ms}=="-1000"
ATTRS{power/connected_duration}=="31342655"
ATTRS{power/control}=="on"
ATTRS{power/level}=="on"
ATTRS{power/persist}=="1"
ATTRS{power/runtime_active_kids}=="1"
ATTRS{power/runtime_active_time}=="31342168"
ATTRS{power/runtime_enabled}=="forbidden"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/runtime_usage}=="2"
ATTRS{product}==" SanDisk 3.2Gen1"
ATTRS{quirks}=="0x400"
ATTRS{removable}=="removable"
ATTRS{remove}=="(not readable)"
ATTRS{rx_lanes}=="1"
ATTRS{serial}=="00023215022225165640"
ATTRS{speed}=="5000"
ATTRS{tx_lanes}=="1"
ATTRS{urbnum}=="31631"
ATTRS{version}==" 3.20"
looking at parent device '/devices/pci0000:00/0000:00:10.0/usb3':
KERNELS=="usb3"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{authorized_default}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="09"
ATTRS{bDeviceProtocol}=="03"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="9"
ATTRS{bMaxPower}=="0mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0614"
ATTRS{bmAttributes}=="e0"
ATTRS{busnum}=="3"
ATTRS{configuration}==""
ATTRS{devnum}=="1"
ATTRS{devpath}=="0"
ATTRS{idProduct}=="0003"
ATTRS{idVendor}=="1d6b"
ATTRS{interface_authorized_default}=="1"
ATTRS{ltm_capable}=="yes"
ATTRS{manufacturer}=="Linux 6.14.0-35-generic xhci-hcd"
ATTRS{maxchild}=="4"
ATTRS{power/active_duration}=="31998874"
ATTRS{power/async}=="enabled"
ATTRS{power/autosuspend}=="-1"
ATTRS{power/autosuspend_delay_ms}=="-1000"
ATTRS{power/connected_duration}=="31999661"
ATTRS{power/control}=="on"
ATTRS{power/level}=="on"
ATTRS{power/runtime_active_kids}=="1"
ATTRS{power/runtime_active_time}=="31999200"
ATTRS{power/runtime_enabled}=="forbidden"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/runtime_usage}=="2"
ATTRS{power/wakeup}=="disabled"
ATTRS{power/wakeup_abort_count}==""
ATTRS{power/wakeup_active}==""
ATTRS{power/wakeup_active_count}==""
ATTRS{power/wakeup_count}==""
ATTRS{power/wakeup_expire_count}==""
ATTRS{power/wakeup_last_time_ms}==""
ATTRS{power/wakeup_max_time_ms}==""
ATTRS{power/wakeup_total_time_ms}==""
ATTRS{product}=="xHCI Host Controller"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="unknown"
ATTRS{remove}=="(not readable)"
ATTRS{rx_lanes}=="1"
ATTRS{serial}=="0000:00:10.0"
ATTRS{speed}=="5000"
ATTRS{tx_lanes}=="1"
ATTRS{urbnum}=="242"
ATTRS{version}==" 3.00"
looking at parent device '/devices/pci0000:00/0000:00:10.0':
KERNELS=="0000:00:10.0"
SUBSYSTEMS=="pci"
DRIVERS=="xhci_hcd"
ATTRS{ari_enabled}=="0"
ATTRS{broken_parity_status}=="0"
ATTRS{class}=="0x0c0330"
ATTRS{consistent_dma_mask_bits}=="64"
ATTRS{current_link_speed}=="Unknown"
ATTRS{current_link_width}=="0"
ATTRS{d3cold_allowed}=="1"
ATTRS{dbc}=="disabled"
ATTRS{dbc_bInterfaceProtocol}=="01"
ATTRS{dbc_bcdDevice}=="0010"
ATTRS{dbc_idProduct}=="0010"
ATTRS{dbc_idVendor}=="1d6b"
ATTRS{dbc_poll_interval_ms}=="64"
ATTRS{device}=="0x7914"
ATTRS{dma_mask_bits}=="64"
ATTRS{driver_override}=="(null)"
ATTRS{enable}=="1"
ATTRS{irq}=="18"
ATTRS{local_cpulist}=="0-1"
ATTRS{local_cpus}=="3"
ATTRS{max_link_speed}=="Unknown"
ATTRS{max_link_width}=="255"
ATTRS{msi_bus}=="1"
ATTRS{msi_irqs/27}=="msix"
ATTRS{msi_irqs/28}=="msix"
ATTRS{msi_irqs/29}=="msix"
ATTRS{numa_node}=="-1"
ATTRS{power/async}=="enabled"
ATTRS{power/control}=="on"
ATTRS{power/runtime_active_kids}=="2"
ATTRS{power/runtime_active_time}=="31999531"
ATTRS{power/runtime_enabled}=="forbidden"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/runtime_usage}=="3"
ATTRS{power/wakeup}=="disabled"
ATTRS{power/wakeup_abort_count}==""
ATTRS{power/wakeup_active}==""
ATTRS{power/wakeup_active_count}==""
ATTRS{power/wakeup_count}==""
ATTRS{power/wakeup_expire_count}==""
ATTRS{power/wakeup_last_time_ms}==""
ATTRS{power/wakeup_max_time_ms}==""
ATTRS{power/wakeup_total_time_ms}==""
ATTRS{power_state}=="D0"
ATTRS{remove}=="(not readable)"
ATTRS{rescan}=="(not readable)"
ATTRS{resource0}=="(not readable)"
ATTRS{revision}=="0x20"
ATTRS{subsystem_device}=="0x380b"
ATTRS{subsystem_vendor}=="0x17aa"
ATTRS{vendor}=="0x1022"
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
ATTRS{power/async}=="enabled"
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_kids}=="21"
ATTRS{power/runtime_active_time}=="0"
ATTRS{power/runtime_enabled}=="disabled"
ATTRS{power/runtime_status}=="unsupported"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/runtime_usage}=="0"
ATTRS{waiting_for_supplier}=="0"
I notice from some manual experimenting with unmounting/remounting and unbinding/rebinding that the sda block is simply gone, and after a replug the drive is reconfigured under sdc (sdb is the main internal drive). Issuing the below on a normal working system:
echo 0000:00:10.0 > /sys/bus/pci/drivers/xhci_hcd/unbind
then suspending the system for a while before waking then issuing
echo 0000:00:10.0 > /sys/bus/pci/drivers/xhci_hcd/bind
works fine IF the system wake happens before an hour elapses (I think it was an hour but I could be wrong on the exact time it takes to enter a deeper suspend state). At any rate, if I leave it suspended for too long on battery the block device disappears.
Here is dmesg when running on power:
[ 2606.418682] PM: suspend entry (deep)
[ 2606.430180] Filesystems sync: 0.011 seconds
[ 2606.434316] Freezing user space processes
[ 2606.436191] Freezing user space processes completed (elapsed 0.001 seconds)
[ 2606.436200] OOM killer disabled.
[ 2606.436202] Freezing remaining freezable tasks
[ 2613.235524] Freezing remaining freezable tasks completed (elapsed 6.799 seconds)
[ 2613.235589] printk: Suspending console(s) (use no_console_suspend to debug)
[ 2613.240341] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 2613.240533] sd 1:0:0:0: [sdb] Synchronizing SCSI cache
[ 2613.243870] ata1.00: Entering standby power mode
[ 2613.304485] ACPI: EC: interrupt blocked
[ 2613.329275] ACPI: PM: Preparing to enter system sleep state S3
[ 2613.333134] ACPI: EC: event blocked
[ 2613.333138] ACPI: EC: EC stopped
[ 2613.333140] ACPI: PM: Saving platform NVS memory
[ 2613.333257] Disabling non-boot CPUs ...
[ 2613.335495] smpboot: CPU 1 is now offline
[ 2613.338153] ACPI: PM: Low-level resume complete
[ 2613.338178] ACPI: EC: EC started
[ 2613.338179] ACPI: PM: Restoring platform NVS memory
[ 2613.338253] LVT offset 0 assigned for vector 0x400
[ 2613.338687] Enabling non-boot CPUs ...
[ 2613.338789] smpboot: Booting Node 0 Processor 1 APIC 0x11
[ 2613.338970] [Firmware Bug]: CPU 1: APIC ID mismatch. CPUID: 0x0001 APIC: 0x0011
[ 2613.360203] CPU1 is up
[ 2613.360680] ACPI: PM: Waking up from system sleep state S3
[ 2613.391367] ACPI: EC: interrupt unblocked
[ 2613.393584] ACPI: EC: event unblocked
[ 2613.395892] [drm] PCIE GART of 1024M enabled (table at 0x000000F400600000).
[ 2613.395917] amdgpu: smu version 26.17.00
[ 2613.601597] amdgpu 0000:00:01.0: [drm:amdgpu_ring_test_helper [amdgpu]] *ERROR* ring comp_1.0.1 test failed (-110)
[ 2613.648811] usb 1-1.2: reset full-speed USB device number 3 using ehci-pci
[ 2613.782015] amdgpu 0000:00:01.0: [drm:amdgpu_ring_test_helper [amdgpu]] *ERROR* ring comp_1.0.3 test failed (-110)
[ 2613.809755] usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
[ 2613.811213] [drm] UVD initialized successfully.
[ 2613.859755] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[ 2613.861726] sd 1:0:0:0: [sdb] Starting disk
[ 2613.863571] ata1.00: configured for UDMA/133
[ 2613.912182] [drm] VCE initialized successfully.
[ 2613.919040] OOM killer enabled.
[ 2613.919045] Restarting tasks ...
[ 2613.927449] Bluetooth: hci0: RTL: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8821
[ 2613.928509] Bluetooth: hci0: RTL: rom_version status=0 version=1
[ 2613.928520] Bluetooth: hci0: RTL: loading rtl_bt/rtl8821c_fw.bin
[ 2613.929187] Bluetooth: hci0: RTL: loading rtl_bt/rtl8821c_config.bin
[ 2613.929333] Bluetooth: hci0: RTL: cfg_sz 10, total sz 34926
[ 2613.936337] done.
[ 2613.936351] random: crng reseeded on system resumption
[ 2614.099169] PM: suspend exit
[ 2614.369794] Generic FE-GE Realtek PHY r8169-0-100:00: attached PHY driver (mii_bus:phy_addr=r8169-0-100:00, irq=MAC)
[ 2614.400411] Bluetooth: hci0: RTL: fw version 0x75b8f098
[ 2614.469674] Bluetooth: MGMT ver 1.23
[ 2614.549849] r8169 0000:01:00.0 enp1s0: Link is Down
Here is dmesg when running on battery:
[ 1286.383813] PM: suspend entry (deep)
[ 1286.392576] Filesystems sync: 0.008 seconds
[ 1286.396463] Freezing user space processes ... (elapsed 0.002 seconds) done.
[ 1286.398976] OOM killer disabled.
[ 1286.398977] Freezing remaining freezable tasks ... (elapsed 5.641 seconds) done.
[ 1292.040416] printk: Suspending console(s) (use no_console_suspend to debug)
[ 1292.054616] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 1292.054616] sd 1:0:0:0: [sdb] Synchronizing SCSI cache
[ 1292.057289] sd 0:0:0:0: [sda] Stopping disk
[ 1292.170613] ACPI: EC: interrupt blocked
[ 1292.206741] ACPI: PM: Preparing to enter system sleep state S3
[ 1292.211027] ACPI: EC: event blocked
[ 1292.211029] ACPI: EC: EC stopped
[ 1292.211030] ACPI: PM: Saving platform NVS memory
[ 1292.211136] Disabling non-boot CPUs ...
[ 1292.212971] smpboot: CPU 1 is now offline
[ 1292.214198] ACPI: PM: Low-level resume complete
[ 1292.214221] ACPI: EC: EC started
[ 1292.214222] ACPI: PM: Restoring platform NVS memory
[ 1292.214308] LVT offset 0 assigned for vector 0x400
[ 1292.214607] Enabling non-boot CPUs ...
[ 1292.214669] x86: Booting SMP configuration:
[ 1292.214670] smpboot: Booting Node 0 Processor 1 APIC 0x11
[ 1292.214842] microcode: CPU1: patch_level=0x06006705
[ 1292.217125] ACPI: \_PR_.C001: Found 2 idle states
[ 1292.217615] CPU1 is up
[ 1292.218078] ACPI: PM: Waking up from system sleep state S3
[ 1292.249120] ACPI: EC: interrupt unblocked
[ 1292.250992] ACPI: EC: event unblocked
[ 1292.251039] [drm] PCIE GART of 1024M enabled (table at 0x000000F400401000).
[ 1292.251056] amdgpu: smu version 26.17.00
[ 1292.253742] sd 0:0:0:0: [sda] Starting disk
[ 1292.307774] [drm] UVD initialized successfully.
[ 1292.408004] [drm] VCE initialized successfully.
[ 1292.535374] usb 1-1.2: reset full-speed USB device number 3 using ehci-pci
[ 1292.723334] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[ 1292.723339] usb 1-1.3: reset high-speed USB device number 4 using ehci-pci
[ 1292.728037] ata1.00: configured for UDMA/133
[ 1295.213277] OOM killer enabled.
[ 1295.213282] Restarting tasks ...
[ 1295.223222] usb 3-3: USB disconnect, device number 2
[ 1295.252225] Bluetooth: hci0: RTL: examining hci_ver=08 hci_rev=000c lmp_ver=08 lmp_subver=8821
[ 1295.253226] Bluetooth: hci0: RTL: rom_version status=0 version=1
[ 1295.253234] Bluetooth: hci0: RTL: loading rtl_bt/rtl8821c_fw.bin
[ 1295.253263] Bluetooth: hci0: RTL: loading rtl_bt/rtl8821c_config.bin
[ 1295.253303] Bluetooth: hci0: RTL: cfg_sz 10, total sz 34926
[ 1295.267355] done.
[ 1295.511257] PM: suspend exit
[ 1295.703193] Generic FE-GE Realtek PHY r8169-0-100:00: attached PHY driver (mii_bus:phy_addr=r8169-0-100:00, irq=MAC)
[ 1295.730166] Bluetooth: hci0: RTL: fw version 0x75b8f098
[ 1295.903351] r8169 0000:01:00.0 enp1s0: Link is Down
[ 1296.115463] usb 3-3: new SuperSpeed USB device number 3 using xhci_hcd
[ 1296.140769] usb 3-3: New USB device found, idVendor=0781, idProduct=5583, bcdDevice= 1.00
[ 1296.140779] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1296.140783] usb 3-3: Product: SanDisk 3.2Gen1
[ 1296.140786] usb 3-3: Manufacturer: USB
[ 1296.140788] usb 3-3: SerialNumber: 00023215022225165640
[ 1296.157509] scsi host2: uas
[ 1296.296102] FAT-fs (sdb1): unable to read boot sector to mark fs as dirty
[ 1297.260340] kauditd_printk_skb: 16 callbacks suppressed
[ 1297.260345] audit: type=1400 audit(1762975487.044:186): apparmor="DENIED" operation="open" profile="snap.firmware-updater.firmware-notifier" name="/proc/sys/vm/max_map_count" pid=9291 comm="firmware-notifi" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[ 1301.369265] IPv6: ADDRCONF(NETDEV_CHANGE): wlp2s0: link becomes ready
[ 1304.127460] [UFW BLOCK] IN=wlp2s0 OUT= MAC=01:00:5e:00:00:01:20:37:f0:59:a3:0e:08:00 SRC=0.0.0.0 DST=224.0.0.1 LEN=36 TOS=0x00 PREC=0x00 TTL=1 ID=1 PROTO=2
[ 1316.715011] scsi 2:0:0:0: tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
[ 1316.715029] scsi 2:0:0:0: tag#0 CDB: Inquiry 12 00 00 00 24 00
[ 1316.730989] scsi host2: uas_eh_device_reset_handler start
[ 1316.860744] usb 3-3: reset SuperSpeed USB device number 3 using xhci_hcd
[ 1316.886773] scsi host2: uas_eh_device_reset_handler success
[ 1316.890848] scsi 2:0:0:0: tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD
[ 1316.890863] scsi 2:0:0:0: tag#0 CDB: Test Unit Ready 00 00 00 00 00 00
[ 1316.890869] scsi host2: uas_eh_device_reset_handler start
[ 1317.020618] usb 3-3: reset SuperSpeed USB device number 3 using xhci_hcd
[ 1317.047049] scsi host2: uas_eh_device_reset_handler success
[ 1317.047065] scsi 2:0:0:0: Device offlined - not ready after error recovery
So this appears to be the problem:
[ 1296.296102] FAT-fs (sdb1): unable to read boot sector to mark fs as dirty
and then a few lines later:
[ 1317.047065] scsi 2:0:0:0: Device offlined - not ready after error recovery
After a replug and running
sudo fsck.vfat -a /dev/sdb1
Gives this:
fsck.fat 4.2 (2021-01-31)
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
65:01/00
Not automatically fixing this.
Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
Automatically removing dirty bit.
*** Filesystem was changed ***
Writing changes.
/dev/sdb1: 4083 files, 912858/3754218 clusters
So I will double check and add the below to the
/lib/systemd/system-sleep folder:
#!/bin/sh
# rebind sandisk usb
case "$1" in
pre)
# unmount sandisk usb before suspend
umount /dev/disk/by-uuid/3936-3889
;;
post)
# rebind sandisk usb when waking
sleep 1
mount /dev/disk/by-uuid/3936-3889
;;
esac
This isn't a huge deal since I don't often suspend on battery for any great length of time, and a replug of the USB device is all that is necessary. However, it does happen occasionally and I would prefer to minimise physical replugging if there is another way.
Any ideas? I suspect it might not be possible with that USB device and the 'proper' solution is a bigger SSD. Still, I am open to suggestions.
TIA
EDIT I have added the fstab entry above and dmesg logs of a clean suspend/resume on power versus a failed suspend/resume on battery. I am also going to change the drive from fat to ext4 and retest.
--
Mark