FreeNAS and SMBv1 Woes

I recently upgraded my primary FreeNAS to the latest patches (of course, only after double-checking that my data was properly replicated to my secondary!). Afterward, I started having issues with other machines not being able to mount the shares on the FreeNAS via SMB. The issues are outlined below (with the solutions).

From Nautilus (file browser) in Ubuntu, if I clicked on the saved share (the credentials are saved also) I would instantly get a message “Oops! Something went wrong. Unhandled error message: Failed to mount Windows share: Connection timed out.” This made no sense to me. If it were an actual timeout, then it should at least take several seconds between the attempt and the failure, but this was 100% instant.

Another server that had the share in its /etc/fstab would not mount the share, either. In dmesg, the error was “CIFS VFS: cifs_mount failed w/return code = -95”

On that same server, if I ran smbclient interactively, like smbclient -L [IP of FreeNAS], the error message returned was “protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE”

I found some posts around that seemed to indicate that it was likely to be an issue with the SMB version. As it turns out, in a recent patch for FreeNAS, they disabled SMBv1 support by default. As a troubleshooting step, I enabled SMBv1 support on the SMB service on my FreeNAS box, and I was able to mount the share from my other systems again. However, that wasn’t the true fix. The fine people that maintain FreeNAS disabled SMBv1 support by default for some good reasons. So, I needed to figure out how to get a newer version of SMB working.

In some of the posts mentioned above, people talked about setting client min version and client max version explicitly in smb.conf, but (1) it was not clear to me from their posts if they were doing this on the server or the client and (2) I tried it on my client (since the server is the FreeNAS box and is BSD-based and I’m not about to start mucking with the config files if I don’t have to–and I believed it was a client-side issue anyway) and the workaround didn’t seem to work correctly for me. After a bunch more experimentation and trying it on other clients, I realized that the fix was working…kind of. It fixed my Nautilus/GVFS issues, but it did not fix my issues with mounting from /etc/fstab.

(Conclusion 1) On the client side, you must specify client min protocol = SMB2 and client max protocol = SMB3 (or otherwise sane values) in /etc/samba/smb.conf to alleviate the issue, but doing so only fixes the smb command-line tools such as smbclient and also GVFS/Nautilus, but will not fix any shares being mounted via /etc/fstab

After some more Googling, reading, and experimentation, I came across this post which held the gem I needed.

(Conclusion 2) If you have a share being mounted in /etc/fstab, you must specify the SMB version you want to use (I used 3.0) in the options in the line for the mount in /etc/fstab, which will look like this: vers=3.0 (or 2.0 if you prefer). Here’s an example:

//samba-server-name/share-name/  /path/to/mount/point    cifs    rw,auto,user,credentials=/etc/samba/creds.file,uid=user-to-use,gid=group-to-use,vers=3.0