SSH Timeout issue while converting rhel9.4 dvd iso to qcow2 using python packer and qemu

Posted on

Using python packer and qemu we are trying to convert rhel9.4 dvd iso to qcow2 to use it on openstack cloud for creating instances. But we are ending up with ssh timeout issue, below is the console output and followed by qemu object template used.

12:19:44 ==> rhel9_4_Minimal: Creating required virtual machine disks
12:19:44 ==> rhel9_4_Minimal: Starting HTTP server on port 8248
12:19:44 ==> rhel9_4_Minimal: Found port for communicator (SSH, WinRM, etc): 3216.
12:19:44 ==> rhel9_4_Minimal: Looking for available port between 5900 and 6000 on 127.0.0.1
12:19:44 ==> rhel9_4_Minimal: Starting VM, booting from CD-ROM
12:19:44 rhel9_4_Minimal: The VM will be run headless, without a GUI. If you want to
12:19:44 rhel9_4_Minimal: view the screen of the VM, connect via VNC without a password to
12:19:44 rhel9_4_Minimal: vnc://127.0.0.1:5995
12:19:44 ==> rhel9_4_Minimal: Overriding defaults Qemu arguments with QemuArgs...
12:19:44 ==> rhel9_4_Minimal: Waiting 10s for boot...
12:19:49 ==> rhel9_4_Minimal: Connecting to VM via VNC (127.0.0.1:5995)
12:19:49 ==> rhel9_4_Minimal: Typing the boot command over VNC...
12:19:58 ==> rhel9_4_Minimal: Using ssh communicator to connect: 127.0.0.1
12:19:58 ==> rhel9_4_Minimal: Waiting for SSH to become available...
12:39:59 ==> rhel9_4_Minimal: Timeout waiting for SSH.
12:39:59 ==> rhel9_4_Minimal: Deleting output directory...
12:39:59 Build 'rhel9_4_Minimal' errored: Timeout waiting for SSH.
12:39:59
12:39:59 ==> Some builds didn't complete successfully and had errors:
12:39:59 --> rhel9_4_Minimal: Timeout waiting for SSH.

{
12:39:59 "builders": [
12:39:59 {
12:39:59 "accelerator": "kvm",
12:39:59 "boot_command": [
12:39:59 " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg"
12:39:59 ],
12:39:59 "boot_wait": "10s",
12:39:59 "communicator": "ssh",
12:39:59 "disk_interface": "virtio",
12:39:59 "disk_size": 160000,
12:39:59 "format": "qcow2",
12:39:59 "headless": "true",
12:39:59 "http_directory": "kickstart/rhel8x",
12:39:59 "iso_checksum": "398561d7b66f1a4bf23664f4aa8f2cfbb3641aa2f01a320068e86bd1fc0e9076",
12:39:59 "iso_checksum_type": "sha256",
12:39:59 "iso_url": "/openstack-images-external/Rhel9/Rhel9-4/rhel-9.4-x86_64-dvd.iso",
12:39:59 "memory": 5000,
12:39:59 "name": "rhel9_4_Minimal",
12:39:59 "net_device": "virtio-net",
12:39:59 "output_directory": "./output-qemu/rhel9_4_Minimal",
12:39:59 "qemu_binary": "qemu-kvm",
12:39:59 "qemuargs": [
12:39:59 [
12:39:59 "-netdev",
12:39:59 "user,hostfwd=tcp::{{ .SSHHostPort }}-:22,id=forward"
12:39:59 ],
12:39:59 [
12:39:59 "-device",
12:39:59 "virtio-net,netdev=forward,id=net0"
12:39:59 ]
12:39:59 ],
12:39:59 "shutdown_command": "echo 'netvanta' | sudo -S shutdown -P now",
12:39:59 "ssh_password": "adn123",
12:39:59 "ssh_timeout": "20m",
12:39:59 "ssh_username": "adn",
12:39:59 "type": "qemu",
12:39:59 "vm_name": "rhel9_4.qcow2"
12:39:59 }
12:39:59 ],
12:39:59 "provisioners": [
12:39:59 {
12:39:59 "execute_command": "echo 'adn123' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'",
12:39:59 "inline": [
12:39:59 "ln -sf ../usr/share/zoneinfo/GMT /etc/localtime"
12:39:59 ],
12:39:59 "pause_before": "10s",
12:39:59 "type": "shell"
12:39:59 },
12:39:59 {
12:39:59 "ansible_env_vars": [
12:39:59 "ANSIBLE_ROLES_PATH=galaxy"
12:39:59 ],
12:39:59 "extra_arguments": [
12:39:59 "--extra-vars",
12:39:59 "ansible_become_password=adn123vm_user=adn"
12:39:59 ],
12:39:59 "playbook_file": "site_minimal.yml",
12:39:59 "type": "ansible"
12:39:59 }
12:39:59 ]
12:39:59 }

Could you please help us with what is causing the issue. Thanks for the help.

Responses