System suddenly wont suspend/wake while any smb are mounted?

My system has be fine until this morning.

Now i find it will hang for ages in i try to suspend and it will crash completely when waking up (it wakes with a frozen desktop that you can not do anything with except a hard reset)

I have no clue what has changed, nothing as far as i know.

Im trying to make a script to umount -a -t cifs before sleep and the mount -a -t cifs after wake but im not getting anywhere.

I would much rather figure why its just started doing this?

inxi -b

❱inxi -b
System:
Host: greg-venusseries Kernel: 6.9.12-1-MANJARO arch: x86_64 bits: 64
Desktop: KDE Plasma v: 6.0.5 Distro: Manjaro Linux
Machine:
Type: Desktop System: Micro (HK) Tech product: Venus Series v: N/A
serial:
Mobo: Shenzhen Meigao Equipment model: AHWSA serial:
UEFI: American Megatrends LLC. v: AHWSA.1.22 date: 03/12/2024

full journalctl of a suspend/wake attempt: it had to be hard rebooted at the end.

Aug 18 13:08:22 greg-venusseries systemd[895]: Started Sleep.
Aug 18 13:08:22 greg-venusseries systemd-logind[795]: The system will suspend now!
Aug 18 13:08:22 greg-venusseries ModemManager[835]: <msg> [sleep-monitor-systemd] system is about to suspend
Aug 18 13:08:22 greg-venusseries NetworkManager[791]: <info>  [1723982902.9642] manager: sleep: sleep requested (sleeping: no  enabled: yes)
Aug 18 13:08:22 greg-venusseries NetworkManager[791]: <info>  [1723982902.9644] device (p2p-dev-wlp88s0): state change: disconnected -> unmanaged (reason 'unmanaged-sleep>
Aug 18 13:08:22 greg-venusseries NetworkManager[791]: <info>  [1723982902.9648] manager: NetworkManager state is now ASLEEP
Aug 18 13:08:22 greg-venusseries NetworkManager[791]: <info>  [1723982902.9649] device (wlp88s0): state change: activated -> deactivating (reason 'sleeping', sys-iface-st>
Aug 18 13:08:22 greg-venusseries NetworkManager[791]: <info>  [1723982902.9650] dhcp4 (wlp88s0): canceled DHCP transaction
Aug 18 13:08:22 greg-venusseries NetworkManager[791]: <info>  [1723982902.9650] dhcp4 (wlp88s0): activation: beginning transaction (timeout in 45 seconds)
Aug 18 13:08:22 greg-venusseries NetworkManager[791]: <info>  [1723982902.9650] dhcp4 (wlp88s0): state changed no lease
Aug 18 13:08:22 greg-venusseries NetworkManager[791]: <info>  [1723982902.9651] dhcp6 (wlp88s0): canceled DHCP transaction
Aug 18 13:08:22 greg-venusseries NetworkManager[791]: <info>  [1723982902.9651] dhcp6 (wlp88s0): activation: beginning transaction (timeout in 45 seconds)
Aug 18 13:08:22 greg-venusseries NetworkManager[791]: <info>  [1723982902.9651] dhcp6 (wlp88s0): state changed no lease
Aug 18 13:08:22 greg-venusseries kded6[1014]: org.kde.plasma.nm.kded: Unhandled active connection state change:  3
Aug 18 13:08:22 greg-venusseries systemd[1]: Starting Network Manager Script Dispatcher Service...
Aug 18 13:08:23 greg-venusseries systemd[1]: Started Network Manager Script Dispatcher Service.
Aug 18 13:08:23 greg-venusseries kernel: wlp88s0: deauthenticating from 9c:53:22:17:e0:15 by local choice (Reason: 3=DEAUTH_LEAVING)
Aug 18 13:08:23 greg-venusseries wpa_supplicant[886]: nl80211: send_event_marker failed: Source based routing not supported
Aug 18 13:08:23 greg-venusseries wpa_supplicant[886]: wlp88s0: CTRL-EVENT-DISCONNECTED bssid=9c:53:22:17:e0:15 reason=3 locally_generated=1
Aug 18 13:08:23 greg-venusseries wpa_supplicant[886]: wlp88s0: CTRL-EVENT-DSCP-POLICY clear_all
Aug 18 13:08:23 greg-venusseries NetworkManager[791]: <info>  [1723982903.4617] device (wlp88s0): state change: deactivating -> disconnected (reason 'sleeping', sys-iface>
Aug 18 13:08:23 greg-venusseries wpa_supplicant[886]: wlp88s0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Aug 18 13:08:23 greg-venusseries NetworkManager[791]: <info>  [1723982903.4935] device (wlp88s0): supplicant interface state: completed -> disconnected
Aug 18 13:08:23 greg-venusseries NetworkManager[791]: <info>  [1723982903.4936] device (wlp88s0): state change: disconnected -> unmanaged (reason 'unmanaged-sleeping', sy>
Aug 18 13:08:23 greg-venusseries wpa_supplicant[886]: wlp88s0: CTRL-EVENT-DSCP-POLICY clear_all
Aug 18 13:08:23 greg-venusseries systemd[1]: Reached target Sleep.
Aug 18 13:08:23 greg-venusseries systemd[1]: Starting System Suspend...
Aug 18 13:08:23 greg-venusseries wpa_supplicant[886]: wlp88s0: CTRL-EVENT-DSCP-POLICY clear_all
Aug 18 13:08:23 greg-venusseries wpa_supplicant[886]: nl80211: deinit ifname=wlp88s0 disabled_11b_rates=0
Aug 18 13:08:33 greg-venusseries systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
Aug 18 13:08:37 greg-venusseries systemd[1]: Starting Check Bluetooth Connection and Reconnect if Needed...
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3630]: No devices connected. Attempting to connect...
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3635]: [84B blob data]
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3635]: [bluetooth]# connect B0:38:E2:51:B0:B4
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3635]: Attempting to connect to B0:38:E2:51:B0:B4
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3635]: [54B blob data]
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3635]: [bluetooth]#
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3637]: [84B blob data]
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3637]: [bluetooth]# connect E0:9D:FA:F5:5F:99
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3637]: Device E0:9D:FA:F5:5F:99 not available
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3637]: [54B blob data]
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3637]: [bluetooth]#
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3639]: [84B blob data]
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3639]: [bluetooth]# connect B0:38:E2:51:B1:F0
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3639]: Attempting to connect to B0:38:E2:51:B1:F0
Aug 18 13:08:37 greg-venusseries bt-recon.sh[3639]: [bluetooth]#
Aug 18 13:08:37 greg-venusseries systemd[1]: check_bluetooth.service: Deactivated successfully.
Aug 18 13:08:37 greg-venusseries systemd[1]: Finished Check Bluetooth Connection and Reconnect if Needed.
Aug 18 13:08:57 greg-venusseries systemd[1]: Starting Check Bluetooth Connection and Reconnect if Needed...
Aug 18 13:08:58 greg-venusseries bt-recon.sh[3642]: No devices connected. Attempting to connect...
Aug 18 13:08:58 greg-venusseries bt-recon.sh[3647]: [84B blob data]
Aug 18 13:08:58 greg-venusseries bt-recon.sh[3647]: [bluetooth]# connect B0:38:E2:51:B0:B4
Aug 18 13:08:58 greg-venusseries bt-recon.sh[3647]: Attempting to connect to B0:38:E2:51:B0:B4
Aug 18 13:08:58 greg-venusseries bt-recon.sh[3647]: [bluetooth]#
Aug 18 13:08:58 greg-venusseries bt-recon.sh[3649]: [84B blob data]
Aug 18 13:08:58 greg-venusseries bt-recon.sh[3649]: [bluetooth]# connect E0:9D:FA:F5:5F:99
Aug 18 13:08:58 greg-venusseries bt-recon.sh[3649]: Device E0:9D:FA:F5:5F:99 not available
Aug 18 13:08:58 greg-venusseries bt-recon.sh[3649]: [bluetooth]#

I have tried making a script at
/usr/lib/systemd/system-sleep/smb-suspend.sh

with

#!/bin/bash
case $1 in
    pre)
        echo "Unmounting SMB shares..."
        umount -a -t cifs
        ;;
    post)
        sleep 30
        echo "Mounting SMB shares..."
        mount -a -t cifs
        ;;
esac

but the network will not connect until after this script has ended so it wont work.

at a loss :frowning:

One guess is that the wifi is shutoff before the smb mounts has been unmounted thus causing your system to hang when waking up as there is no network connection until your system is fully operable after the suspension.

Usually a matter of configuration and one of the reason I avoid system supension when having network mounts active.

Create units for your smb moutns - instead of fstab mounts.

See → [root tip] [How To] Use systemd to mount ANY device
And → [root tip] [How To] systemd mount unit samples

The steps

  1. Unmount your smb mounts
  2. Comment your smb mount in fstab
  3. Create mount unit for each smb mount
    • follow the rules
      • don’t be tempted to use your home or /mnt
      • create a new tree from root folder containing your mountpoints
      • e.g. /a/smb1
      • name the units according to the mountpoint
        • a-smb1.mount
        • a-smb1.automount
    • test the mount units
    • ensure the mount units are stopped and disabled
  4. Create a complimentary automount unit for each smb mount
    • start and enable the automount units

The benefits are obvious

  • automount will activate the mount unit when you access the mountpoint
  • automount will unmount when no longer accessed (defined inactivity in automount unit)

The end result is that your system will resume succesfully from a suspend.

Another approach is to use small gvfs mount scripts.

See → [root tip] [Utility Script] GIO mount samba share
And a mogrified version → Re: [Utility Script] GIO mount samba share - #3 by pheiduck

1 Like

o my god, my head hurts.

Chatgpt and me are going round and round in circles
My fstab for just this one nas mount looks like this

//192.168.1.100/manjaro-home                /mnt/TRUENAS-manjaro-home   cifs    vers=2.0,user,nofail,cache=loose,credentials=/home/greg/.smbcredentials-nas,iocharset=utf8,uid=1000,gid=1000,noperm,_netdev      0 0

what do i have to do to create this darn unit.

❱sudo systemctl status mnt-TRUENAS\x2dmanjaro\x2dhome.mount

○ mnt-TRUENAS-manjaro-home.mount - Mount SMB Share - TRUENAS Manjaro Home
     Loaded: bad-setting (Reason: Unit mnt-TRUENAS-manjaro-home.mount has a bad unit file setting.)
     Active: inactive (dead)
      Where: /mnt/TRUENAS-manjaro-home
       What: //192.168.1.100/manjaro-home

Aug 18 15:38:59 greg-venusseries systemd[1]: mnt-TRUENAS-manjaro-home.mount: Where= setting doesn't match unit name. Refusing.
Aug 18 15:39:31 greg-venusseries systemd[1]: mnt-TRUENAS-manjaro-home.mount: Where= setting doesn't match unit name. Refusing.
Aug 18 15:49:02 greg-venusseries systemd[1]: mnt-TRUENAS-manjaro-home.mount: Where= setting doesn't match unit name. Refusing.
3

⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼ /home/greg ⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼
❱cat /etc/systemd/system/mnt-TRUENAS\x2dmanjaro\x2dhome.mount
[Unit]
Description=Mount SMB Share - TRUENAS Manjaro Home
After=network-online.target
Wants=network-online.target

[Mount]
What=//192.168.1.100/manjaro-home
Where=/mnt/TRUENAS-manjaro-home
Type=cifs
Options=vers=2.0,user,nofail,cache=loose,credentials=/home/greg/.smbcredentials-nas,iocharset=utf8,uid=1000,gid=1000,noperm,_netdev

[Install]
WantedBy=multi-user.target

But it IS correct.

❱systemd-escape -p --suffix=mount "/mnt/TRUENAS-manjaro-home"
mnt-TRUENAS\x2dmanjaro\x2dhome.mount

Ok, I got it all sorted in the end. That was a long day that I had not accounted for.

However, yes, you are correct in that using systemd units to mount and/or automount is a superior way to go.

It has, as far as I know, fixed the sleep issue. I don’t know why the issue just started freezing my system this morning after a few years with a good handful of computers and many more OS’s on each, all just use fstab. I have never seen this behavior before.

In the end I had to rename all my mounts as they all used "-"s in the name, and I never did figure out how to use “-”. So that also meant going and finding all the places and apps where I use the paths to adjust them. I had to create all the unit files one at a time… hmmm lot of tapping away trying to figure out if they should be stopped/enabled/started etc.

As i say it was a long day but i am happy with the result.

Thx @linux-aarhus

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.