为什么更新 postgresql-client 会卸载 postgresql?

为什么更新 postgresql-client 会卸载 postgresql?

在 Debian 7 服务器上,apt-get 建议我升级以下两个软件包:postgresql-9.1 和 postgresql-client-9.1。由于我不想重新启动数据库服务器,因此我决定仅升级客户端并运行:

sudo apt-get install --only-upgrade postgresql-client-9.1

但这导致 postgresql-9.1 被删除。我知道 postgresql-9.1 依赖于 postgresql-client-9.1,但是为什么升级 postgresql-client 会删除 postgresql?


输出apt-get upgrade看起来不错:

~$ 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/4,307 kB of archives.
After this operation, 432 kB of additional disk space will be used.
Do you want to continue [Y/n]?

但在尝试仅升级客户端时则不然:

~$ sudo apt-get install --only-upgrade postgresql-client-9.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  postgresql-doc-9.1
The following packages will be REMOVED:
  postgresql postgresql-9.1
The following packages will be upgraded:
  postgresql-client-9.1
1 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
Need to get 0 B/996 kB of archives.
After this operation, 16.7 MB disk space will be freed.
Do you want to continue [Y/n]?

答案1

如果没有 postgresql 包,也不可能升级 postgresql-client。但是,可以让 postgresql 服务在下次操作系统重启之前不重新启动。使用策略-rc.d

cat > ./usr/sbin/policy-rc.d <<EOF
#!/bin/sh
exit 101
EOF

chmod a+x ./usr/sbin/policy-rc.d

如果您想在不重启操作系统的情况下重新启动 PostgreSQL 服务,请记住删除 policy-rc.d。

相关内容