安装 samba 时如何满足未满足的依赖关系?

安装 samba 时如何满足未满足的依赖关系?
sudo apt-get install samba samba-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:
 samba : Depends: python3-samba (= 2:4.17.10+dfsg-0+deb12u1) but it is not going to be installed
         Depends: samba-common-bin (= 2:4.17.10+dfsg-0+deb12u1) but it is not installable
         Depends: libc6 (>= 2.34) but 2.31-13+deb11u6 is to be installed
         Depends: libldb2 (>= 2:2.6.1) but 2:2.2.3-2~deb11u2 is to be installed
         Depends: libtalloc2 (>= 2.3.4~) but 2.3.1-2+b1 is to be installed
         Depends: libtdb1 (>= 1.4.7~) but 1.4.3-1+b1 is to be installed
         Depends: libtevent0 (>= 0.13.0~) but 0.10.2-1 is to be installed
         Depends: samba-libs (= 2:4.17.10+dfsg-0+deb12u1) but 2:4.13.13+dfsg-1~deb11u5 is to be installed
         Recommends: attr but it is not going to be installed
         Recommends: python3-markdown but it is not going to be installed
         Recommends: samba-dsdb-modules but it is not going to be installed
         Recommends: samba-vfs-modules but it is not going to be installed
         Recommends: samba-ad-provision but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

如何解决未满足的依赖关系?

政策状况:

sudo apt policy
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://mirrors.ustc.edu.cn/debian-security stable-security/main amd64 Packages
     release v=12,o=Debian,a=stable-security,n=bookworm-security,l=Debian-Security,c=main,b=amd64
     origin mirrors.ustc.edu.cn
 100 http://mirrors.163.com/debian bullseye-backports/contrib amd64 Packages
     release o=Debian Backports,a=bullseye-backports,n=bullseye-backports,l=Debian Backports,c=contrib,b=amd64
     origin mirrors.163.com
 100 http://mirrors.163.com/debian bullseye-backports/non-free amd64 Packages
     release o=Debian Backports,a=bullseye-backports,n=bullseye-backports,l=Debian Backports,c=non-free,b=amd64
     origin mirrors.163.com
 100 http://mirrors.163.com/debian bullseye-backports/main amd64 Packages
     release o=Debian Backports,a=bullseye-backports,n=bullseye-backports,l=Debian Backports,c=main,b=amd64
     origin mirrors.163.com
 500 http://mirrors.163.com/debian bullseye-updates/main amd64 Packages
     release v=11-updates,o=Debian,a=oldstable-updates,n=bullseye-updates,l=Debian,c=main,b=amd64
     origin mirrors.163.com
 500 http://mirrors.163.com/debian bullseye/contrib amd64 Packages
     release v=11.7,o=Debian,a=oldstable,n=bullseye,l=Debian,c=contrib,b=amd64
     origin mirrors.163.com
 500 http://mirrors.163.com/debian bullseye/non-free amd64 Packages
     release v=11.7,o=Debian,a=oldstable,n=bullseye,l=Debian,c=non-free,b=amd64
     origin mirrors.163.com
 500 http://mirrors.163.com/debian bullseye/main amd64 Packages
     release v=11.7,o=Debian,a=oldstable,n=bullseye,l=Debian,c=main,b=amd64
     origin mirrors.163.com
Pinned packages:

我的操作系统:

uname -a
Linux debian 5.10.0-22-amd64 #1 SMP Debian 5.10.178-3 (2023-04-22) x86_64 GNU/Linux

答案1

您似乎正在运行 Debian 11,但您stable-security现在有一个对 Debian 12 的引用。要解决此问题,请替换stable-securitybullseye-securityin/etc/apt/sources.list和 files in /etc/apt/sources.list.d

sudo sed -i.bak s/stable-security/bullseye-security/ /etc/apt/sources.list
sudo sed -i.bak s/stable-security/bullseye-security/ /etc/apt/sources.list.d/*

然后更新为

sudo apt update

然后您应该能够安装samba.如果某些软件包之前已更新至 Debian 12 版本,您可能需要将其降级至 Debian 11 版本。

相关内容