Packer: curl failed to connect to packer set http server , which failed to fetch ks.cfg and which aborted the linux boot

Created on 22 Jan 2020  路  21Comments  路  Source: hashicorp/packer

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

at Packer code, with default network switch value required to VM NAT to host ,
curl failed to connect to packer set http server, which failed to fetch ks.cfg and which aborted the linux boot

A paragraph or two about the issue you're experiencing.

Reproduction Steps

Steps to reproduce this issue
Trying to build -packer centOS8 hyperv-iso gold image-
with

{
"builders": [
{
"type": "hyperv-iso",
"vm_name": "{{ user vm_name }}",
"temp_path": ".",
"iso_url": "{{ user iso_url }}",
"iso_checksum_type": "{{user iso_checksum_type}}",
"iso_checksum": "{{user iso_checksum}}",
"disk_size": "{{user disk_size}}",
"disk_block_size": "1",
"communicator": "ssh",
"ssh_username": "root",
"ssh_password": "{{ user ssh_password }}",
"ssh_timeout" : "4h",
"shutdown_timeout": "30m",
"shutdown_command": "echo 'password' | sudo -S shutdown -P now",
"memory": 4096,
"enable_dynamic_memory": "true",
"cpus": 4,
"generation": 2,
"switch_name": "{{user switch_name}}",
"vlan_id": "{{user vlan_id}}",
"http_directory": "./extra/files",
"boot_wait": "5s",
"boot_command": [
"c setparams 'kickstart' linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x\86_64 inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/gen2-centos/ks.cfg initrdefi /images/pxeboot/initrd.img boot"
],
"guest_additions_mode":"disable",
"enable_secure_boot": false,
"output_directory": "{{ user output_directory }}"
}
],
{
"iso_url": "C:/San/SV65/CentOS/CentOS-8.1.1911-x86_64-boot.iso",
"iso_checksum_type": "sha256",
"iso_checksum": "7fea13202bf2f26989df4175aace8fdc16e1137f7961c33512cbfad844008948",
"vm_name": "packer-centos8-g2",
"disk_size": "70000",
"disk_additional_size":"150000",
"switch_name": "Default Switch",
"output_directory": "output-centos77",
"vlan_id": "",
"ssh_password": "password",
"provision_script_options": ""
}
}

Packer version

From packer version
1.5.1

Simplified Packer Buildfile

Operating system and Environment details

HyperV Packer
OS, Architecture, and any other information you can provide about the
environment.

Log Fragments and crash.log files

Include appropriate log fragments. If the log is longer than a few dozen lines,
please include the URL to the gist of the log or
use the Github detailed format instead of posting it directly in the issue.

Set the env var PACKER_LOG=1 for maximum log detail.

bug

All 21 comments

Thanks for reaching out. Where is the curl invocation?

I suppose from the VM end! this is the output i see on the screen

update2 (2)

I hope this clarifies

Ah, I get it. So it's the boot command itself. I thought you were doing it from a provisioner or something. Thanks for clarifying!

It ended up with not able to boot, leaving at dracut Emergency shell . Could not proceed further with the build image with packer

can you check your host computer's firewall rules and make sure it's allowed to open that port?

From my local computer, am able to access the file through http with port

Further now dracut-initqueue timeout is the issue, something to do with network adapters config?
which is not picking the right values?

DHCP not getting enabled from host to vm? unable to get the ip address
2020/01/24 14:49:23 packer.exe plugin: [DEBUG] Unable to get address during connection step: No ip address.
==> hyperv-iso: Waiting for SSH to become available...
2020/01/24 14:49:23 packer.exe plugin: [INFO] Waiting for SSH, up to timeout: 4h0m0s
2020/01/24 14:49:25 packer.exe plugin: [DEBUG] Error getting SSH address: No ip address.
2020/01/24 14:49:33 packer.exe plugin: [DEBUG] Error getting SSH address: No ip address.
2020/01/24 14:49:40 packer.exe plugin: [DEBUG] Error getting SSH address: No ip address.
2020/01/24 14:49:48 packer.exe plugin: [DEBUG] Error getting SSH address: No ip address.
2020/01/24 14:49:56 packer.exe plugin: [DEBUG] Error getting SSH address: No ip address.
2020/01/24 14:50:04 packer.exe plugin: [DEBUG] Error getting SSH address: No ip address.

though i am able to see the ip address in the linux rdsosreport.txt , the packer doesnt get the ip address
tried the same without the proxy as well,

all it ends at dracut initqueue error
Linuxdracut

Is this something to look at the provider end?

So to clarify; it looks like you are now able to retrieve the ks file from inside the guest machine. I think the dracut timeout you are seeing is related to a kickstart or guest OS misconfiguration, not with Packer. SSH is probably timing out because although the VM has an ip address, hyper-v doesn't have it yet. Once the vm kickstarts successfully, hyper-v will probably be able to access the IP, and Packer will be able to connect.

Hi @santhoshganesan, did you find @SwampDragons' reply helpful? Is this an issue yet of can I close it?

Hi @sylviamoss ! I came up further into the issue, curl, dracut and all working fine now, could sort out those issue, now like, on the Linux side , it does install OS, up for the terminal login, but the packer couldnt connect via SSH to the installed linux CentOS. Packer scripts timesout with the ssh timeout value..

What could do to these, struggling on these for past 24 hours..

Is your ks file installing openssh?

Yes in the package section of ks have openssh openssh-server and openssh-client

Can you share the current logs you're getting from Packer?

error enabling ssh

seems some problem with python kickstart.py enabling ssh

Same probleme here with the proxmox provider. I disabled selinux and firewalld on the packer system.

Hey @santhoshganesan or @Syntax3rror404 - were either of you able to figure a working solution for this? I have tried both Gen 1 like you have here and Gen 2 and cannot seem to get this to build. Have never had issues like this with CentOS 7/RHEL 7 and Hyper-V and I can build RHEL 8 to VMware using Packer w/out issue.

I have disabled selinux, disabled firewall, using a static ip and can confirm the ks is reachable through the gateway address:port. I have been at this for hours and am at my end.

Adam, can you share your JSON file, because mine doesn't work. It's like network is not activated/connected!!!

I had the same error message and luckily it could be solved with a simple VM Ware Workstation upgrade.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shashanksinha89 picture shashanksinha89  路  3Comments

Tensho picture Tensho  路  3Comments

sourav82 picture sourav82  路  3Comments

Nikoos picture Nikoos  路  3Comments

tleyden picture tleyden  路  3Comments