You are not logged in.

#1 2022-07-02 18:49:08

kobhian
Member
Registered: 2021-02-07
Posts: 14

CIFS Mount Failed, Error 22

hello,

I'm trying to connect to a samba share and keep getting error 22, upon checking the logs, this is what I get:

[  250.895781] CIFS: fs/cifs/fs_context.c: CIFS: parsing cifs mount option 'source'
[  250.895790] CIFS: fs/cifs/fs_context.c: CIFS: parsing cifs mount option 'ip'
[  250.895795] CIFS: fs/cifs/fs_context.c: CIFS: parsing cifs mount option 'unc'
[  250.895805] CIFS: fs/cifs/cifsfs.c: Devname: \\192.168.2.229\Trans flags: 0
[  250.895809] CIFS: fs/cifs/connect.c: Username: admin
[  250.895811] CIFS: fs/cifs/connect.c: file mode: 0755  dir mode: 0755
[  250.895816] CIFS: fs/cifs/connect.c: VFS: in mount_get_conns as Xid: 11 with uid: 0
[  250.895819] CIFS: fs/cifs/connect.c: UNC: \\192.168.2.229\Trans
[  250.895824] CIFS: fs/cifs/connect.c: generic_ip_connect: connecting to 192.168.2.229:445
[  250.895835] CIFS: fs/cifs/connect.c: Socket created
[  250.895837] CIFS: fs/cifs/connect.c: sndbuf 16384 rcvbuf 131072 rcvtimeo 0x834
[  250.896402] CIFS: fs/cifs/connect.c: cifs_get_tcp_session: next dns resolution scheduled for 600 seconds in the future
[  250.896409] CIFS: fs/cifs/connect.c: VFS: in cifs_get_smb_ses as Xid: 12 with uid: 0
[  250.896413] CIFS: fs/cifs/connect.c: Existing smb sess not found
[  250.896411] CIFS: fs/cifs/connect.c: Demultiplex PID: 2288
[  250.896418] CIFS: fs/cifs/smb2pdu.c: Negotiate protocol
[  250.896426] CIFS: fs/cifs/transport.c: wait_for_free_credits: remove 1 credits total=0
[  250.896446] CIFS: fs/cifs/transport.c: Sending smb: smb_len=244
[  250.899312] CIFS: fs/cifs/connect.c: RFC1002 header 0x49
[  250.899324] CIFS: fs/cifs/smb2misc.c: SMB2 data length 0 offset 0
[  250.899327] CIFS: fs/cifs/smb2misc.c: SMB2 len 73
[  250.899332] CIFS: fs/cifs/smb2ops.c: smb2_add_credits: added 1 credits total=1
[  250.899389] CIFS: fs/cifs/transport.c: cifs_sync_mid_result: cmd=0 mid=0 state=4
[  250.899398] CIFS: Status code returned 0xc000000d STATUS_INVALID_PARAMETER
[  250.899405] CIFS: fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc000000d to POSIX err -22
[  250.899413] CIFS: fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[  250.899420] CIFS: fs/cifs/connect.c: VFS: leaving cifs_get_smb_ses (xid = 12) rc = -22
[  250.899426] CIFS: fs/cifs/dfs_cache.c: cache_refresh_path: search path: \192.168.2.229\Trans
[  250.899432] CIFS: fs/cifs/dfs_cache.c: get_dfs_referral: get an DFS referral for \192.168.2.229\Trans
[  250.899446] CIFS: fs/cifs/connect.c: VFS: leaving mount_put_conns (xid = 11) rc = 0
[  250.899450] CIFS: VFS: cifs_mount failed w/return code = -22

Thanks!

Offline

#2 2022-07-02 18:52:59

Maniaxx
Member
From: .de
Registered: 2014-05-14
Posts: 636

Re: CIFS Mount Failed, Error 22

Upstream bug. I'm affected as well.
https://lore.kernel.org/all/87edz63t11.fsf@cjr.nz/T/
culprit: https://git.kernel.org/pub/scm/linux/ke … eb81c765fe

I'm using gvfs-smb (userspace) as a workaround atm.
Server 4.14.7. Client 4.16.2. Kernel 5.18.8.

Last edited by Maniaxx (2022-07-02 19:01:23)


sys2064

Offline

#3 2022-07-02 19:10:09

kobhian
Member
Registered: 2021-02-07
Posts: 14

Re: CIFS Mount Failed, Error 22

Maniaxx, thanks!

I never used gvfs-smb, is there a guide/reference you can help me with as to temp mount this shares?

Thanks!

Offline

#4 2022-07-02 19:17:45

Maniaxx
Member
From: .de
Registered: 2014-05-14
Posts: 636

Re: CIFS Mount Failed, Error 22

An easy way is probably via file manager:
https://wiki.archlinux.org/title/Samba# … figuration

5.18.9 has no fix.
https://git.kernel.org/pub/scm/linux/ke … nux-5.18.y

Last edited by Maniaxx (2022-07-03 14:37:14)


sys2064

Offline

#5 2022-07-02 20:26:03

kobhian
Member
Registered: 2021-02-07
Posts: 14

Re: CIFS Mount Failed, Error 22

Maniaxx, that's good info.

based on that I decided to instead use the LTS kernel for the meantime and its indeed, "fixed".

Many thanks for saving me a night of head scratching!

Last edited by kobhian (2022-07-03 00:05:10)

Offline

#6 2022-07-03 08:52:47

GeorgeJP
Member
From: Czech Republic
Registered: 2020-01-28
Posts: 137

Re: CIFS Mount Failed, Error 22

I am affected with this on shares from OpenMediaVault (NAS).
Shares from Windows10 machine works.

Offline

#7 2022-07-04 21:05:40

Brocellous
Member
Registered: 2017-11-27
Posts: 80

Re: CIFS Mount Failed, Error 22

Is anyone able to apply the revert and build the cifs module for arch's linux? I tried just building the plain cifs module for 5.18.9 but I'm getting what look like linker errors in linux-stable:

$ git describe HEAD
v5.18.9
$ zcat /proc/config.gz > .config
$ make -j8 $(uname -r | awk -F- '{print "EXTRAVERSION=-" $2, "LOCALVERSION=-" $3}') modules_prepare
[...]
$ make -j8 M=fs/cifs
[...]
  MODPOST fs/cifs/Module.symvers
ERROR: modpost: "__put_devmap_managed_page" [fs/cifs/cifs.ko] undefined!
ERROR: modpost: "kmem_cache_alloc_lru" [fs/cifs/cifs.ko] undefined!
ERROR: modpost: "__fscache_begin_write_operation" [fs/cifs/cifs.ko] undefined!
ERROR: modpost: "__fscache_use_cookie" [fs/cifs/cifs.ko] undefined!
ERROR: modpost: "kfree_skb_reason" [fs/cifs/cifs.ko] undefined!
ERROR: modpost: "__module_put_and_kthread_exit" [fs/cifs/cifs.ko] undefined!
ERROR: modpost: "__fscache_relinquish_volume" [fs/cifs/cifs.ko] undefined!
ERROR: modpost: "hugetlb_free_vmemmap_enabled_key" [fs/cifs/cifs.ko] undefined!
ERROR: modpost: "__fscache_unuse_cookie" [fs/cifs/cifs.ko] undefined!
ERROR: modpost: "__trace_trigger_soft_disabled" [fs/cifs/cifs.ko] undefined!
WARNING: modpost: suppressed 3 unresolved symbol warnings because there were too many)
make[1]: *** [scripts/Makefile.modpost:134: fs/cifs/Module.symvers] Error 1
make[1]: *** Deleting file 'fs/cifs/Module.symvers'
make: *** [Makefile:1753: modules] Error 2

Is our gcc too new or something?

Offline

#8 2022-07-04 21:48:28

progandy
Member
Registered: 2012-05-17
Posts: 5,003

Re: CIFS Mount Failed, Error 22

Try the other option and build with the  build headers for the installed/running kernel. This worked for me:

# https://downgit.github.io
# https://github.com/gregkh/linux/tree/v5.18.7/fs/cifs
# https://github.com/gregkh/linux/tree/v5.18.7/fs/smbfs_common
# directories: build/cifs, build/smbfs_common
# install linux-headers for your kernel
# https://docs.kernel.org/kbuild/modules.html

cd build/cifs
make -C /lib/modules/`uname -r`/build M=$PWD

Edit: In this case, building the version for v5.18.7 is the same as reverting the commits in 5.18.9.

Last edited by progandy (2022-07-04 21:58:44)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#9 2022-07-04 22:03:50

Brocellous
Member
Registered: 2017-11-27
Posts: 80

Re: CIFS Mount Failed, Error 22

Thanks @Progandy, I did

$ git rev-list v5.18.7..v5.18.8 -- fs/cifs | xargs git revert
$ cd fs/cifs
$ make -j8 -C /lib/modules/`uname -r`/build M=$PWD
$ zstd cifs.ko
$ sudo cp cifs.ko.zst `modinfo -F filename cifs`

and it works now.

Offline

#10 2022-07-05 18:31:45

mulberrywheeth
Member
Registered: 2022-07-05
Posts: 1

Re: CIFS Mount Failed, Error 22

Another workaround besides using gvfs-smb that also works, at least for me, is adding vers=2.0 to the options in /etc/fstab.

Offline

#11 2022-07-05 19:37:48

GeorgeJP
Member
From: Czech Republic
Registered: 2020-01-28
Posts: 137

Re: CIFS Mount Failed, Error 22

mulberrywheeth wrote:

Another workaround besides using gvfs-smb that also works, at least for me, is adding vers=2.0 to the options in /etc/fstab.

Works also for me

Offline

#12 2022-07-05 19:41:10

primalmotion
Member
Registered: 2021-10-28
Posts: 2

Re: CIFS Mount Failed, Error 22

mulberrywheeth wrote:

Another workaround besides using gvfs-smb that also works, at least for me, is adding vers=2.0 to the options in /etc/fstab.

Worked for me. Thanks for saving my day smile

Offline

#13 2022-07-05 20:18:36

Simaryp
Member
Registered: 2018-04-28
Posts: 121

Re: CIFS Mount Failed, Error 22

I updated today my machine and after reboot my systemd CIFS mounts don't work anymore.
I see in journalctl that the error code is -22 " mount error(22): Invalid argument".
I changed nothing so I can only guess that something changed in CIFS and I need to adapt my mount units. But I don't know what the issue is.
This is my example unit. Actually in daily business it's started via an automount unit.
[Unit]
Description=media cifs mount
Requires=network-online.target
After=network-online.service

[Mount]
What=//myserver.mydomain.org/media
Where=/mnt/media
Type=cifs
Options=credentials=/home/user/.smb2credentials,vers=3.1.1,uid=1000,gid=1000

[Install]
WantedBy=multi-user.target

Does anybody see the issue?

Offline

#14 2022-07-05 20:23:12

GeorgeJP
Member
From: Czech Republic
Registered: 2020-01-28
Posts: 137

Re: CIFS Mount Failed, Error 22

Offline

#15 2022-07-05 20:31:44

Xyne
Administrator/TU
Registered: 2008-08-03
Posts: 6,896
Website

Re: CIFS Mount Failed, Error 22

Mod note: merged the two previous posts from a duplicate thread.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#16 2022-07-05 20:41:34

Simaryp
Member
Registered: 2018-04-28
Posts: 121

Re: CIFS Mount Failed, Error 22

Is there already an estimate when an fix can be expected?

Offline

#17 2022-07-05 21:38:32

Maniaxx
Member
From: .de
Registered: 2014-05-14
Posts: 636

Re: CIFS Mount Failed, Error 22

mulberrywheeth wrote:

adding vers=2.0 to the options in /etc/fstab.

That's the best solution so far indeed.
vers=3.02 is working as well. vers=3.1.1 is broken.

Brocellous wrote:

Is anyone able to apply the revert and build the cifs module for arch's linux?

This might be a good speed/traffic (230MB) tradeoff:

git clone --depth=16 -b linux-5.18.y git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
cd linux
git revert -n 16d5d910 ca83f50b
cd fs/cifs
make -j4 -C /lib/modules/`uname -r`/build M=$PWD
strip -d cifs.ko
zstd cifs.ko
sudo cp cifs.ko.zst `modinfo -F filename cifs`

Last edited by Maniaxx (2022-07-05 22:09:20)


sys2064

Offline

#18 2022-07-06 01:50:14

Brocellous
Member
Registered: 2017-11-27
Posts: 80

Re: CIFS Mount Failed, Error 22

Fortunately I already had a copy of linux-stable checked out. Progandy is right though it works just as well to build the 5.18.7 version with our 5.18.9 headers, which is faster than applying the reverts.

EDIT: If not, probably faster to grab the source tarball https://mirrors.edge.kernel.org/pub/lin … 8.7.tar.gz

Last edited by Brocellous (2022-07-06 01:53:40)

Offline

#19 2022-07-07 10:35:08

joanmanel
Member
Registered: 2012-11-06
Posts: 189

Re: CIFS Mount Failed, Error 22

mulberrywheeth wrote:

Another workaround besides using gvfs-smb that also works, at least for me, is adding vers=2.0 to the options in /etc/fstab.

vers=2.0 also worked for me.

Offline

#20 2022-07-16 00:58:02

Brocellous
Member
Registered: 2017-11-27
Posts: 80

Re: CIFS Mount Failed, Error 22

Offline

#21 2022-07-22 18:16:38

Brocellous
Member
Registered: 2017-11-27
Posts: 80

Re: CIFS Mount Failed, Error 22

Released in linux 5.18.13

Offline

Board footer

Powered by FluxBB