hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.1k stars 3.33k forks source link

Urgent : SSH Timeout with VirtualBox and ubuntu iso #13196

Open rohank63 opened 5 days ago

rohank63 commented 5 days ago

Hi Team, I am having ssh timeout issues for the last 2 days. I read out different articles (stackoverflow / packer doc) and tried different ways but the issue still persists. I would be thankful if anyone can solve it.

I am getting this repeatedly, this goes on for more than couple of hours. And after the timeout specified in my config I get timeout.

 Attempting SSH connection to 127.0.0.1:4222...
 [DEBUG] reconnecting to TCP connection for SSH
 [DEBUG] handshaking with SSH
 [DEBUG] SSH handshake err: SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:49743->127.0.0.1:4222: read: connection reset by peer

I am using VitualBox 7.1.4 , and Packer v1.11.2 on Mac M3 .

 "variables":{
     "vm_name": "ubuntu2204-x86_64"
  },
  "builders": [
    {
      "vm_name": "{{user `vm_name`}}",
      "type": "virtualbox-iso",
      "guest_os_type": "Ubuntu22_LTS_64",
      "iso_urls": [
        "iso/ubuntu-22.04.1-live-server-amd64.iso",
        "https://old-releases.ubuntu.com/releases/22.04.1/ubuntu-22.04.1-live-server-amd64.iso"
      ],
      "iso_checksum": "sha256:10f19c5b2b8d6db711582e0e27f5116296c34fe4b313ba45f9b201a5007056cb",
      "iso_interface": "sata",
      "boot_wait": "8s",
      "boot_keygroup_interval": "1000ms",
      "boot_command": [
        "c<wait>",
        "set gfxpayload=keep<enter><wait>",
        "linux /casper/vmlinuz --- ",
        "quiet net.ifnames=0 biosdevname=0 ",
        "autoinstall ds=nocloud;seedfrom=/cidata/<enter><wait>",
        "initrd /casper/initrd<enter><wait>",
        "boot<enter>"
      ],
      "guest_additions_mode": "disable",
      "memory": "2048",
      "cpus": 2,
      "disk_size": 32768,
      "cd_files": [
        "templates/http/user-data",
        "templates/http/meta-data"
      ],
      "cd_label": "cidata",
      "output_directory": "{{user `vm_name`}}",
      "shutdown_timeout": "5m",
      "post_shutdown_delay": "1m",
      "communicator": "ssh",
      "ssh_username": "someValue",
      "ssh_password": "someValue",
      "ssh_port": 22,
      "ssh_pty": true,
      "ssh_handshake_attempts": "50000",
      "ssh_timeout": "1h"
    }
  ],

In Virtual Box I can see network as NAT with port forwarding enabled.

image

KinoFool commented 5 days ago

Hello,

Since the latest version of macos (15.1), our VM deployment on Proxmox has stopped working, and we have SSH related errors.

We have tested the deployment on Linux systems where it works as intended, but we're encountering SSH errors on multiple Mac M3 running the latest macOS version.

We need to investigate what's happening, but I suspect the latest macOS update is breaking or interfering with Packer...

Xavier2p commented 5 days ago

Hello,

I have the same problem on macOS 15.1 on M3.

From Linux, I don't have any issue.

rohank63 commented 3 days ago

@KinoFool @Xavier2p But I am using Sonoma 14.7

Xavier2p commented 3 days ago

Sonoma 14.7 is the last version too. I think it's a security bug or something like that @rohank63