當我使用 Ubuntu 21.04 推出全新的 LXC CT 時,我無法software-properties-common
安裝apt-add-repository
.
在一個全新的實例上,我以 root 身分登入並執行apt update
and apt upgrade
,然後apt install software-properties-common
得到以下輸出:
root@kubernetes:~# apt install software-properties-common
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
software-properties-common : Depends: packagekit but it is not installable
E: Unable to correct problems, you have held broken packages.
root@kubernetes:~# apt install packagekit
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libglib2.0-bin : Depends: libglib2.0-0 (= 2.68.1-1~ubuntu21.04.1) but 2.68.0-1 is to be installed
E: Unable to correct problems, you have held broken packages.
知道為什麼我無法在全新的實例上安裝它嗎?看起來有點亂。
答案1
對於其他遇到此問題的人來說,解決方案是編輯/etc/apt/sources.list
並將以下內容作為僅有的項目(註解掉其他所有內容):
deb http://archive.ubuntu.com/ubuntu/ hirsute-proposed main
然後再次運行apt update
以apt upgrade
修復 libglib2.0-0 軟體包,然後恢復sources.list
到之前(但保留建議的行),並且在嘗試再次安裝時它將起作用software-properties-common
。
為什麼你必須為庫存安裝執行此操作確實令人困惑並且用戶體驗很糟糕。