Comments (7)
This is likely caused by this branch of code:
packer-plugin-tart/builder/tart/step_run.go
Lines 124 to 134 in 9ddd019
If you use http_directory
or http_content
, we need to figure out the IP-address on which the VM will be able to reach the HTTP server running on host, and this requires a VM to obtain an IP address first, which takes time.
You can set http_bind_address
manually to a value other than 0.0.0.0
to override this behavior, see also #63.
from packer-plugin-tart.
That would seem to explain the behaviour I'm seeing, but I've used http_directory
setting with the packer builder plugin for VirtualBox and it didn't have this delay in sending keystrokes, which implies it didn't have to wait such a long time to determine the host VM as I was passing it this line:
ds=nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/
so I think either I'm missing something or there is something more that needs to be done here.
Is it possible this is just some logic or optimization problem in the tart packer plugin itself since the VirtualBox packer plugin seems to have solved this?
Also, isn't the host IP usually the same IP each time, usually the first or second IP on the VM network. For example, I had created an alternative config where I was running my own web server locally and passing this to the tart VM:
'ds=nocloud-net;s=http://192.168.64.1:8000/'
which I'd reverse engineered from tty2 console on a tart VM itself and this worked consistently for me...
I just tried setting in the pkr.hcl:
http_bind_address = "192.168.64.1"
and the whole VM just hangs for 18 minutes so far:
$ packer build --force ubuntu-arm64.tart.http.pkr.hcl
ubuntu-22.04.tart-cli.ubuntu: output will be in this color.
<no_output>
from packer-plugin-tart.
After leaving it for over an hour it was still stuck.
Do I commented out the http_bind_address
line and tried again:
packer build --force ubuntu-arm64.tart.http.pkr.hcl
ubuntu-22.04.tart-cli.ubuntu: output will be in this color.
==> ubuntu-22.04.tart-cli.ubuntu: Starting HTTP server on port 8798
==> ubuntu-22.04.tart-cli.ubuntu: Creating virtual machine...
==> ubuntu-22.04.tart-cli.ubuntu: Starting the virtual machine for installation...
==> ubuntu-22.04.tart-cli.ubuntu: Detecting host IP...
<stuck here for over 30 seconds - missed the boot loader's 30 second timeout>
<eventually continued but boot is hosed by that point>
==> ubuntu-22.04.tart-cli.ubuntu: Host IP is assumed to be 192.168.64.1
==> ubuntu-22.04.tart-cli.ubuntu: Waiting for the VNC server credentials from Tart...
==> ubuntu-22.04.tart-cli.ubuntu: Retrieved VNC credentials, connecting...
==> ubuntu-22.04.tart-cli.ubuntu: Connected to the VNC!
==> ubuntu-22.04.tart-cli.ubuntu: Typing the commands over VNC...
==> ubuntu-22.04.tart-cli.ubuntu: Waiting for the install process to shutdown the VM...
It looks like it failed to detect the host IP after a long period and missing the boot loader countdown
==> ubuntu-22.04.tart-cli.ubuntu: Host IP is assumed to be 192.168.64.1
perhaps this is why it's hanging and not sending the boot_command
?
from packer-plugin-tart.
and the whole VM just hangs for 18 minutes so far:
This is probably because the interface with 192.168.64.1
address doesn't exist yet at the time of HTTP server creation and Packer's plugin SDK does not discern between bind: address already in use
and bind: address family not supported by protocol family
errors when starting the HTTP server, so it automatically re-tries the same operation over and over, but with another port and without logging any errors because it thinks that it's due to the occupied port.
I think you can fix this by binding to the IP-address that your macOS machine got from your LAN/WLAN, for example:
http_bind_address = "192.168.0.50"
Note that this will make your HTTP server available from the LAN too.
from packer-plugin-tart.
Regarding the root cause, do I understand correctly that even if you increase the GRUB_TIMEOUT
in your Ubuntu autoinstall configuration, the VM will only get it's IP address via DHCP after booting?
from packer-plugin-tart.
So I tested setting the http_bind_address
to the same IP my laptop has on the LAN and yes that does actually work around issue of not sending keystrokes in time for the bootloader and also the permanent hang from combining http_directory
and http_bind_address
.
The only downside is that being a DHCP address, this is not a permanent solution to packer configs on github which will need to run across machines of unknown IP addresses, run by people on the internet or shared with colleagues etc.
I mean I could easily script a search and replace of the local machine's IP address but it'd be such an ugly hack... aside from exposing the autoinstaller containing hashed passwords on the LAN...
from packer-plugin-tart.
How would I set GRUB_TIMEOUT
in a packer build?
Ubuntu's AutoInstall isn't triggered because the keystrokes aren't sent and besides grub bootloader happens before autoinstaller...
Apologies if I'm missing something simple there.
from packer-plugin-tart.
Related Issues (20)
- Support for Remote Builds HOT 1
- Attaching additional disks during build HOT 3
- VNC password is not printed in debug log
- No cleanup after failure HOT 7
- Fails after VM start with "Failed to lock auxiliary storage" HOT 5
- PACKER_HTTP_ADDR is unset for shell provisioner
- Duplicated code between step_run and step_create_linux_vm HOT 3
- macOS 12 VM does not respond to VNC input HOT 3
- 2.7.0 crashes when trying to use via packer HOT 8
- Software Update doesn't work in VMs from tart packer plugin HOT 2
- Cannot extend the image with "Error: -69519: The target disk is too small for this operation" HOT 3
- Don't delete `vm_name` if it already exists HOT 4
- Occasional Timeout waiting for SSH HOT 14
- Document new http file serving example
- IPSW data source HOT 2
- Tart push post processor
- Plugin version 1.5.3 breaking on disk resize
- Allow running provisioners when recovery = true HOT 2
- Allow --resolver option when getting VM's IP HOT 1
- `{{ .HTTPIP }}` and `{{ .HTTPPort }}` are substituted as `<no value>` in `boot_command` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from packer-plugin-tart.