Cannot mount samba network share

5,749

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.

Share:
5,749

Related videos on Youtube

codebat
Author by

codebat

BY DAY: software developer. BY NIGHT: gamer, tv series junkie. FOR FUN: (ice) dancing and figure skating. I speak Java and a little bit of Python. Some basic knowledge of XML, HTML, CSS, SQL. Always eager to learn new stuff.

Updated on September 18, 2022

Comments

  • codebat
    codebat almost 2 years

    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.

  • codebat
    codebat almost 6 years
    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.)
  • W.creator
    W.creator almost 6 years
    Can you post the samba config file? If your network share is on a Linux host it should be in /etc/samba/smb.conf
  • codebat
    codebat almost 6 years
    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
    codebat almost 6 years
    Thank you so much! That's exactly the solution, I installed the keyutils package and now it works. Who could have guessed that...
  • codebat
    codebat over 5 years
    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.