如何手動從 Ubuntu 中強制移除軟體包?

如何手動從 Ubuntu 中強制移除軟體包?

我在 ServerFault 上發布了這篇文章,並得到了一些看起來有幫助的問題,但沒有回答我能做什麼。在低水平上,我可以做什麼來完全消除乾擾能力升級的軟體包?

--

libssl-dev安裝了一個軟體包,可能是因為我不確定是否繞過了軟體包管理器,並且它從軟體包管理器中可見,但不會消失。

root@li393-189:/home/jonathan/python-amazon-product-api-0.2.5# aptitude purge l
ibssl-dev
The following packages will be REMOVED:  
  libssl-dev{p} 
The following partially installed packages will be configured:
  apt 
0 packages upgraded, 0 newly installed, 1 to remove and 84 not upgraded.
Need to get 0 B of archives. After unpacking 4,929 kB will be freed.
Do you want to continue? [Y/n/?] Y
Setting up apt (0.8.16~exp12ubuntu10.10) ...
gpg: Invalid option "--primary-keyring"
gpg: [don't know]: invalid packet (ctb=03)
gpg: read_keyblock: read error: invalid packet
gpg: enum_keyblocks(read) failed: invalid keyring
gpg: WARNING: nothing exported
dpkg: error processing apt (--configure):
 subprocess installed post-installation script returned error exit status 2
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 apt
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up apt (0.8.16~exp12ubuntu10.10) ...
gpg: Invalid option "--primary-keyring"
gpg: [don't know]: invalid packet (ctb=03)
gpg: read_keyblock: read error: invalid packet
gpg: enum_keyblocks(read) failed: invalid keyring
gpg: WARNING: nothing exported
dpkg: error processing apt (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 apt

我希望將目前安裝的 libssl-dev 替換為新的軟體包安裝。我見過的 aptitude 配置還沒有將其刪除。

如何刪除現有的軟體包以便能夠從頭開始重新安裝?

- 編輯 -

@Brigo,我嘗試過使用 aptitude 而不僅僅是 apt-get,但是 apt-get 在我看來給出了一個明顯的等價物:

root@li393-189:/home/jonathan/python-amazon-product-api-0.2.5# apt-get remove l我希望將目前安裝的 libssl-dev 替換為新的軟體包安裝。我見過的 aptitude 配置還沒有將其刪除。

如何刪除現有的軟體包以便能夠從頭開始重新安裝?

- 編輯 -

@Brigo,我嘗試過使用 aptitude 而不僅僅是 apt-get,但是 apt-get 在我看來給出了一個明顯的等價物:

root@li393-189:/home/jonathan/python-amazon-product-api-0.2.5# apt-get 刪除 l
ibssl 開發
正在閱讀包裹清單...完成
建構依賴樹       
讀取狀態資訊...完成
以下軟體包將會被刪除:
  libssl 開發
0 已升級,0 已新安裝,1 已刪除,84 未升級。
1 未完全安裝或拆卸。
執行此操作後,將釋放 4,929 kB 磁碟空間。
您想繼續[Y/n]嗎?是
設定 apt (0.8.16~exp12ubuntu10.10) ...
gpg:gpg:無效選項“--primary-keyring”
[不知道]:無效資料包(ctb=03)
gpg:read_keyblock:讀取錯誤:無效資料包
gpg:enum_keyblocks(讀取)失敗:無效的金鑰環
gpg:警告:沒有匯出任何內容
dpkg:處理 apt 時發生錯誤(--configure):
 子進程安裝的安裝後腳本回傳錯誤退出狀態 2
處理時遇到錯誤:
 易於
E: 子進程 /usr/bin/dpkg 回傳錯誤代碼 (1)
root@li393-189:/home/jonathan/python-amazon-product-api-0.2.5#

- 編輯 -

這是建議的輸出sh -x /usr/bin/apt-key update

root@li393-189:~# sh -x /usr/bin/apt-key update + 設定-e + 取消設定 GREP_OPTIONS + 暫存檔 + 秘密密鑰環=/tmp/tmp.yKRn2OqlH3 + trap rm -f '/tmp/tmp.yKRn2OqlH3' 0 HUP INT 退出 ILL ABRT FPE SEGV 管道術語 + GPG_CMD=gpg --忽略時間衝突 --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 + id -u + [ 0 -eq 0 ] + GPG_CMD=gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 --trustdb-name /etc/apt/trustdb.gpg + GPG=gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 --trustdb-name /etc/apt/trustdb.gpg + MASTER_KEYRING=/usr/share/keyrings/ubuntu-master-keyring.gpg + ARCHIVE_KEYRING=/usr/share/keyrings/ubuntu-archive-keyring.gpg + REMOVED_KEYS=/usr/share/keyrings/ubuntu-archive-removed-keys.gpg + ARCHIVE_KEYRING_URI=http://archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg + TMP_KEYRING=/var/lib/apt/keyrings/maybe-import-keyring.gpg + [ 更新 = --keyring ] + TRUSTEDFILE=/etc/apt/trusted.gpg + apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring + 評估 + apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f + eval TRUSTEDFILE='/etc/apt/trusted.gpg' + TRUSTEDFILE=/etc/apt/trusted.gpg + [ -r /etc/apt/trusted.gpg ] + GPG=gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg + GPG=gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg + TRUSTEDPARTS=/etc/apt/trusted.gpg.d + apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d + eval TRUSTEDPARTS='/etc/apt/trusted.gpg.d/' + TRUSTEDPARTS=/etc/apt/trusted.gpg.d/ + [ -d /etc/apt/trusted.gpg.d/ ] + run-parts --list /etc/apt/trusted.gpg.d/ --regex ^.*\.gpg$ + 命令=更新 + [ -z 更新 ] + 移位 + [更新! + 哪個GPG + 更新 + [ ! -f /usr/share/keyrings/ubuntu-archive-keyring.gpg ] + 需要根目錄 + id -u + [ 0 -ne 0 ] + gpg --ignore-time-conflict --no-options+ --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3gpg --trustdb-name /etc/apt/trustdb.gpg --ignore-time -conflict --no-options --no-default-keyring --quiet --batch --secret-keyring /tmp/tmp.yKRn2OqlH3 --keyring --trustdb-name /etc/apt/trustdb.gpg /usr/共享/keyrings/ubuntu-archive-keyring.gpg --keyring /etc/apt/trusted.gpg --export --primary-keyring /etc/apt/trusted.gpg - 進口 gpg:無效選項“--primary-keyring” gpg: [不知道]: 無效資料包 (ctb=03) gpg:read_keyblock:讀取錯誤:無效資料包 gpg:enum_keyblocks(讀取)失敗:無效的金鑰環 gpg:警告:沒有匯出任何內容 + rm -f /tmp/tmp.yKRn2OqlH3

答案1

成立這個方法關於超級用戶:

 sudo dpkg --remove --force-remove-reinstreq libssl-dev

相關內容