chef / bento

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

packer build -only=virtualbox-iso rockylinux-8.7-x86_64.json unable to access to ks.cfg virtualbox-7.0 #1459

Closed rubisher closed 1 year ago

rubisher commented 1 year ago

Version:

https://github.com/chef/bento [jlst@rl8-vgr2 bento]$ git log -n 1 commit 141131188f44e9f2b6de3ad91713fd74b50e9faf (HEAD -> main, origin/main, origin/bento_old_json_templates, origin/HEAD) Author: Li-Wen Hsu lwhsu@lwhsu.org Date: Thu Dec 22 23:56:02 2022 +0800

Environment:

Virtualbox running RockyLinux 8.7 based on live XFCE

Scenario:

Following procedure https://computingforgeeks.com/create-rocky-linux-8-vagrant-boxes-using-packer/

Steps to Reproduce:

Follow above mentioned link and install VirtualBox 7.0: $ sudo yum-config-manager --add-repo https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo Adding repo from: https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo

$ sudo dnf install VirtualBox-7.0

Download github chef/bento src , go to rockylinux template: $ cd packer_templates/rockylinux/

And try to build this box with packer: $ packer build -only=virtualbox-iso rockylinux-8.7-x86_64.json

Expected Result:

build the box into $ ls -l ../../builds total 1363716 -rw-r--r--. 1 jlst sysadmins 721915594 Jan 2 17:31 almalinux-8.7.virtualbox.box -rw-r--r--. 1 jlst sysadmins 674527243 Jan 1 14:15 rockylinux-8.7.virtualbox.box drwxr-xr-x. 2 jlst sysadmins 22 Dec 31 17:09 uploaded

As with Virtualbox-6.1

Actual Result:

Nothing created because the created VM get stuck to access its ks.cfg file

I find this possible work-arround: $ diff rockylinux-8.7-x86_64.json.orig rockylinux-8.7-x86_64.json 25c25,28 < "vm_name": "{{ usertemplate}}" --- > "vm_name": "{{ usertemplate}}", > "vboxmanage": [ > ["modifyvm", "{{.Name}}", "--nat-localhostreachable1", "on"] > ]

What do think ? ( apply with success on rockylinux 8 & almalinux 8 )

Tia, Rudy

Stromweld commented 1 year ago

Virtualbox 7.x isolates the host from nat'ed instances by default now. The vbox manage command is then needed for http access to the ks.cfg files otherwise they'd need to be mounted via cdrom or floppy disk.

I am working on a new HCL2 rewrite of the packer files and that config will be added but commented out to make it easy for those on vbox7.x to adjust to make them work.