Nextcloud Server: Fehler bei der Installation der "News"-App

  • Webhoster: Uberspace.de
  • Server-OS: GNU/Linux CentOS Linux 7 (Core) 3.10.0-1160.24.1.el7.x86_64
  • PHP: 7.4.26
  • Datenbank: mysql Ver 15.1 Distrib 10.3.23-MariaDB
  • Nextcloud: 22.2.3
  • News-App: 17.0.1

Hallo zusammen,

ich wollte soeben die “News”-App in meiner Nextcloud aktivieren, erhielt jedoch die Meldung: “Es ist ein Fehler bei der Anfrage aufgetreten. Es kann nicht fortgefahren werden.”

Auszug aus der Protokollierung:

Formatierte Kopie

[settings] Error: could not enable apps

POST /index.php/settings/apps/enable
from [meine-IPv6-Adresse] by User at 2022-01-11T10:25:08+00:00

Rohkopie (anonymisiert)

{"reqId":"Yd1a-fAJFWuYRFFF7SbdqgAAAAo","level":3,"time":"2022-01-11T10:25:08+00:00","remoteAddr":"[meine-IPv6-Adresse]","user":"User","app":"settings","method":"POST","url":"/index.php/settings/apps/enable","message":"could not enable apps","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0","version":"22.2.3.0","exception":{"Exception":"Doctrine\\DBAL\\Exception\\ForeignKeyConstraintViolationException","Message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`***`.`#sql-a36_2682a7`, CONSTRAINT `folder` FOREIGN KEY (`folder_id`) REFERENCES `oc_news_folders` (`id`) ON DELETE CASCADE)","Code":1452,"Trace":[{"file":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Connection.php","line":1780,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDO\\Exception"},{"__class__":"Doctrine\\DBAL\\Query"}]},{"file":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Connection.php","line":1719,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDO\\Exception"},{"__class__":"Doctrine\\DBAL\\Query"}]},{"file":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Connection.php","line":1067,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDO\\Exception"},"ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE",[],[]]},{"file":"/var/www/virtual/***/***/lib/private/DB/Connection.php","line":236,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE",[],[],null]},{"file":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Connection.php","line":1809,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE"]},{"file":"/var/www/virtual/***/***/lib/private/DB/Migrator.php","line":175,"function":"query","class":"Doctrine\\DBAL\\Connection","type":"->","args":["ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE"]},{"file":"/var/www/virtual/***/***/lib/private/DB/Migrator.php","line":76,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Schema\\Schema"}]},{"file":"/var/www/virtual/***/***/lib/private/DB/Connection.php","line":532,"function":"migrate","class":"OC\\DB\\Migrator","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Schema\\Schema"}]},{"file":"/var/www/virtual/***/***/lib/private/DB/MigrationService.php","line":463,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Schema\\Schema"}]},{"file":"/var/www/virtual/***/***/lib/private/DB/MigrationService.php","line":417,"function":"migrateSchemaOnly","class":"OC\\DB\\MigrationService","type":"->","args":["latest"]},{"file":"/var/www/virtual/***/***/lib/private/Installer.php","line":153,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->","args":["latest",true]},{"file":"/var/www/virtual/***/***/apps/settings/lib/Controller/AppSettingsController.php","line":452,"function":"installApp","class":"OC\\Installer","type":"->","args":["news"]},{"file":"/var/www/virtual/***/***/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->","args":[["news"],[]]},{"file":"/var/www/virtual/***/***/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/virtual/***/***/lib/private/AppFramework/App.php","line":156,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/virtual/***/***/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AppSettingsController","enableApps",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"settings.AppSettings.enableApps"}]},{"file":"/var/www/virtual/***/***/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/apps/enable"]},{"file":"/var/www/virtual/***/***/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":54,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`***`.`#sql-a36_2682a7`, CONSTRAINT `folder` FOREIGN KEY (`folder_id`) REFERENCES `oc_news_folders` (`id`) ON DELETE CASCADE)","Code":1452,"Trace":[{"file":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":87,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::","args":[{"errorInfo":["23000",1452,"Cannot add or update a child row: a foreign key constraint fails (`***`.`#sql-a36_2682a7`, CONSTRAINT `folder` FOREIGN KEY (`folder_id`) REFERENCES `oc_news_folders` (`id`) ON DELETE CASCADE)"],"__class__":"PDOException"}]},{"file":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Connection.php","line":1062,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->","args":["ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE"]},{"file":"/var/www/virtual/***/***/lib/private/DB/Connection.php","line":236,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE",[],[],null]},{"file":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Connection.php","line":1809,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE"]},{"file":"/var/www/virtual/***/***/lib/private/DB/Migrator.php","line":175,"function":"query","class":"Doctrine\\DBAL\\Connection","type":"->","args":["ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE"]},{"file":"/var/www/virtual/***/***/lib/private/DB/Migrator.php","line":76,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Schema\\Schema"}]},{"file":"/var/www/virtual/***/***/lib/private/DB/Connection.php","line":532,"function":"migrate","class":"OC\\DB\\Migrator","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Schema\\Schema"}]},{"file":"/var/www/virtual/***/***/lib/private/DB/MigrationService.php","line":463,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Schema\\Schema"}]},{"file":"/var/www/virtual/***/***/lib/private/DB/MigrationService.php","line":417,"function":"migrateSchemaOnly","class":"OC\\DB\\MigrationService","type":"->","args":["latest"]},{"file":"/var/www/virtual/***/***/lib/private/Installer.php","line":153,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->","args":["latest",true]},{"file":"/var/www/virtual/***/***/apps/settings/lib/Controller/AppSettingsController.php","line":452,"function":"installApp","class":"OC\\Installer","type":"->","args":["news"]},{"file":"/var/www/virtual/***/***/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->","args":[["news"],[]]},{"file":"/var/www/virtual/***/***/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/virtual/***/***/lib/private/AppFramework/App.php","line":156,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/virtual/***/***/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AppSettingsController","enableApps",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"settings.AppSettings.enableApps"}]},{"file":"/var/www/virtual/***/***/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/apps/enable"]},{"file":"/var/www/virtual/***/***/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":26,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`***`.`#sql-a36_2682a7`, CONSTRAINT `folder` FOREIGN KEY (`folder_id`) REFERENCES `oc_news_folders` (`id`) ON DELETE CASCADE)","Code":"23000","Trace":[{"file":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","line":82,"function":"query","class":"PDO","type":"->","args":["ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE"]},{"file":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Connection.php","line":1062,"function":"query","class":"Doctrine\\DBAL\\Driver\\PDO\\Connection","type":"->","args":["ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE"]},{"file":"/var/www/virtual/***/***/lib/private/DB/Connection.php","line":236,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":["ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE",[],[],null]},{"file":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Connection.php","line":1809,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->","args":["ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE"]},{"file":"/var/www/virtual/***/***/lib/private/DB/Migrator.php","line":175,"function":"query","class":"Doctrine\\DBAL\\Connection","type":"->","args":["ALTER TABLE oc_news_feeds ADD CONSTRAINT folder FOREIGN KEY (folder_id) REFERENCES oc_news_folders (id) ON DELETE CASCADE"]},{"file":"/var/www/virtual/***/***/lib/private/DB/Migrator.php","line":76,"function":"applySchema","class":"OC\\DB\\Migrator","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Schema\\Schema"}]},{"file":"/var/www/virtual/***/***/lib/private/DB/Connection.php","line":532,"function":"migrate","class":"OC\\DB\\Migrator","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Schema\\Schema"}]},{"file":"/var/www/virtual/***/***/lib/private/DB/MigrationService.php","line":463,"function":"migrateToSchema","class":"OC\\DB\\Connection","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Schema\\Schema"}]},{"file":"/var/www/virtual/***/***/lib/private/DB/MigrationService.php","line":417,"function":"migrateSchemaOnly","class":"OC\\DB\\MigrationService","type":"->","args":["latest"]},{"file":"/var/www/virtual/***/***/lib/private/Installer.php","line":153,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->","args":["latest",true]},{"file":"/var/www/virtual/***/***/apps/settings/lib/Controller/AppSettingsController.php","line":452,"function":"installApp","class":"OC\\Installer","type":"->","args":["news"]},{"file":"/var/www/virtual/***/***/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->","args":[["news"],[]]},{"file":"/var/www/virtual/***/***/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/virtual/***/***/lib/private/AppFramework/App.php","line":156,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/virtual/***/***/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AppSettingsController","enableApps",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"settings.AppSettings.enableApps"}]},{"file":"/var/www/virtual/***/***/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/apps/enable"]},{"file":"/var/www/virtual/***/***/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/virtual/***/***/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php","Line":82}},"CustomMessage":"could not enable apps"},"id":"61dd5b1906056"}

Frage: ist das ein Shared Hosting bei Uberspace? Falls ja, dann haben die ggf untersagt, dass man andere Apps als die angebotenen installiert. Du solltest dich dann an deren Support wenden

Ja, es ist ein Shared Hoster – aber ich bin mir absolut sicher, dass es dort keine Begrenzung an Apps für Nextcloud gibt.

nun, dann poste doch bitte mal deine config.php - (achte darauf, wichtige Daten darin zu anonymisieren)

Gerne:

<?php
$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => '/xxx',
  'secret' => 'xxx+xxx',
  'trusted_domains' => 
  array (
    0 => 'sub.domain.tl',
  ),
  'datadirectory' => '/var/www/virtual/user/sub.domain.tl/data',
  'overwrite.cli.url' => 'https://sub.domain.tl',
  'dbtype' => 'mysql',
  'version' => '22.2.3.0',
  'dbname' => 'user',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'user',
  'dbpassword' => 'xxx',
  'installed' => true,
  'filelocking.enabled' => 'true',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/home/user/.redis/sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtpport' => '587',
  'mail_smtpsecure' => 'tls',
  'mail_from_address' => 'user',
  'mail_domain' => 'domain.tl',
  'mail_smtphost' => 'sub.uberspace.de',
  'mail_smtpname' => 'user@domain.tl',
  'mail_smtppassword' => 'xxx',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 0,
  'updater.release.channel' => 'stable',
  'app_install_overwrite' => 
  array (
    0 => 'apporder',
    1 => 'gpxedit',
  ),
  'mysql.utf8mb4' => true,
  'mail_sendmailmode' => 'smtp',
  'trashbin_retention_obligation' => 'auto, 30',
  'versions_retention_obligation' => 'auto, 7',
  'default_phone_region' => 'DE',
);

das sieht soweit nicht schlecht aus…

gibt es noch setup-/security messages, die noch nicht gelöst sind?

Ja, es gibt ein etliche Warnings (“Login failed”) bezüglich eines Geräts in welchem offensichtlich falsche Zugangsdaten gespeichert sind und es gibt einen Error bezüglich einer Datei:

[remote] Error: The requested uri(/remote.php/dav/files/User/Dateiname.pdf%0A) cannot be processed by the script '/remote.php/dav/files/User/Dateiname.pdf
')

GET /remote.php/dav/files/User/Dateiname%0A
from [meine-IPv6-Adresse] by User at 2022-01-10T18:49:53+00:00

Edit: das “%0A” hinter der Dateinamenerweiterung ist vermutlich die Ursache für den Fehler – aber kann das auch Ursache für das Thema des Threads sein?

die Meldung ist glaube ich nicht zusammenhängend mit dem Problem.
Ich meinte die Meldungen, die man sieht (oder auch nicht) im Admin-account - Einstellungen - Überblick

Da ist alles bestens:
Screenshot

sehr gut…

möchtest du mal
"appstoreenabled" => true,
in deiner config.php einfügen und sehen ob das hilft?

Habe ich getan; änderte aber nichts am Ergebnis: die Fehlermeldung erscheint leider weiterhin

Ich habe soeben die Installation einer anderen App (“Forms”) versucht: Das klappte auf Anhieb ohne Probleme. Es scheint(!) also spezifisch an der News-App zu liegen.

hmmm… dann schau doch mal hier, ob dir das hilft

Danke! Das hat mein Problem in der Tat gelöst.

Für die Nachwelt mit ähnlichen Problemen hier nochmal meine Lösung Schritt-für-Schritt:

  1. SSH-Verbindung zum Nextcloud-Server aufbauen
  2. Namen der Datenbank der Nextcloudinstanz ermitteln: cat /pfad/zur/Nextcloud/config/config.php | grep dbname
  3. Sicherung der Datenbank erstellen: mysqldump Name_der_Datenbank > Name_der_Datenbank.sql
  4. Zu MySQL (MariaDB) wechseln: mysql
  5. Nextcloud-Datenbank verwenden: USE Name_der_Datenbank
  6. News-Tabellen finden: SHOW TABLES LIKE 'oc_news%';
  7. gefundene News-Tabellen löschen: DROP TABLE oc_news_feeds,oc_news_folders,oc_news_items; (Beispiel)
  8. MySQL (MariaDB) verlassen: exit
  9. SSH-Verbindung zum Nextcloud-Server verlassen: exit
  10. Die “News”-App über die Weboberfläche der Nextcloud-Instanz installieren bzw. aktivieren