Problem with appdata folder

Hello I have a very big problem because I can’t use cron or ajax because of this error Thank you for your help.

Nextcloud version: 22.2.3
Ubuntu system : 20.04.3 LTS
nginx version : nginx/1.18.0
PHP version: 7.4

<?php
$CONFIG = array (
  'instanceid' => '************',
  'passwordsalt' => '*****+************+*****',
  'secret' => '*******/*******/*********************',
  'trusted_domains' =>
  array (
    0 => 'cloud.Your_Server.com',
    1 => 'ip',
  ),
  'datadirectory' => '/mnt/Nas',
  'dbtype' => 'mysql',
  'version' => '22.2.3.0',
  'overwrite.cli.url' => 'https://cloud.Your_Server.com',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '***********',
  'config_is_read_only' => true,
  'installed' => true,
  'filesystem_check_changes' => 1,
  'default_phone_region' => 'FR',
  'maintenance' => false,
  'theme' => '',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'loglevel' => 2,
  'logtimezone' => 'Europe/Paris',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'log_rotate_size' => 104857600,
  'app_install_overwrite' =>
  array (
    0 => 'printer',
    1 => 'file_upload_notification',
    2 => 'admin_notifications',
  ),

My error when i use occ command sudo -u nextcloud php occ:

An unhandled exception has been thrown:
RuntimeException: Could not get appdata folder in /var/www/nextcloud/lib/private/Files/AppData/AppData.php:93
Stack trace:
#0 /var/www/nextcloud/lib/private/Files/AppData/AppData.php(109): OC\Files\AppData\AppData->getAppDataRootFolder()
#1 /var/www/nextcloud/lib/private/Files/AppData/AppData.php(156): OC\Files\AppData\AppData->getAppDataFolder()
#2 /var/www/nextcloud/apps/richdocuments/lib/TemplateManager.php(148): OC\Files\AppData\AppData->newFolder()
#3 /var/www/nextcloud/apps/richdocuments/lib/TemplateManager.php(134): OCA\Richdocuments\TemplateManager->createAppDataFolders()
#4 [internal function]: OCA\Richdocuments\TemplateManager->__construct()
#5 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(106): ReflectionClass->newInstanceArgs()
#6 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(114): OC\AppFramework\Utility\SimpleContainer->buildClass()
#7 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(131): OC\AppFramework\Utility\SimpleContainer->resolve()
#8 /var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php(460): OC\AppFramework\Utility\SimpleContainer->query()
#9 /var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php(432): OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback()
#10 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(87): OC\AppFramework\DependencyInjection\DIContainer->query()
#11 [internal function]: OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#12 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(106): array_map()
#13 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(114): OC\AppFramework\Utility\SimpleContainer->buildClass()
#14 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(131): OC\AppFramework\Utility\SimpleContainer->resolve()
#15 /var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php(460): OC\AppFramework\Utility\SimpleContainer->query()
#16 /var/www/nextcloud/lib/private/ServerContainer.php(145): OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback()
#17 /var/www/nextcloud/lib/private/Console/Application.php(215): OC\ServerContainer->query()
#18 /var/www/nextcloud/lib/private/Console/Application.php(128): OC\Console\Application->loadCommandsFromInfoXml()
#19 /var/www/nextcloud/console.php(98): OC\Console\Application->loadCommands()
#20 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#21 {main}root@pcserver:/var/www/nextcloud#

Perhaps it is a permission problem.

All folders and files in /var/www/nextcloud (including .) must be owned from www-data:www-data.

sudo chown -R www-data:www-data /var/www/nextcloud works thanks to you devnull

1 Like