After a pleasant year of using Manjaro Linux on my laptop at home, I started seeing problems with SMB mounts. My setup is that I have all of the main storage on my home server which is shared through SMB shares and these shares are mounted on the laptop through SMB4k. SMB4k started doing strange things (mounting it with the wrong user id, hanging after suspend/resume etc.) after the latest round of package updates. Instead of trying to fix that, I decided to move to autofs as my solution for mounting the SMB shares. The setup for using autofs is somewhat involved but I got it setup so I was able to mount my shares and use them normally. However, one problem I noticed was that shutdown of the laptop became slow – reading through the logs, I saw that the issue was that the WiFi network was getting shutdown during the shutdown of autofs causing a three minute timeout and eventual force terminate of autofs during shutdown.
Even though the systemd configurations and dependencies were right, this problem seemed to persist – eventually I figured out a simple and correct solution to the problem. The issue seems to be that the WiFi connection is marked for use only for my user in NetworkManager – so during shutdown, the logout for the user immediately shuts down the WiFi connection. The easy way to correct this is to do the following:
# Find your WiFi connection UUID
nmcli connection show
# Check connection.permissions. Check if it says user:<username>
nmcli connection show <UUID of WiFi Connection>
# If you saw user:<username>, this is your problem. Fix it with this command
nmcli connection modify <UUID> connection.permissions ""
Alternately, on KDE Plasma, you can go to System Settings > Connections > Your WiFi Network > General Configuration and select the “All users may connect to this network” option. This prevents the desktop from incorrectly yanking the connection out with user logout and prevents the extended delay during shutdown. I will write a follow-up post on using autofs for a stable way of mounting, unmounting and handling suspend/sleep/resume on a Linux laptop with SMB shares.
1 Reply to “Fixing slow shutdown in Linux from CIFS/SMB mounts over WiFi”