-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IP address gets changed after reboot (not always) when building using vsphere - no route to host ssh #425
Comments
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 |
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. |
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. |
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. |
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. |
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... |
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. |
Any luck @LeifErik1995 @patschi?
|
@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. |
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. |
Thanks for confirming, @patschi. Closing based on the workaround provided for Ubuntu's installer in #425 (comment). |
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 |
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
The text was updated successfully, but these errors were encountered: