Hi,
Logs are stuck at SSH:
==> virtualbox-iso.vm: Using SSH communicator to connect: 127.0.0.1
==> virtualbox-iso.vm: Waiting for SSH to become available…
and checked in virtual box manager, some processing were going on and it suddenly closed all the processing without any error!
in logs:
==> virtualbox-iso.ubuntu: Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
ubuntu.pkr.hcl file:
source “virtualbox-iso” “ubuntu” {
iso_url = “https://releases.ubuntu.com/22.04/ubuntu-22.04.4-live-server-amd64.iso”
iso_checksum = “45f873de9f8cb637345d6e66a583762730bbea30277ef7b32c9c3bd6700a32b2”
ssh_username = “vagrant”
ssh_password = “vagrant”
ssh_wait_timeout = “50m”
shutdown_command = “echo ‘packer’ | sudo -S shutdown -P now”
vm_name = “ubuntu-22-04”
guest_os_type = “Ubuntu_64”
headless = false
boot_wait = “2m”
http_directory = “http”
ssh_port = 22
boot_command = [
“c”,
“linux /casper/vmlinuz — autoinstall ds=nocloud-net;seedfrom=http://{{ .HTTPIP}}:{{ .HTTPPort}}/”,
“”,
“initrd /casper/initrd”,
“”,
“boot”,
“”
]
vboxmanage = [
[“modifyvm”, “{{.Name}}”, “–memory”, “4096”],
[“modifyvm”, “{{.Name}}”, “–cpus”, “2”],
[“modifyvm”, “{{.Name}}”, “–vram”, “32”],
[“modifyvm”, “{{.Name}}”, “–nic1”, “nat”],
[“modifyvm”, “{{.Name}}”, “–audio”, “none”],
[“modifyvm”, “{{.Name}}”, “–uart1”, “0x3F8”, “4”],
[“modifyvm”, “{{.Name}}”, “–uartmode1”, “file”, “serial.log”]
]
}
Define the build process
build {
sources = [“source.virtualbox-iso.ubuntu”]
provisioner “shell” {
inline = [
“sudo apt-get update”,
“sudo apt-get upgrade -y”,
“sudo apt-get install -y virtualbox-guest-utils”,
]
}
provisioner “shell-local”{
script = “./scripts/networking.sh”
}
}
and created a http folder, there is user-data.yaml file:
#cloud-config
autoinstall:
version: 1
identity:
hostname: vagrant
username: vagrant
password: $6$rounds=4096$5CU3LEj/MQvbkfPb$LmKEF9pCfU8R.dA.GemgE/8GT6r9blge3grJvdsVTMFKyLEQwzEF3SGWqAzjawY/XHRpWj4fOiLBrRyxJhIRJ1
ssh:
install-server: yes
allow-pw: yes