AlmaLinux / cloud-images

Packer templates and other tools for building AlmaLinux images for various cloud platforms.
MIT License
161 stars 48 forks source link

Getting SSH Handshake Failed on Alma 9 #172

Open AkashRajvanshi opened 7 months ago

AkashRajvanshi commented 7 months ago

Hi, I'm trying to build Alma 9 images, but I'm encountering an SSH handshake error: 'ssh: handshake failed: read tcp 127.0.0.1:59326->127.0.0.1:3346: read: connection reset by peer'. Can you please help?"

Screenshot_20240501_124309

LKHN commented 7 months ago

Hi Akash, Could you please share more information from you setup?

AkashRajvanshi commented 7 months ago

Hi @LKHN , below are the required details of my environment:

Building BIOS images is working, but when I try for UEFI, it gets stuck on the SSH connection part.

AkashRajvanshi commented 6 months ago

Hi @LKHN , I tried building UEFI images and also opened a local VNC viewer. It shows on screen "guest has not initialized the display (yet)", while the console is attempting to SSH into it.

Packer Logs:

2024/05/04 09:33:24 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:33:24 Special code '<enter>' found, replacing with: 0xFF0D
2024/05/04 09:33:24 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:33:24 [INFO] Waiting 1s
    qemu.almalinux-9-gencloud-x86_64: Not using a NetBridge -- skipping StepWaitGuestAddress
==> qemu.almalinux-9-gencloud-x86_64: Using SSH communicator to connect: 127.0.0.1
2024/05/04 09:33:25 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:33:25 [INFO] Waiting for SSH, up to timeout: 1h0m0s
==> qemu.almalinux-9-gencloud-x86_64: Waiting for SSH to become available...
2024/05/04 09:33:25 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:33:25 [INFO] Attempting SSH connection to 127.0.0.1:2291...
2024/05/04 09:33:25 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:33:25 [DEBUG] reconnecting to TCP connection for SSH
2024/05/04 09:33:25 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:33:25 [DEBUG] handshaking with SSH
2024/05/04 09:34:25 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:34:25 [DEBUG] SSH handshake err: Timeout during SSH handshake
2024/05/04 09:34:32 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:34:32 [INFO] Attempting SSH connection to 127.0.0.1:2291...
2024/05/04 09:34:32 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:34:32 [DEBUG] reconnecting to TCP connection for SSH
2024/05/04 09:34:32 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:34:32 [DEBUG] handshaking with SSH
2024/05/04 09:35:32 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:35:32 [DEBUG] SSH handshake err: Timeout during SSH handshake
2024/05/04 09:35:39 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:35:39 [INFO] Attempting SSH connection to 127.0.0.1:2291...
2024/05/04 09:35:39 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:35:39 [DEBUG] reconnecting to TCP connection for SSH
2024/05/04 09:35:39 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:35:39 [DEBUG] handshaking with SSH
2024/05/04 09:36:39 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:36:39 [DEBUG] SSH handshake err: Timeout during SSH handshake
2024/05/04 09:36:46 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:36:46 [INFO] Attempting SSH connection to 127.0.0.1:2291...
2024/05/04 09:36:46 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:36:46 [DEBUG] reconnecting to TCP connection for SSH
2024/05/04 09:36:46 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:36:46 [DEBUG] handshaking with SSH
2024/05/04 09:37:46 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:37:46 [DEBUG] SSH handshake err: Timeout during SSH handshake
2024/05/04 09:37:53 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:37:53 [INFO] Attempting SSH connection to 127.0.0.1:2291...
2024/05/04 09:37:53 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:37:53 [DEBUG] reconnecting to TCP connection for SSH
2024/05/04 09:37:53 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:37:53 [DEBUG] handshaking with SSH
2024/05/04 09:38:53 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:38:53 [DEBUG] SSH handshake err: Timeout during SSH handshake
2024/05/04 09:39:00 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:39:00 [INFO] Attempting SSH connection to 127.0.0.1:2291...
2024/05/04 09:39:00 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:39:00 [DEBUG] reconnecting to TCP connection for SSH
2024/05/04 09:39:00 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:39:00 [DEBUG] handshaking with SSH
2024/05/04 09:40:00 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:40:00 [DEBUG] SSH handshake err: Timeout during SSH handshake
2024/05/04 09:40:07 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:40:07 [INFO] Attempting SSH connection to 127.0.0.1:2291...
2024/05/04 09:40:07 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:40:07 [DEBUG] reconnecting to TCP connection for SSH
2024/05/04 09:40:07 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:40:07 [DEBUG] handshaking with SSH
2024/05/04 09:41:07 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:41:07 [DEBUG] SSH handshake err: Timeout during SSH handshake
2024/05/04 09:41:14 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:41:14 [INFO] Attempting SSH connection to 127.0.0.1:2291...
2024/05/04 09:41:14 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:41:14 [DEBUG] reconnecting to TCP connection for SSH
2024/05/04 09:41:14 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:41:14 [DEBUG] handshaking with SSH
2024/05/04 09:42:14 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:42:14 [DEBUG] SSH handshake err: Timeout during SSH handshake
2024/05/04 09:42:21 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:42:21 [INFO] Attempting SSH connection to 127.0.0.1:2291...
2024/05/04 09:42:21 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:42:21 [DEBUG] reconnecting to TCP connection for SSH
2024/05/04 09:42:21 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/05/04 09:42:21 [DEBUG] handshaking with SSH
LKHN commented 6 months ago

@AkashRajvanshi

I just tested the the distros listed below because of the #176 . Haven't experienced any issue.

Can you clone the repo and test again with the recently merged changes?

VladyslavTkachenkoDesy commented 2 months ago

Hi @LKHN , I did the test with : Packer 1.11.2 Host: Ubuntu 22.04 Image: qemu.almalinux-9-gencloud-x86_64

The only think that I changed is that it create LVM, but should not be an issue. As a result has the same SSH issue. Any suggestions?

LKHN commented 2 months ago

@VladyslavTkachenkoDesy

Can you disable the headless mode to able to see whether the VM is booted after the installation or not?

export PKR_VAR_headless='false'