chef / bento

Packer templates for building minimal Vagrant baseboxes for multiple platforms
Apache License 2.0
4.25k stars 1.12k forks source link

Ubuntu 22.04 VirtualBox SSH timeout. #1560

Closed karcaw closed 7 months ago

karcaw commented 8 months ago

Version

bento main/292fdc63dafc8244a792221960273ec921daa4e7 Packer v1.10.2

Environment

Ubuntu 22.04

Scenario

Build the ubuntu20.04 bento box

Steps to Reproduce

bin/bento build -o virtualbox-iso.vm os_pkrvars/ubuntu/ubuntu-20.04-x86_64.pkrvars.hcl

Expected Result

A built .box in the builds directory

Actual Result

==> Starting build for templates:
==> Installing packer plugins
    Shelling out to run packer init -upgrade os_pkrvars/ubuntu/../../packer_templates
- os_pkrvars/ubuntu/ubuntu-20.04-x86_64
==> [ubuntu-20.04-x86_64] Building: 'packer build -timestamp-ui -force -var headless=false -only=virtualbox-iso.vm -var-file=ubunt
u-20.04-x86_64.pkrvars.hcl ../../packer_templates'
virtualbox-iso.vm: output will be in this color.

2024-03-29T15:46:54-07:00: ==> virtualbox-iso.vm: Retrieving Guest additions
2024-03-29T15:46:54-07:00: ==> virtualbox-iso.vm: Trying /usr/share/virtualbox/VBoxGuestAdditions.iso
2024-03-29T15:46:54-07:00: ==> virtualbox-iso.vm: Trying /usr/share/virtualbox/VBoxGuestAdditions.iso
2024-03-29T15:46:54-07:00: ==> virtualbox-iso.vm: /usr/share/virtualbox/VBoxGuestAdditions.iso => /usr/share/virtualbox/VBoxGuestAdditions.iso
2024-03-29T15:46:54-07:00: ==> virtualbox-iso.vm: Retrieving ISO
2024-03-29T15:46:54-07:00: ==> virtualbox-iso.vm: Trying https://releases.ubuntu.com/focal/ubuntu-20.04.6-live-server-amd64.iso
2024-03-29T15:46:54-07:00: ==> virtualbox-iso.vm: Trying https://releases.ubuntu.com/focal/ubuntu-20.04.6-live-server-amd64.iso?checksum=sha256%3Ab8f31413336b9393ad5d8ef0282717b2ab19f007df2e9ed5196c13d8f9153c8b
2024-03-29T15:47:00-07:00: ==> virtualbox-iso.vm: https://releases.ubuntu.com/focal/ubuntu-20.04.6-live-server-amd64.iso?checksum=sha256%3Ab8f31413336b9393ad5d8ef0282717b2ab19f007df2e9ed5196c13d8f9153c8b => /home/efelix/.cache/packer/74137c86f91d35e79617069ca73ab76607b2949f.iso
2024-03-29T15:47:00-07:00: ==> virtualbox-iso.vm: Starting HTTP server on port 8410
2024-03-29T15:47:00-07:00: ==> virtualbox-iso.vm: Creating virtual machine...
2024-03-29T15:47:02-07:00: ==> virtualbox-iso.vm: Creating hard drive ../../builds/packer-ubuntu-20.04-x86_64-virtualbox/ubuntu-20.04-amd64.vdi with size 65536 MiB...
2024-03-29T15:47:02-07:00: ==> virtualbox-iso.vm: Mounting ISOs...
2024-03-29T15:47:02-07:00:     virtualbox-iso.vm: Mounting boot ISO...
2024-03-29T15:47:03-07:00: ==> virtualbox-iso.vm: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 2629)
2024-03-29T15:47:03-07:00: ==> virtualbox-iso.vm: Executing custom VBoxManage commands...
2024-03-29T15:47:03-07:00:     virtualbox-iso.vm: Executing: modifyvm ubuntu-20.04-amd64 --audio none --nat-localhostreachable1 on
2024-03-29T15:47:03-07:00: ==> virtualbox-iso.vm: Starting the virtual machine...
2024-03-29T15:47:05-07:00: ==> virtualbox-iso.vm: Waiting 5s for boot...
2024-03-29T15:47:10-07:00: ==> virtualbox-iso.vm: Typing the boot command...
2024-03-29T15:47:19-07:00: ==> virtualbox-iso.vm: Using SSH communicator to connect: 127.0.0.1
2024-03-29T15:47:19-07:00: ==> virtualbox-iso.vm: Waiting for SSH to become available...
2024-03-29T16:17:19-07:00: ==> virtualbox-iso.vm: Timeout waiting for SSH.
2024-03-29T16:17:20-07:00: ==> virtualbox-iso.vm: Cleaning up floppy disk...
2024-03-29T16:17:20-07:00: ==> virtualbox-iso.vm: Deregistering and deleting VM...
2024-03-29T16:18:20-07:00: ==> virtualbox-iso.vm: Deleting output directory...
2024-03-29T16:18:20-07:00: Build 'virtualbox-iso.vm' errored after 31 minutes 26 seconds: Timeout waiting for SSH.

==> Wait completed after 31 minutes 26 seconds

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso.vm: Timeout waiting for SSH.

==> Builds finished but no artifacts were created.
==> Not writing metadata file since no boxes exist
==> [ubuntu-20.04-x86_64] Finished building in 31m31.29s.
==> Build finished in 31m35.86s.
>>> Failed Builds:
 ubuntu-20.04-x86_64
 exited
karcaw commented 8 months ago

shot-2024-03-29_09-55-38 Looks like a crash on the console.

I poked around in the shell and found that the DNS config is not getting copied in into the /tmp/tmpXXXX/mount directories, such that chrooting in there and running apt-get is failing.

Stromweld commented 8 months ago

did you build and install the latest version of bento?

karcaw commented 8 months ago

I have bento 3.0.0, running it directly out of the repository. is there a newer version?

karcaw commented 8 months ago

trying bento 4.0.2 now

Stromweld commented 8 months ago

yes it's up to bento 4.0.2 now. If you checkout main and run gem build bento.gemspec then gem install bento-4.0.2.gem that'll install it. There is also a version command now bento version to verify version installed.

karcaw commented 8 months ago

The install has the same issue. There just seems to be no DNS config in the chroots under /tmp/tmp*/mount. any idea what part of the installer is supposed to put something there?

karcaw commented 8 months ago

VirtualBox_ubuntu-20 it seems there are resolv.conf files, but they point at a stub version, and not a useful one, as it is empty

Stromweld commented 8 months ago

the command you posted shows trying to run it for vitrualbox-iso.vm only but the output says it's running for qemu.vm? When I run the command you posted for virtualbox everything works as expected. libvirt or qemu are still experimental and may still need extra work to get them working for many OS's.

karcaw commented 8 months ago

doh.. I'm having the same issue with both of them, I can get you a log from the VirtualBox one as well... the console logs look a little different now that i have installed the new bento: shot-2024-03-29_15-50-47

Stromweld commented 8 months ago

build log would help

karcaw commented 7 months ago

This Build log? ubuntu.build.log

Stromweld commented 7 months ago

I'm not sure what's going on there. It works on my intel mac mini and on Ubuntu 22.04 github actions machine. https://github.com/chef/bento/actions/runs/8540903336/job/23399029339

karcaw commented 7 months ago

what version of virtualbox is on that machine?

Stromweld commented 7 months ago

vbox: 7.0.14 vagrant: 2.4.1 packer: 1.10.2

karcaw commented 7 months ago

Ok, I've moved over to a Rocky9 based system to attempt building on, with a fresh git checkout. Seems to be failing in a different place now. Looks like it time related:
2024-04-03T09:02:02-07:00: ==> virtualbox-iso.vm: E: Release file for http://us.archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease is not valid yet (invalid for another 6h 21min 11s). Updates for this repository will not be applied.

So it may just be something about my host box, or VirtualBox config that is causing the timeout

Stromweld commented 7 months ago

sounds like it. I'm going to close this issue then.