当我使用 Ubuntu 21.04 推出全新的 LXC CT 时,我无法安装software-properties-common
所需的内容apt-add-repository
。
在一个全新的实例上,我以 root 身份登录并运行apt update
,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
。
为什么必须对库存安装执行此操作确实令人困惑,并且用户体验很糟糕。