I encountered this problem when installing Ubuntu openssh-server:
root@ubuntu:~# apt-get install openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be install. 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:
openssh-server : Depends: libwrap0(>= 7.6-4~) but it is not installable
Recommends: ssh-import-id but it is not installable
E: Unable to correct problems, you have held broken packages.
Execute apt-update
root@ubuntu:~# apt-get update
......
W: Failed to fetch bzip2: /var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_precise_binary-i386_Packages Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.
Install libwrap0
root@ubuntu:~# apt-get install libwrap0
...
Package libwrap0 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
E: Package libwrap0 has no installation candidate
Here is the problem with the installation source, replace the installation source
if os is ubuntu:
root@ubuntu:~# cp /etc/apt/sources.list ~/sources.list.old
root@ubuntu:~# sed -i 's/us.archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
root@ubuntu:~# diff ~/sources.list.old /etc/apt/sources.list | wc -l
root@ubuntu:~# diff ~/sources.list.old /etc/apt/sources.list | tail
If is debian you put this to end file
/etc/apt/sources.list
deb http://ftp.us.debian.org/debian/ buster main contrib non-free
Execute apt-update
root@ubuntu:~# apt-get update
Get:79 http://mirrors.aliyun.com precise-backports/restricted Translation-en [14 B]
Get:80 http://mirrors.aliyun.com precise-backports/universe Translation-en [34.2 kB]
Fetched 28.0 MB in 23s (1,207 kB/s)
Reading package lists... Done
Install openssh-server
root@ubuntu:~# apt-get install openssh-server
Check status
root@ubuntu:~# service ssh status
ssh start/running, process 1975