Nextcloud Snap data permissions

Hi,

I’m running Nextcloud as a snap on Ubuntu 20.04

My data folder is a mounted NFS share on /media/nextcloud

It was accessible from other servers, and I made a mistake. I lost all permissions, but the data is still available.

I’ve tried to restore permissions but I’m doing something wrong, crearly. Automatic uploads fail with permission erros. And when I log in via web I get “internal server error”

I tried changing permissions to www-data:www-data, but nothing changed. Any help would be appreciated.

Thanks!

What was this mistake exactly?

Also, if you would, fill out the provided support template.

The data folder is a NFS share from my TrueNAS. I was changing permissions of some shares, and I made a mistake and changed the permissions of the dataset that contains the NFS share. Owner, group and access level changed to a Active Directory user and group.

I filled the support template, I’m starting to regret the decision of using a snap :stuck_out_tongue:

Nextcloud version: 24.0.3.2
Operating system and version: Ubuntu 20.04.2 LTS
Apache or nginx version: I don’t know how to get the version from the snap
PHP version:

The issue you are facing:

After loging in Nextcloud I get “Internal Server Error. The server was unable to complete your request. If this happens again, please send the technical details below to the server administrator. More details can be found in the server log.”

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:

Can’t log in with Admin

The output of your config.php file in /path/to/nextcloud:

<?php
$CONFIG = array (
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
    ),
  ),
  'supportedDatabases' =>
  array (
    0 => 'mysql',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  ),
  'log_type' => 'file',
  'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
  'logfilemode' => 416,
  'instanceid' => 'ocg5nuttt4ts',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => 'cloud.something.com.ar',
  ),
  'trusted_proxies' =>
  array (
    0 => '192.168.10.2',
  ),
  'datadirectory' => '/media/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '24.0.3.2',
  'overwrite.cli.url' => 'https://cloud.something.com.ar',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '',
  'installed' => true,
  'maintenance' => false,
  'loglevel' => 2,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' =>
  array (
    0 => 'Nextcloud Users',
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
  'app_install_overwrite' =>
  array (
    0 => 'richdocumentscode',
  ),
  'theme' => '',
);

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


[Sun Aug 07 00:00:14.997043 2022] [ssl:warn] [pid 1115452:tid 140573271635136] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Sun Aug 07 00:00:14.997160 2022] [lbmethod_heartbeat:notice] [pid 1115452:tid 140573271635136] AH02282: No slotmem from mod_heartmonitor
[Sun Aug 07 00:00:14.997389 2022] [mpm_event:notice] [pid 1115452:tid 140573271635136] AH00489: Apache/2.4.54 (Unix) OpenSSL/1.1.1 configured -- resuming normal operations
[Sun Aug 07 00:00:14.997400 2022] [core:notice] [pid 1115452:tid 140573271635136] AH00094: Command line: 'httpd -d /snap/nextcloud/31222 -D EnableCompression -D FOREGROUND'
[Sun Aug 07 00:00:14.998726 2022] [unixd:alert] [pid 2523932:tid 140573271635136] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Sun Aug 07 00:00:14.998895 2022] [unixd:alert] [pid 2523933:tid 140573271635136] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Sun Aug 07 00:00:15.309900 2022] [mpm_event:notice] [pid 1115452:tid 140573271635136] AH00493: SIGUSR1 received.  Doing graceful restart
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Sun Aug 07 00:00:15.311865 2022] [ssl:warn] [pid 1115452:tid 140573271635136] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Sun Aug 07 00:00:15.311937 2022] [lbmethod_heartbeat:notice] [pid 1115452:tid 140573271635136] AH02282: No slotmem from mod_heartmonitor
[Sun Aug 07 00:00:15.312143 2022] [mpm_event:notice] [pid 1115452:tid 140573271635136] AH00489: Apache/2.4.54 (Unix) OpenSSL/1.1.1 configured -- resuming normal operations
[Sun Aug 07 00:00:15.312153 2022] [core:notice] [pid 1115452:tid 140573271635136] AH00094: Command line: 'httpd -d /snap/nextcloud/31222 -D EnableCompression -D FOREGROUND'
[Sun Aug 07 00:00:15.312175 2022] [unixd:alert] [pid 2524077:tid 140573271635136] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Sun Aug 07 00:00:15.313559 2022] [unixd:alert] [pid 2524078:tid 140573271635136] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Sun Aug 07 00:00:15.313568 2022] [unixd:alert] [pid 2524079:tid 140573271635136] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Sun Aug 07 00:00:15.314746 2022] [unixd:alert] [pid 2524081:tid 140573271635136] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Sun Aug 07 04:49:13.785386 2022] [unixd:alert] [pid 2555244:tid 140573271635136] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Sun Aug 07 07:23:02.249278 2022] [proxy_fcgi:error] [pid 2524081:tid 140572299867904] [client 192.168.10.2:41946] AH01071: Got error 'Primary script unknown'
[Mon Aug 08 21:33:27.380223 2022] [proxy_fcgi:error] [pid 2524078:tid 140573046425344] [client 192.168.10.2:53608] AH01071: Got error 'Primary script unknown', referer: http://cloud.something.com.ar/wp-login.php
[Wed Aug 10 20:35:01.773476 2022] [mpm_event:notice] [pid 1115452:tid 140573271635136] AH00491: caught SIGTERM, shutting down
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Wed Aug 10 20:35:44.223180 2022] [ssl:warn] [pid 2644:tid 139990846244032] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Aug 10 20:35:44.223283 2022] [lbmethod_heartbeat:notice] [pid 2644:tid 139990846244032] AH02282: No slotmem from mod_heartmonitor
[Wed Aug 10 20:35:44.224021 2022] [mpm_event:notice] [pid 2644:tid 139990846244032] AH00489: Apache/2.4.54 (Unix) OpenSSL/1.1.1 configured -- resuming normal operations
[Wed Aug 10 20:35:44.224038 2022] [core:notice] [pid 2644:tid 139990846244032] AH00094: Command line: 'httpd -d /snap/nextcloud/31222 -D EnableCompression -D FOREGROUND'
[Wed Aug 10 20:35:44.245156 2022] [unixd:alert] [pid 2645:tid 139990846244032] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Wed Aug 10 20:35:44.245157 2022] [unixd:alert] [pid 2646:tid 139990846244032] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Wed Aug 10 20:35:44.245159 2022] [unixd:alert] [pid 2647:tid 139990846244032] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Wed Aug 10 20:40:28.982917 2022] [unixd:alert] [pid 4140:tid 139990846244032] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Wed Aug 10 20:49:18.086039 2022] [mpm_event:notice] [pid 2644:tid 139990846244032] AH00491: caught SIGTERM, shutting down
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Wed Aug 10 20:49:41.885656 2022] [ssl:warn] [pid 2625:tid 139860123681984] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Aug 10 20:49:41.885762 2022] [lbmethod_heartbeat:notice] [pid 2625:tid 139860123681984] AH02282: No slotmem from mod_heartmonitor
[Wed Aug 10 20:49:41.886472 2022] [mpm_event:notice] [pid 2625:tid 139860123681984] AH00489: Apache/2.4.54 (Unix) OpenSSL/1.1.1 configured -- resuming normal operations
[Wed Aug 10 20:49:41.886492 2022] [core:notice] [pid 2625:tid 139860123681984] AH00094: Command line: 'httpd -d /snap/nextcloud/31222 -D EnableCompression -D FOREGROUND'
[Wed Aug 10 20:49:41.891213 2022] [unixd:alert] [pid 2628:tid 139860123681984] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Wed Aug 10 20:49:41.891219 2022] [unixd:alert] [pid 2629:tid 139860123681984] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Wed Aug 10 20:49:41.891220 2022] [unixd:alert] [pid 2627:tid 139860123681984] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Wed Aug 10 20:51:02.968465 2022] [unixd:alert] [pid 3658:tid 139860123681984] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Wed Aug 10 21:51:10.460499 2022] [proxy_fcgi:error] [pid 2627:tid 139859922491136] [client 192.168.10.2:49688] AH01071: Got error 'Primary script unknown', referer: http://cloud.something.com.ar
[Thu Aug 11 01:15:57.257814 2022] [mpm_event:notice] [pid 2625:tid 139860123681984] AH00491: caught SIGTERM, shutting down
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Aug 11 01:16:21.247568 2022] [ssl:warn] [pid 2627:tid 139962538505408] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Aug 11 01:16:21.247671 2022] [lbmethod_heartbeat:notice] [pid 2627:tid 139962538505408] AH02282: No slotmem from mod_heartmonitor
[Thu Aug 11 01:16:21.248370 2022] [mpm_event:notice] [pid 2627:tid 139962538505408] AH00489: Apache/2.4.54 (Unix) OpenSSL/1.1.1 configured -- resuming normal operations
[Thu Aug 11 01:16:21.248386 2022] [core:notice] [pid 2627:tid 139962538505408] AH00094: Command line: 'httpd -d /snap/nextcloud/31222 -D EnableCompression -D FOREGROUND'
[Thu Aug 11 01:16:21.253453 2022] [unixd:alert] [pid 2631:tid 139962538505408] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Thu Aug 11 01:16:21.253454 2022] [unixd:alert] [pid 2629:tid 139962538505408] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Thu Aug 11 01:16:21.253455 2022] [unixd:alert] [pid 2630:tid 139962538505408] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Thu Aug 11 01:18:14.368609 2022] [unixd:alert] [pid 3892:tid 139962538505408] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Thu Aug 11 01:32:41.605062 2022] [mpm_event:notice] [pid 2627:tid 139962538505408] AH00491: caught SIGTERM, shutting down
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Aug 11 01:33:04.146899 2022] [ssl:warn] [pid 2598:tid 139937050367168] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Aug 11 01:33:04.147020 2022] [lbmethod_heartbeat:notice] [pid 2598:tid 139937050367168] AH02282: No slotmem from mod_heartmonitor
[Thu Aug 11 01:33:04.147758 2022] [mpm_event:notice] [pid 2598:tid 139937050367168] AH00489: Apache/2.4.54 (Unix) OpenSSL/1.1.1 configured -- resuming normal operations
[Thu Aug 11 01:33:04.147779 2022] [core:notice] [pid 2598:tid 139937050367168] AH00094: Command line: 'httpd -d /snap/nextcloud/31222 -D EnableCompression -D FOREGROUND'
[Thu Aug 11 01:33:04.152376 2022] [unixd:alert] [pid 2601:tid 139937050367168] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Thu Aug 11 01:33:04.152375 2022] [unixd:alert] [pid 2602:tid 139937050367168] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Thu Aug 11 01:33:04.152378 2022] [unixd:alert] [pid 2600:tid 139937050367168] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Thu Aug 11 01:34:14.220209 2022] [unixd:alert] [pid 3606:tid 139937050367168] AH02155: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
[Thu Aug 11 17:16:39.449284 2022] [proxy_fcgi:error] [pid 3606:tid 139936956606208] [client 192.168.10.2:60786] AH01071: Got error 'Primary script unknown', referer: http://cloud.something.com.ar/wp-login.php

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

Lots of this:

{"reqId":"qy15m7jIPPx2jicXCFts","level":3,"time":"2022-08-11T23:11:20+00:00","remoteAddr":"192.168.20.2","user":"9884E82F-9343-4A70-A4CB-DB178926FBB5","app":"index","method":"GET","url":"/index.php/apps/dashboard/","message":"","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36","version":"24.0.3.2","exception":{"Exception":"OCP\\Files\\NotPermittedException","Message":"","Code":0,"Trace":[{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/SimpleFS/SimpleFile.php","line":90,"function":"getContent","class":"OC\\Files\\Node\\File","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Template/IconsCacher.php","line":109,"function":"getContent","class":"OC\\Files\\SimpleFS\\SimpleFile","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Template/SCSSCacher.php","line":339,"function":"setIconsCss","class":"OC\\Template\\IconsCacher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Template/SCSSCacher.php","line":177,"function":"cache","class":"OC\\Template\\SCSSCacher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Template/CSSResourceLocator.php","line":109,"function":"process","class":"OC\\Template\\SCSSCacher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Template/CSSResourceLocator.php","line":61,"function":"cacheAndAppendScssIfExist","class":"OC\\Template\\CSSResourceLocator","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Template/ResourceLocator.php","line":78,"function":"doFind","class":"OC\\Template\\CSSResourceLocator","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/TemplateLayout.php","line":342,"function":"find","class":"OC\\Template\\ResourceLocator","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/TemplateLayout.php","line":250,"function":"findStylesheetFiles","class":"OC\\TemplateLayout","type":"::"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/legacy/OC_Template.php","line":185,"function":"__construct","class":"OC\\TemplateLayout","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/public/AppFramework/Http/TemplateResponse.php","line":204,"function":"fetchPage","class":"OC_Template","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":178,"function":"render","class":"OCP\\AppFramework\\Http\\TemplateResponse","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/snap/nextcloud/31222/htdocs/lib/base.php","line":1023,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/snap/nextcloud/31222/htdocs/lib/private/Files/Node/File.php","Line":58,"CustomMessage":"--"}}
{"reqId":"ZnXEAD8IlkS1TKAbBm2p","level":3,"time":"2022-08-11T23:11:21+00:00","remoteAddr":"192.168.20.2","user":"9884E82F-9343-4A70-A4CB-DB178926FBB5","app":"index","method":"GET","url":"/index.php/apps/dashboard/","message":"","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36","version":"24.0.3.2","exception":{"Exception":"OCP\\Files\\NotPermittedException","Message":"","Code":0,"Trace":[{"file":"/snap/nextcloud/31222/htdocs/lib/private/Files/SimpleFS/SimpleFile.php","line":90,"function":"getContent","class":"OC\\Files\\Node\\File","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Template/IconsCacher.php","line":109,"function":"getContent","class":"OC\\Files\\SimpleFS\\SimpleFile","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Template/SCSSCacher.php","line":339,"function":"setIconsCss","class":"OC\\Template\\IconsCacher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Template/SCSSCacher.php","line":177,"function":"cache","class":"OC\\Template\\SCSSCacher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Template/CSSResourceLocator.php","line":109,"function":"process","class":"OC\\Template\\SCSSCacher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Template/CSSResourceLocator.php","line":61,"function":"cacheAndAppendScssIfExist","class":"OC\\Template\\CSSResourceLocator","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Template/ResourceLocator.php","line":78,"function":"doFind","class":"OC\\Template\\CSSResourceLocator","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/TemplateLayout.php","line":342,"function":"find","class":"OC\\Template\\ResourceLocator","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/TemplateLayout.php","line":250,"function":"findStylesheetFiles","class":"OC\\TemplateLayout","type":"::"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/legacy/OC_Template.php","line":185,"function":"__construct","class":"OC\\TemplateLayout","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/public/AppFramework/Http/TemplateResponse.php","line":204,"function":"fetchPage","class":"OC_Template","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":178,"function":"render","class":"OCP\\AppFramework\\Http\\TemplateResponse","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/snap/nextcloud/31222/htdocs/lib/base.php","line":1023,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/snap/nextcloud/31222/htdocs/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/snap/nextcloud/31222/htdocs/lib/private/Files/Node/File.php","Line":58,"CustomMessage":"--"}}

Fixed it! :slight_smile:

I created a new NFS share, copied all the data from the old one (I could read it, but couldn’t change permissions for some reason).

Changed permissions to 0770 and root:root

It’s now working!