IP address gets changed after reboot (not always) when building using vsphere - no route to host ssh #644
Replies: 15 comments
-
Beta Was this translation helpful? Give feedback.
-
|
In my case, i am hitting the issue randomly even when running a single packer job. So might not be similar to what you are facing @patschi |
Beta Was this translation helpful? Give feedback.
-
|
Is your packer VM the only VM your DHCP server is handling in the same network? I have a dedicated network for packer it building VM templates, so no other DHCP requests ongoing. |
Beta Was this translation helpful? Give feedback.
-
|
hmm, interesting. No there is no dedicated network for packer (The network i use in my packer build is commonly used with around 500 vms associated with it). Maybe i will ask my build infra team to have a dedicated network and try this and see. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
So. I found a workaround. As per my previous guess, the issue was indeed the DHCP. The tricky part was, that after autoinstall starts, it immediately gets an IP address assigned from the DHCP server and Packer is picking up this specific address - even before any autoinstall configuration was parsed. This happens before the In other words:
For context and as an example, I use following My workaround was stopping And on the packer side, I tell packer to wait at least 2 minutes before checking the current IP. This prevents that packer receives the IP address via So ideally packer will only get the IP address from the VM once rebooted, to get its final IP. This took a friend and me now hours to figure out... For me, it works now as I expected it to. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @patschi, i will check it out. It is my first time with such in-depth tasks on devops and infra side. Usually i work on application side of the stuff. Once i try it out then i will update the thread. |
Beta Was this translation helpful? Give feedback.
-
|
Yeah, let me know if it helps and if it is the same/similar issue. I'm very curious to know. I have been building this for my private lab now - for the like 2-4 times per year I need a new, fresh Ubuntu VM... Maybe the time invested pay off in a few decades... |
Beta Was this translation helpful? Give feedback.
-
|
Try modifying the boot command for Ubuntu to include the following: boot_command = [
... other commands ...
"autoinstall network-config=disabled"
... other commands ...
]This should skip the initial IP address. |
Beta Was this translation helpful? Give feedback.
-
|
Any luck @LeifErik1995 @patschi?
|
Beta Was this translation helpful? Give feedback.
-
|
@tenthirtyam I will try this in some time. Currently busy with another task. Once I am somewhat light on my workload, will check back on all the suggestions here. |
Beta Was this translation helpful? Give feedback.
-
That's a valid workaround, thanks for suggesting! While I think this will help, it does have following disadvantages:
But obviously, the latter can be done during using provisioning script. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for confirming, @patschi. Closing based on the workaround provided for Ubuntu's installer in #425 (comment). |
Beta Was this translation helpful? Give feedback.
-
|
Well. I stumbled about some other weird issue when using kind of the same approach as suggested above: The network was also disabled on the final, created VM after the installer finished. Interestingly, this has only shown its behavior with Ubuntu 24.04 on an ongoing reproducible basis. With Ubuntu 22.04 the kernel parameters are copied too, but network was still working. Looks like there were some changes in latest 24.04. So in case anyone has the same behavior... The boot commands were: After almost 8 hours of research and pulling my hair out, I found out the three Removed |
Beta Was this translation helpful? Give feedback.
-
|
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks,
I am experiencing an issue with IP address where old one not getting recognized after the reboot when building ubuntu 22.04, host ESXi 7.0. After reboot IP is no longer assigned to the VM.
My cloud-init is as below
Boot command is as follows
I scoured through the issues that relate to this to make some headway on this, but there seems to be some issue with my config.
<BTW, I am very new to packer, so any advice is appreciated however trivial it might be>.
Also attaching the screenshot of both the after reboot vm log, and the packer debug log at the time of the error. After that and i get the no route to host error, the vm ends up in the state of the final image.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions