“ sudo apt-get升级”不起作用

维巴德拉辛

我正在使用Dell Vostro 15 3000系列笔记本电脑上安装的Ubuntu 12.04。当我打

sudo apt-get update

它工作正常,然后我击中

sudo apt-get upgrade

它告诉我: 在此处输入图片说明

然后当我按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)

现在我该怎么做才能解决此问题并进行升级?

Maythux

您可以通过运行以下命令解决问题:

 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 

这应该工作

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

sudo apt-get升级不起作用

来自分类Dev

ubuntu 更新后 sudo apt 升级不起作用

来自分类Dev

使用sudo aptitude / apt-get update不起作用

来自分类Dev

Sudo apt-get update命令不起作用

来自分类Dev

sudo apt-get(某物)不起作用

来自分类Dev

Sudo apt-get在18.04中不起作用

来自分类Dev

sudo apt-get update 不起作用,ctrl+alt+t 不起作用

来自分类Dev

sudo apt-get install nautilus-open-terminal不起作用

来自分类Dev

sudo apt-get install nautilus-open-terminal不起作用

来自分类Dev

sudo apt-get update在Linux Mint 17.1上不起作用

来自分类Dev

sudo apt-get update不起作用无法连接到192.168.1.254:3128

来自分类Dev

Sudo apt-get更新不起作用-未安装任何软件包

来自分类Dev

sudo apt-get 更新在安装 PPA 后不起作用

来自分类Dev

sudo apt-get升级时出错

来自分类Dev

必须执行“ sudo su”,然后执行apt-get update / upgrade / install,以sudo开头不起作用

来自分类Dev

Sudo apt-get 更新

来自分类Dev

Sudo apt 升级导致 dpkg 错误

来自分类Dev

sudo apt-get升级时如何修复错误

来自分类Dev

执行“ sudo apt-get升级”时出现问题

来自分类Dev

sudo apt-get升级时如何修复错误

来自分类Dev

IPv6 sudo apt-get更新/升级问题

来自分类Dev

进行sudo apt-get升级时出现错误

来自分类Dev

陷入Parrot OS上的“ sudo apt-get升级”

来自分类Dev

sudo apt install -y 有什么作用?

来自分类Dev

sudo apt-get更新和ownCloud

来自分类Dev

'sudo apt-get update'收到警告

来自分类Dev

为什么apt-get需要sudo?

来自分类Dev

'sudo apt-get update'收到警告

来自分类Dev

错误:sudo apt-get更新