{"id":203,"date":"2019-07-10T18:26:31","date_gmt":"2019-07-10T23:26:31","guid":{"rendered":"http:\/\/almost.solutions\/?p=203"},"modified":"2020-10-26T08:49:04","modified_gmt":"2020-10-26T13:49:04","slug":"freenas-and-smbv1-woes","status":"publish","type":"post","link":"https:\/\/almost.solutions\/?p=203","title":{"rendered":"FreeNAS and SMBv1 Woes"},"content":{"rendered":"\n<p>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).<\/p>\n\n\n\n<p>From Nautilus (file browser) in Ubuntu, if I clicked on the saved share (the credentials are saved also) I would <strong>instantly<\/strong> get a message <strong>&#8220;Oops! Something went wrong. Unhandled error message: Failed to mount Windows share: Connection timed out.&#8221; <\/strong>This made no sense to me. If it were an <em>actual<\/em> timeout, then it should at least take several seconds between the attempt and the failure, but this was 100% instant.<\/p>\n\n\n\n<p>Another server that had the share in its \/etc\/<em>fstab<\/em> would not mount the share, either. In <em>dmesg<\/em>, the error was <strong>&#8220;CIFS VFS: cifs_mount failed w\/return code = -95&#8221;<\/strong><\/p>\n\n\n\n<p>On that same server, if I ran smbclient interactively, like <em>smbclient -L [IP of FreeNAS]<\/em>, the error message returned was <strong>&#8220;protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE&#8221;<\/strong><\/p>\n\n\n\n<p>I found <a href=\"https:\/\/ubuntuforums.org\/showthread.php?t=2218876\">some<\/a> <a href=\"https:\/\/ubuntuforums.org\/showthread.php?t=2361383\">posts<\/a> <a href=\"https:\/\/www.linuxquestions.org\/questions\/linux-networking-3\/samba-min-protocol-%3D-smb2-causes-protocol-negotiation-failed-nt_status_invalid_network_response-4175597669\/\">around<\/a> 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&#8217;t the true fix. The fine people that maintain FreeNAS disabled SMBv1 support by default for some <a href=\"https:\/\/techcommunity.microsoft.com\/t5\/Storage-at-Microsoft\/Stop-using-SMB1\/ba-p\/425858\">good<\/a> <a href=\"https:\/\/blog.malwarebytes.com\/101\/2018\/12\/how-threat-actors-are-using-smb-vulnerabilities\/\">reasons<\/a>. So, I needed to figure out how to get a newer version of SMB working.<\/p>\n\n\n\n<p>In some of the posts mentioned above, people talked about setting <em>client min version<\/em> and <em>client max version<\/em> explicitly in <em>smb.conf<\/em>, 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&#8217;m not about to start mucking with the config files if I don&#8217;t have to&#8211;and I believed it was a client-side issue anyway) and the workaround didn&#8217;t seem to work correctly for me. After a bunch more experimentation and trying it on other clients, I realized that the fix <em>was<\/em> working&#8230;kind of. It fixed my Nautilus\/GVFS issues, but it did not fix my issues with mounting from <em>\/etc\/fstab<\/em>.<\/p>\n\n\n\n<p>(Conclusion 1) On the client side, you must specify <em>client min protocol = SMB2<\/em> and <em>client max protocol = SMB3<\/em> (or otherwise sane values) in <em>\/etc\/samba\/smb.conf <\/em>to alleviate the issue, but doing so <strong>only<\/strong> fixes the smb command-line tools such as <em>smbclient<\/em> and also GVFS\/Nautilus, but <strong>will not<\/strong> fix any shares being mounted via <em>\/etc\/fstab<\/em><\/p>\n\n\n\n<p>After some more Googling, reading, and experimentation, I came across <a href=\"https:\/\/www.ixsystems.com\/community\/threads\/failed-to-retrieve-share-after-u6-update-smb-error.69408\/\">this post<\/a> which held the gem I needed.<\/p>\n\n\n\n<p>(Conclusion 2) If you have a share being mounted in <em>\/etc\/fstab<\/em>, you <strong>must<\/strong> specify the SMB version you want to use (I used 3.0) in the options in the line for the mount in <em>\/etc\/fstab<\/em>, which will look like this: <strong>vers=3.0<\/strong> (or 2.0 if you prefer). Here&#8217;s an example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/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,<strong>vers=3.0<\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/almost.solutions\/?p=203\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">FreeNAS and SMBv1 Woes<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,14],"tags":[9,11,12,13,10],"class_list":["post-203","post","type-post","status-publish","format-standard","hentry","category-general","category-it","tag-freenas","tag-gvfs","tag-linux","tag-mount","tag-smbv1"],"_links":{"self":[{"href":"https:\/\/almost.solutions\/index.php?rest_route=\/wp\/v2\/posts\/203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/almost.solutions\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/almost.solutions\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/almost.solutions\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/almost.solutions\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=203"}],"version-history":[{"count":5,"href":"https:\/\/almost.solutions\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions"}],"predecessor-version":[{"id":212,"href":"https:\/\/almost.solutions\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions\/212"}],"wp:attachment":[{"href":"https:\/\/almost.solutions\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/almost.solutions\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/almost.solutions\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}