Networking when Packer boots up an image, ssh issue

51 views
Skip to first unread message

ksac...@gmail.com

unread,
Aug 26, 2018, 12:17:02 PM8/26/18
to Packer
I have a question on this. When I bootup my qemu raw image without using packer(say using libvirt/virsh), I can see it gets a 192.x.x.x IP and I can ssh into it. When packer boots it up, I can see the Qemu console and it has 10.x.x.x Ip .I can get inside the vm via qemu console that packer shows as I have done "headless":"false" but packer can never ssh into it. Even when I go inside the VM via Qemu, at the linux prompt when I try to reach say "8.8.8.8" or sth from the VM, the VM cannot. I am trying to wonder if this is somehow needs to be fixed via some config so that packer can ssh into the machine? My builder section is very simple and simply asks packer to bootup from raw pre-installed linux disk. It also has the username password that is for the raw centos img.

But packer just waits and waits and never is able to ssh into the machine. This has blocked me for over 3 days now and I still have had no luck. I would really appreciate if packer team can help me get past this issue(genuine or config, not sure)



Miguel Baquero

unread,
Aug 26, 2018, 9:16:50 PM8/26/18
to Packer
I'm working with QEMU and no issues for now with connectivity... can you share your Packer template?

ksac...@gmail.com

unread,
Aug 27, 2018, 3:41:36 AM8/27/18
to Packer
Hello Miguel, thanks. i am sharing my packer template. BTW, as shared in previous msg, the raw img boots fine with 192 address. Even via packer it boots up and i can ssh via the consol as i am headless but on doing ifconfig -a either the ip is absent or 10.x. and not 192.x. I think this is somehow related. If this can be fixed, I don't know how, rest will work.

{
  "builders":
  [
    {
      "type": "qemu",
      "disk_image":"true",
      "iso_url": "myimage.img",
      "iso_checksum": "9125d9910c353479e6295d297ae4d65c",
      "iso_checksum_type": "md5",
      "output_directory": "/tmp/packerout1",
      "shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
      "disk_size": 9000,
      "format": "raw",
      "headless": false,
      "ssh_host_port_min": 2222,
      "ssh_host_port_max": 4444,
      "ssh_username": "root",
      "ssh_password": "check123",
      "ssh_port": 22,
      "ssh_timeout": "19000s",
      "net_device": "vmxnet3",
      "disk_interface": "virtio",
      "http_port_min": 10082,
      "http_port_max": 10089,
      "vm_name": "tdhtest"
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "scripts": [
        "cleanup.sh"
      ]
    }
  ]

}

Miguel Baquero

unread,
Aug 27, 2018, 12:10:12 PM8/27/18
to Packer
Look at the interface, it seems like a vmware maybe? vmxnet3
try using "net_device": "virtio-net",

Kanwaljeet Singh

unread,
Aug 27, 2018, 12:11:28 PM8/27/18
to packe...@googlegroups.com
Tried that too buddy

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/9be6369d-71e5-431a-b85b-dd3cace5163f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Miguel Baquero

unread,
Aug 28, 2018, 6:59:24 PM8/28/18
to Packer
Did you connect to the VM using VNC to see what's happening during the installation? One thing that may fail is the storage device name, so it will just hang in there and you won't know

Alvaro Miranda Aguilera

unread,
Sep 6, 2018, 9:32:50 AM9/6/18
to packe...@googlegroups.com
hello

if you could put your code in a repo will be easier to test and review

alvaro

On Sun, Aug 26, 2018 at 6:17 PM <ksac...@gmail.com> wrote:
I have a question on this. When I bootup my qemu raw image without using packer(say using libvirt/virsh), I can see it gets a 192.x.x.x IP and I can ssh into it. When packer boots it up, I can see the Qemu console and it has 10.x.x.x Ip .I can get inside the vm via qemu console that packer shows as I have done "headless":"false" but packer can never ssh into it. Even when I go inside the VM via Qemu, at the linux prompt when I try to reach say "8.8.8.8" or sth from the VM, the VM cannot. I am trying to wonder if this is somehow needs to be fixed via some config so that packer can ssh into the machine? My builder section is very simple and simply asks packer to bootup from raw pre-installed linux disk. It also has the username password that is for the raw centos img.

But packer just waits and waits and never is able to ssh into the machine. This has blocked me for over 3 days now and I still have had no luck. I would really appreciate if packer team can help me get past this issue(genuine or config, not sure)



--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Alvaro

Mike Pietruszka

unread,
May 15, 2019, 10:50:10 AM5/15/19
to Packer
Have you been able to resolve this issue? I'm running into the exact same scenario in qemu and CentOS.

Thanks!


On Sunday, August 26, 2018 at 11:17:02 AM UTC-5, ksac...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages