Bug 425202

Summary: Show a better and more actionable error message when Samba shares are globally disabled or sambashares path doesn't exist on disk/isn't accessible
Product: [Frameworks and Libraries] kdenetwork-filesharing Reporter: Nate Graham <nate>
Component: generalAssignee: Nate Graham <nate>
Status: RESOLVED FIXED    
Severity: normal CC: beedellrokejulianlockhart, BTJustice, code, fabian, michele.kipiel, sitter
Priority: NOR Keywords: usability
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 22.12
Attachments: Samba "net usershare add" error

Description Nate Graham 2020-08-10 20:55:48 UTC
On openSUSE, apparently Samba sharing is globally disabled by default. As a result, if you attempt to create a Samba share, it will currently just fail silently. With https://invent.kde.org/network/kdenetwork-filesharing/-/merge_requests/2 applied, you will at least see a fairly cryptic error message:

net usershare add: usershares are currently disabled

This is much better than nothing, but it would be even better if it could warn you ahead of time, potentially even inline, when you click on the checkbox to share a folder.

For bonus points, it could even prompt you to enable samba shares globally, which as far as I can tell involves the following change to smb.conf:


diff samba_working.conf samba_broken.conf 
17c17,19
<       usershare max shares = 100
---
>       ldap admin dn = 
>       wins server = 
>       wins support = No
Comment 1 Harald Sitter 2020-08-14 17:10:03 UTC
ksambashare provides no api for that. it'd have to grow some. on a somewhat related matter someone ought to check out how the new registry system of samba works. as I understand one could read&write settings in a less lax fashion than fiddling the file.

the real question is where to draw the line with this though? will we eventually end up rewriting the entire smb.conf to mitigate any impeding configuration a distro might have made in smb.conf? I'm counting 5 settings that could get in the way of usersharing alone, many more if we take general samba functionality into account
Comment 2 Harald Sitter 2020-08-26 12:53:32 UTC
FTR registry system is not on by default so it's not of any use to us.
Comment 3 MK 2021-06-16 08:23:33 UTC
Created attachment 139372 [details]
Samba "net usershare add" error

It's impossible to share a location in the home folder using the share panel.

SYSTEM:
Operating System: KDE neon 5.22
KDE Plasma Version: 5.22.1
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.3
Kernel Version: 5.4.0-74-generic (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i5-6200U CPU @ 2.30GHz
Memory: 7.1 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 520
Comment 4 Nate Graham 2022-06-13 18:28:57 UTC
For posterity: how to enable it manually: https://wiki.archlinux.org/title/samba#Enable_Usershares
Comment 5 Nate Graham 2022-06-13 18:32:31 UTC
Enabling Samba shares requires editing /etc/samba/smb.conf, and I don't know if there is a .d folder that override files can be put in. So it unfortunately does seem like this needs to be done by the distro packaging when you install the samba server package.

I have filed a thing for Fedora; See https://bugzilla.redhat.com/show_bug.cgi?id=2096405 and https://pagure.io/fedora-kde/SIG/issue/109

However we can certainly improve the error message presented to the user, pointing them at some documentation and explaining that this is the distro's responsibility.
Comment 6 Nate Graham 2022-06-13 18:33:50 UTC
*** Bug 454021 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2022-06-21 17:59:06 UTC
*** Bug 455640 has been marked as a duplicate of this bug. ***
Comment 8 Bug Janitor Service 2022-08-02 21:43:37 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kdenetwork-filesharing/-/merge_requests/32
Comment 9 Nate Graham 2022-08-02 22:18:10 UTC
*** Bug 443588 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2022-08-05 14:33:13 UTC
Git commit 8a37b42000c56a23c8c83617f4f4406b370e5551 by Nate Graham.
Committed on 05/08/2022 at 14:33.
Pushed by ngraham into branch 'master'.

Make initial setup much clearer

There are a lot of ways that initial Samba sharing setup can go wrong if
the distro hasn't set up everything perfectly out of the box. Right now
the wizard shows some error messages when problems are encountered, but
the logic fails to account for the full set of things that can go wrong
during initial setup, and as a result are sometimes displays misleading
error messages that can send the user down the wrong path.

This commit expands the set of conditions that are checked for, and
offers more verbose and actionable error messages specific to each of
them.

To accomplish this, the code is refactored to move nearly all of the
logic to the backend, with the QML side simply presenting the
information for whatever error was encountered.

The existing code already had logic for showing a friendly button to fix
the "you're not a member of the right group" error condition, which is
preserved here. TODOs are added in the place where other similar actions
to fix the other errors could be defined, which can be done later.
FIXED-IN: 22.12

M  +81   -58   samba/filepropertiesplugin/groupmanager.cpp
M  +26   -17   samba/filepropertiesplugin/groupmanager.h
M  +12   -19   samba/filepropertiesplugin/qml/GroupPage.qml

https://invent.kde.org/network/kdenetwork-filesharing/commit/8a37b42000c56a23c8c83617f4f4406b370e5551