Невозможно полностью очистить и переустановить postgresql в Ubuntu 14.04 - PullRequest
0 голосов
/ 11 апреля 2020

У меня есть Ubuntu 14.04.5 LTS (GNU / Linux 2.6.32-042stab127.2 x86_64) VPS, и я пытался полностью очистить и переустановить postgresql в Ubuntu 14.04.

I было следующее Вариант B

Для очистки я сделал

 apt-get --purge remove postgresql\*

Последние несколько строк вывода

(Reading database ... 68690 files and directories currently installed.)
Removing postgresql (11+195.pgdg14.04+1) ...
Removing postgresql-contrib (11+195.pgdg14.04+1) ...
Removing postgresql-11 (11.0-1.pgdg14.04+2) ...
update-alternatives: using /usr/share/postgresql/9.5/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmas       ter.1.gz) in auto mode
Purging configuration files for postgresql-11 (11.0-1.pgdg14.04+2) ...
Dropping cluster main...
Removing postgresql-contrib-9.3 (9.3.24-1.pgdg14.04+1) ...
Removing postgresql-9.3 (9.3.24-1.pgdg14.04+1) ...
Purging configuration files for postgresql-9.3 (9.3.24-1.pgdg14.04+1) ...
Removing postgresql-contrib-9.4 (9.4.19-1.pgdg14.04+1) ...
Removing postgresql-9.4 (9.4.19-1.pgdg14.04+1) ...
Purging configuration files for postgresql-9.4 (9.4.19-1.pgdg14.04+1) ...
Removing postgresql-contrib-9.5 (9.5.14-1.pgdg14.04+1) ...
update-alternatives: warning: forcing reinstallation of alternative /usr/share/postgresql/9.5/man/man1/postmaster.1.gz because link g       roup postmaster.1.gz is broken
Removing postgresql-9.5 (9.5.14-1.pgdg14.04+1) ...
Purging configuration files for postgresql-9.5 (9.5.14-1.pgdg14.04+1) ...
Removing postgresql-client-11 (11.0-1.pgdg14.04+2) ...
update-alternatives: using /usr/share/postgresql/9.5/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto        mode
Removing postgresql-client-9.3 (9.3.24-1.pgdg14.04+1) ...
Removing postgresql-client-9.4 (9.4.19-1.pgdg14.04+1) ...
Removing postgresql-client-9.5 (9.5.14-1.pgdg14.04+1) ...
Removing postgresql-common (195.pgdg14.04+1) ...
 * No PostgreSQL clusters exist; see "man pg_createcluster"
Removing 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Purging configuration files for postgresql-common (195.pgdg14.04+1) ...
dpkg: warning: while removing postgresql-common, directory '/etc/postgresql' not empty so not removed
dpkg: warning: while removing postgresql-common, directory '/var/lib/postgresql' not empty so not removed
Removing postgresql-client-common (195.pgdg14.04+1) ...
Purging configuration files for postgresql-client-common (195.pgdg14.04+1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up gpm (1.20.4-6.1) ...
ioctl: Invalid argument
 * Stopping mouse interface server gpm                                                                                        [ OK ]
 * Starting mouse interface server gpm                                                                                                      /etc/init.d/gpm: 66: /etc/init.d/gpm: cannot open /dev/input/mice: No such file
invoke-rc.d: initscript gpm, action "restart" failed.
dpkg: error processing package gpm (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up influxdb (1.7.10-1) ...
Failed to issue method call: No such file or directory
dpkg: error processing package influxdb (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 gpm
 influxdb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Что это за ошибка?

и

 rm -r /etc/postgresql/
 rm -r /etc/postgresql-common/
 rm: cannot remove '/etc/postgresql-common/': No such file or directory
 rm -r /var/lib/postgresql/
 userdel -r postgres
 userdel: postgres mail spool (/var/mail/postgres) not found
 userdel: postgres home directory (/var/lib/postgresql) not found
 groupdel postgres
 groupdel: group 'postgres' does not exist

Для переустановки я сделал

sudo apt install postgresql-11 libpq-dev

Последние несколько строк вывода

    Unpacking postgresql-common (201.pgdg14.04+1) ...
Selecting previously unselected package postgresql-11.
Preparing to unpack .../postgresql-11_11.3-1.pgdg14.04+1_amd64.deb ...
Unpacking postgresql-11 (11.3-1.pgdg14.04+1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up gpm (1.20.4-6.1) ...
ioctl: Invalid argument
 * Stopping mouse interface server gpm                                                                                        [ OK ]
 * Starting mouse interface server gpm                                                                                                      /etc/init.d/gpm: 66: /etc/init.d/gpm: cannot open /dev/input/mice: No such file
invoke-rc.d: initscript gpm, action "restart" failed.
dpkg: error processing package gpm (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up influxdb (1.7.10-1) ...
Failed to issue method call: No such file or directory
dpkg: error processing package influxdb (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up libpq5:amd64 (11.3-1.pgdg14.04+1) ...
Setting up libpq-dev (11.3-1.pgdg14.04+1) ...
Setting up postgresql-client-common (201.pgdg14.04+1) ...
Setting up postgresql-client-11 (11.3-1.pgdg14.04+1) ...
update-alternatives: using /usr/share/postgresql/11/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto m       ode
Setting up postgresql-common (201.pgdg14.04+1) ...
Adding user postgres to group ssl-cert

Creating config file /etc/postgresql-common/createcluster.conf with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
 * No PostgreSQL clusters exist; see "man pg_createcluster"
Processing triggers for ureadahead (0.100.0-16) ...
Setting up postgresql-11 (11.3-1.pgdg14.04+1) ...
Creating new PostgreSQL cluster 11/main ...
/usr/lib/postgresql/11/bin/initdb -D /var/lib/postgresql/11/main --auth-local peer --auth-host md5
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 "C.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/11/main ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    pg_ctlcluster 11 main start

Ver Cluster Port Status Owner    Data directory              Log file
11  main    5432 down   postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log
update-alternatives: using /usr/share/postgresql/11/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmast       er.1.gz) in auto mode
 * Starting PostgreSQL 11 database server                                                                                                    * Failed to issue method call: Unit postgresql@11-main.service failed to load: No such file or directory. See system logs and 'syste       mctl status postgresql@11-main.service' for details.
                                                                                                                              [fail]
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing package postgresql-11 (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin (2.19-0ubuntu6.14) ...
Errors were encountered while processing:
 gpm
 influxdb
 postgresql-11
E: Sub-process /usr/bin/dpkg returned an error code (1)

и

dpkg -l | grep postgres
ii  pgdg-keyring                             2018.1+b1                                  all          keyring for apt.postgresql.org
iF  postgresql-11                            11.3-1.pgdg14.04+1                         amd64        object-relational SQL database,                  version 11 server
ii  postgresql-client-11                     11.3-1.pgdg14.04+1                         amd64        front-end programs for PostgreSQ                 L 11
ii  postgresql-client-common                 201.pgdg14.04+1                            all          manager for multiple PostgreSQL                  client versions
ii  postgresql-common                        201.pgdg14.04+1                            all          PostgreSQL database-cluster mana                 ger
ii  pgdg-keyring                             2018.1+b1                                  all          keyring for apt.postgresql.org
iF  postgresql-11                            11.3-1.pgdg14.04+1                         amd64        object-relational SQL database,                  version 11 server
ii  postgresql-client-11                     11.3-1.pgdg14.04+1                         amd64        front-end programs for PostgreSQ                 L 11
ii  postgresql-client-common                 201.pgdg14.04+1                            all          manager for multiple PostgreSQL                  client versions
ii  postgresql-common                        201.pgdg14.04+1                            all          PostgreSQL database-cluster mana                 ger

Почему postgresql не запускается?

...