3

I recently switched to a new computer at work and since then I am not able to mount my personal network share via cifs. I checked twice with my old computer about the command and even the exact version of cifs-utils, which is exactly the same. I have currently no idea why it doesn't work and I hope you can give me some hints to debug this.

Here's the command I'm using:

sudo mount -t cifs -o user=shareuser,uid=myuser,gid=mygrp //path/to/my/network/share /home/myuser/mountpoint --verbose

And here's the error I receive:

mount error(22): Invalid argument

Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

which is not very helpful as -22 seems to be a generic "something went wrong" error code.

I checked syslog while executing the above command:

 Jul 19 15:31:28 kernel: [23412.098328] Key type cifs.idmap registered
 Jul 19 15:31:28 kernel: [23412.098578] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.
 Jul 19 15:31:28 kernel: [23412.115297] CIFS VFS: DFS capability contradicts DFS flag
 Jul 19 15:31:28 kernel: [23412.123565] CIFS VFS: cifs_mount failed w/return code = -22

Second and third message also appear on my old computer so this doesn't seem to be any problem.

System information:

  • (K)Ubuntu 18.04
  • Linux 4.15.0-23-generic #25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018
  • cifs-utils version 2:6.8-1

EDIT:

I also tried to mount the share by adding it to fstab:

#network share
//path/to/my/network/share /home/myuser/mountpoint cifs credentials=/home/myuser/.smbcredentials,uid=myuser,gid=mygrp,file_mode=0777,dir_mode=0777 0 0

Applying fstab results in the same error message.

3 Answers 3

4

I ran into a similar problem where mount using cifs produced the -22 error. The share aught to be mountable as I was able to access it using smbclient.

Based on this bug report: https://bugs.launchpad.net/ubuntu/+source/cifs-utils/+bug/1772148, I tried installing the 'keyutils' package and that fixed it for me. It could be that your old computer has this package but the new one doesn't for whatever reason.

1
  • Thank you so much! That's exactly the solution, I installed the keyutils package and now it works. Who could have guessed that...
    – codebat
    Aug 29, 2018 at 15:06
0

The second line of your syslog output shows:

"Jul 19 15:31:28 kernel: [23412.098578] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount."

Try specifying vers=2.1 or vers=1.0 in your mount command.

sudo mount -t cifs -o user=shareuser,uid=myuser,gid=mygrp,vers=1.0 //path/to/my/network/share /home/myuser/mountpoint --verbose

3
  • 1
    Thanks, but this didn't help either. I already tried that one when I examined the syslog output. Must be some other problem. (And as I said, I get this message also on my old computer where I also don't specify version and it still worked there.)
    – codebat
    Jul 19, 2018 at 14:16
  • Can you post the samba config file? If your network share is on a Linux host it should be in /etc/samba/smb.conf
    – W.creator
    Jul 19, 2018 at 14:28
  • I have no information on the share other than its address. It's managed by the central IT department. Given that mounting is no problem on my old computer, I don't think there's some issue on their side. Are you thinking of something specific?
    – codebat
    Jul 19, 2018 at 14:36
0

Use IP number, not server name, in mount commands. Whether in command line or in file manager, this solved problem for me. This works around a kernel bug that affects some server configurations: https://www.spinics.net/lists/linux-cifs/msg13825.html.

1
  • In my specific case, this was not the problem (I also tried with IP address but still same issue), see the answer by @daz - installing keyutils package fixed the problem for me. But thanks nevertheless for pointing out this bug.
    – codebat
    Nov 26, 2018 at 8:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .