[SOLVED] Error connecting windows share (SMB, UFW & kernel 4.8)

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Arrababiski
Level 1
Level 1
Posts: 39
Joined: Wed Aug 24, 2016 3:21 pm
Location: España

[SOLVED] Error connecting windows share (SMB, UFW & kernel 4.8)

Post by Arrababiski »

I recently upgraded my Mint 18 (x86_64) from kernel 4.4 to 4.8.30. Since then, I can't connect via samba to a windows shared folder in a W7 computer. I try smb://w7_computer/photos/ in Caja 1.14.2 but only to get this error:

Can't show <smb://w7_computer/photos/>
Error: Can't mount the shared folder in
Windows: invalid argument
Select another viewer and try again

Restarting with kernel 4.4 works fine as it did before the upgrade to 4.8.
Disabling the firewall with "sudo ufw disable" works again.
Setting a firewall rule allowing incoming and outgoing traffic from/to 192.168.1.25 (the IP of the W7 computer with the shared folder) doesn't work.

Any other idea...?

What happens with UFW? After upgrading from kernel 4.2 to 4.4 stopped connecting Epson scanners as described here:

viewtopic.php?f=51&t=228387&p=1213851#p1206645

Now stops connecting to shared folders. I'm really stunned... :(
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
amuk

Re: Error connecting windows share (SMB, UFW & kernel 4.8)

Post by amuk »

I was able to solve my issue by adding a few lines to /etc/samba/smb.conf
In the GLOBAL SETTINGS I updated my "workgroup" to the workgroup of my windows computer.
I then added this line under the updated workgroup: name resolve order = bcast host

I hope this helps. It was driving me mad till I found it. I am still very new to Linux Mint and enjoy a lot.
Arrababiski
Level 1
Level 1
Posts: 39
Joined: Wed Aug 24, 2016 3:21 pm
Location: España

Re: Error connecting windows share (SMB, UFW & kernel 4.8)

Post by Arrababiski »

Hi amuk!
amuk wrote:I was able to solve my issue by adding a few lines to /etc/samba/smb.conf
In the GLOBAL SETTINGS I updated my "workgroup" to the workgroup of my windows computer.
I then added this line under the updated workgroup: name resolve order = bcast host

I hope this helps. It was driving me mad till I found it. I am still very new to Linux Mint and enjoy a lot.
Thank for your help, but the workgroup was already the same and adding the "name resolver order" line didn't solve the issue.

Fortunately I found one solution. Tried "sudo ufw allow samba" and didn't work. This morning I was creating firewall rules in Terminal via "sudo ufw allow 192.168.1.25" and "sudo ufw allow out 192.168.1.25", none of all worked. But now tried creating a rule in GUFW to allow incoming traffic from 192.168.1.25 (the W7 machine) to 192.168.1.30 (Linux Mint machine) and this was the one, finally worked!!! The Mint computer (.30) has a dynamic IP, also tried to allow incoming traffic from 192.168.1.25 to 127.0.0.1 trying to find a firewall rule valid even if the Mint IP changes but this way doesn't work. Changing Mint dynamic IP to a static IP finally solved the question.

But the disturbing matter for me are still those unexpected changes in firewall behaviour each time I update the kernel... :(
amuk

Re: [SOLVED] Error connecting windows share (SMB, UFW & kernel 4.8)

Post by amuk »

I am a noob so please excuse the level of my contribution. With that said, I have found that the Firewall takes a little extra work coming from the Windows platform for the past 20 years. Yes yes another MS convert in the house. Glad you got it all worked out. I am actually searching for the right place to express my opinion regarding the friendliness of Linux Mint, 1 that it is very very friendly and the other being that on a fresh install Windows Shares should be visible. Just figured I may have another person that supports my thought on this. If so please reply or message me with the correct place to express that opinion in the Linux Mint Forum.
peter_szekeres

Re: [SOLVED] Error connecting windows share (SMB, UFW & kernel 4.8)

Post by peter_szekeres »

I was also affected by this strange bug, but finally managed to find a solution for it. I posted an Ask Ubuntu ticket about it over here:https://askubuntu.com/questions/875845/ ... g-together

A little update on the solution, if you ever have to make changes to any standing rules to your ufw firewall by the gufw GUI application or in the terminal you have to make sure to save the changes with "sudo dpkg-reconfigure iptables-persistent" so the changes will be saved and loaded in the next instance you start after rebooting your computer. Without it the rules will be set and visible in your gufw application but the iptables will tell you otherwise, so make sure you save the rules.
jrichard326
Level 1
Level 1
Posts: 14
Joined: Thu Mar 09, 2017 8:06 am

Re: [SOLVED] Error connecting windows share (SMB, UFW & kernel 4.8)

Post by jrichard326 »

The solution from peter_szekeres worked for me on Mint 18.2 xfce x64 with Kernel 4.10.0-26.
Thanks.
allanr
Level 2
Level 2
Posts: 56
Joined: Tue Feb 07, 2017 1:02 pm
Location: Scotland

Re: [SOLVED] Error connecting windows share (SMB, UFW & kernel 4.8)

Post by allanr »

Given that any new Mint 18.2 installations will load the 4.8 kernel by default, I expect more and more people will run into this network issue.
(with kernel 4.8/4.10, Samba and ufw/gufw firewall fails to connect using "hostname", but absolute IP address is ok e.g. 192.168.0.2.)

I'd be interested to hear peoples view(s) on the various workarounds:

1) Disable gufw firewall !?
2) Set firewall Incoming to "Allow" (is that better/worse than 1) ?
3) Revert to kernel 4.4
4) Apply peter_szekeres iptables modification and install iptables-persistant package. The challenge thereafter is remembering to keep gufw changes synced with iptables.
5) Any other ?
Image
User avatar
Vogelfreund
Level 1
Level 1
Posts: 32
Joined: Sun Jan 29, 2017 6:29 am
Location: Basel, Switzerland
Contact:

Re: [SOLVED] Error connecting windows share (SMB, UFW & kernel 4.8)

Post by Vogelfreund »

I run into the same problem after I updated from 18.1. to 18.2. Even though the SAMBA rules for gufw are set, it no longer works. I'm also interested in possible workarounds.
User avatar
Vogelfreund
Level 1
Level 1
Posts: 32
Joined: Sun Jan 29, 2017 6:29 am
Location: Basel, Switzerland
Contact:

Re: [SOLVED] Error connecting windows share (SMB, UFW & kernel 4.8)

Post by Vogelfreund »

I seems that any rules in the firewall are ignored, not only the ones for SAMBA
User avatar
Vogelfreund
Level 1
Level 1
Posts: 32
Joined: Sun Jan 29, 2017 6:29 am
Location: Basel, Switzerland
Contact:

Re: [SOLVED] Error connecting windows share (SMB, UFW & kernel 4.8)

Post by Vogelfreund »

I uninstalled UFW and installed firewalld. Same problem there, rules are not respected.
DrM
Level 3
Level 3
Posts: 105
Joined: Sun Feb 23, 2014 4:03 pm

Re: [SOLVED] Error connecting windows share (SMB, UFW & kernel 4.8)

Post by DrM »

allanr wrote:Given that any new Mint 18.2 installations will load the 4.8 kernel by default, I expect more and more people will run into this network issue.
(with kernel 4.8/4.10, Samba and ufw/gufw firewall fails to connect using "hostname", but absolute IP address is ok e.g. 192.168.0.2.)
Using absolute IP addresses in stead of using hostnames to connect to other shares, is rather tedious and I wouldn't like to run my system without a firewall enabled. For example the "sudo mount -t cifs \\hostname/share /mnt/share o- username=,password=" is much better to use than "sudo mount -t cifs //IP-address/share /mnt/share o- username=,password=". This problem hasn't still been fixed within the 4.11.0-14-generic kernel!
psicotron3

Re: [SOLVED] Error connecting windows share (SMB, UFW & kernel 4.8)

Post by psicotron3 »

allanr wrote:Given that any new Mint 18.2 installations will load the 4.8 kernel by default, I expect more and more people will run into this network issue.
(with kernel 4.8/4.10, Samba and ufw/gufw firewall fails to connect using "hostname", but absolute IP address is ok e.g. 192.168.0.2.)

I'd be interested to hear peoples view(s) on the various workarounds:

1) Disable gufw firewall !?
2) Set firewall Incoming to "Allow" (is that better/worse than 1) ?
3) Revert to kernel 4.4
4) Apply peter_szekeres iptables modification and install iptables-persistant package. The challenge thereafter is remembering to keep gufw changes synced with iptables.
5) Any other ?
I don't think iptables-persistant is the better way around.

The correct and documented way to enforce advanced iptables commands is described on https://wiki.ubuntu.com/UncomplicatedFi ... ctionality

Using that info, what solved the problem for me was to add the code bellow and the end of "/etc/ufw/after.rules" and restarting ufw:

Code: Select all

*raw
:PREROUTING ACCEPT [728:143746]
:OUTPUT ACCEPT [664:135398]
-A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns
COMMIT
This way, there's not need to mess with iptables-persistant and if you installed iptables-persistent you'll need to uninstall it running sudo "apt-get purge iptables-persistent".
allanr
Level 2
Level 2
Posts: 56
Joined: Tue Feb 07, 2017 1:02 pm
Location: Scotland

Re: [SOLVED] Error connecting windows share (SMB, UFW & kernel 4.8)

Post by allanr »

psicotron3 wrote
The correct and documented way to enforce advanced iptables commands is described on https://wiki.ubuntu.com/UncomplicatedFi ... ctionality
That's an elegant solution, thanks for sharing it. It works for me too. Not having to re-fresh iptables-persistant after gufw changes (such as adding ports for TouchOSC) is more convenient too.
Image
Locked

Return to “Networking”