hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.

Home Page:http://www.packer.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File server timeout for Rocky kickstart

mkm29 opened this issue · comments

Overview of the Issue

I am attempting to use Packer to build some Rocky Linux 8.9 ISOs for Vagrant, however I get a timeout when trying to access the file from the built in file server

Reproduction Steps

You can find my code (quite simple) here

Packer version

From packer version: 1.10.2

Simplified Packer Template

You can find the HCL config here

Operating system and Environment details

Linux pop-os 6.6.10-76060610-generic x86_64

Log Fragments and crash.log files

After the machine is initially bootstrapped I get the following error (on the VM)

curl (7) Failed to connect to 10.0.2.2 port 8222: Connection times out
[ <ts>] dracut-initqueue[920]: Warning: anaconda: failed to fetch kickstart from http://10.0.2.2:8222/ks.cfg
...

During which time Packer prints these errors (over and over):

2024/03/17 16:46:18 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2024/03/17 16:46:18 [INFO] Attempting SSH connection to 127.0.0.1:2874...
2024/03/17 16:46:18 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2024/03/17 16:46:18 [DEBUG] reconnecting to TCP connection for SSH
2024/03/17 16:46:18 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2024/03/17 16:46:18 [DEBUG] handshaking with SSH
2024/03/17 16:46:18 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2024/03/17 16:46:18 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:47068->127.0.0.1:2874: read: connection reset by peer

I fixed it, needed to add this configuration to my source

  vboxmanage           = [
    ["modifyvm", "{{ .Name }}", "--memory", "${var.memsize}"],
    ["modifyvm", "{{ .Name }}", "--cpus", "${var.numvcpus}"],
    ["modifyvm", "{{ .Name }}", "--nat-localhostreachable1", "on"]
  ]

You can self-close the issue when you're ready.