Bugzilla – Bug 1216808
postgresql16 fails to run after DB update from postgresql13
Last modified: 2023-11-06 14:54:39 UTC
I use opensuse tumbleweed and the Kmail/Kontact PIM software. The default database for akonadi was Mysql but it caused a lot of reliability issues for me so i migrated to Postgresql 9.6 (yes, it was a few years ago) I've since then update the DB to postgresql10, 11, 12 until ver 13 which i have been using until now. I did try updating to ver 14 but it failed with locale issues during the update and i couldn't get a resolution. I just recently managed to get the database converted from postgresql13 to postgresql16 and the data was transferred to the new DB with no issues. I can't get Akonadi to load as it fails to start postgresql16, its failing with a message saying it needs postgesql9.6 as the DB was originally created using 9.6. I can't see why it insists on ver 9.6 being there as i've updated to ver 16 and that process means i create an empty DB. I can't even install Ver 9.6 to see if that cures the problem as its no longer in the opensuse repos. -------------- the section lists my process to convert DB ---------- I update the DB manually via scripts with one file per action. 1. Backup # stop akonadi akonadictl stop # copy cp -R $HOME/.local/share/akonadi/db_data $HOME/.local/share/akonadi/db_data_13 # rename mv $HOME/.local/share/akonadi/db_data $HOME/.local/share/akonadi/db_data_old 2. Create new DB /usr/lib/postgresql16/bin/initdb --pgdata=$HOME/.local/share/akonadi/db_data --lc-collate=en_US.UTF-8 --locale=en_US.UTF-8 3. Check upgrade /usr/lib/postgresql16/bin/pg_upgrade -b /usr/lib/postgresql13/bin -B /usr/lib/ postgresql16/bin -d $HOME/.local/share/akonadi/db_data_13 -D $HOME/.local/ share/akonadi/db_data --check 4. Do the upgrade if "3" worked okay /usr/lib/postgresql16/bin/pg_upgrade -b /usr/lib/postgresql13/bin -B /usr/lib/ postgresql16/bin -d $HOME/.local/share/akonadi/db_data_13 -D $HOME/.local/ share/akonadi/db_data -------------- the section list errors from "akonadi start" ---------- ~:> akonadictl start org.kde.pim.akonadictl: Starting Akonadi Server... org.kde.pim.akonadictl: done. ~> Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString) org.kde.pim.akonadiserver: Starting up the Akonadi Server... (QFileInfo(/usr/lib/postgresql/bin), QFileInfo(/usr/lib/postgresql/lib64)) QSqlDatabase: QPSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QMYSQL3 org.kde.pim.akonadiserver: Invalid database object during database server startup QProcess: Destroyed while process ("/usr/bin/pg_ctl") is still running. org.kde.pim.akonadiserver: Shutting down AkonadiServer... org.kde.pim.akonadicontrol: Application '/usr/bin/akonadiserver' exited normally... --------- this shows status using "systemctl status postgresql.service" --- × postgresql.service - PostgreSQL database server Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: disabled) Active: failed (Result: exit-code) since Tue 2023-10-31 16:24:13 GMT; 1min 31s ago Process: 5916 ExecStart=/usr/share/postgresql/postgresql-script start (code=exited, status=1/FAILURE) CPU: 8ms Oct 31 16:24:13 Lian-Li systemd[1]: Starting PostgreSQL database server... Oct 31 16:24:13 Lian-Li postgresql-script[5916]: Your database files were created by PostgreSQL version 9.6. Oct 31 16:24:13 Lian-Li postgresql-script[5916]: Could not find executables for this version. Oct 31 16:24:13 Lian-Li postgresql-script[5916]: Please install the PostgreSQL server package for version 9.6. Oct 31 16:24:13 Lian-Li systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE Oct 31 16:24:13 Lian-Li systemd[1]: postgresql.service: Failed with result 'exit-code'. Oct 31 16:24:13 Lian-Li systemd[1]: Failed to start PostgreSQL database server. ---------- Errors from the journal using "journalctl -xeu postgresql.service" Oct 31 16:24:13 Lian-Li systemd[1]: Starting PostgreSQL database server... Subject: A start job for unit postgresql.service has begun execution Defined-By: systemd Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel A start job for unit postgresql.service has begun execution. The job identifier is 2241. Oct 31 16:24:13 Lian-Li postgresql-script[5916]: Your database files were created by PostgreSQL version 9.6. Oct 31 16:24:13 Lian-Li postgresql-script[5916]: Could not find executables for this version. Oct 31 16:24:13 Lian-Li postgresql-script[5916]: Please install the PostgreSQL server package for version 9.6. Oct 31 16:24:13 Lian-Li systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE Subject: Unit process exited Defined-By: systemd Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel An ExecStart= process belonging to unit postgresql.service has exited. The process' exit code is 'exited' and its exit status is 1. Oct 31 16:24:13 Lian-Li systemd[1]: postgresql.service: Failed with result 'exit-code'. Subject: Unit failed Defined-By: systemd Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel The unit postgresql.service has entered the 'failed' state with result 'exit- code'. Oct 31 16:24:13 Lian-Li systemd[1]: Failed to start PostgreSQL database server. Subject: A start job for unit postgresql.service has failed Defined-By: systemd Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel A start job for unit postgresql.service has finished with a failure. ----------------------- opensuse:tumbleweed:20231030 Qt: 5.15.11 KDE Frameworks: 5.111.0 - KDE Plasma: 5.27.9 - kwin 5.27.9 kmail2 5.24.2 (23.08.2) - akonadiserver 5.24.2 (23.08.2) - Kernel: 6.5.9-1- default - kernel-firmware-radeon 20231019
I've joined the pgsql-novice mailing list and someone there pointed to the problem being from /usr/share/postgresql/postgresql-script because the error message is from that script. Not sure what the issue is though and why it needs to stop postgresql from loading
I don't know much about Akonadi, but AFAIK (and your logs indicate) it starts its own database server that has nothing to do with the system-wide postgresql.service . This server is owned by the user that runs Akonadi and uses different files than the system-wide server, which is not needed if Akonadi is your only reason to run a PostgreSQL server. As far as I see you converted this private PostgreSQL instance to PostgreSQL 16, but there still seems to be a (probably unused) system-wide instance that has not been converted, and that's what postgresql-script (executed by postgresql.service) is complaining about. The default location for this would be /var/lib/pgsql/data¹, and the PG_VERSION file in that directory will tell you what version this instance was created with. If you really need that database instance you have to convert it using old postgresql96 packages. If you don't need it, you can just disable postgresql.service and optionally delete the files below the data dir mentioned above. Now to the question why Akonadi fails to start the PostgreSQL sever: Unfortunately the log messages don't give a clear indication of what's going wrong, but it looks to me like the QPSQL database driver is either not installed or not not configured properly. I am passing this on to the maintainer of Akonadi for further analysis, if needed. ____ ¹) defined as POSTGRES_DATADIR=~postgres/data in /etc/sysconfig/postgresql
(In reply to Reinhard Max from comment #2) Thanks for the reply. > I don't know much about Akonadi, but AFAIK (and your logs indicate) it > starts its own database server that has nothing to do with the system-wide > postgresql.service . This server is owned by the user that runs Akonadi and > uses different files than the system-wide server, which is not needed if > Akonadi is your only reason to run a PostgreSQL server. I'm not sure why it started to do that as it was working fine before the database in my local folders was upgraded > > As far as I see you converted this private PostgreSQL instance to PostgreSQL > 16, but there still seems to be a (probably unused) system-wide instance > that has not been converted, and that's what postgresql-script (executed by > postgresql.service) is complaining about. The default location for this > would be /var/lib/pgsql/data¹, and the PG_VERSION file in that directory > will tell you what version this instance was created with. If you really > need that database instance you have to convert it using old postgresql96 > packages. If you don't need it, you can just disable postgresql.service and > optionally delete the files below the data dir mentioned above. i've now disabled postgresql.service and i have to login to different user to try it before deleting any files. I've looked into the directory and it has files dated 2017 and a couple 2021 and the PG_VERSION contains the 9.6 I have no need for old versions of postgresql > > Now to the question why Akonadi fails to start the PostgreSQL sever: > Unfortunately the log messages don't give a clear indication of what's going > wrong, but it looks to me like the QPSQL database driver is either not > installed or not not configured properly. > > I am passing this on to the maintainer of Akonadi for further analysis, if > needed. > ____ > ¹) defined as POSTGRES_DATADIR=~postgres/data in /etc/sysconfig/postgresql
(In reply to Reinhard Max from comment #2) > I don't know much about Akonadi, but AFAIK (and your logs indicate) it > starts its own database server that has nothing to do with the system-wide > postgresql.service . This server is owned by the user that runs Akonadi and > uses different files than the system-wide server, which is not needed if > Akonadi is your only reason to run a PostgreSQL server. > > As far as I see you converted this private PostgreSQL instance to PostgreSQL > 16, but there still seems to be a (probably unused) system-wide instance > that has not been converted, and that's what postgresql-script (executed by > postgresql.service) is complaining about. The default location for this > would be /var/lib/pgsql/data¹, and the PG_VERSION file in that directory > will tell you what version this instance was created with. If you really > need that database instance you have to convert it using old postgresql96 > packages. If you don't need it, you can just disable postgresql.service and > optionally delete the files below the data dir mentioned above. > > Now to the question why Akonadi fails to start the PostgreSQL sever: > Unfortunately the log messages don't give a clear indication of what's going > wrong, but it looks to me like the QPSQL database driver is either not > installed or not not configured properly. > > I am passing this on to the maintainer of Akonadi for further analysis, if > needed. > > ____ > ¹) defined as POSTGRES_DATADIR=~postgres/data in /etc/sysconfig/postgresql i've renamed POSTGRES_DATADIR=~postgres/data to data.old and it still didn't work
(In reply to Reinhard Max from comment #2) I've post this to the KDE bugs.kde.org and the frameworks section - Bug 476617 thanks for the help
Problem now solved - missing file called libQt5Sql5-postgresql which is concerning. THanks for the help