1
votes

Anything with apt-get install is giving following error

You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
openssh-server : Depends: openssh-client (= 1:6.0p1-4) but 1:6.0p1-4+deb7u2 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

If i try to install apt-get -f install it give following error

reparing to replace openssh-server 1:6.0p1-4 (using .../openssh-server_1%3a6.0p1-4+deb7u2_amd64.deb) ...
Unpacking replacement openssh-server ...
dpkg: error processing /var/cache/apt/archives/openssh-server_1%3a6.0p1-4+deb7u2_amd64.deb (--unpack):
 unable to make backup link of `./usr/sbin/sshd' before installing new version: Operation not permitted
Processing triggers for man-db ...
Errors were encountered while processing:
 /var/cache/apt/archives/openssh-server_1%3a6.0p1-4+deb7u2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo apt-get update also not working completely. Suggestion please
Thanks in advance

2
Have you tried apt-get -f install like it suggested? This usually happens when a dependency wasn't met for whatever reason and it needs to get the database in a consistent state. - Bandrami
@Bandrami i have update question with output of apt-get -f install ... Thanks for reply - user3410235

2 Answers

8
votes
sudo apt-get update
sudo apt-get -f install
sudo apt-get install openssh-server

If you are not logged in as root (as I'm assuming), you should put sudo before adding/removing packages to the system.

If that doesn't work, run these commands:

chattr -i /usr/bin/sshd
chattr -a /usr/bin/sshd 
sudo apt-get update
sudo apt-get -f install
sudo apt-get install openssh-server

If that doesn't work, you can also go to /var/lib/dpkg/info and /var/cache/apt/archives to delete anything with a name close to openssh-server. Then, run the commands:

sudo apt-get update
sudo apt-get -f install
sudo apt-get install openssh-server

pd: this is quite complex, so not having access to the system means a lot of "try and fail" :(

1
votes

Ok I tried all of this and more, and not one of the methods worked. So I tried to remove openssh-client, then install openssh-server and that worked for me.