CIFS: VFS: cifs_mount failed w/return code = -22

Googling doesn’t seem to yield anything useful. The mount command itself yields “Invalid argument”, but that message doesn’t show what’s amiss:

$ sudo mount -t cifs //{server}/{share} {mount} -o rw,username={name},password={password},uid={me},gid={group},domain={domain}
mount error(22): Invalid argument

$ dmesg | tail -n2
[13928.636167] CIFS: Attempting to mount \\{server}\{share}
[13928.713489] CIFS: VFS: cifs_mount failed w/return code = -22

I’ve not seen any information on what to look for on the Mac server for connection failures, but it is returning “-22” as a result code.

P.S.

sudo smbclient -L {server} -U {name}Password for {domain}\{user}:

        Sharename       Type      Comment
        ---------       ----      -------
        IPC$            IPC       
        Macintosh HD    Disk      
        RAID5-21TB      Disk      
        {user}       Disk

Only the “RAID5-21TB” is supposed to be shared, according to the Mac “system preferences”.

I keep trying over and over to make the last two code segments be one segment, but the web page insists on inserting the “CODE” and “/CODE” markers after the word “smbclient”. There’s a bug in this Javascript.

I have determined out to get more info out of the CIFS subsystem, but to no help:

[16692.441371] CIFS: A: 0x1c29 S: 0x1c29 R: 0x1003e8793
[16726.025047] CIFS: A: 0x1994 S: 0x1994 R: 0x0
[16726.044920] CIFS: Status code returned 0xc0000016 STATUS_MORE_PROCESSING_REQUIRED
[16726.507604] CIFS: Status code returned 0xc00000be STATUS_BAD_NETWORK_PATH
[16726.507942] CIFS: Status code returned 0xc000019c STATUS_FS_DRIVER_REQUIRED
[16726.508296] CIFS: VFS: cifs_mount failed w/return code = -22

Not sure what the “bad network path” is about. I hear the RAID array spool up when I issue the command.

Even more debug information:

...
[17301.527116] CIFS: ../fs/cifs/cifsfs.c: Devname: \\imac\Volumes flags: 0
[17301.527118] CIFS: ../fs/cifs/connect.c: Username: <user>
[17301.527120] CIFS: ../fs/cifs/connect.c: file mode: 0755  dir mode: 0755
[17301.527122] CIFS: ../fs/cifs/connect.c: VFS: in mount_get_conns as Xid: 106 with uid: 0
[17301.527123] CIFS: ../fs/cifs/connect.c: UNC: \\imac\Volumes
[17301.527128] CIFS: ../fs/cifs/connect.c: generic_ip_connect: connecting to 172.16.16.115:445
[17301.527133] CIFS: ../fs/cifs/connect.c: Socket created
[17301.527134] CIFS: ../fs/cifs/connect.c: sndbuf 16384 rcvbuf 131072 rcvtimeo 0x6d6
[17306.180003] CIFS: ../fs/cifs/fscache.c: cifs_fscache_get_client_cookie: (...)
[17306.180007] CIFS: ../fs/cifs/connect.c: Demultiplex PID: 16259
[17306.180016] CIFS: ../fs/cifs/connect.c: VFS: in cifs_get_smb_ses as Xid: 107 with uid: 0
[17306.180018] CIFS: ../fs/cifs/connect.c: Existing smb sess not found
[17306.180025] CIFS: ../fs/cifs/smb2pdu.c: Negotiate protocol
Sending smb: smb_len=220
[17306.185459] CIFS: ../fs/cifs/connect.c: RFC1002 header 0x100
[17306.185468] CIFS: ../fs/cifs/smb2misc.c: SMB2 data length 128 offset 128
[17306.185469] CIFS: ../fs/cifs/smb2misc.c: SMB2 len 256
[17306.185491] CIFS: ../fs/cifs/transport.c: cifs_sync_mid_result: cmd=0 mid=0 state=4
[17306.185504] CIFS: ../fs/cifs/smb2pdu.c: mode 0x3
[17306.185506] CIFS: ../fs/cifs/smb2pdu.c: negotiated smb3.02 dialect
[17306.185512] CIFS: ../fs/cifs/asn1.c: OID len = ...
[17306.185527] CIFS: ../fs/cifs/connect.c: Security Mode: 0x3 Capabilities: 0x300066 TimeAdjust: 0
[17306.185529] CIFS: ../fs/cifs/smb2pdu.c: Session Setup
[17306.185531] CIFS: ../fs/cifs/smb2pdu.c: sess setup type 4
Sending smb: smb_len=128
[17306.190246] CIFS: ../fs/cifs/connect.c: RFC1002 header 0xd6
[17306.190251] CIFS: ../fs/cifs/smb2misc.c: SMB2 data length 142 offset 72
[17306.190252] CIFS: ../fs/cifs/smb2misc.c: SMB2 len 214
[17306.190270] CIFS: ../fs/cifs/transport.c: cifs_sync_mid_result: cmd=1 mid=1 state=4
[17306.190275] CIFS: Status code returned 0xc0000016 STATUS_MORE_PROCESSING_REQUIRED
[17306.190282] CIFS: ../fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000016 to POSIX err -5
[17306.190284] CIFS: ../fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[17306.190299] CIFS: ../fs/cifs/smb2pdu.c: rawntlmssp session setup challenge phase
Sending smb: smb_len=336
[17306.212660] CIFS: ../fs/cifs/connect.c: RFC1002 header 0x48
[17306.212667] CIFS: ../fs/cifs/smb2misc.c: SMB2 data length 0 offset 72
[17306.212668] CIFS: ../fs/cifs/smb2misc.c: SMB2 len 73
[17306.212670] CIFS: ../fs/cifs/smb2misc.c: Calculated size 73 length 72 mismatch mid 2
[17306.212682] CIFS: ../fs/cifs/transport.c: cifs_sync_mid_result: cmd=1 mid=2 state=4
[17306.212706] CIFS: ../fs/cifs/smb2pdu.c: SMB2/3 session established successfully
[17306.212710] CIFS: ../fs/cifs/connect.c: VFS: leaving cifs_get_smb_ses (xid = 107) rc = 0
[17306.212713] CIFS: ../fs/cifs/connect.c: VFS: in cifs_setup_ipc as Xid: 108 with uid: 0
[17306.212715] CIFS: ../fs/cifs/smb2pdu.c: TCON
Sending smb: smb_len=100
[17306.213000] CIFS: ../fs/cifs/connect.c: RFC1002 header 0x50
[17306.213003] CIFS: ../fs/cifs/smb2misc.c: SMB2 len 80
[17306.213012] CIFS: ../fs/cifs/transport.c: cifs_sync_mid_result: cmd=3 mid=3 state=4
[17306.213021] CIFS: ../fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[17306.213024] CIFS: ../fs/cifs/smb2pdu.c: connection to pipe share
[17306.213025] CIFS: ../fs/cifs/smb2pdu.c: validate negotiate
[17306.213027] CIFS: ../fs/cifs/smb2pdu.c: SMB2 IOCTL
Sending smb: smb_len=156
[17306.213320] CIFS: ../fs/cifs/connect.c: RFC1002 header 0x88
[17306.213324] CIFS: ../fs/cifs/smb2misc.c: SMB2 data length 24 offset 112
[17306.213325] CIFS: ../fs/cifs/smb2misc.c: SMB2 len 136
[17306.213334] CIFS: ../fs/cifs/transport.c: cifs_sync_mid_result: cmd=11 mid=4 state=4
[17306.213340] CIFS: ../fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[17306.213343] CIFS: ../fs/cifs/smb2pdu.c: validate negotiate info successful
[17306.213345] CIFS: ../fs/cifs/connect.c: VFS: leaving cifs_setup_ipc (xid = 108) rc = 0
[17306.213347] CIFS: ../fs/cifs/connect.c: IPC tcon rc = 0 ipc tid = 1
[17306.213351] CIFS: ../fs/cifs/connect.c: VFS: in cifs_get_tcon as Xid: 109 with uid: 0
[17306.213352] CIFS: ../fs/cifs/smb2pdu.c: TCON
Sending smb: smb_len=106
[17306.217446] CIFS: ../fs/cifs/connect.c: RFC1002 header 0x49
[17306.217452] CIFS: ../fs/cifs/smb2misc.c: SMB2 len 73
[17306.217476] CIFS: ../fs/cifs/transport.c: cifs_sync_mid_result: cmd=3 mid=5 state=4
[17306.217484] CIFS: Status code returned 0xc00000be STATUS_BAD_NETWORK_PATH
[17306.217489] CIFS: ../fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc00000be to POSIX err -22
[17306.217490] CIFS: ../fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[17306.217494] CIFS: ../fs/cifs/connect.c: VFS: leaving cifs_get_tcon (xid = 109) rc = -22
[17306.217495] CIFS: ../fs/cifs/connect.c: Tcon rc = -22
[17306.217500] CIFS: ../fs/cifs/dfs_cache.c: cache_refresh_path: search path: \imac\Volumes
[17306.217504] CIFS: ../fs/cifs/dfs_cache.c: get_dfs_referral: get an DFS referral for \imac\Volumes
[17306.217507] CIFS: ../fs/cifs/smb2ops.c: smb2_get_dfs_refer: path: \imac\Volumes
[17306.217509] CIFS: ../fs/cifs/smb2pdu.c: SMB2 IOCTL
Sending smb: smb_len=154
[17306.217822] CIFS: ../fs/cifs/connect.c: RFC1002 header 0x49
[17306.217824] CIFS: ../fs/cifs/smb2misc.c: SMB2 data length 0 offset 0
[17306.217824] CIFS: ../fs/cifs/smb2misc.c: SMB2 len 73
[17306.217831] CIFS: ../fs/cifs/transport.c: cifs_sync_mid_result: cmd=11 mid=6 state=4
[17306.217838] CIFS: Status code returned 0xc000019c STATUS_FS_DRIVER_REQUIRED
[17306.217843] CIFS: ../fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc000019c to POSIX err -95
[17306.217845] CIFS: ../fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[17306.217849] CIFS: ../fs/cifs/connect.c: cifs_put_smb_ses: ses_count=1
[17306.217850] CIFS: ../fs/cifs/connect.c: cifs_put_smb_ses: ses_count=1
[17306.217852] CIFS: ../fs/cifs/connect.c: cifs_put_smb_ses: ses ipc: \\imac\IPC$
[17306.217854] CIFS: ../fs/cifs/connect.c: VFS: in cifs_put_smb_ses as Xid: 110 with uid: 0
[17306.217856] CIFS: ../fs/cifs/smb2pdu.c: disconnect session 00000000293f86eb
Sending smb: smb_len=72
[17306.218137] CIFS: ../fs/cifs/connect.c: RFC1002 header 0x44
[17306.218139] CIFS: ../fs/cifs/smb2misc.c: SMB2 len 68
[17306.218145] CIFS: ../fs/cifs/transport.c: cifs_sync_mid_result: cmd=2 mid=7 state=4
[17306.218158] CIFS: ../fs/cifs/fscache.c: cifs_fscache_release_client_cookie: (...)
[17306.218166] CIFS: ../fs/cifs/connect.c: VFS: leaving mount_put_conns (xid = 106) rc = 0
[17306.218168] CIFS: VFS: cifs_mount failed w/return code = -22

The most interesting lines yielded the -22 “something went wrong” error:

[17306.190282] CIFS: ../fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc0000016 to POSIX err -5
[17306.217489] CIFS: ../fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc00000be to POSIX err -22
[17306.217843] CIFS: ../fs/cifs/smb2maperror.c: Mapping SMB2 status code 0xc000019c to POSIX err -95

Is this the wrong forum? Surely somebody somewhere knows how to mount CIFS file systems hosted by OS/X.

Most likely it’s failing to negotiate the suitable version.

Try adding; vers=2.1 as a mount.cifs option - if that fails, add in sec=ntlm or ntlmv2

I tried vers= all of 1.0, 2.0, 2.1 and 3.0 – to no avail. Likewise ntlm and ntlmv2. :frowning: I probably need to see what my Mac is thinking about this, but debugging Mac problems isn’t as readily available on the net.

**bach:/home/Pictures/Exports #** mount -t cifs -o $opts //172.16.16.115/Volumes/RAID5-21TB /mnt/imac
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
**bach:/home/Pictures/Exports #** mount -t cifs -o ${opts}v2 //172.16.16.115/Volumes/RAID5-21TB /mnt/imac
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
**bach:/home/Pictures/Exports #** for v in 1.0 2.0 2.1 3.0 ; do mount -t cifs -o ${opts}v2,vers=$v //172.16.16.115/Volumes/RAID5-21TB /mnt/imac ; slee
p 8 ; done
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

P.S. https://apple.stackexchange.com/questions/441203/mounting-smb-share-on-monterey-is-rejected did not work. It may be that the suggestions work for Apple native file systems, but this is an exfat file system on an external RAID5 array.

PPS: I can make it work by plugging the RAID5 into my Linux box and exporting it, but I don’t always want to run my power hungry Linux tower while editing photos on the Mac. I am wanting to see the edited photos when I bring up Linux. I may be forced to give up. :frowning:

You’re not gonna like that I tested on my Macbook Pro and sharing a single directory everything worked on 15.4 using simple mount -t cifs -o username=my.macuser //xxx.xxx.xxx.xxx/Share /mnt

You should completely drop the opts and just try without any additional parameters and go from there.

I did. I added options as I went along seeing if they’d fix anything. I think OS/X doesn’t like exfat very well, but I can’t tell how to tell. Thank you for trying to help, tho. I do appreciate it.

P.S. I could try changing the file system, but that would entail copying 3TB of data off and back onto the RAID array. :slight_smile: Nope.

PPS: different behavior this time. Still doesn’t mount, but instead of saying “invalid argument” it instead says nothing and never comes back. I suppose I’ll get an eventual timeout, but it’s been gone for over 10 minutes now.

Just in case these are of interest…
https://developer.apple.com/forums/thread/666915
https://apple.stackexchange.com/questions/293390/macos-cant-mount-exfat-external-drive

…and how do you think this does this relates to the OP’s issue?

So why not start your own thread? This thread doesn’t relate to TW, and not even remotely connected.