“sudo apt-get upgrade” não funciona

3

Estou usando o Ubuntu 12.04 instalado em um laptop Dell Vostro 15 3000 series. quando eu bati

sudo apt-get update

funciona bem e depois eu acerto

sudo apt-get upgrade

me mostra:

e, quando eu pressionar Y , isso me dá erros conforme abaixo:

(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)

Agora, o que posso fazer para resolver este problema e atualizar?

    
por Virbhadrasinh 11.06.2015 / 13:55

1 resposta

5

Você pode resolver seu problema executando:

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

Adicionar

exit 0

diretamente após

#!/bin/sh

set -e

para que o novo arquivo seja assim:

#!/bin/sh

set -e

exit 0

VERSION=9.1



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

stop_version $VERSION

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

Agora corra

sudo apt-get upgrade 

Isso deve funcionar

    
por Maythux 11.06.2015 / 14:08