我正在关注一个教程关于如何在 Ubuntu 22.04 上安装 Libvirt。然而我现在陷入了这一步:
$ sudo apt install -y qemu-kvm virt-manager libvirt-daemon-system virtinst libvirt-clients bridge-utils
[sudo] password for zulh:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'qemu-system-x86' instead of 'qemu-kvm'
bridge-utils is already the newest version (1.7-1ubuntu3).
libvirt-clients is already the newest version (8.0.0-1ubuntu7).
virt-manager is already the newest version (1:4.0.0-1).
virtinst is already the newest version (1:4.0.0-1).
qemu-system-x86 is already the newest version (1:6.2+dfsg-2ubuntu6.2).
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:
libvirt-daemon-system-systemd : Depends: systemd-container
E: Unable to correct problems, you have held broken packages.
当我尝试安装时systemd-container
,出现此错误:
$ sudo apt install -y systemd-container
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:
apt : Depends: libapt-pkg6.0 (>= 2.4.8) but it is not going to be installed
Depends: libsystemd0 but it is not installable
bsdutils : PreDepends: libsystemd0 but it is not installable
init : PreDepends: systemd-sysv
libacl1:i386 : Depends: libc6:i386 (>= 2.33) but it is not installable
libapparmor1:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libargon2-1:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libaudit1:i386 : Depends: libc6:i386 (>= 2.33) but it is not installable
libblkid1:i386 : Depends: libc6:i386 (>= 2.33) but it is not installable
libcap-ng0:i386 : Depends: libc6:i386 (>= 2.33) but it is not installable
libcap2:i386 : Depends: libc6:i386 (>= 2.33) but it is not installable
libcrypt1:i386 : Depends: libc6:i386 (>= 2.25) but it is not installable
libcryptsetup12:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libdevmapper1.02.1:i386 : Depends: libc6:i386 (>= 2.33) but it is not installable
Recommends: dmsetup:i386 (>= 2:1.02.175-2.1ubuntu4~)
libffi8:i386 : Depends: libc6:i386 (>= 2.27) but it is not installable
libgcrypt20:i386 : Depends: libc6:i386 (>= 2.33) but it is not installable
libgmp10:i386 : Depends: libc6:i386 (>= 2.7) but it is not installable
libgnutls30:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libgpg-error0:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libhogweed6:i386 : Depends: libc6:i386 (>= 2.4) but it is not installable
libidn2-0:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libip4tc2:i386 : Depends: libc6:i386 (>= 2.28) but it is not installable
libjson-c5:i386 : Depends: libc6:i386 (>= 2.33) but it is not installable
libkmod2:i386 : Depends: libc6:i386 (>= 2.33) but it is not installable
liblz4-1:i386 : Depends: libc6:i386 (>= 2.4) but it is not installable
liblzma5:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libmount1:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libnettle8:i386 : Depends: libc6:i386 (>= 2.4) but it is not installable
libp11-kit0:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libpam0g:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libpcre2-8-0:i386 : Depends: libc6:i386 (>= 2.4) but it is not installable
libseccomp2:i386 : Depends: libc6:i386 (>= 2.4) but it is not installable
libselinux1:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libssl3:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libsystemd0:i386 : PreDepends: libc6:i386 (>= 2.34) but it is not installable
libtasn1-6:i386 : Depends: libc6:i386 (>= 2.4) but it is not installable
libudev1:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libunistring2:i386 : Depends: libc6:i386 (>= 2.34) but it is not installable
libuuid1:i386 : Depends: libc6:i386 (>= 2.28) but it is not installable
Recommends: uuid-runtime:i386
libzstd1:i386 : Depends: libc6:i386 (>= 2.4) but it is not installable
shim-signed : Depends: grub-efi-amd64-signed but it is not going to be installed or
grub-efi-arm64-signed but it is not installable
Depends: grub2-common (>= 2.04-1ubuntu24)
systemd:i386 : PreDepends: libc6:i386 (>= 2.34) but it is not installable
Recommends: default-dbus-system-bus:i386 or
dbus-system-bus:i386
Recommends: networkd-dispatcher:i386 but it is not installable
Recommends: systemd-timesyncd:i386 or
time-daemon:i386
systemd-container : Depends: default-dbus-system-bus or
dbus-system-bus
util-linux : PreDepends: libsystemd0 but it is not installable
PreDepends: libudev1 (>= 183) but it is not installable
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
我可以做什么来解决这个问题?
FWIW,下面是我的主机详细信息。我用的是64位。
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy
$ uname -r
5.15.0-53-generic
答案1
读完这两个问题后我明白了:
当我运行时apt-cache policy systemd systemd-container
,服务器不是美国服务器。
当我更改为美国服务器后,输出更改为:
$ apt-cache policy systemd systemd-container
systemd:
Installed: 249.11-0ubuntu3.6
Candidate: 249.11-0ubuntu3.6
Version table:
*** 249.11-0ubuntu3.6 100
100 /var/lib/dpkg/status
249.11-0ubuntu3 500
500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
systemd-container:
Installed: (none)
Candidate: 249.11-0ubuntu3
Version table:
249.11-0ubuntu3 500
500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
命令sudo apt install -y qemu-kvm virt-manager libvirt-daemon-system virtinst libvirt-clients bridge-utils
终于起作用了。