[SOLVED] console: Failed to connect to server: Host Key verification failed

hellfire

Renowned Member
Aug 17, 2016
81
51
83
47
When I request the console I get the following error in the console window:

Code:
failed to connect to server

In the log line I get:

Code:
Host Key verification failed
TASK ERROR: Failed to run vncproxy.


I have this error now and then(after reinstalling,...) and will describe the solution:

The problem is, that the host where I started the WebGUI(server-a) has an incorrect ssh-host-key for the host the vm is on(server-b) and can not open a console(or migrate). To fix this the following is necessary:

  • Open a root console at server-a
  • run the command:
    Code:
    /usr/bin/ssh -e none -o 'HostKeyAlias=server-b-name' root@server-b-ip-address /bin/true
    server-b-name is the name of the node server-b in the cluster
    server-b-ip-address is the primary cluster-ip-address of server-b

    Example:

    My server is named px03 and its primary ip address is 192.168.207.12

    Code:
    /usr/bin/ssh -e none -o 'HostKeyAlias=px03' root@192.168.207.12 /bin/true

  • If there are any errors fix them according to the ssh output. Host Key Verification failed means there's a wrong key in /root/.ssh/known_hosts. The wrong key should be removed and the new key should be accepted when prompted for at the ssh command.

  • If the command succeeds with no output all should be perfect agin
 
I encountered this issue, and your solution worked for me. Thank you!

I was curious how /etc/ssh/ssh_known_hosts had the alias for the other node without the IP - the 'HostKeyAlias' ssh option clarified this.
 
  • Like
Reactions: Jannoke
Maravilha, estava com o Seguinte Erro ao Conectar não VNCPROXY:


A verificação da chave do host falhou.
ERRO DE TAREFA: falha ao executar vncproxy.

Mesmo refazendo as chaves dos hosts (nem sei se isso pode afetar o Cluster) nada funcionava, com essa dica, tudo ficou 100% !!!!!

Parabens!!!!!!!!!!!!!!!!!!!!!!
 
Maravilha, estava com o Seguinte Erro ao Conectar não VNCPROXY:


A verificação da chave do host falhou.
ERRO DE TAREFA: falha ao executar vncproxy.

Mesmo refazendo as chaves dos hosts (nem sei se isso pode afetar o Cluster) nada funcionava, com essa dica, tudo ficou 100% !!!!!

Parabens!!!!!!!!!!!!!!!!!!!!!!
Great that you could solve your issue, but please remember that this is an international English-speaking forum to provide answers for a broad audience. We do not have a Portuguese sub-forum, I'm afraid, so I'd be great if you could post in English - thanks!
 
When I request the console I get the following error in the console window:

Code:
failed to connect to server

In the log line I get:

Code:
Host Key verification failed
TASK ERROR: Failed to run vncproxy.


I have this error now and then(after reinstalling,...) and will describe the solution:

The problem is, that the host where I started the WebGUI(server-a) has an incorrect ssh-host-key for the host the vm is on(server-b) and can not open a console(or migrate). To fix this the following is necessary:

  • Open a root console at server-a
  • run the command:
    Code:
    /usr/bin/ssh -e none -o 'HostKeyAlias=server-b-name' root@server-b-ip-address /bin/true
    server-b-name is the name of the node server-b in the cluster
    server-b-ip-address is the primary cluster-ip-address of server-b

    Example:

    My server is named px03 and its primary ip address is 192.168.207.12

    Code:
    /usr/bin/ssh -e none -o 'HostKeyAlias=px03' root@192.168.207.12 /bin/true

  • If there are any errors fix them according to the ssh output. Host Key Verification failed means there's a wrong key in /root/.ssh/known_hosts. The wrong key should be removed and the new key should be accepted when prompted for at the ssh command.

  • If the command succeeds with no output all should be perfect agin
made my day. big thx.
 
When I request the console I get the following error in the console window:

Code:
failed to connect to server

In the log line I get:

Code:
Host Key verification failed
TASK ERROR: Failed to run vncproxy.


I have this error now and then(after reinstalling,...) and will describe the solution:

The problem is, that the host where I started the WebGUI(server-a) has an incorrect ssh-host-key for the host the vm is on(server-b) and can not open a console(or migrate). To fix this the following is necessary:

  • Open a root console at server-a
  • run the command:
    Code:
    /usr/bin/ssh -e none -o 'HostKeyAlias=server-b-name' root@server-b-ip-address /bin/true
    server-b-name is the name of the node server-b in the cluster
    server-b-ip-address is the primary cluster-ip-address of server-b

    Example:

    My server is named px03 and its primary ip address is 192.168.207.12

    Code:
    /usr/bin/ssh -e none -o 'HostKeyAlias=px03' root@192.168.207.12 /bin/true

  • If there are any errors fix them according to the ssh output. Host Key Verification failed means there's a wrong key in /root/.ssh/known_hosts. The wrong key should be removed and the new key should be accepted when prompted for at the ssh command.

  • If the command succeeds with no output all should be perfect agin
thank you this solved my issue
 
That didn't work for me still getting "Failed to connect to server".

Update: Never mind I needed to do pvecm updatecerts
 
Last edited:
  • Like
Reactions: hellfire
Proxmox VE: Fix for Host key verification failed Error


If you get the following error when opening a VM console or during migration:
Code:
Console: failed to connect to server – Host key verification failed


Run this command on each node in the cluster. It will remove old SSH host keys for other nodes and fetch the current ones, skipping the local node:

Bash:
for ip in IP1 IP2 IP3 ...; do hn=$(getent hosts $ip | awk '{print $2}'); if [[ $(hostname -I) != *"$ip"* ]]; then ssh-keygen -R "$ip"; ssh-keygen -R "$hn"; ssh-keyscan -H "$ip" >> /root/.ssh/known_hosts 2>/dev/null; ssh-keyscan -H "$hn" >> /root/.ssh/known_hosts 2>/dev/null; fi; done

Where:


  • IP1 IP2 IP3 ... — list of all other node IPs in your cluster
    (e.g. 192.168.0.151 192.168.0.152 192.168.0.153 etc.)

Optional: regenerate Proxmox certificates and restart services
Bash:
pvecm updatecerts --force
systemctl restart pveproxy pvedaemon
After that, console access and VM migrations should work correctly again.