External storage (SMB) public share doesn't show content (running oficial docker&helm on kubernetes)

Nextcloud version: 24.0.1
Docker Container base Image: nextcloud:24.0.1-apache
Docker Container in use: icebrian/nextcloud-docker-smb:24.0.1-v1-apache (this is my own docker image that simply adds SMB support to it)

Can’t open any of my public shares. With or without password. When I open created link, nextcloud page opens but then seems to be stuck at loading, displaying two animated brackets, and never gets past that meaning I never get to actually see the contents of the folder. This is what I see Imgur: The magic of the Internet (had to put image in imgur as it seems I can’t upload here).

All my files are on an external storage device, made available to Nextcloud via external storage SMB meaning I don’t have any local files.

This is also a new installation on Kubernetes using Nextcloud helm charts and nextcloud base image with tag 24.0.1-apache on which I then add SMB support to it via the following Dockerfile:

FROM nextcloud:24.0.1-apache

RUN apt-get update && apt-get install -y sudo procps smbclient libsmbclient-dev && pecl install smbclient && docker-php-ext-enable smbclient && rm -rf /var/lib/apt/lists/*
RUN sed -i 's/opcache.interned_strings_buffer=16/opcache.interned_strings_buffer=32/g' /usr/local/etc/php/conf.d/opcache-recommended.ini
RUN mkdir /var/www/.cache && mkdir /var/www/.cache/samba

Since this is a container all logs are show in same output, and when I try to access a public share I get the following PROPFIND 404:

10.42.0.38 - - [06/Jun/2022:21:24:12 +0000] "GET /s/6bMFYok9pixWZex HTTP/1.1" 200 8320 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"
10.42.0.38 - 6bMFYok9pixWZex [06/Jun/2022:21:24:13 +0000] "PROPFIND /public.php/webdav/ HTTP/1.1" 404 1016 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"

6bMFYok9pixWZex is the public share that was generated, as we can see above, first we get a 200 on the GET, then a 404 on the PROPFIND method.

I suspect this is a possible nginx ingress configuration (provided via the helm chart) issue so here is the config I think is most relevant (if not please let me know as I will supply whatever might be needed):

      server_tokens off;
      proxy_hide_header X-Powered-By;

      client_max_body_size 16G;
      fastcgi_read_timeout 3600s;
      proxy_buffering off;
      gzip off;

      rewrite ^/.well-known/webfinger /index.php/.well-known/webfinger last;
      rewrite ^/.well-known/nodeinfo /index.php/.well-known/nodeinfo last;
      rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
      rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json;
      location = /.well-known/carddav {
        return 301 $scheme://$host/remote.php/dav;
      }
      location = /.well-known/caldav {
        return 301 $scheme://$host/remote.php/dav;
      }
      location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
      }
      location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
        deny all;
      }
      location ~ ^/(?:autotest|occ|issue|indie|db_|console) {
        deny all;
      }

And finally, if anyone is interested here is .htaccess file contents https://pastebin.com/U6X5X2s6, however, please note that this file is the default file provided by the oficial nextcloud container image and not mine. Altering it will require me to build my own container image.

Any and all help will be very much appreciated!

EDIT0: various corrections in original text

EDIT1: I created a github issue in nextcloud helm project at: https://github.com/nextcloud/helm/issues/239 (not sure if it should or not be in the docker repo issues)

EDIT2: Just noticed that the “Download all files” works just fine. It sends me a ZIP with the directory contents. So it seems the issue is really only with the listing. I am loosing my mind, I have tried everything!

EDIT3: So I just did a brand new install, using helm to deploy on kubernetes and tested imediately a public share on local storage and everything worked. I then installed the External storage app and added my SMB storage then did the same, created a public share and tested, and problem once again is happening. Share contents are not shown.

So it seems that the issue is specifically when doing a public share on an external drive. Now I don’t know if this is specific to nextcloud on containers or may-be general to nextcloud itself. Can anyone test and confirm?

Hi

imho the default docker image does not contain smbclient, you have to modify the docker compose file and build your own image or do something like this

docker exec --user root nextcloud bash -c "apt update && apt -y install smblient"

Hope this helps

Yes, i’ve already done that (should probably have clarified that). I am using my image at Docker Hub which simply adds SMB support.

EDIT: I’ve added this info to the text above, along with my dockerfile.

Please set up a higher log level and take a look at the log file. Im using the “full” nextcloud:24 (latest) docker image and the same configuration with external smb storage works.

Could be related to some other missing packages or your docker based nextcloud image? Does the browser debug console shows something?

So I increased loggin to debug and can see the following in Admin → Logging

Screenshot from 2022-06-09 15-49-58

In browser debug window don’t see much besides the same error:

What’s strange is that if I do try to access the 404 url directly, so at https://mydomain.com/public.php/webdav/ I get a HTTP authentication request and not a 404.

I don’t see anyting of relevance when I dive into the JS in the browser console.

Mmmmh. Do you try the Nextcloud App SMB connection test, Version 0.3.4 from Nextcloud App store?

I have now, but seems to be all ok. I add my NAS, username and password, click on test and am shown share contents, and no error anywhere. I also checked Admin → Logging and nothing.

In the meantime I will try with the FPM container instead of Apache. Will report back soon.

EDIT: Just tested with the FPM container, fresh install, and same issue. Error message however is slightly different:

127.0.0.1 - TXbN4nQMETs2CKa 10/Jun/2022:21:38:03 +0000 "PROPFIND /public.php" 404

By the way, I also customized this container the same way I did the apache version. Am thinking may-be the issue is with my container. Will run a few tests with oficial container adding smb manually. Will report back.

Eureka! I’ve figured it out!

So, aparently when we add an External Storage there is also a little check box that enables sharing. It seems that I had not enabled this, ergo the error, now whats strange is that even thou I hadn’t enabled this I still had the share icon (on the files pages) and was able to create public share links, they however simply did not work.

This just became aparent when I decided to test with version 23.0.3. After I added the SMB share I noticed I didn’t have the share icon in the files listing. Only after enabling sharing on my external storage (which I didn’t know existed), did the icon show up, and everything is now working!

Problem here is why was the Share icon, on the files page showing up on an external storage that had not been enabled/allowed for sharing? idk

If anyone wants me to test anything else to try to come to some conclusion on what was happening I am of course available to do so and in the meantime, thanks very much for your support and patience @ralfi !Very much appreciated!

Hi, now i have the same issue with my 24.0.1 test installation for smb share and also for a sftp share… curious… With enabled “sharing checkbox” it works, without not. I will take a look at the github issues to find similar issues…