为什么 libvirt-daemon-system 对 Debian 有如此多的依赖?

为什么 libvirt-daemon-system 对 Debian 有如此多的依赖?

在我的无头 debian 11(牛眼)服务器上,当我尝试安装时libvirt-daemon-systemapt几乎会安装整个图形环境,包括音频库和所有内容:

mic@micserver:~$ sudo apt install libvirt-daemon-system
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  adwaita-icon-theme alsa-topology-conf alsa-ucm-conf at-spi2-core augeas-lenses dbus-user-session dconf-gsettings-backend dconf-service fontconfig glib-networking glib-networking-common
  glib-networking-services gsettings-desktop-schemas gstreamer1.0-libav gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-x gtk-update-icon-cache hicolor-icon-theme i965-va-driver
  ibverbs-providers intel-media-va-driver ipxe-qemu jq libaa1 libaacs0 libasound2 libasound2-data libass9 libasyncns0 libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0 libaugeas0 libavc1394-0
  libavcodec58 libavfilter7 libavformat58 libavutil56 libbdplus0 libbluray2 libbrlapi0.8 libbs2b0 libcaca0 libcacard0 libcairo-gobject2 libcairo2 libcapstone4 libcdparanoia0 libchromaprint1 libcodec2-0.9
  libcolord2 libdatrie1 libdaxctl1 libdconf1 libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libdv4 libdw1 libepoxy0 libexecs0 libfdt1 libflac8 libflite1 libfribidi0 libgbm1
  libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgfortran5 libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libgme0 libgraphite2-3 libgsm1 libgstreamer-plugins-base1.0-0
  libgstreamer1.0-0 libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0 libharfbuzz0b libibverbs1 libiec61883-0 libigdgmm11 libjack-jackd2-0 libjq1 libjson-glib-1.0-0 libjson-glib-1.0-common liblapack3
  liblilv-0-0 libmfx1 libmp3lame0 libmpg123-0 libmysofa1 libndctl6 libnetcf1 libnl-route-3-200 libnorm1 libogg0 libopenmpt0 libopus0 liborc-0.4-0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libparted2
  libpciaccess0 libpgm-5.3-0 libpixman-1-0 libpmem1 libpocketsphinx3 libpolkit-agent-1-0 libpolkit-gobject-1-0 libpostproc55 libproxy1v5 libpulse0 libquadmath0 librabbitmq4 libraw1394-11 librdmacm1
  librest-0.7-0 librsvg2-2 librsvg2-common librubberband2 libsamplerate0 libserd-0-0 libshine3 libshout3 libslirp0 libsndfile1 libsord-0-0 libsoup-gnome2.4-1 libsoup2.4-1 libsoxr0 libspeex1 libsphinxbase3
  libspice-server1 libsratom-0-0 libsrt1.4-gnutls libssh-gcrypt-4 libswresample3 libswscale5 libtag1v5 libtag1v5-vanilla libthai-data libthai0 libtheora0 libtwolame0 libudfread0 libunwind8 liburing1
  libusbredirparser1 libv4l-0 libv4lconvert0 libva-drm2 libva-x11-2 libva2 libvdeplug2 libvdpau-va-gl1 libvdpau1 libvidstab1.1 libvirglrenderer1 libvirt-clients libvirt-daemon libvirt-daemon-config-network
  libvirt-daemon-config-nwfilter libvirt-daemon-driver-lxc libvirt-daemon-driver-vbox libvirt-daemon-driver-xen libvisual-0.4-0 libvorbis0a libvorbisenc2 libvorbisfile3 libvpx6 libvte-2.91-0 libvte-2.91-common
  libvulkan1 libwavpack1 libwayland-client0 libwayland-cursor0 libwayland-egl1 libwayland-server0 libx11-xcb1 libx264-160 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-render0
  libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcomposite1 libxcursor1 libxdamage1 libxencall1 libxendevicemodel1 libxenevtchn1 libxenforeignmemory1 libxengnttab1 libxenhypfs1 libxenmisc4.14 libxenstore3.0
  libxentoolcore1 libxentoollog1 libxfixes3 libxinerama1 libxkbcommon0 libxml2-utils libxrandr2 libxshmfence1 libxv1 libxvidcore4 libxxf86vm1 libzmq5 libzvbi-common libzvbi0 mdevctl mesa-va-drivers
  mesa-vdpau-drivers mesa-vulkan-drivers ocl-icd-libopencl1 ovmf parted pocketsphinx-en-us policykit-1 qemu-system-common qemu-system-data qemu-system-gui qemu-system-x86 qemu-utils seabios va-driver-all
  vdpau-driver-all

但我不明白这是从哪里来的。看看apt-cache dependencies,这个包看起来更加理智:

mic@micserver:~$ apt-cache depends libvirt-daemon-system
libvirt-daemon-system
  Depends: adduser
  Depends: gettext-base
 |Depends: iptables
  Depends: firewalld
  Depends: libvirt-clients
  Depends: libvirt-daemon
  Depends: libvirt-daemon-config-network
  Depends: libvirt-daemon-config-nwfilter
 |Depends: libvirt-daemon-system-systemd
  Depends: libvirt-daemon-system-sysv
  Depends: logrotate
  Depends: policykit-1
 |Depends: debconf
  Depends: <debconf-2.0>
    cdebconf
    debconf
  Breaks: systemd-sysv
  Recommends: dmidecode
  Recommends: dnsmasq-base
  Recommends: iproute2
  Recommends: mdevctl
  Recommends: parted
  Suggests: apparmor
  Suggests: auditd
  Suggests: nfs-common
  Suggests: open-iscsi
  Suggests: pm-utils
  Suggests: radvd
  Suggests: systemd
  Suggests: systemtap
  Suggests: <zfsutils>

这些依赖可以避免吗?

答案1

是的,您可以apt忽略推荐的软件包:

sudo apt install --no-install-recommends libvirt-daemon-system

这只会引入严格的依赖关系。

您可能想要挑选推荐的套餐,而不是完全忽略它们;推荐包定义为

除了不寻常的安装之外,在所有安装中都会与此软件包一起找到的软件包。

要探索给定包的依赖关系链,您可以使用apt-rdepends

apt-rdepends -sDepends,PreDepends,Recommends libvirt-daemon-system | less

这将允许您检查链中所有推荐的软件包并决定是否安装它们。例如,您可能不需要 QEMU ( qemu-system),或支持 LXC ( libvirt-daemon-driver-lxc)。在这种情况下,您可以请求完整安装,减去一些软件包:

sudo apt install libvirt-daemon-system qemu-system- libvirt-daemon-driver-lxc-

请注意-不应安装的软件包名称后面的内容:这指示apt删除指定的软件包(因此它不仅不会安装它们,如果已经安装了它们,还会删除它们)。

要了解最终拉入看似不相关的包的关系,请询问aptitude:例如:

$ aptitude why libvirt-daemon-system gsettings-desktop-schemas
i   libvirt-daemon-system     Depends    libvirt-daemon (= 7.0.0-3)       
i   libvirt-daemon            Recommends qemu-kvm | qemu-system (>= 0.9.1)
i   qemu-system               Depends    qemu-system-x86                  
i A qemu-system-x86           Depends    libspice-server1 (>= 0.14.2)     
i A libspice-server1          Recommends gstreamer1.0-plugins-good        
i A gstreamer1.0-plugins-good Depends    libsoup2.4-1 (>= 2.48)           
i A libsoup2.4-1              Depends    glib-networking (>= 2.32.0)      
i A glib-networking           Depends    gsettings-desktop-schemas        

相关内容