chef / bento

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

Ubuntu 22.04 bento virtual box build fails when curtin errors out (despite netplan fix) #1564

Closed agafonoo closed 2 months ago

agafonoo commented 5 months ago

Version

ubuntu-22.04-x86_64

Environment

The host OS is Ubuntu also.

Scenario

I am using Bento to build an Ubuntu 22.04 box with virtualbox as a provider.

Steps to Reproduce

bento build --only virtualbox-iso.vm --gui os_pkrvars/ubuntu/ubuntu-22.04-x86_64.pkrvars.hcl

Expected Result

The build should finish normally.

Actual Result

Instead, I get the following curtin error:

Screenshot from 2024-04-10 10-58-34

I already fixed my user-data file with the netplan fix, so that's not the issue:

image

Stromweld commented 5 months ago

what version of packer and virtualbox are you running? Currently this is building fine on github hosted runners wich is running ubuntu 22.04 and latest packer/virtualbox versions https://github.com/chef/bento/actions/runs/8622371120/job/23633406501

agafonoo commented 5 months ago

I have Packer v1.10.2 and VirtualBox version 7.0.12 r159484. Let me upgrade to 7.0.14 and see what happens.

agafonoo commented 5 months ago

image

After upgrade to VirtualBox version 7.0.14, confirmed that I am getting the same error.

Sn0wCrack commented 4 months ago

I had this same issue in building for qemu.

I edited packer_templates/http/ubuntu/user-data and replaced the first late-commands that has the if statement in it and replaced it with a previous version of this command:

- 'sed -i "s/dhcp4: true/&\n      dhcp-identifier: mac/" /target/etc/netplan/00-installer-config.yaml'

I get past the initial netplan provisioning, but some networking features don't work post reboot and the provision fails as the VM can't resolve DNS for raw.githubusercontent.com

EDIT:

Got it working in the end by removing the netplan fix instead, image built without issues in the end and also worked without issues after importing it into vagrant, provisioning the VM and using it as normal.

svpernova09 commented 4 months ago

EDIT:

Got it working in the end by removing the netplan fix instead, image built without issues in the end and also worked without issues after importing it into vagrant, provisioning the VM and using it as normal.

Confirming that removing

    - |
      if [ -f /target/etc/netplan/00-installer-config.yaml ]; then
        'sed -i "s/dhcp4: true/&\n      dhcp-identifier: mac/" /target/etc/netplan/00-installer-config.yaml'
      fi

from packer_templates/http/ubuntu/user-data allows the image to be built successfully. Tested with Vagrant and the VM boots and runs as expected.

Tested on Packer 1.9.4 Parallels Version 19.3.1 (54941)

Stromweld commented 4 months ago

unfortunately removing that line causes other issues for bringing up multiple ubuntu boxes and them getting the same IP address. This netplan line is supposed to fix that.

Stromweld commented 2 months ago

hopefully this is fixed now in #1572. feel free to reopen this issue if you find that it still has an issue.