How can fulfill unmet dependencies when to install 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.

How can resolve the unmet dependencies?

The policy status:

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:

My os:

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

||

You appear to be running Debian 11, but you have a reference to stable-security which is now Debian 12. To fix that, replace stable-security with bullseye-security in /etc/apt/sources.list and 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/*

Then update with

sudo apt update

You should then be able to install samba. You might need to downgrade some packages to their Debian 11 versions, if they’ve previously been updated to Debian 12 versions.

Answered By: Stephen Kitt
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.