Bug 420188 - SMB1 says connection to host is broken
Summary: SMB1 says connection to host is broken
Status: RESOLVED NOT A BUG
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 19.12.3
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-17 10:02 UTC by Jack
Modified: 2020-04-20 14:20 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
SMB3-part1 (45.36 KB, image/png)
2020-04-20 13:55 UTC, Jack
Details
SMB3-part2 (73.73 KB, image/png)
2020-04-20 13:56 UTC, Jack
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jack 2020-04-17 10:02:20 UTC
SUMMARY
Suddenly, some weeks ago, I started having problem with my router SMB1 shares. The router is giving me the red error "Connection to host 192.168.1.1 is broken". I have a SMB3 share from another LAN device and I can copy files from and to it

STEPS TO REPRODUCE
1. Open Dolphin
2a. Try to connect to smb://192.168.1.1 (SMB1)

OBSERVED RESULT
Red error

EXPECTED RESULT
I can view the folders in the share

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux 
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.69.0
Qt Version: 5.14.2
Kernel Version: 5.5.17-1-MANJARO
OS Type: 64-bit

ADDITIONAL INFORMATION
This appears if I launch Dolphin from my shell. Note that the SMB1 doesn't require authentication and that I don't have shares on my PC (/etc/samba/ is empty)  

```
$ dolphin
kf5.kio.core: We got some errors while running testparm "Error loading services."
kf5.kio.core: We got some errors while running 'net usershare info'
kf5.kio.core: "Can't load /etc/samba/smb.conf - run testparm to debug it\n"
# ^ this happens at step 1
```

Mounting it with the following command works
```
sudo mount -t cifs -o vers=1.0,noperm //192.168.1.1/share/ /home/jack/mount
```

I couldn't find https://bugs.kde.org/enter_bug.cgi?product=kio , I don't know if this is the right section
Comment 1 Harald Sitter 2020-04-17 10:48:41 UTC
kf5.kio.core: "Can't load /etc/samba/smb.conf - run testparm to debug it\n"

It seems you or your distro broke your smb config which would result in defaults getting used and the samba defaults are to not speak the deprecated SMB1 protocol hence you cannot talk to the router with only SMB1 support.
Comment 2 Nate Graham 2020-04-17 15:27:19 UTC
(In reply to Harald Sitter from comment #1)
> kf5.kio.core: "Can't load /etc/samba/smb.conf - run testparm to debug it\n"
> 
> It seems you or your distro broke your smb config which would result in
> defaults getting used and the samba defaults are to not speak the deprecated
> SMB1 protocol hence you cannot talk to the router with only SMB1 support.
Maybe we should have Dolphin show a user-comprehensible error message when this is the case?
Comment 3 Jack 2020-04-17 17:51:22 UTC
(In reply to Harald Sitter from comment #1)
> kf5.kio.core: "Can't load /etc/samba/smb.conf - run testparm to debug it\n"
> 
> It seems you or your distro broke your smb config which would result in
> defaults getting used and the samba defaults are to not speak the deprecated
> SMB1 protocol hence you cannot talk to the router with only SMB1 support.

I have never modified or touched that file on my PC (it never existed) or even enabled Samba to talk with SMB1, it always worked out of the box.  

I've just created a dummy file with only "server string" and "server role", now I can't see anymore the kf5.kio errors in step 1, but the following appears in step 2, along with the red graphical error:  

```
$ dolphin               
org.kde.dolphin: could not find entry for charset= "Other encoding ()"
```
Comment 4 Harald Sitter 2020-04-19 16:28:48 UTC
(In reply to Nate Graham from comment #2)
> (In reply to Harald Sitter from comment #1)
> > kf5.kio.core: "Can't load /etc/samba/smb.conf - run testparm to debug it\n"
> > 
> > It seems you or your distro broke your smb config which would result in
> > defaults getting used and the samba defaults are to not speak the deprecated
> > SMB1 protocol hence you cannot talk to the router with only SMB1 support.
> Maybe we should have Dolphin show a user-comprehensible error message when
> this is the case?

Ideally yes, but, we don't know that it's an SMB1 problem. When SMB1 is disabled libsmbc isn't allowed to talk SMB1 with the remote. A remote that only speaks SMB1 isn't really distinguishable from a remote that has a HTTP server run on that port for example, they both speak gibberish from libsmbc's POV. Windows 10 has fundamentally the same problem. 
The best we could do is make the error more descriptive. Patches welcome ;) I expect we'll also need an entire wiki page or docs page somewhere explaining the entire mess though. Telling people that this may be because their device only supports SMB1 isn't that useful without explaining what can be done about it.

(In reply to Jack from comment #3)
> I have never modified or touched that file on my PC (it never existed) or
> even enabled Samba to talk with SMB1, it always worked out of the box.  

You'll want to talk to your distribution. We haven't changed anything there, and in fact it's always been libsmbclient's defaults that decided whether or not SMB1 is supported (it has been off by default for years now though).
Comment 5 Jack 2020-04-20 13:55:16 UTC
Created attachment 127708 [details]
SMB3-part1

First part of the error, also I can't "retry all" if I transfer more files, even if I can "skip all"
Comment 6 Jack 2020-04-20 13:56:43 UTC
Created attachment 127709 [details]
SMB3-part2
Comment 7 Jack 2020-04-20 13:57:34 UTC
I'm having another error, but this time with the SMB3 server. If I mount the share everything is allright, but If I try to copy a file from my Manjaro computer directly to smb://host/path/ I get the error I've attached, but not always, and I need to manually retry every transfer (see SMB3-part1 and after some time SMB3-part2, note the different timestamp in this step only). I would like to point out that another PC with Windows 7 can flawlessly transfer files with both the SMB1 and the SMB3 shares.  
Dolphin logs in stderr don't appear every time a tranfer needs a manual retry, but this is what I get after a few manual retries:  
```
$ dolphin
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 62020, resource id: 41943747, major code: 40 (TranslateCoords), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 8223, resource id: 41943813, major code: 40 (TranslateCoords), minor code: 0
[...]
```

Where does this errore come from?
Comment 8 Harald Sitter 2020-04-20 14:20:02 UTC
Windows 7, just like SMB1 is no longer supported.
I suggest you wait for the soon to be released 20.04 version of dolphin and if the problems with SMB3 persists file a new bug about it.

To get useful debug output you need to start dolphin like so: `KDE_FORK_SLAVES=1 QT_LOGGING_RULES="kf5.*=true;kf5.kio.*=true;kio_smb=true" dolphin --new-window`

Before that you could also enable libsmbclient logging by running `kwriteconfig5 --file kioslaverc --group SMB --key DebugLevel 10`