Internal error + occ command not workin

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

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:

Nextcloud version (eg, 20.0.5): 22.2.3.0
Operating system and version (eg, Ubuntu 20.04): ubuntu 21.04
Apache or nginx version (eg, Apache 2.4.25): apache 2.4.46
PHP version (eg, 7.4): 7.4.16

The issue you are facing:
Don’t know if it is related to an ubuntu recent update, I rebooted the server and got a server internal error

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

Steps to replicate it:

///

The output of your Nextcloud log in Admin > Logging:

PASTE HERE

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

root@srvdc:/var/www/html/nextcloud/config# cat config.php
<?php
$CONFIG = array (
  'instanceid' => '...........',
  'passwordsalt' => '...........',
  'secret' => '............',
  'trusted_domains' => 
  array (
    0 => 'portail.eec31.com',
    1 => 'srvdc.eec31.local',
    2 => '192.168.31.10',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '22.2.3.0',
  'overwrite.cli.url' => 'https://portail.eec31.com',
  'dbname' => '..............',
  'dbhost' => '...........',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '..............',
  'dbpassword' => '................',
  'installed' => true,
  'activity_expire_days' => 14,
  'auth.bruteforce.protection.enabled' => 'false',
  'blacklisted_files' => 
  array (
    0 => '.htaccess',
    1 => 'Thumbs.db',
    2 => 'thumbs.db',
  ),
  'cron_log' => true,
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\GIF',
    3 => 'OC\\Preview\\BMP',
    4 => 'OC\\Preview\\XBitmap',
    5 => 'OC\\Preview\\Movie',
    6 => 'OC\\Preview\\PDF',
    7 => 'OC\\Preview\\MP3',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\MarkDown',
  ),
  'filesystem_check_changes' => 0,
  'filelocking.enabled' => 'true',
  'htaccess.RewriteBase' => '/',
  'integrity.check.disabled' => false,
  'knowledgebaseenabled' => false,
  'logfile' => '/var/www/html/nextcloud/data/nextcloud.log',
  'loglevel' => 0,
  'logtimezone' => 'Europe/Paris',
  'log_rotate_size' => 104857600,
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'overwriteprotocol' => 'https',
  'preview_max_x' => 1024,
  'preview_max_y' => 768,
  'preview_max_scale_factor' => 1,
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'quota_include_external_storage' => false,
  'share_folder' => '/PARTAGES',
  'skeletondirectory' => '',
  'theme' => '',
  'default_phone_region' => 'FR',
  'trashbin_retention_obligation' => 'auto, 7',
  'updater.release.channel' => 'stable',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'support',
  'mail_domain' => 'overlaps.fr',
  'app_install_overwrite' => 
  array (
    0 => 'calendar',
    1 => 'mail',
    2 => 'ransomware_protection',
    3 => 'spreed',
    4 => 'apporder',
    5 => 'auto_mail_accounts',
    6 => 'sharerenamer',
  ),
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'srvmail.overlaps.fr',
  'mail_smtpport' => '465',
  'mail_smtpname' => 'support@overlaps.fr',
  'mail_smtppassword' => 'Supp0rt1664!',
  'mysql.utf8mb4' => true,
  'mail_smtpsecure' => 'ssl',

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

root@srvdc:/var/www/html/nextcloud/config# cat /var/log/apache2/error.log
[Sat Jan 29 00:00:08.187573 2022] [http2:warn] [pid 390] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Sat Jan 29 00:00:08.224998 2022] [mpm_prefork:notice] [pid 390] AH00163: Apache/2.4.46 (Ubuntu) OpenSSL/1.1.1j configured -- resuming normal operations
[Sat Jan 29 00:00:08.225016 2022] [core:notice] [pid 390] AH00094: Command line: '/usr/sbin/apache2'
[Sat Jan 29 00:34:18.325882 2022] [core:error] [pid 3015160] [client 45.146.165.37:37920] AH00126: Invalid URI in request 'bin/sh' 'POST /cgi-bin/.%2e/.%2e/.%2e/.%2e/bin/sh HTTP/1.1'
[Sat Jan 29 11:22:32.629174 2022] [core:error] [pid 3048563] [client 45.146.165.37:41098] AH00126: Invalid URI in request 'bin/sh' 'POST /cgi-bin/.%2e/.%2e/.%2e/.%2e/bin/sh HTTP/1.1'
[Sat Jan 29 14:47:46.578690 2022] [mpm_prefork:notice] [pid 390] AH00170: caught SIGWINCH, shutting down gracefully
[Sat Jan 29 14:50:18.725856 2022] [http2:warn] [pid 374] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Sat Jan 29 14:50:18.761600 2022] [mpm_prefork:notice] [pid 374] AH00163: Apache/2.4.46 (Ubuntu) OpenSSL/1.1.1j configured -- resuming normal operations
[Sat Jan 29 14:50:18.761623 2022] [core:notice] [pid 374] AH00094: Command line: '/usr/sbin/apache2'
[Sat Jan 29 15:10:37.363014 2022] [mpm_prefork:notice] [pid 374] AH00170: caught SIGWINCH, shutting down gracefully
[Sat Jan 29 15:10:41.899570 2022] [http2:warn] [pid 256] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Sat Jan 29 15:10:41.958336 2022] [mpm_prefork:notice] [pid 256] AH00163: Apache/2.4.46 (Ubuntu) OpenSSL/1.1.1j configured -- resuming normal operations
[Sat Jan 29 15:10:41.958352 2022] [core:notice] [pid 256] AH00094: Command line: '/usr/sbin/apache2'

Additional log:

root@srvdc:/var/www/html/nextcloud# sudo -u www-data php occ maintenance:mode --on
An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory in /var/www/html/nextcloud/lib/private/DB/Connection.php:87
Stack trace:
#0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1519): OC\DB\Connection->connect()
#1 /var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1041): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /var/www/html/nextcloud/lib/private/DB/Connection.php(236): Doctrine\DBAL\Connection->executeQuery()
#3 /var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(345): OC\DB\Connection->executeQuery()
#4 /var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(287): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /var/www/html/nextcloud/lib/private/AppConfig.php(344): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /var/www/html/nextcloud/lib/private/AppConfig.php(109): OC\AppConfig->loadConfigValues()
#7 /var/www/html/nextcloud/lib/private/AppConfig.php(300): OC\AppConfig->getApps()
#8 /var/www/html/nextcloud/lib/private/legacy/OC_App.php(971): OC\AppConfig->getValues()
#9 /var/www/html/nextcloud/lib/private/Server.php(687): OC_App::getAppVersions()
#10 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(160): OC\Server->OC{closure}()
#11 /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()
#12 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(127): Pimple\Container->offsetGet()
#13 /var/www/html/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#14 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query()
#15 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(182): OC\AppFramework\Utility\SimpleContainer->get()
#16 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(160): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()
#17 /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()
#18 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(127): Pimple\Container->offsetGet()
#19 /var/www/html/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#20 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query()
#21 /var/www/html/nextcloud/lib/private/Server.php(1064): OC\AppFramework\Utility\SimpleContainer->get()
#22 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(160): OC\Server->OC{closure}()
#23 /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()
#24 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(127): Pimple\Container->offsetGet()
#25 /var/www/html/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#26 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query()
#27 /var/www/html/nextcloud/lib/private/Server.php(2024): OC\AppFramework\Utility\SimpleContainer->get()
#28 /var/www/html/nextcloud/lib/private/Files/View.php(118): OC\Server->getLockingProvider()
#29 /var/www/html/nextcloud/lib/private/Server.php(435): OC\Files\View->__construct()
#30 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(160): OC\Server->OC{closure}()
#31 /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()
#32 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(127): Pimple\Container->offsetGet()
#33 /var/www/html/nextcloud/lib/private/ServerContainer.php(136): OC\AppFramework\Utility\SimpleContainer->query()
#34 /var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query()
#35 /var/www/html/nextcloud/lib/private/Server.php(1387): OC\AppFramework\Utility\SimpleContainer->get()
#36 /var/www/html/nextcloud/lib/base.php(594): OC\Server->boot()
#37 /var/www/html/nextcloud/lib/base.php(1089): OC::init()
#38 /var/www/html/nextcloud/console.php(48): require_once(’/var/www/html/n…’)
#39 /var/www/html/nextcloud/occ(11): require_once(’/var/www/html/n…’)

janv. 29 15:10:41 srvdc systemd[1]: Starting MariaDB 10.5.13 database server…
janv. 29 15:10:42 srvdc mariadbd[713]: 2022-01-29 15:10:42 0 [Note] /usr/sbin/mariadbd (mysqld 10.5.13-MariaDB-0ubuntu0.21.04.1-log) starting as process 71>
janv. 29 15:10:42 srvdc mariadbd[713]: /usr/sbin/mariadbd: Can’t create file ‘/var/log/mysql/mysql_error.log’ (errno: 13 “Permission denied”)
janv. 29 15:10:42 srvdc mariadbd[713]: 2022-01-29 15:10:42 0 [ERROR] mariadbd: File ‘/var/log/mysql/mariadb-bin.index’ not found (Errcode: 13 "Permission d>
janv. 29 15:10:42 srvdc mariadbd[713]: 2022-01-29 15:10:42 0 [ERROR] Aborting
janv. 29 15:10:42 srvdc systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
janv. 29 15:10:42 srvdc systemd[1]: mariadb.service: Failed with result ‘exit-code’.
janv. 29 15:10:42 srvdc systemd[1]: Failed to start MariaDB 10.5.13 database server.

MariaDB fails to start (because it can’t create the log files) which in turn makes it impossible for nextcloud to connect to the database. You might want to check the permissions/owner of /var/log/mysql and/or the files within.

That was it, fixed with
sudo chown mysql:mysql /var/log/mysql
thanks for the tip !