Shared files are shown as folders

Bug #1872476 reported by INIZAN yannick
166
This bug affects 33 people
Affects Status Importance Assigned to Milestone
samba (Ubuntu)
High
Sergio Durigan Junior
Focal
High
Sergio Durigan Junior

Bug Description

[Impact]

The current samba package on focal suffers from a bug that manifests itselft when the SMB1 (NT1) protocol is being used. In this scenario, the user will see regular files being presented as directories when using GIO/gvfs to browse the samba share (e.g., via nautilus, or using the "gio" command). Even though the SMB1 protocol is old, it is still used by some NAS devices and therefore this issue can impact a non-trivial number of users.

The fix, which had to be cherry-picked from upstream, is to revert a specific libsmb code that attempts to obtain some POSIX stat(2) information when running on UNIX-like environments. The upstream commit can be found here:

  https://gitlab.com/samba-team/devel/samba/-/commit/39c910fd9cba3caf7414274b678b9eee33d7e20b

[Test Case]

In order to reproduce the bug, one can do:

$ lxc launch ubuntu-daily:focal samba-bug1872476
$ lxc shell samba-bug1872476

When inside the LXC container, as root:

# apt install samba smbclient gvfs gvfs-backends dbus-x11
# sed -i 's/^\[global\]/[global]\n client min protocol = NT1\n client max protocol = NT1\n server min protocol = NT1\n server max protocol = NT1/g' /etc/samba/smb.conf
# cat >> /etc/samba/smb.conf << __EOF__
[testshare]
  path = /testshare
  readonly = no
  browsable = yes
  guest ok = yes
__EOF__
# mkdir /testshare
# cat > /testshare/123.txt << __EOF__
Hi, this is a test for samba bug 1872476.
This is a regular file, and not a directory.
__EOF__
# ufw allow samba
# eval $(dbus-launch --sh-syntax)
# gio mount -a smb://127.0.0.1/testshare
# gio info smb://127.0.0.1/testshare/123.txt | grep '^type:'
type: directory

As can be seen above, the regular file '123.txt' is mistakenly listed as a directory.

There's a PPA with a proposed fix here:

https://launchpad.net/~sergiodj/+archive/ubuntu/samba-bug1872476-v2

When trying it out, it is important to umount the share and remount it with the new package:

# gio mount -u smb://127.0.0.1/testshare
# add-apt-repository ppa:sergiodj/samba-bug1872476-v2
# apt update && apt upgrade
# gio mount -a smb://127.0.0.1/testshare
# gio info smb://127.0.0.1/testshare/123.txt | grep '^type:'
type: regular

[Regression Potential]

This change is relatively simple and has been incorporated by upstream and by other distributions, but it touches libsmb, which is a central area of samba.

The POSIX stat(2) call was only made when dealing with the NT1/SMB1 version of the samba protocol running on UNIX-like environments, which contributes to reduce the impact of the patch.

We can assume that there is regression potential for users of the NT1/SMB1 protocol on UNIX-like environments that are dealing with different types of files (regular, directory, symbolic links, etc.), since the code that the patch modifies is responsible for obtaining the attributes of a file. Even though the function uses fallback mechanisms (like resorting to qpathinfo calls) to not depend solely on stat(2), the user might experience some regression when trying to determine the type of a file.

[Original Description]
System : Xubuntu 20.04 LTS, kernel 5.6.2
Samba : Version 4.11.6-Ubuntu

problem : latest versions of samba can't mount remote disk if the remote protocol is too old. Can be fixed by adding "client min protocol = CORE" under [global] section in conf.
But there is another problem, all files in remote disk are shown as folders, so we can't read these files

(screenshot : https://ibb.co/g9FW14c)

Related branches

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Thank you for taking the time to file a bug report.

Could you please describe detailed steps in order to reproduce this issue ?

Something like:

1) Configure smb.conf like this ""
2) Restart smb service
3) Try to access remote shared folder using smbfs://xxxx/yyyy
4) If it is authenticated or not
5) The other side OS version and configuration

and/or any other information, that might help us reproducing the issue, would be great!

Since there is not enough information in your report to begin triage or to
differentiate between a local configuration problem and a bug in Ubuntu, I
am marking this bug as "Incomplete". We would be grateful if you would:
provide a more complete description of the problem, explain why you
believe this is a bug in Ubuntu rather than a problem specific to your
system, and then change the bug status back to "New".

For local configuration issues, you can find assistance here:
http://www.ubuntu.com/support/community

Changed in samba (Ubuntu):
status: New → Incomplete
Revision history for this message
Bruno F (bruno-fr) wrote :

I can reproduce the problem on a fresh new installed Ubuntu desktop 20.04 :

1) install package samba-common
   which is currently version 2:4.11.6+dfsg-0ubuntu1

2) add "client min protocol = NT1" to /etc/samba/smb.conf in [global] section
Note : required to access my NAS which only support SMB v1. It is included in my ISP internet box so I can not upgrade it.

3) launch "Files"
Note : Files version is currently 3.36.1.1-stable.

4.1) browse "Other Locations", Windows Network, WORKGROUP, FREEBOX_SERVER (which is my NAS)

4.2) connect as "Anonymous"

4.3) browse my NAS folder, all files are displayed as Folder, like on the attached screenshot "files_shown_as_folder.png".

4.4) I can not use any file on my NAS. When clicking on an item, a message box is displayed « This location could not be displayed. "France 3 Pays de Loire…" could not be found. Perhaps it has recently been deleted » as shown on the screenshot "can_not_open_file.png".

This was working correctly on Ubuntu 19.10. It looks like the upgrade to v4.11 of samba cause some problems with file browser accessing SMB v1 share.
I can reproduce the problem on LUbuntu 20.04 with either PCManFM-Qt and Dolhpin file browser.

With Ubuntu 20.04 "smbclient", I can correctly access the same share through SMB v1 and files are correctly displayed as files and usable, cf attachment "smbclient-works.txt"

Revision history for this message
Bruno F (bruno-fr) wrote :
Revision history for this message
Bruno F (bruno-fr) wrote :
Changed in samba (Ubuntu):
status: Incomplete → New
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

When you are connected with the GUI and seeing all files as browsers, can you please run smbstatus on your NAS to see what protocol version was used?

NT1 is used for browsing when you set that option, but the client (your machine) might switch to a higher version if the NAS says it supports it.

For example, I just tried with a 20.04 install, browser to my NAS (a synology DS216) using windows network, and when I actually connected to a share, smbstatus on the server says it used SMB3_11:

root@ds216:~# smbstatus
29552 1587992052 andreas 10.10.1.230 downloads SMB3_11

Regarding your smbclient test, you didn't add the -m switch, so it's likely is used a higher protocol version.

Example:
a) no -m switch:
$ smbclient //ds216.lowtech/downloads
Enter WORKGROUP\andreas's password:
Try "help" to get a list of possible commands.
smb: \>

smbstatus on the NAS:
# smbstatus
29833 1587992358 andreas 10.10.1.195 downloads SMB3_11

b) with -m NT1:
$ smbclient //ds216.lowtech/downloads -m NT1
Enter WORKGROUP\andreas's password:
Try "help" to get a list of possible commands.
smb: \>

smbstatus on the NAS:
# smbstatus
29816 1587992342 andreas 10.10.1.195 downloads NT1

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

In fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1801442#c28

Looks like the fix for https://bugzilla.samba.org/show_bug.cgi?id=14101 which went into 4.11.6 needs to be reverted for now.

Thanks santa_ on #ubuntu-devel for the pointers!

Revision history for this message
Jose Manuel Santamaria Lema (panfaust) wrote :

I would like to add a few notes:

1. I have been experiencing this bug while using kde's plasma kio smb:// protocol in dolphin

2. To reproduce the bug, it seems you need to force the "NT1" (~ CIFS 1.0) protocol. You can do this adding these 2 lines to /etc/samba/sm.conf under the "[global]" section:
client min protocol = NT1
client max protocol = NT1

3. This bug, apparently, was fixed in samba 4.11.7 (we have 4.11.6 in focal). I have seen Andreas did some partial work on 4.11.7 for focal here:
https://launchpad.net/~ahasenack/+archive/ubuntu/samba-4117
So I just fixed the ldb symbols files and rebuilt that plasma package in this PPA:
https://launchpad.net/~panfaust/+archive/ubuntu/samba-4117

4. With the packages from my PPA the bug goes away for me, but we don't know yet which commit fixed it.

Revision history for this message
Jose Manuel Santamaria Lema (panfaust) wrote :

Nevermind, it seems the problem is not fixed yet in 4.11.7.

I have just tested again and I can still reproduce the bug with the packages from my PPA.

Revision history for this message
Bruno F (bruno-fr) wrote :

Jose Manuel,
I tried with the samba 4.11.7 package from your PPA and the bug still occurs with "Files"

Andreas,
I have no shell access on the NAS so I am unable to check smbstatus. However I can confirm you that it always uses SMB1. This NAS does not support SMB2/3.

I could capture SMB traffic with Wireshark. Would it help you ?

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Bruno, no need, we reproduced the bug and will work on a fix.

Changed in samba (Ubuntu):
assignee: nobody → Sergio Durigan Junior (sergiodj)
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in samba (Ubuntu):
status: New → Confirmed
Revision history for this message
LE POITTEVIN (lepolau) wrote :

Same observation, my NAS is in smb1, idem for my router with a USB disk.
The files are seen as folders. You can neither read the files nor delete them.
The same folder mounted in CIFS by fstab is seen correctly.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

I have a fix and will work on getting it ready for upload today. Thanks.

Revision history for this message
Pier Luigi Cinquantini (petro-ludoviko) wrote :

For information, me too, I have the same problem: Kubuntu 20.04, files displayed like folders. Old Nas, with smb1.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote : Re: [Bug 1872476] Re: Shared files are shown as folders

On Friday, May 01 2020, Pier Luigi Cinquantini wrote:

> For information, me too, I have the same problem: Kubuntu 20.04, files
> displayed like folders. Old Nas, with smb1.

Could you folks please give it a try with:

https://launchpad.net/~sergiodj/+archive/ubuntu/samba-bug1872476-v2

?

Thanks,

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Revision history for this message
H I Murphy (him610) wrote :

Yes, issue is present on 2 systems running Xubuntu LTS 20.04. Another system (18.04.4) has no problem accessing files as files on legacy NAS running freenas vers 0.68.

Revision history for this message
Pier Luigi Cinquantini (petro-ludoviko) wrote :

I did that:
I addedd the new PPA:
sudo add-apt-repository ppa:sergiodj/samba-bug1872476-v2
I updated
sudo apt-get update
I upgraded installing the new samba files.

But now it doesn't see the NAS.

If useful, in the beginning I created .smb/smb.conf with these lines:
[global]
    client min protocol = NT1
    client max protocol = SMB3

I'm not an expert, maybe I have to do something more..

Revision history for this message
Pier Luigi Cinquantini (petro-ludoviko) wrote :

A moment!
I did these commands:
smbclient -L //192.168.1.51 -N --option='client min protocol = NT1'
smbclient -L //192.168.1.51 --user="USER"%"PASSWORD" --option='client min protocol = NT1'

and now it works properly.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Friday, May 01 2020, Pier Luigi Cinquantini wrote:

> A moment!
> I did these commands:
> smbclient -L //192.168.1.51 -N --option='client min protocol = NT1'
> smbclient -L //192.168.1.51 --user="USER"%"PASSWORD" --option='client min protocol = NT1'
>
> and now it works properly.

I assume that "works properly" means that the bug has been fixed, right?

Thanks for checking!

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Revision history for this message
Pier Luigi Cinquantini (petro-ludoviko) wrote :

Right!
Thank you.
A question, please. Now the official PPA will be updated with the nes files, isn't?
What to do with these bug-files? Do remove them before the updating?

Revision history for this message
Max-Ulrich Farber (m.u.farber) wrote :

Hi Sergio Durigan jr.,

could you please tell us what has been changed in the samba 4.11.7 package in your PPA. It would be fine if I could know that before installing your samba version in my system. I am surprised that you could find the bug in samba and not in GIO/gvfs, for smbclient and mount.cifs both work fine without any problems in the original samba 4.11.7, and files are not shown as folders there.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Friday, May 01 2020, Pier Luigi Cinquantini wrote:

> Right!
> Thank you.
> A question, please. Now the official PPA will be updated with the nes files, isn't?
> What to do with these bug-files? Do remove them before the updating?

This PPA is for testing purposes only. I will soon create an SRU to
officially ship these fixes to focal.

Thanks,

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Friday, May 01 2020, Max-Ulrich Farber wrote:

> Hi Sergio Durigan jr.,

Hi Max-Ulrich,

> could you please tell us what has been changed in the samba 4.11.7
> package in your PPA. It would be fine if I could know that before
> installing your samba version in my system. I am surprised that you
> could find the bug in samba and not in GIO/gvfs, for smbclient and
> mount.cifs both work fine without any problems in the original samba
> 4.11.7, and files are not shown as folders there.

The PPA still contains samba 4.11.6, not 4.11.7. We don't want to bump
the package version right now, so I just backported a few fixes needed
to fix this problem.

The fixes are:

  https://gitlab.com/samba-team/devel/samba/-/commit/a33656c9df2cde3ff1cfc6b0427c7dfb2b140cae
  https://gitlab.com/samba-team/devel/samba/-/commit/a95a8c7eaa46d5c8c485de714f0a97e307e49f7e
  https://gitlab.com/samba-team/devel/samba/-/commit/39c910fd9cba3caf7414274b678b9eee33d7e20b

The first two are included in samba 4.11.7; the third one hasn't been
released yet, AFAIK.

It's interesting to notice that the bug manifests only on GIO/gvfs, and
not on mount.cifs/smbclient, not even when using samba 4.11.6. I
haven't investigated much to find the reason for this discrepancy; maybe
GIO/gvfs's implementation of the SMB protocol are able to trigger a
corner case on samba when using SMB1. You can look at the bugs from
Fedora and/or Samba to see that the problem was with the way
libsmbclient dealt with stat(2) on UNIX:

  https://bugzilla.samba.org/show_bug.cgi?id=14101
  https://bugzilla.redhat.com/show_bug.cgi?id=1801442#c28

As I explained to Pier, there will be an SRU for samba on focal which
will include this fix.

Cheers,

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Revision history for this message
Bruno F (bruno-fr) wrote :

Sergio,

Thank for your fix !

After adding your ppa, I did the same test as the one I described in comment #2.
Now files are correctly displayed as files when I browse my SMBv1 NAS with Dolphin or PCManFM-Qt.

Revision history for this message
Max-Ulrich Farber (m.u.farber) wrote :

Thanks, Sergio!

After adding your ppa in a newly installed virtual machine with Xubuntu 20.02, all shares of my NAS and my FritzBox were accessible and browsable via SMB-1 (client max protocol = NT1). I tried with Thunar and Nautilus (both gtk and therefore using gvfs); all files are displayed correctly and accessible without any problems. As Bruno F verified, it is the same thing for file managers in qt (Kubuntu, Dolphin and others) using GIO slaves.

For my real machines I shall wait for the SRU you announced, and I hope it will arrive soon!

Revision history for this message
Jose Manuel Santamaria Lema (panfaust) wrote :

Hi Sergio,

I have tried to build a package just with the posix stat patch here:
https://launchpad.net/~panfaust/+archive/ubuntu/samba-bugfix

In my case that patch seems enough to get it working again for me.

Would you mind to explain why the other 2 patches are needed? Thanks for your work.

Changed in samba (Ubuntu):
importance: Undecided → High
tags: added: rls-ff-incoming
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Monday, May 04 2020, Jose Manuel Santamaria Lema wrote:

> Hi Sergio,

Hey Jose,

> I have tried to build a package just with the posix stat patch here:
> https://launchpad.net/~panfaust/+archive/ubuntu/samba-bugfix
>
> In my case that patch seems enough to get it working again for me.

Heh, that's interesting. I was indeed starting to test this scenario
here myself. After playing a bit with this bug, I noticed that, in
order to really check whether the bug has been fixed or not, it's better
if you umount and remount the samba share. If you don't, then the bug
might still manifest even after you install a samba package with the
fix.

> Would you mind to explain why the other 2 patches are needed? Thanks for
> your work.

Because of what I explained above, I initially thought the fix involved
upgrading samba to 4.11.7 + backporting the POSIX stat patch. So what I
did was try to find possible patch candidates on 4.11.7 that might be
needed to fix the bug.

Anyhow, I'm running some more tests here and will file the SRU as soon
as I have a confirmation of the necessary patch(es) to fix the bug.

Thanks,

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Revision history for this message
ffatman (jjjnjankowski) wrote :

For me works only the solution:
 sudo add-apt-repository ppa:sergiodj/samba-bug1872476-v2
and line added
 client min protocol = CORE
as access to Freebox and D-Link NAS Freebox connected and to see files as files.

But this solution affects SMPlayer & VLC.

SMPlayer (mpv):

/usr/bin/mpv --no-config --no-quiet --terminal --no-msg-color --input-file=/dev/stdin --msg-level=ffmpeg/demuxer=error --no-fs --hwdec=no --sub-auto=fuzzy --audio-device=pulse/alsa_output.pci-0000_00_09.2.analog-stereo --ao=pulse, --no-input-default-bindings --input-vo-keyboard=no --no-input-cursor --cursor-autohide=no --no-keepaspect --wid=211812372 --monitorpixelaspect=1 --osd-level=1 --osd-scale=1 --osd-bar-align-y=0.6 --sub-ass --embeddedfonts --sub-ass-line-spacing=0 --sub-scale=1 --sub-font=Noto Sans --sub-color=#ffffffff --sub-shadow-color=#ff000000 --sub-border-color=#ff000000 --sub-border-size=0.75 --sub-shadow-offset=2.5 --sub-font-size=60 --sub-bold=yes --sub-italic=no --sub-margin-y=0 --sub-margin-x=0 --sub-ass-force-style=PlayResX=512,PlayResY=320,Name=Default,Fontname=Noto Sans,Fontsize=24,PrimaryColour=&H00ffffff,BackColour=&H00000000,OutlineColour=&H00000000,Bold=1,Italic=0,Alignment=1,BorderStyle=1,Outline=0.3,Shadow=0,MarginL=0,MarginR=0,MarginV=0 --sub-codepage=CP1250 --sub-pos=100 --volume=165 --cache=auto --screenshot-template=cap_%F_%p_%02n --screenshot-format=jpg --screenshot-directory=/home/bagadyr/Obrazy/smplayer_screenshots --audio-pitch-correction=yes --volume-max=300 --term-playing-msg=MPV_VERSION=${=mpv-version:}
INFO_VIDEO_WIDTH=${=width}
INFO_VIDEO_HEIGHT=${=height}
INFO_VIDEO_ASPECT=${=video-params/aspect}
INFO_VIDEO_FPS=${=container-fps:${=fps}}
INFO_VIDEO_FORMAT=${=video-format}
INFO_VIDEO_CODEC=${=video-codec}
INFO_AUDIO_FORMAT=${=audio-codec-name}
INFO_AUDIO_CODEC=${=audio-codec}
INFO_AUDIO_RATE=${=audio-params/samplerate}
INFO_AUDIO_NCH=${=audio-params/channel-count}
INFO_LENGTH=${=duration:${=length}}
INFO_DEMUXER=${=current-demuxer:${=demuxer}}
INFO_SEEKABLE=${=seekable}
INFO_TITLES=${=disc-titles}
INFO_CHAPTERS=${=chapters}
INFO_TRACKS_COUNT=${=track-list/count}
METADATA_TITLE=${metadata/by-key/title:}
METADATA_ARTIST=${metadata/by-key/artist:}
METADATA_ALBUM=${metadata/by-key/album:}
METADATA_GENRE=${metadata/by-key/genre:}
METADATA_DATE=${metadata/by-key/date:}
METADATA_TRACK=${metadata/by-key/track:}
METADATA_COPYRIGHT=${metadata/by-key/copyright:}
INFO_MEDIA_TITLE=${=media-title:}
INFO_STREAM_PATH=${stream-path}
 --audio-client-name=SMPlayer --term-status-msg=STATUS: ${=time-pos} / ${=duration:${=length:0}} P: ${=pause} B: ${=paused-for-cache} I: ${=core-idle} VB: ${=video-bitrate:0} AB: ${=audio-bitrate:0} /run/user/1000/gvfs/smb-share:server=dlink-8f6f7d,share=volume_1/BIBLIOTEKA/FILMY/C/Casino.Royale.1967/Casino Royale.mp4

Error parsing option input-file (option not found)
Setting commandline option --input-file=/dev/stdin failed.
Exiting... (Fatal error)

VLC - slow and slow frame rate.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Monday, May 04 2020, I wrote:

> Anyhow, I'm running some more tests here and will file the SRU as soon
> as I have a confirmation of the necessary patch(es) to fix the bug.

I confirmed that the POSIX stat patch is indeed the only one needed to
fix this bug. Thanks, Jose!

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :
Download full text (3.5 KiB)

On Monday, May 04 2020, ffatman wrote:

> For me works only the solution:
> sudo add-apt-repository ppa:sergiodj/samba-bug1872476-v2
> and line added
> client min protocol = CORE
> as access to Freebox and D-Link NAS Freebox connected and to see files as files.

Sorry, do you mean that the PPA package works for you?

AFAIK, the CORE protocol is silently upgraded to NT1, so you could use
"client protocol min = NT1".

> But this solution affects SMPlayer & VLC.
>
> SMPlayer (mpv):
>
> /usr/bin/mpv --no-config --no-quiet --terminal --no-msg-color
> --input-file=/dev/stdin --msg-level=ffmpeg/demuxer=error --no-fs
> --hwdec=no --sub-auto=fuzzy
> --audio-device=pulse/alsa_output.pci-0000_00_09.2.analog-stereo
> --ao=pulse, --no-input-default-bindings --input-vo-keyboard=no
> --no-input-cursor --cursor-autohide=no --no-keepaspect --wid=211812372
> --monitorpixelaspect=1 --osd-level=1 --osd-scale=1
> --osd-bar-align-y=0.6 --sub-ass --embeddedfonts
> --sub-ass-line-spacing=0 --sub-scale=1 --sub-font=Noto Sans
> --sub-color=#ffffffff --sub-shadow-color=#ff000000
> --sub-border-color=#ff000000 --sub-border-size=0.75
> --sub-shadow-offset=2.5 --sub-font-size=60 --sub-bold=yes
> --sub-italic=no --sub-margin-y=0 --sub-margin-x=0
> --sub-ass-force-style=PlayResX=512,PlayResY=320,Name=Default,Fontname=Noto
> Sans,Fontsize=24,PrimaryColour=&H00ffffff,BackColour=&H00000000,OutlineColour=&H00000000,Bold=1,Italic=0,Alignment=1,BorderStyle=1,Outline=0.3,Shadow=0,MarginL=0,MarginR=0,MarginV=0
> --sub-codepage=CP1250 --sub-pos=100 --volume=165 --cache=auto
> --screenshot-template=cap_%F_%p_%02n --screenshot-format=jpg
> --screenshot-directory=/home/bagadyr/Obrazy/smplayer_screenshots
> --audio-pitch-correction=yes --volume-max=300
> --term-playing-msg=MPV_VERSION=${=mpv-version:}
> INFO_VIDEO_WIDTH=${=width}
> INFO_VIDEO_HEIGHT=${=height}
> INFO_VIDEO_ASPECT=${=video-params/aspect}
> INFO_VIDEO_FPS=${=container-fps:${=fps}}
> INFO_VIDEO_FORMAT=${=video-format}
> INFO_VIDEO_CODEC=${=video-codec}
> INFO_AUDIO_FORMAT=${=audio-codec-name}
> INFO_AUDIO_CODEC=${=audio-codec}
> INFO_AUDIO_RATE=${=audio-params/samplerate}
> INFO_AUDIO_NCH=${=audio-params/channel-count}
> INFO_LENGTH=${=duration:${=length}}
> INFO_DEMUXER=${=current-demuxer:${=demuxer}}
> INFO_SEEKABLE=${=seekable}
> INFO_TITLES=${=disc-titles}
> INFO_CHAPTERS=${=chapters}
> INFO_TRACKS_COUNT=${=track-list/count}
> METADATA_TITLE=${metadata/by-key/title:}
> METADATA_ARTIST=${metadata/by-key/artist:}
> METADATA_ALBUM=${metadata/by-key/album:}
> METADATA_GENRE=${metadata/by-key/genre:}
> METADATA_DATE=${metadata/by-key/date:}
> METADATA_TRACK=${metadata/by-key/track:}
> METADATA_COPYRIGHT=${metadata/by-key/copyright:}
> INFO_MEDIA_TITLE=${=media-title:}
> INFO_STREAM_PATH=${stream-path}
> --audio-client-name=SMPlayer --term-status-msg=STATUS: ${=time-pos} /
> ${=duration:${=length:0}} P: ${=pause} B: ${=paused-for-cache} I:
> ${=core-idle} VB: ${=video-bitrate:0} AB: ${=audio-bitrate:0}
> /run/user/1000/gvfs/smb-share:server=dlink-8f6f7d,share=volume_1/BIBLIOTEKA/FILMY/C/Casino.Royale.1967/Casino
> Royale.mp4
>
> Error parsing option input-file (option not found)
> Setting commandline option --input-file=/...

Read more...

Revision history for this message
ffatman (jjjnjankowski) wrote :

"Sorry, do you mean that the PPA package works for you?"

Yes, but with problems, I've found that comic books (cbr, cbz..) are recognized as documents, and many formats of documents (lit, doc, rtf...) are not recognized.

Is it a difference between "client min protocol" and "client protocol min"?

Edit: Don't mind, "NT1" not connecting. Only "CORE".

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Monday, May 04 2020, ffatman wrote:

> "Sorry, do you mean that the PPA package works for you?"
>
> Yes, but with problems, I've found that comic books (cbr, cbz..) are
> recognized as documents, and many formats of documents (lit, doc,
> rtf...) are not recognized.

What do you mean by "not recognized"?

I cannot reproduce this bug here. I created a .doc document inside a
share, and was able to access it without problems using Nautilus.

Can you confirm that this bug does *not* happen with the current version
from focal?

> Is it a difference between "client min protocol" and "client protocol
> min"?

Sorry, it should have been "client min protocol = NT1".

> Edit: Don't mind, "NT1" not connecting. Only "CORE".

This is strange.

What does "sudo smbstatus" say?

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Revision history for this message
Max-Ulrich Farber (m.u.farber) wrote :

In the German UbuntuUsers forum there are several threads concerning this bug, for instance:

https://forum.ubuntuusers.de/topic/freigaben-im-netzwerk-sind-nicht-erreichbar/

For some users it happens regularly (like myself), for others it happens sometimes and with several kinds of files only, and still others say that it does not happen at all. This is very strange!

Anyhow, for me the bug seems to disappear completely with Sergio's update.

Changed in samba (Ubuntu Focal):
assignee: nobody → Sergio Durigan Junior (sergiodj)
status: New → In Progress
importance: Undecided → High
description: updated
Revision history for this message
H I Murphy (him610) wrote :

When I try, using Thunar, to open my fileserver, error message appears:
Failed to open 'fileserver'. Failed to retrieve share list from server: Software caused connection abort.

 affects ubuntu/samba
 affects thunar

May be related to Bug #1872476

Steps to recreate:
1. Open FileManager (thunar 1.8.14)
2. Left click mouse on Browse Network
3. Double-left click mouse on fileserver (freenas0)
  or right click then select Open with "FileManager" in dropdown list.
Error message appears:
Failed to open 'fileserver'. Failed to retrieve share list from server: Software caused connection abort.

Revision history for this message
Max-Ulrich Farber (m.u.farber) wrote :

@ H I Murphy:

This is not a bug but a feature. In SMBv2 and SMBv3 there are no more share lists, and SMBv1 is disabled by default in samba 4.11. But the error message is quite misleading!

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

For the SRU team reviewing this, I can confirm the bug is fixed in samba 4.12.2 which I will upload to groovy shortly:

root@groovy-samba-file-folder:~# gio info smb://127.0.0.1/testshare/123.txt | grep '^type:'
type: regular
root@groovy-samba-file-folder:~# apt-cache policy samba
samba:
  Installed: 2:4.12.2+dfsg-0ubuntu1~ppa2
  Candidate: 2:4.12.2+dfsg-0ubuntu1~ppa2
  Version table:
 *** 2:4.12.2+dfsg-0ubuntu1~ppa2 500
        500 http://ppa.launchpad.net/ahasenack/samba-4122/ubuntu groovy/main amd64 Packages
        100 /var/lib/dpkg/status
     2:4.11.6+dfsg-0ubuntu1.1 500
        500 http://archive.ubuntu.com/ubuntu groovy/main amd64 Packages

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello INIZAN, or anyone else affected,

Accepted samba into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/samba/2:4.11.6+dfsg-0ubuntu1.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in samba (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Vincent (vinnl) wrote :

Thanks Brian, I just upgrade to the package from focal-proposed, and it worked for me. The testing I did was accessing a Samba share through Nautilus that would previously throw an error when I copied files there, and that would display files as folder. With the updated version, I could copy files onto it, and files were listed as they should.

The versions of the packages I tested:

    Selected version '2:4.11.6+dfsg-0ubuntu1.2' (Ubuntu:20.04/focal-proposed [amd64]) for 'samba'
    Selected version '2:4.11.6+dfsg-0ubuntu1.2' (Ubuntu:20.04/focal-proposed [amd64]) for 'samba-common-bin' because of 'samba'
    Selected version '2:4.11.6+dfsg-0ubuntu1.2' (Ubuntu:20.04/focal-proposed [amd64]) for 'samba-libs' because of 'samba-common-bin'

tags: added: verification-done-focal
removed: verification-needed-focal
Revision history for this message
Bruno F (bruno-fr) wrote :

I did some testing with these new packages : I have activated focal-proposed repository on two new virtual machines. One is Ubuntu 20.04 and the other LUbuntu 20.04.
On both VM, I upgraded all packages and now samba-common, samba-libs, libwbclient0:amd64 and libsmbclient:amd64 have version 2:4.11.6+dfsg-0ubuntu1.2

I added "client min protocol = NT1" to /etc/samba/smb.conf in [global] section to access my NAS which ONLY support SMB v1.

Now files are correctly displayed as files when I browse this NAS with Nautilus on Ubuntu 20.04
and they are also correctly displayed as files with Dolphin and PCManFM-Qt on LUbuntu 20.04.
And now I can watch the video files stored on this NAS with VLC.

With the old package version 2:4.11.6+dfsg-0ubuntu1, files were displayed as folder, see my comment #2

Revision history for this message
Laurent Riffard (laurent-riffard) wrote :

Below are some outputs exhibiting the bug and its correction.

Reference test with samba:amd64 2:4.11.6+dfsg-0ubuntu1.1

# gio mount -a smb://xxxx/xxxxxxxx
# ls -l /run/user/1000/gvfs/smb-share\:server\=xxxx\,share\=xxxxxxxx/
total 0
drwx------ 1 sylvie sylvie 0 avril 2 18:57 Enregistrements
drwx------ 1 sylvie sylvie 0 avril 2 18:57 Laurent-2019-08-31-18-27-03.gramps
drwx------ 1 sylvie sylvie 0 avril 2 18:57 Médias
drwx------ 1 sylvie sylvie 0 avril 2 18:57 Musiques
drwx------ 1 sylvie sylvie 0 avril 2 18:57 Photos
drwx------ 1 sylvie sylvie 0 avril 2 18:57 Téléchargements
drwx------ 1 sylvie sylvie 0 avril 2 18:57 Vidéos

Test with proposed samba:amd64 2:4.11.6+dfsg-0ubuntu1.2

# gio mount -a smb://xxxx/xxxxxxxx
# ls -l /run/user/1000/gvfs/smb-share\:server\=xxxx\,share\=xxxxxxxx/
total 111
drwx------ 1 sylvie sylvie 0 févr. 2 10:27 Enregistrements
-rwx------ 1 sylvie sylvie 112916 août 31 2019 Laurent-2019-08-31-18-27-03.gramps
drwx------ 1 sylvie sylvie 0 févr. 2 10:29 Médias
drwx------ 1 sylvie sylvie 0 nov. 18 2018 Musiques
drwx------ 1 sylvie sylvie 0 févr. 2 10:31 Photos
drwx------ 1 sylvie sylvie 0 avril 4 10:14 Téléchargements
drwx------ 1 sylvie sylvie 0 févr. 2 10:30 Vidéos

The proposed version fixed the problem for me.
Thanks.

Revision history for this message
ffatman (jjjnjankowski) wrote :

samba:amd64=2:4.11.6+dfsg-0ubuntu1.2 seems at last working properly. It's official Canonical focal-propoosed I presume. Thanks to everyone who's been working hard for the last two weeks!

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This is fixed in 4.12.2 uploaded to groovy, so marking that task as fix released.

Changed in samba (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for samba has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package samba - 2:4.11.6+dfsg-0ubuntu1.2

---------------
samba (2:4.11.6+dfsg-0ubuntu1.2) focal; urgency=medium

  * Fix "Shared files are shown as folders" (LP: #1872476)
    - d/p/0023-libsmb-Don-t-try-to-find-posix-stat-info-in-SMBC_get.patch:
      Don't obtain stat(2) information if dealing with older protocols on
      UNIX-like systems.

 -- Sergio Durigan Junior <email address hidden> Thu, 30 Apr 2020 15:17:24 -0400

Changed in samba (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
ffatman (jjjnjankowski) wrote :

>> What do you mean by "not recognized"? (cbr, cbz, doc, lit etc...)<<

@sergiodj: "Unknown type", when to copy on the desk - recognizable. Still exist the ptoblem.

Revision history for this message
Rapper_skull (rapper-skull) wrote :

This bug presented today on samba 2:4.11.6+dfsg-0ubuntu1.5 using a Windows client. Affected files and folders are shown with a grey cross on them. Files are also shown as folders obviously.

Revision history for this message
jsquared (jeroldlewis) wrote :

Just started seeing this issue again today as well (was working fine yesterday; no updates run overnight either that I'm aware of..)

Samba 2:4.11.6+dfsg-0ubuntu1.2, Ubuntu 20.04.1

I have min protocol = SMB3 and client min protocol = SMB3 in /etc/samba/smb.conf

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Focal task reopened due to last comment above

Changed in samba (Ubuntu Focal):
status: Fix Released → New
Revision history for this message
Rapper_skull (rapper-skull) wrote :

I just want to add that this problem is still present with samba 2:4.11.6+dfsg-0ubuntu1.6

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in samba (Ubuntu Focal):
status: New → Confirmed
Revision history for this message
MasterCATZ (mastercatz) wrote :

yes also still having these issues on ubuntu 20.04 with 2:4.11.6+dfsg-0ubuntu1.6
even after doing a full purge and starting again

but then again also having one hell of a time trying to get this PC to see any windows available shares

Changed in samba (Ubuntu Focal):
status: Confirmed → Fix Released
Revision history for this message
Lee Tae Hoon (lth0420) wrote :

Also having the issue on ubuntu 20.04 using samba 2:4.11.6+dfsg-0ubuntu1.6. Protocol was SMB3, macOS and windows client.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

@Meabert - why was this closed? It seems several people are still affected and it is worth to look at it again.

@Sergio - do you think you could take a look again to identify if the old fix was incomplete or if here we might have multiple underlying issues?

@MasterCatz / @Rapper_skull / jsquared - could I ask you to share as much of your related configuration as possible. This needs to be reproducible outside of your own machines to really be worked on. So if you can share a config that - with todays versions in a new set of VMs - fails that would help a lot.

Changed in samba (Ubuntu Focal):
status: Fix Released → Confirmed
Revision history for this message
Lee Tae Hoon (lth0420) wrote :

I hided #52 cause I was afraid I was doing something wrong because I'm new to ubuntu. Today is just a week 2 or 3 to me. I'm still having this bug and I guess someone might help me for this.

About smf.conf, I maintained default settings except a few things. I gave a new netbios name (by "netbios name (something)", and just added settings for my shared folder (as in below). I didn't change it to use SMBv1 or 2.

[SMB_share]
   comment = Samba Shared Folder
   path = /home/samba/shared
   writable = yes
   browsable = yes
   create mask = 0660
   directory mask = 0771
   valid users = (redacted)

Checked smbstatus and it is showing that the protocol is SMB3_02. Already run apt-get update and upgrade, but no change. Happens like a screenshot attached. Also happens when I check the shared folder from macOS and windows. I can give some specific configuration if you want because I desperately want to see this bug to fix. (I just don't know what to offer.)

Revision history for this message
Dave Gregory (offspring-6) wrote :

@paelzer I'm here because I'm running into the same issue. Server and client are running Samba version 4.11.6-Ubuntu.

smbstatus shows SMB3 for the protocol.

Ubuntu client mounts Ubuntu server share via SMB via fstab. Kodi client returns the following errors:

2020-12-08 12:56:45.868 T:140052030023424 ERROR: SMBDirectory->GetDirectory: Unable to open directory : 'smb://192.168.1.17/media/movies/4K/Resident.Evil.Extinction.2007.2160p.UHD.BluRay.x265-FLAME/Resident.Evil.Extinction.2007.2160p.UHD.BluRay.x265-FLAME.nfo-orig'
                                            unix_err:'14' error : 'Not a directory'
snippit of the smb.conf:
[media]
        writeable = yes
        path = /media/mergerfs
        guest ok = yes
        browseable = yes
        follow symlinks = yes
        wide links = yes
        directory mask = 0755
        directory mask = 0644
        force user = offspring

fstab entry from client:

//192.168.1.17/media /media/mergerfs cifs vers=3,users,uid=offspring,gid=offspring,users,credentials=/home/offspring/.smb,iocharset=utf8,sec=ntlmssp 0 0

Revision history for this message
Dave Gregory (offspring-6) wrote :

I can't edit my previous post, but I've attached a screenshot of what Nautilus looks like as well.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

I apologize for the delay, but I'm now starting to investigate this problem.

As Christian said above, the very first step I have to take is to reproduce the problem, but for now I am unable to do so. Here is what I did:

1) Installed a Focal VM from scratch. Made sure that everything is up-to-date.

2) Installed samba smbclient gvfs gvfs-backends dbus-x11.

3) Edited /etc/samba/smb.conf and added the following lines:

[testshare]
   comment = Samba Shared Folder
   path = /testshare
   writable = yes
   browsable = yes
   create mask = 0660
   directory mask = 0771
   valid users = sergio

[testshare2]
        writeable = yes
        path = /testshare2
        guest ok = yes
        browseable = yes
        follow symlinks = yes
        wide links = yes
        directory mask = 0755
        directory mask = 0644
        force user = sergio

4) Added my user to Samba using smbpasswd.

5) Created /testshare and /testshare2, then created new text files inside them.

6) Opened Nautilus (using my regular user, not root) and mounted the "testshare" and "testshare2" shares.

7) Also verified that I'm using SMB3_11 via smbstatus. I have also tried forcing the usage of SMB3_02 (which is what Lee Tae Hoon said he was using).

I verified that the text file is correctly being showed as a regular file, not a directory. I also tried downloading some JPEG images from the internet and putting them inside the shares, but they always show up correctly as regular files.

I understand that this bug is affecting multiple users, but I'm trying to find a way to reproduce it locally so that I can investigate it more.

I have a few questions:

1) Aside from the share definition you shared above, is there anything else that you may have changed in /etc/samba/smb.conf? Would it be possible to share the whole file, taking care to obfuscate any personal information?

2) Can you share/examine the contents of /var/log/samba/log.<YOUR_HOSTNAME>?

3) Can you set Samba's log level to the maximum value and reload the share? You can set the log level by doing (as root):

# smbcontrol smbd debug 10

Then, after you refresh Nautilus, you should set the debug level back to 0:

# smbcontrol smbd debug 0

If you could share your log files under /var/log/samba/log.*, that would be great.

Thank you.

Revision history for this message
Rapper_skull (rapper-skull) wrote :

This problem never happened to me until 6 weeks ago. The only thing I did was moving some folders from one HDD to another. The two drives are mapped to different SMB shares. If I correctly recall, only the folders I moved are affected (but not all of them). The file transfer was done with Nautilus, not on the network. If this can help, the two drives are formatted as XFS.

Revision history for this message
Lee Tae Hoon (lth0420) wrote :

Here is my smb.conf file, and log files after applied 'debug 10'. Opened my share folder, tried to open a jpg file which is incorrectly shown as a folder, and got an error message (both from the current ubuntu system and other macOS system). Some names were replaced with 'aaaa' or something similar.

I guess it might be hard to find what is actually causing the problem, but since Sergio is helping us, I think I can patiently wait. Thanks a lot.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the replies, Rapper_skull an Lee Tae Hoon.

Lee, I have a few questions for you.

1) What is the name of the file you tried to open? Based on the screenshot you posted earlier, I thought the file was named IMG_1809.JPG. However, in your logs I don't see any attempt to open a file/folder with this name.

2) Can you please try repeating the "debug 10" experiment, but this time send me all log files inside /var/log/samba/ ?

3) Just to confirm: I understand that your Samba share is in your Ubuntu system. Did you try accessing it from the same system?

4) Can you create a new Samba share in the same system and verify that this issue manifests with it as well? Based on Rapper_skull's comment, this problem does not manifest with all shares.

Thanks!

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

I forgot to mention, but I:

1) Replaced my smb.conf with Lee Tae Hoon's smb.conf, and tried to reproduce the error. Everything still works for me.

2) Tried moving files (via terminal and using Nautilus) to the share. I can access them fine.

3) Tried attaching another disk to my Focal VM, format it using XFS, and creating shares there. I can access the shared and all files normally.

In other words, I still can't reproduce the bug. I'm now waiting on Lee Tae Hoon's answers to my questions above.

Revision history for this message
Rapper_skull (rapper-skull) wrote :

I'm unable to reproduce the bug in a VM, but I found two things that could be useful:

If I move or copy the affected folder to another drive, the problem persists, both in the original and in the copy. This is the case with both ext4 and xfs drives, but doesn't happen on a FAT32 drive.

Moving the folder back from the FAT32 drive solves the issue. Also creating a ZIP and extracting it works.

Revision history for this message
Lee Tae Hoon (lth0420) wrote :

1) The file I tried to open yesterday was indeed IMG_1809.JPG, and the error pops up saying it is not a directory. I reproduced the error message today in my system, so let me give you another log files today.

2) Yes indeed.

3) Yes, I accessed the files from the same system, as my system appeared in Nautilus.

4) I made another shared folder in my home folder and the symptom was exactly the same.
Though I figured out something strange in the process. This time I tried to share 4 different files. 3 files (m4a, pdf, jpg file) were from my macOS system, and copied through samba protocol (I'm still able to write to shared folder. Unable to read it properly though). 1 file (jpg file) was a random macbook image from the internet. All 3 files from my macOS system showed as folders, while random macbook image from the internet showed properly. I think I need to figure out which kind of files were affected...

Some screenshots and log files were attached.

Revision history for this message
Rapper_skull (rapper-skull) wrote :

@Lee Tae Hoon can you share the link of the image you found on the Internet? Maybe I can try to replicate.

Revision history for this message
Lee Tae Hoon (lth0420) wrote :

Ok, I tried more. I downloaded a random copyright-free music file to this ubuntu system, and moved/copied to the samba share folder, and I could share the file properly. Repeated several times, and the same result. And then, I downloaded a different copyright-free music file from the same site to my macOS system, and copied to the samba share folder of ubuntu system (through Nautilus). At first, the file correctly showed. After that, I moved the file to shared folder to my home folder, and copied to the samba share folder again. Now the file is showing as a folder. I think I'll gonna try this from my another laptop (this one has Windows system installed), maybe tomorrow.

When I search about this kind of bug, some users are still suffering from it even after the patch but now I'm not sure where exactly to find the source of the problem.

@ Rapper-skull Well the image was from this site. I still don't have the symptom with this file.: https://www.pcmag.com/reviews/apple-macbook-pro-16-inch

Revision history for this message
Lee Tae Hoon (lth0420) wrote :

Whoops, correction: The file was transfered from macOS to ubuntu system via Finder app in macOS, not Nautilus. Moving/copying the file inside the ubuntu system was done via Nautilus.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

@Lee Tae Hoon, thank you for the feedback. I downloaded the zip file you provided, but I still can't see anything useful in the logs. I wonder what's really happening. I will have to bug you one more time and ask you to provide a network trace of the moment of the failure, please. You can read this guide here:

https://www.samba.org/~asn/reporting_samba_bugs.txt

Specifically the "Testing daemons" and the "Network trace" sections, and follow the instructions from there.

Thanks also for investigating the scenarios where this bug manifests or not. I don't have access to a macbook here, so I wonder what else I can do to reproduce this.

@Rapper_skull, thanks as well for the help. If I understand correctly, you are not using a macbook in your setup, right? Since I don't have access to one, it might be a "good sign" that you don't need a macbook to reproduce it.

I appreciate you verifying that you can't reproduce the bug in a VM. The problem here is that I don't have access to this "affected folder" you mention, and I can't seem to be able to create one.

I will keep trying to reproduce it here, but I'd like to ask if you could follow the same instructions I gave to Lee Tae Hoon and provide (a) your full logs (with debug enabled) of the moment the failure happens, and (b) a network trace.

Thanks.

Revision history for this message
Rapper_skull (rapper-skull) wrote :

I can confirm there's no MacOS system involved. I'll try to provide logs ASAP.

Revision history for this message
Lee Tae Hoon (lth0420) wrote :
  • Samba2.docx Edit (2.0 MiB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)

I tried to replicate the problem several times with different systems (Thankfully, I have three laptops with three different OS installed.), and concluded that the symptom doesn't need to be provoked with macOS. I can reproduce the error with these steps with the files from any OS.

1) Write a certain file through the samba protocol to the shared folder.
2) Open the shared folder in ubuntu system and move the file to the my home folder. (Don't move the file through samba, please move the file locally.)
3) 'Copy' the file to the shared folder. (Still, don't use samba for this process. Interestingly, simply moving the file to the shared folder did not reproduce the error. Only copying works.)
4) Now open the shared folder through samba. The file is now showing as folder, or sometimes not showing at all.

I have Parallels installed in my macOS, and I tried to figure out whether I can reproduce this problem with fresh-installed ubuntu in virtual machine, (Of course, fully updated via apt-get update/upgrade before doing everything.) and it was successful. I'll upload the instruction docx file including some screenshots.

I'll upload more log files when I'm ready.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Finally! Thanks for the detailed steps, Lee. I was finally able to reproduce it locally.

For the record, these are the commands you can issue to reproduce. Suppose that you have a samba share named "sambashare" serving a directory at $HOME/testshare.

$ gio mount smb://127.0.0.1/sambashare
<type the password here>
$ gio copy Downloads/test.jpg smb://127.0.0.1/sambashare/
$ gio move $HOME/testshare/test.jpg $HOME
$ gio copy $HOME/test.jpg $HOME/testshare/
$ gio info smb://127.0.0.1/sambashare/test.jpg | grep '^type:'
type: directory

This looks exactly like the bug I fixed for the SMBv1 protocol, but it's happening with SMBv3. I will now finally be able to investigate further what may be happening here.

Thanks again.

Revision history for this message
Bernard (ceejay) wrote :

I just wanted to jump in here because this bug (I think) is causing me a lot of grief and I'd like to help if I can. I have Samba 2:4.11.6+dfsg-0ubuntu1.6 on Ubuntu 20.04. I've been using it fine for several months, serving files to Mac and another Linux (also 20.04). Just in the last few days I've found files not showing up at all on my Mac - I poked around quite a lot, going down what I guess was a rathole of thinking this was a Mac compatibility issue, but just today realised I am seeing something similar on my Linux client and have ended up here.

From a troubleshooting point of view I can see that this could be tricky to pin down as the behaviour I am seeing is so inconsistent. As it stands most of my files are accessible fine, but I am having trouble with a bunch of new files that I've just added (yes, I have checked permissions and ownership!). Sometimes the files are showing up as (empty) directories, other times not at all.

In a recent experiment I copied a folder full of files to a temp folder - they still showed up as directories in my clients - and then copied them back again. Now my Linux client is seeing them all as directories, but my Mac client is seeing half of the files (text files) not at all but the other half (videos) as a bizarre cross between a video file (which it should be) and a directory.

Revision history for this message
rmills (rmillsd) wrote :

Just updated from 18.04 to 20.04, This seems to still be a bug. I have a share that only a few files both ubuntu 20.04 and windows 10 clients show as folders. There seems to be no reason why it's these specific files either other than time. I copied these the day before the upgrade, they worked fine after the copy. I did the update and with both my windows 10 machine and other ubuntu 20.04 clients the issue remains. Latest samba is installed 2:4.11.6+dfsg-0ubuntu1.6 confirmed SMB3 is in use with smbstatus. Basic troubleshooting done, restarting, samba, clients, moving files. The issue follows the files but nothing fixed the issue. In my case files are both small images and large video files. There are files copied at the exact same time that work fine while others don't.

I'm assuming there are no known workarounds?

Revision history for this message
Andrew Berezovskiy (an9rew) wrote :

@rmills: workaround is described in https://askubuntu.com/questions/1288678/some-files-on-samba-shares-are-displayed-as-folders (run `setfattr -x user.DOSATTRIB ` on every file that shows as a dir).

Revision history for this message
Morbius1 (morbius1) wrote :

So I duplicated the steps in #70 and was able to reproduce the "type: directory" problem.

Then I edited smb.conf and set "store dos attributes = No" in the [global] section and restarted smbd.

If I redo the steps in #70 the issue is resolved resulting in: "type: regular"

"store dos attributes" was set to No by default in samba until version 4.9 so the change would have impacted Ubuntu from Ubuntu 19.04 forward.

Revision history for this message
Nathan Rennie-Waldock (nathan-renniewaldock) wrote :

Turns out it's caused by user.DOSATTRIB being empty (missing attribute doesn't cause this). I can reproduce with simply `setfattr -n user.DOSATTRIB testfile.txt`

Currently testing a patch on my servers to handle this, I'll attach the patch and also make a PPA for anyone wanting to test later today.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thank you all for the further investigation on this bug.

@Nathan, were you able to identify an upstream patch that fixes this issue? I would appreciate if you could point me to a commit so that I could test it locally as well.

Thanks.

Revision history for this message
Bernard (ceejay) wrote :

Just hopping in to say that I'm not sure it's quite as simple as that. I'm accessing a Ubuntu 20.04 Samba share from a MacOS system and I am seeing this problem.

I have a few files which are showing as directories on my Mac (I think I don't have the problem if the file is first created from the Mac, but I do if it is created on the server).

If on the server I run 'setfattr -x user.DOSATTRIB filename' then they show up as directories.
If I run 'setfattr -n user.DOSATTRIB filename' then they disappear completely.

I did make the smb.conf change referenced above (store dos attributes = No) and then restarted smbd ... the files appeared as directories as they did before but, as I imagine you would expect, the setfattr... wasn't valid anymore.

A clunky workaround which has solved my problem for the moment was, after making that smb.conf change, to make new copies of all of the affected files and then delete the originals.

Hope that helps someone.

Revision history for this message
Nathan Rennie-Waldock (nathan-renniewaldock) wrote :

Later than I intended to post this, but I've attached the patch I'm using. PPA is: ppa:nathan-renniewaldock/lp1872476

@Sergio: No luck so far with finding what upstream commit fixes this, there's a lot of changes between 4.11.17 and 4.12.0. I'm still looking, but my patch won't cause any issues as it just treats empty attributes as if they were missing.

Revision history for this message
actaris (actaris41) wrote :

waiting for the official patch, as a workaround, can I suggest this PPA? https://launchpad.net/~linux-schools/+archive/ubuntu/samba4.12 Installs samba 4.12 and, on Mint 20.1, solved my problem

Revision history for this message
Patrik Nilsson (nipatriknilsson) wrote :

A work-a-round is to pack a zip packages with gz. The following works with the file tested.

$ find . -mindepth 1 -maxdepth 1
./Marlin-src_1.1.9.34_5f9c029d1.zip

This zip file can't be transferred.

But doing

$ gzip Marlin-src_1.1.9.34_5f9c029d1.zip

$ find . -mindepth 1 -maxdepth 1
./Marlin-src_1.1.9.34_5f9c029d1.zip.gz

... and it can be transferred.

Revision history for this message
Morbius1 (morbius1) wrote :
Bryce Harrington (bryce)
Changed in samba (Ubuntu Focal):
status: Confirmed → Triaged
Revision history for this message
Khalid Dermoumi (khalid-dermoumi) wrote :

I am seeing this problem since a couple of days on an up-to-date 20.04 system.

The fix described here solves the problem:
https://askubuntu.com/questions/1288678/some-files-on-samba-shares-are-displayed-as-folders

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.