Mounting CIFS after suspend fails

Hi everyone, I'm having an issue with a CIFS mount that I'm trying to solve and I haven't had much luck with my internet searches.

I have a FreeNAS server that I mount using CIFS and then use rsync to sync a copy of my photos folder to FreeNAS.

The issue is that if I reboot my desktop, the mount works. However if the desktop has been suspend and resumed then the mount fails. A folder is created at the mount point and all the photos are dumped in the folder taking up all the space on my home partition.

I followed this post when setting up cron and rsync.

The script the cron job calls is located on my home partition and owned by root (I have recently added the smbd and sleep options in the home that restarting the samba service will help but it has not):

#!/usr/bin/env zsh

# Restart samba service
smbd restart

# Wait to make sure service has restarted
sleep 5s

# Mount volume 
mount -t cifs -o credentials=/.smbcred,uid=1000,gid=1000,forceuid,forcegid,vers=2.1, // /home/george/mnt/FreeNAS/Backups/

# Sync the Photos folder on Data drive to FreeNAS box
# Full list of options:
# r -- recursive
# a -- archive
# t -- times (transfer modification times along with the files and update them on remote system)
# v -- verbose
# s -- no space-splitting; wildcard chars only
# progress -- show progress during transfer
rsync -r -a -t -v -s --progress --log-file=/tmp/rsync-output /run/media/george/Data/Photos /home/george/mnt/FreeNAS/Backups/
# Unmount volume
umount /home/george/mnt/FreeNAS/Backups/

When the mount fails, kernel logs show:

No dialects specified on mount. Default has changed to a more secure dialect, SMB2.1 or later
CIFS VFS: could not allocate crypto cmac(aes)
CIFS VFS: could not allocate crypto md4
CIFS VFS: could not allocate crypto API arc4
Status code returned 0xc000000d STATUS_INVALID_PARAMETER
CIFS VFS: Send error in SessSetup=-22
CIFS VFS: cifs_mount failed w/return code=-22

Any guidance is greatly appreciated, and if any more information is required please let me know.

I've helped resolve a few suspend/resume issues with wifi/bluetooth/and NIC's by bringing down the adapter and unloading the modules before suspend. At resume the modules must be reloaded and the adapter must be raised. This usually solves the problem.

I would assume the same thing could be done with your network mount. You would need to script unmounting your share before suspend, then mount the share after resume. The Samba service may also need to be stopped restarted as well.

This can be done by creating one or two systemd unit files to unmount/mount your shares. Others scripts may be called from the systemd unit files to perform the task. If the scripting requirements are very simple the job may be accomplished with only one systemd suspend/resume file.

I worked on this within the last couple days on a Bluetooth issue. I will find the link and post it for you. The same principles should apply I would think.

Thanks @tbg - I remember coming across the post you linked when I was setting up Manjaro on my surface pro a while back.

I've followed the steps to create the scripts to unload/load the wifi module. The mount itself shouldn't need to be unmounted before suspend as the backup script is the only time it is ever mounted and then unmounts it at the end of the process.

I'll keep an eye on how the backup goes with the changes and report back in a couple of days.

1 Like

Just wanted to report back for anyone that comes across this that after a couple of days, the fix suggested by @tbg appears to work - my cron/rsync job has been running fine without any issues.


Sweet, those scripts have solved way more issues than I ever first wrote them for. Are you gonna give me credit for the solve on this one. :smile:

Could you please post your scripts/systemd unit files so that others can find the solution if they are having similar issues. Thank you.

Somehow I missed this last post @tbg. I suppose it is fortunate then that I nuked my root partition while trying to resize it and had to come back to track down these scripts!

Credit has been given for solving the issue and my scripts/unit files are below, although besides the different module name they are not any different from your original post.

modprobe -r wl


'# cat netmod-suspend.service
'# /etc/systemd/system/netmod-suspend.service
Description=Network module suspend helper



modprobe wl


'# systemctl cat netmod-resume.service
'# /etc/systemd/system/netmod-resume.service

Description=Network module resume helper



1 Like

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

Forum kindly sponsored by