«Sudo apt-get upgrade» не работает

Я использую Ubuntu 12.04, установленную на ноутбуке Dell Vostro 15 3000 серии. когда я нажимаю

sudo apt-get update

, он работает нормально, а затем я нажимаю

sudo apt-get upgrade

, он показывает мне: enter image description here

и затем, когда я нажимаю Y, он выдает мне ошибки, как показано ниже:

(Reading database ... 204809 files and directories currently installed.)
Preparing to replace postgresql-9.1 9.1.16-0ubuntu0.12.04 (using .../postgresql-9.1_9.1.17-0ubuntu0.12.04_amd64.deb) ...
 * Stopping PostgreSQL 9.1 database server                                                                                                              * Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 246.
Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 255.
(does not shutdown gracefully, now stopping immediately)
                                                                                                                                                [fail]
invoke-rc.d: initscript postgresql, action "stop" failed.
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
 * Stopping PostgreSQL 9.1 database server                                                                                                              * Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 246.
Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 255.
(does not shutdown gracefully, now stopping immediately)
                                                                                                                                                [fail]
invoke-rc.d: initscript postgresql, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/postgresql-9.1_9.1.17-0ubuntu0.12.04_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
dpkg: considering deconfiguration of postgresql-9.1, which would be broken by installation of postgresql-client-9.1 ...
dpkg: yes, will deconfigure postgresql-9.1 (broken by postgresql-client-9.1).
Preparing to replace postgresql-client-9.1 9.1.16-0ubuntu0.12.04 (using .../postgresql-client-9.1_9.1.17-0ubuntu0.12.04_amd64.deb) ...
De-configuring postgresql-9.1 ...
 * Stopping PostgreSQL 9.1 database server                                                                                                              * Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 246.
Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 255.
(does not shutdown gracefully, now stopping immediately)
                                                                                                                                                [fail]
invoke-rc.d: initscript postgresql, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/postgresql-client-9.1_9.1.17-0ubuntu0.12.04_amd64.deb (--unpack):
 subprocess installed pre-removal script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/postgresql-9.1_9.1.17-0ubuntu0.12.04_amd64.deb
 /var/cache/apt/archives/postgresql-client-9.1_9.1.17-0ubuntu0.12.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
vgo@vgo-dell:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  postgresql-9.1 postgresql-client-9.1
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/5,282 kB of archives.
After this operation, 4,096 B of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 204809 files and directories currently installed.)
Preparing to replace postgresql-9.1 9.1.16-0ubuntu0.12.04 (using .../postgresql-9.1_9.1.17-0ubuntu0.12.04_amd64.deb) ...
 * Stopping PostgreSQL 9.1 database server                                                                                                              * Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 246.
Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 255.
(does not shutdown gracefully, now stopping immediately)
                                                                                                                                                [fail]
invoke-rc.d: initscript postgresql, action "stop" failed.
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
 * Stopping PostgreSQL 9.1 database server                                                                                                              * Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 246.
Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 255.
(does not shutdown gracefully, now stopping immediately)
                                                                                                                                                [fail]
invoke-rc.d: initscript postgresql, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/postgresql-9.1_9.1.17-0ubuntu0.12.04_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
dpkg: considering deconfiguration of postgresql-9.1, which would be broken by installation of postgresql-client-9.1 ...
dpkg: yes, will deconfigure postgresql-9.1 (broken by postgresql-client-9.1).
Preparing to replace postgresql-client-9.1 9.1.16-0ubuntu0.12.04 (using .../postgresql-client-9.1_9.1.17-0ubuntu0.12.04_amd64.deb) ...
De-configuring postgresql-9.1 ...
 * Stopping PostgreSQL 9.1 database server                                                                                                              * Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 246.
Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 255.
(does not shutdown gracefully, now stopping immediately)
                                                                                                                                                [fail]
invoke-rc.d: initscript postgresql, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/postgresql-client-9.1_9.1.17-0ubuntu0.12.04_amd64.deb (--unpack):
 subprocess installed pre-removal script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/postgresql-9.1_9.1.17-0ubuntu0.12.04_amd64.deb
 /var/cache/apt/archives/postgresql-client-9.1_9.1.17-0ubuntu0.12.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Теперь, что я могу сделать, чтобы решить эту проблему и обновить?

3
задан 21 July 2016 в 00:20

1 ответ

Можно решить проблему путем выполнения:

 sudo nano /var/lib/dpkg/info/postgresql*.prerm

Добавляют

exit 0

непосредственно после

#!/bin/sh

set -e

так, новый файл был бы похож:

#!/bin/sh

set -e

exit 0

VERSION=9.1



. /usr/share/postgresql-common/maintscripts-functions

stop_version $VERSION

if [ "$1" = remove ]; then
    remove_version $VERSION
fi

Теперь работает

sudo apt-get upgrade 

, Это должно работы

0
ответ дан 21 July 2016 в 00:20

Другие вопросы по тегам:

Похожие вопросы: