After Ubuntu Upgrade, Nextcloud not loading

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 30.0.4
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 24.04 (from 22.04)
  • Web server and version (e.g, Apache 2.4.25):
    • Apache2 2.4.58
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • (Not relevant)
  • PHP version (e.g, 8.3):
    • 8.3
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • Today after Ubuntu Upgrade
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • NextCloud VM Script

Summary of the issue you are facing:

After upgrading to Ubuntu 24.04, Nextcloud will not load. I ran the OCC and this is what appeared:

sudo -u www-data php /var/www/nextcloud/occ
PHP Warning: PHP Startup: Unable to load dynamic library ‘pq.so’ (tried: /usr/lib/php/20230831/pq.so (/usr/lib/php/20230831/pq.so: undefined symbol: php_resource_factory_handle_ctor), /usr/lib/php/20230831/pq.so.so (/usr/lib/php/20230831/pq.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[08006] [7] connection to server at “localhost” (127.0.0.1), port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections? in /var/www/nextcloud/lib/private/DB/Connection.php:233
Stack trace:
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(453): OC\DB\Connection->connect()
#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(411): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(318): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /var/www/nextcloud/lib/private/DB/Connection.php(899): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /var/www/nextcloud/lib/private/DB/ConnectionAdapter.php(235): OC\DB\Connection->getDatabaseProvider()
#5 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(96): OC\DB\ConnectionAdapter->getDatabaseProvider()
#6 /var/www/nextcloud/lib/private/AppConfig.php(1211): OC\DB\QueryBuilder\QueryBuilder->expr()
#7 /var/www/nextcloud/lib/private/AppConfig.php(237): OC\AppConfig->loadConfig()
#8 /var/www/nextcloud/lib/private/AppConfig.php(1351): OC\AppConfig->searchValues()
#9 /var/www/nextcloud/lib/private/App/AppManager.php(126): OC\AppConfig->getValues()
#10 /var/www/nextcloud/lib/private/App/AppManager.php(147): OC\App\AppManager->getInstalledAppsValues()
#11 /var/www/nextcloud/lib/private/legacy/OC_App.php(191): OC\App\AppManager->getInstalledApps()
#12 /var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php(48): OC_App::getEnabledApps()
#13 /var/www/nextcloud/lib/base.php(659): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#14 /var/www/nextcloud/lib/base.php(1134): OC::init()
#15 /var/www/nextcloud/console.php(28): require_once(‘…’)
#16 /var/www/nextcloud/occ(11): require_once(‘…’)

I tried looking up the error and running the “php-updater” script, and it still shows this. I’m at a loss as to what to do at this point.

Your php setup / Installation is Not Correct

I figured that, but I’m unsure where to look. I feel I looked everywhere with where Google told me to look. re-installed a few things. But nothing seems to be working.

Hello,

After a bit, I got the PHP error resolved. But it’s still not connecting to the database.

Welp, the good news is I found the error.

The bad news is that the error is the database is gone. Going to need to rebuild the database, but I lost the database files.

No databases are purged due to an ubuntu upgrade.

Please type pg_lsclusters as root and report.

Hi there,

It wasn’t Nextcloud’s fault, it was 100% my fault.

Here’s what happened:
I was using Ubuntu 22.04. When I first installed NextCloud, the NextCloud VM script used PostgreSQL version 14. Since then, that version obsoleted in Ubuntu 24.04, so during the upgrade to 24.04, it removed PostgreSQL v14 and installed v16.

In my lack of judgement, I accidentally deleted the Version 14 files without migrating them to version 16. When I logged into version 16, it had no NextCloud Databases, and it was too late to recover them.

Honestly, it’s a learning experience. Plus, realistically I didn’t lose much in a total rebuild, and somehow the server’s even faster than before, so I’m not complaining. Other than a minor freakout on Tuesday :slight_smile:

Thank you for your reply though!

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.