Cannot Install Openssh on Ubuntu Server Virtual Machine (Kvm)

Cannot Install Openssh on Ubuntu Server Virtual Machine (Kvm)

I am having trouble installing OpenSSH server on Ubuntu Server 16.04.01 which is a virtual machine using KVM.

When I try to install openssh-server I get the following response:

Setting up openssh-server (1:7.2p2-4ubuntu2.1) ...
Creating SSH2 RSA key; this may take some time ...
2048 SHA256:i6IKfykW1E9hYmlHFLid3KksBI11oxCmKlbQjFOVNZY root@host (RSA)
Creating SSH2 DSA key; this may take some time ...
1024 SHA256:tGZN8I6qfTdAanbPy4fxj/ARLTPrrtQKWZXTQZWG/o4 root@host (DSA)
Creating SSH2 ECDSA key; this may take some time ...key_generate failed

dpkg: error processing package openssh-server (--configure):
 subprocess installed post-installation script returned error exit status 255
Processing triggers for systemd (229-4ubuntu7) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Errors were encountered while processing:
 openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Does anyone have any suggestions on how to overcome this problem?

2 Answers

The dpkg scripts failed to generate the ECDSA keys for some reasons. The other host keys are generated successfully and your ssh server was installed successfully so you should not have any problem using it.

If you have problems, try to start the ssh service and check its logs:

# systemctl start ssh
# journalctl -b -e
1

I was upgrading to openssh-server (1:6.6p1-2ubuntu2.8).

I got the following error.

Creating SSH2 ECDSA key; this may take some time ...unknown key type ecdsa
dpkg: error processing package openssh-server (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have to edit /var/lib/dpkg/info/openssh-server.postinst and comment the following lines.

#create_key "Creating SSH2 ECDSA key; this may take some time ..." \
#       "$hostkeys" /etc/ssh/ssh_host_ecdsa_key -t ecdsa
#create_key "Creating SSH2 ED25519 key; this may take some time ..." \
#       "$hostkeys" /etc/ssh/ssh_host_ed25519_key -t ed25519

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett
Author

Chloe Bennett

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.