ubuntu nextcloud from snap wrong server root

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 30.0.5
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 24.04
  • Web server and version (e.g, Apache 2.4.25):
    • replace me
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • replace me
  • PHP version (e.g, 8.3):
    • replace me
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • replace me
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • replace me
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • replace me

Summary of the issue you are facing:

I have installed nextcloud on ubuntu via snap. I can start nextcloud, but I cannot access the gui from my browser.
I am connectig from another computer on the network!

Steps to replicate it (hint: details matter!):

  1. start nextcloud via snap
  2. check regular apache logs (not the logs on the snap directory)

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.


Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

PASTE

Web server / Reverse Proxy

The output of your Apache/nginx/system log in /var/log/____:

[Mon Mar 24 15:05:33.487873 2025] [core:info] [pid 2146714] [client 178.254.20.65:57760] AH00128: File does not exist: /var/www/html/var/snap/nextcloud/common/nextcloud/data/.ncdata

You can see, “/var/www/html” looks to me as the Server Root of some apache configuration.
“/var/snap/nextcloud/common/nextcloud/data/” is the data-Directory configured in the nextcloud configuration file.

...
'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
...

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

nextcloud.occ config:list system
{
    "system": {
        "apps_paths": [
            {
                "path": "\/snap\/nextcloud\/current\/htdocs\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/snap\/nextcloud\/current\/nextcloud\/extra-apps",
                "url": "\/extra-apps",
                "writable": true
            }
        ],
        "trusted_domains": [
            "localhost",
            "cloud.gwfwsfi.de"
        ],
        "supportedDatabases": [
            "mysql"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0
        },
        "log_type": "file",
        "logfile": "\/var\/snap\/nextcloud\/current\/logs\/nextcloud.log",
        "logfilemode": 416,
        "maintenance_window_start": 1,
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "sqlite3",
        "version": "30.0.5.1",
        "overwrite.cli.url": "http:\/\/localhost",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "overwritehost": "cloud.gwfwsfi.de:81"
    }
}

Apps

The output of occ app:list (if possible).

My question is:
Where does the filepath in the log entry of the apache log come from? There must be some configuration file where the ServerRoot is set and this might be wrong or misconfigured.

E.g:
/snap/nextcloud/current/conf/httpd.conf

This includes

ServerRoot "${SNAP}"

But where is “${SNAP}” set?

Any help apreciated!

Have you checked whether the file exists?
and whether the permissions are correct?

i checked the links again and I noticed the following

...
'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
...

and the error:

/var/www/html/var/snap/nextcloud/common/nextcloud/data/.ncdata

there is a missmatch, you have to correct this.

@amateurkicker I don’t know what you mean with “correct this”.

From my point of view the correct path would be /var/snap…

The “/var/www/html” is wrong.

But I don’t know where this comes from!

What is the actual path in the filesystem?

So, ls /var/

What is the configuration of the web server regarding the nextcloud site?

la /var/snap/nextcloud/common/nextcloud/data/
insgesamt 1720
drwxrwx--- 4 root root    4096 Mär 25 12:22 .
drwxr-x--- 4 root root    4096 Mär 25 08:05 ..
drwxr-xr-x 3 root root    4096 Mär 25 08:43 admin
drwxr-xr-x 5 root root    4096 Mär 25 08:45 appdata_ocdmka2wvv7a
-rw-rw-r-- 1 root root     542 Mär 25 08:43 .htaccess
-rw-rw-r-- 1 root root       0 Mär 25 08:43 index.html
-rw-rw-r-- 1 root root      52 Mär 25 08:43 .ncdata
-rw-r--r-- 1 root root 1736704 Mär 25 12:22 nextcloud.db

Hey @averlon welcome to the community :wave:

feel free to check out Nextcloud snap wiki and support most of your question should be answered there

well that won’t give you much information, see Managing logs

check out How to install Nextcloud snap especially first start

if you’ve moved you data to another partition or directory check out change data directory especially managing external media and storage

it looks like you’ve changed the snaps ports? did you follow the directions HTTP/HTTPS port configuration see also Reverse proxy configuration

not sure why you need to to this at all… please explain?

I have checked out - but unfortunately there are no answers on that. At least I did not find useful answers!

Yes, I did. Some messages in the error log, but I am not sure if the relate to the GUI which I cannot access:

[Tue Mar 25 09:07:16.214180 2025] [unixd:alert] [pid 844324:tid 844324] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Tue Mar 25 09:07:16.215517 2025] [unixd:alert] [pid 844326:tid 844326] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Tue Mar 25 10:06:31.705722 2025] [mpm_event:notice] [pid 844323:tid 844323] AH00491: caught SIGTERM, shutting down
[Tue Mar 25 10:06:37.922619 2025] [ssl:warn] [pid 852675:tid 852675] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Mar 25 10:06:37.922927 2025] [lbmethod_heartbeat:notice] [pid 852675:tid 852675] AH02282: No slotmem from mod_heartmonitor
[Tue Mar 25 10:06:37.924580 2025] [mpm_event:notice] [pid 852675:tid 852675] AH00489: Apache/2.4.62 (Unix) OpenSSL/1.1.1 configured -- resuming normal operations
[Tue Mar 25 10:06:37.924637 2025] [core:notice] [pid 852675:tid 852675] AH00094: Command line: 'httpd -d /snap/nextcloud/46218 -D FOREGROUND'
[Tue Mar 25 10:06:37.948979 2025] [unixd:alert] [pid 852677:tid 852677] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Tue Mar 25 10:06:37.949060 2025] [unixd:alert] [pid 852678:tid 852678] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Tue Mar 25 10:06:37.949060 2025] [unixd:alert] [pid 852676:tid 852676] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive

I followed that

Yes, I did. I added the

snap set nextcloud ports.http=81

I simply can not open the GUI from my browser and I assume it has to do with the messages “file not found” in the apache logs.

Although, to be honest, it is courious to me that these messages show up in the “normal” apache logs and not in the apache logs of the snap!

O.K.; I have done in my terminal (ssh to server) a

wget http://cloud.gwfwsfi.de:81

This downloads a index.html

So it looks like, there is some other reason why my browser does not show any GUI.

I need to check my firewall - although the access to my other websites hosted on this server work from my browser!

Firewall does not show any hints.

If I am not wrong, wget from the server itself then does access the GUI from localhost.

So localhost works, but coming from some other IP does not!

nextcloud.occ setupchecks -vv
 dav:
   ✓ DAV system address book: No outstanding DAV system address book sync.
 network:
   ✓ WebDAV endpoint: Your web server is properly set up to allow file synchronization over WebDAV.
   ✓ Data directory protected
   ✓ Internet connectivity
   ✓ JavaScript source map support
   ✓ JavaScript modules support
   ✓ OCS provider resolving
   ✓ .well-known URLs: Your server is correctly configured to serve `.well-known` URLs.
   ✓ Font file loading
 system:
   ⚠ Errors in the log: 79 errors in the logs since March 18, 2025, 2:36:58 PM
   ✓ Allowed admin IP ranges: Admin IP filtering isn’t applied.
   ℹ Brute-force Throttle: Your remote address could not be determined.
   ✓ Cron errors: The last cron job ran without errors.
   ✓ Cron last run: Last background job execution ran seconds ago.
   ✓ Debug mode: Debug mode is disabled.
   ✓ File locking
   ✓ Maintenance window start: Maintenance window to execute heavy background jobs is between 1:00 UTC and 7:00 UTC
   ✓ Memcache: Configured
   ✓ Mimetype migrations available: None
   ✓ Architecture: 64-bit
   ✓ Temporary space available: Temporary directory is correctly configured:
- 37.9 GiB available in /tmp (PHP temporary directory)
   ✓ Push service: Free push service
 notifications:
   ✓ Push notifications - Fair use policy
 security:
   ✓ App directories owner: App directories have the correct owner "root"
   ✓ Old administration imported certificates
   ✓ Code integrity: No altered files
   ℹ Forwarded for headers: Your remote address could not be determined.
   ℹ HTTPS access and URLs: Your instance is generating insecure URLs. If you access your instance over HTTPS, this likely means that your instance is behind a reverse proxy and the Nextcloud `overwrite*` config values are not set correctly.
   ✓ Old server-side-encryption: Disabled
   ✓ PHP version: You are currently running PHP 8.3.14.
   ✓ Random generator: Secure
   ⚠ HTTP headers: Some headers are not set correctly on your instance
- The `Strict-Transport-Security` HTTP header is not set (should be at least `15552000` seconds). For enhanced security, it is recommended to enable HSTS.

 database:
   ✓ Database missing columns: None
   ✓ Database missing indices: None
   ✓ Database missing primary keys: None
   ✓ Database pending bigint migrations: None
   ✓ MySQL Unicode support: You are not using MySQL
   ✓ Scheduling objects table size: Scheduling objects table size is within acceptable range.
   ⚠ Database version: SQLite is currently being used as the backend database. For larger installations we recommend that you switch to a different database backend. This is particularly recommended when using the desktop client for file synchronisation. To migrate to another database use the command line tool: "occ db:convert-type".
   ✓ Database transaction isolation level
 config:
   ℹ Default phone region: Your installation has no default phone region set. This is required to validate phone numbers in the profile settings without a country code. To allow numbers without a country code, please add "default_phone_region" with the respective ISO 3166-1 code of the region to your config file.
   ℹ Email test: You have not set or verified your email server configuration, yet. Please head over to the "Basic settings" in order to set them. Afterwards, use the "Send email" button below the form to verify your settings.
   ✓ Overwrite CLI URL: The "overwrite.cli.url" option in your config.php is correctly set to "http://localhost".
   ✓ Configuration file access rights: Nextcloud configuration file is writable
 php:
   ✓ PHP default charset: UTF-8
   ✓ PHP set_time_limit: The function is available.
   ✓ Freetype: Supported
   ✓ PHP getenv
   ✓ PHP memory limit: 512 MB
   ✓ PHP modules
   ✓ PHP opcache: Checking from CLI, OPcache checks have been skipped.
   ✓ PHP "output_buffering" option: Disabled
   ℹ PHP Imagick module: The PHP module "imagick" is not enabled although the theming app is. For favicon generation to work correctly, you need to install and enable this module.
  • are you running a reverse proxy?
  • is it configured correctly to forward snap port 81 to 443?
  • if yes, have you correctly set your trusted proxy in config.php?
  • have you correctly acquired an SSL certificate for the domain pointing to that machine?
  • are you also running a local apache on port 80?
  • no proxy
  • no ssl (at the moment)
  • “snap set nextcloud ports.http=81” done

But I will close the thread. I have gone back to the traditional installation of nextcloud and I immediately had access to the GUI to install nextcloud.

Thanks for help anyway!