為什麼更新 postgresql-client 會卸載 postgresql?

為什麼更新 postgresql-client 會卸載 postgresql?

在 Debian 7 伺服器上,apt-get 讓我升級以下 2 個軟體包: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。

相關內容