package postgresql-15 15.5-0ubuntu0.23.04.1 failed to install/upgrade: installed postgresql-15 package post-installation script subprocess returned error exit status 1

Bug #2067061 reported by kartikey

This bug report will be marked for expiration in 16 days if no further activity occurs. (find out why)

8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
postgresql-15 (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

couldn't install

ProblemType: Package
DistroRelease: Ubuntu 23.04
Package: postgresql-15 15.5-0ubuntu0.23.04.1
ProcVersionSignature: Ubuntu 6.2.0-39.40-generic 6.2.16
Uname: Linux 6.2.0-39-generic x86_64
ApportVersion: 2.26.1-0ubuntu2.1
AptOrdering:
 postgresql-15:amd64: Install
 NULL: ConfigurePending
Architecture: amd64
CasperMD5CheckResult: pass
Date: Fri May 24 17:16:41 2024
ErrorMessage: installed postgresql-15 package post-installation script subprocess returned error exit status 1
InstallationDate: Installed on 2023-06-30 (328 days ago)
InstallationMedia: Ubuntu 23.04 "Lunar Lobster" - Release amd64 (20230418)
Python3Details: /usr/bin/python3.11, Python 3.11.4, python3-minimal, 3.11.2-1
PythonDetails: N/A
RelatedPackageVersions:
 dpkg 1.21.21ubuntu1
 apt 2.6.0ubuntu0.1
SourcePackage: postgresql-15
Title: package postgresql-15 15.5-0ubuntu0.23.04.1 failed to install/upgrade: installed postgresql-15 package post-installation script subprocess returned error exit status 1
UpgradeStatus: Upgraded to lunar on 2023-11-20 (186 days ago)

Revision history for this message
kartikey (mishrakartik) wrote :
tags: removed: need-duplicate-check
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Hi kartikey,

It seems some other service was using the same port as postgresql. Could you please confirm? Also, would you providing the postgresql logs as well?

I am marking this as incomplete until you can provide additional information so we can keep investigating this further. When you do so, please, set this bug status back to new.

Changed in postgresql-15 (Ubuntu):
status: New → Incomplete
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

I also noticed this:

Start-Date: 2024-05-24 17:16:19
Commandline: apt-get remove --purge postgresql-15
Requested-By: kartik (1000)
Purge: postgresql-15:amd64 (15.5-0ubuntu0.23.04.1), postgresql-contrib:amd64 (15+248), postgresql:amd64 (15+248)
End-Date: 2024-05-24 17:16:27

These version numbers are strange; it seems like the postgresql packages are coming from two different sources (the Ubuntu repository + the upstream repo, maybe?).

Revision history for this message
kartikey (mishrakartik) wrote :
Download full text (6.3 KiB)

sudo apt-get install postgresql-15
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libcommon-sense-perl libjson-perl libjson-xs-perl libtypes-serialiser-perl postgresql-client-15 postgresql-client-common postgresql-common
  sysstat
Suggested packages:
  postgresql-doc-15 isag
The following NEW packages will be installed:
  libcommon-sense-perl libjson-perl libjson-xs-perl libtypes-serialiser-perl postgresql-15 postgresql-client-15 postgresql-client-common
  postgresql-common sysstat
0 upgraded, 9 newly installed, 0 to remove and 4 not upgraded.
Need to get 0 B/18.6 MB of archives.
After this operation, 52.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package libjson-perl.
(Reading database ... 301453 files and directories currently installed.)
Preparing to unpack .../0-libjson-perl_4.10000-1_all.deb ...
Unpacking libjson-perl (4.10000-1) ...
Selecting previously unselected package postgresql-client-common.
Preparing to unpack .../1-postgresql-client-common_248_all.deb ...
Unpacking postgresql-client-common (248) ...
Selecting previously unselected package postgresql-common.
Preparing to unpack .../2-postgresql-common_248_all.deb ...
Adding 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Unpacking postgresql-common (248) ...
Selecting previously unselected package libcommon-sense-perl:amd64.
Preparing to unpack .../3-libcommon-sense-perl_3.75-3_amd64.deb ...
Unpacking libcommon-sense-perl:amd64 (3.75-3) ...
Selecting previously unselected package libtypes-serialiser-perl.
Preparing to unpack .../4-libtypes-serialiser-perl_1.01-1_all.deb ...
Unpacking libtypes-serialiser-perl (1.01-1) ...
Selecting previously unselected package libjson-xs-perl.
Preparing to unpack .../5-libjson-xs-perl_4.030-2_amd64.deb ...
Unpacking libjson-xs-perl (4.030-2) ...
Selecting previously unselected package postgresql-client-15.
Preparing to unpack .../6-postgresql-client-15_15.5-0ubuntu0.23.04.1_amd64.deb ...
Unpacking postgresql-client-15 (15.5-0ubuntu0.23.04.1) ...
Selecting previously unselected package postgresql-15.
Preparing to unpack .../7-postgresql-15_15.5-0ubuntu0.23.04.1_amd64.deb ...
Unpacking postgresql-15 (15.5-0ubuntu0.23.04.1) ...
Selecting previously unselected package sysstat.
Preparing to unpack .../8-sysstat_12.6.1-1ubuntu0.1_amd64.deb ...
Unpacking sysstat (12.6.1-1ubuntu0.1) ...
Setting up postgresql-client-common (248) ...
Setting up libcommon-sense-perl:amd64 (3.75-3) ...
Setting up postgresql-client-15 (15.5-0ubuntu0.23.04.1) ...
update-alternatives: using /usr/share/postgresql/15/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
Setting up libtypes-serialiser-perl (1.01-1) ...
Setting up libjson-perl (4.10000-1) ...
Setting up sysstat (12.6.1-1ubuntu0.1) ...
update-alternatives: using /usr/bin/sar.sysstat to provide /usr/bin/sar (sar) in auto mode
Setting up libjson-xs-perl (4.030-2) ...
Setting up postgresql-common (248) ...

Creating config file /etc/postgresql-common/creat...

Read more...

Revision history for this message
kartikey (mishrakartik) wrote :
Download full text (5.0 KiB)

2024-06-07 13:34:15.468 IST [79895] LOG: starting PostgreSQL 15.5 (Ubuntu 15.5-0ubuntu0.23.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 12.3.0-1ubuntu1~23.04) 12.3.0, 64-bit
2024-06-07 13:34:15.469 IST [79895] LOG: listening on IPv4 address "127.0.0.1", port 5432
2024-06-07 13:34:15.469 IST [79895] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-06-07 13:34:15.473 IST [79898] LOG: database system was shut down at 2024-06-07 13:34:14 IST
2024-06-07 13:34:15.476 IST [79895] LOG: database system is ready to accept connections
2024-06-07 13:34:17.639 IST [79915] FATAL: lock file "postmaster.pid" already exists
2024-06-07 13:34:17.639 IST [79915] HINT: Is another postmaster (PID 79895) running in data directory "/var/lib/postgresql/15/main"?
2024-06-07 13:39:15.571 IST [79896] LOG: checkpoint starting: time
2024-06-07 13:39:19.837 IST [79896] LOG: checkpoint complete: wrote 45 buffers (0.3%); 0 WAL file(s) added, 0 removed, 0 recycled; write=4.213 s, sync=0.013 s, total=4.267 s; sync files=11, longest=0.012 s, average=0.002 s; distance=262 kB, estimate=262 kB
2024-06-07 13:39:42.021 IST [81517] FATAL: lock file "postmaster.pid" already exists
2024-06-07 13:39:42.021 IST [81517] HINT: Is another postmaster (PID 79895) running in data directory "/var/lib/postgresql/15/main"?
2024-06-07 13:41:33.234 IST [79895] LOG: received fast shutdown request
2024-06-07 13:41:33.235 IST [79895] LOG: aborting any active transactions
2024-06-07 13:41:33.238 IST [79895] LOG: background worker "logical replication launcher" (PID 79901) exited with exit code 1
2024-06-07 13:41:33.238 IST [79896] LOG: shutting down
2024-06-07 13:41:33.239 IST [79896] LOG: checkpoint starting: shutdown immediate
2024-06-07 13:41:33.242 IST [79896] LOG: checkpoint complete: wrote 0 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.001 s, total=0.004 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=236 kB
2024-06-07 13:41:33.245 IST [79895] LOG: database system is shut down
2024-06-07 13:41:39.437 IST [81613] LOG: starting PostgreSQL 15.5 (Ubuntu 15.5-0ubuntu0.23.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 12.3.0-1ubuntu1~23.04) 12.3.0, 64-bit
2024-06-07 13:41:39.437 IST [81613] LOG: listening on IPv4 address "127.0.0.1", port 5432
2024-06-07 13:41:39.438 IST [81613] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-06-07 13:41:39.442 IST [81616] LOG: database system was shut down at 2024-06-07 13:41:33 IST
2024-06-07 13:41:39.447 IST [81613] LOG: database system is ready to accept connections
2024-06-07 13:41:41.637 IST [81633] FATAL: lock file "postmaster.pid" already exists
2024-06-07 13:41:41.637 IST [81633] HINT: Is another postmaster (PID 81613) running in data directory "/var/lib/postgresql/15/main"?
2024-06-07 13:43:05.389 IST [81613] LOG: received smart shutdown request
2024-06-07 13:43:05.394 IST [81613] LOG: background worker "logical replication launcher" (PID 81619) exited with exit code 1
2024-06-07 13:43:05.394 IST [81614] LOG: shutting down
2024-06-07 13:43:05.395 IST [81614] LOG: checkpoint starting: shutdown immediate
2024-...

Read more...

Revision history for this message
kartikey (mishrakartik) wrote :

 # Stop PostgreSQL Service
sudo systemctl stop postgresql

# Remove the Data Directory
sudo rm -rf /var/lib/postgresql/15/main

# Recreate the Data Directory
sudo mkdir -p /var/lib/postgresql/15/main
sudo chown -R postgres:postgres /var/lib/postgresql/15/main
sudo chmod -R 700 /var/lib/postgresql/15/main

# Verify Directory is Empty
sudo ls -l /var/lib/postgresql/15/main

# Reinitialize the Database Cluster
sudo -u postgres /usr/lib/postgresql/15/bin/initdb -D /var/lib/postgresql/15/main

# Start PostgreSQL Service
sudo systemctl start postgresql

# Check Service Status
sudo systemctl status postgresql
total 0
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/15/main ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Kolkata
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/lib/postgresql/15/bin/pg_ctl -D /var/lib/postgresql/15/main -l logfile start

Job for postgresql.service failed because the control process exited with error code.
See "systemctl status postgresql.service" and "journalctl -xeu postgresql.service" for details.
× postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/etc/systemd/system/postgresql.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Fri 2024-06-07 14:06:05 IST; 37ms ago
       Docs: man:postgres(1)
    Process: 82985 ExecStart=/usr/lib/postgresql/15/bin/pg_ctl start -D /var/lib/postgresql/15/main -s -o -c config_file=/etc/postgresql/15/m>
        CPU: 27ms

Jun 07 14:06:05 kartik-81WE systemd[1]: Starting postgresql.service - PostgreSQL RDBMS...
Jun 07 14:06:05 kartik-81WE pg_ctl[82985]: pg_ctl: another server might be running; trying to start server anyway
Jun 07 14:06:05 kartik-81WE pg_ctl[82985]: pg_ctl: could not start server
Jun 07 14:06:05 kartik-81WE pg_ctl[82985]: Examine the log output.
Jun 07 14:06:05 kartik-81WE systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE
Jun 07 14:06:05 kartik-81WE systemd[1]: postgresql.service: Failed with result 'exit-code'.
Jun 07 14:06:05 kartik-81WE systemd[1]: Failed to start postgresql.service - PostgreSQL RDBMS.
lines 1-14/14 (END)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.