kaorimatz / packer-templates

Packer templates for Vagrant base boxes
MIT License
491 stars 244 forks source link

DNS lookup broken on OpenBSD installer. #8

Open develCuy opened 8 years ago

develCuy commented 8 years ago

Stuck on console:

$ packer build -only=virtualbox-iso openbsd-6.0-amd64.json 
virtualbox-iso output will be in this color.

==> virtualbox-iso: Downloading or copying ISO
    virtualbox-iso: Downloading or copying: http://ftp.openbsd.org/pub/OpenBSD/6.0/amd64/cd60.iso
==> virtualbox-iso: Starting HTTP server on port 8193
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 2402)
==> virtualbox-iso: Executing custom VBoxManage commands...
    virtualbox-iso: Executing: modifyvm packer-openbsd-6.0-amd64 --memory 512
    virtualbox-iso: Executing: modifyvm packer-openbsd-6.0-amd64 --cpus 1
==> virtualbox-iso: Starting the virtual machine...
==> virtualbox-iso: Waiting 15s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Waiting for SSH to become available...

Error in OpenBSD (after a timeout):

ftp2.eu.openbsd.org: no address associated with name
kaorimatz commented 8 years ago

Hi @develCuy, thank you for sending the PR. On VirtualBox, the DHCP server of the NAT engine offers a list of DNS servers that are configured on the host by default, so you may need to point host's DNS servers to those that are also usable within the guest machine.

ek9 commented 7 years ago

I used these templates to build OpenBSD 6.0 via VirtualBox and I did not experience any problems regarding this. Possibly this is somehow related to insufficient VirtualBox configuration on your machine? It possible you do not have proper networking working with VirtualBox. Make sure you have VirtualBox Host modules installed and loaded. The NAT that is setup by default should be sufficient enough for this. Make sure you use proper DNS server on your host machine too.

develCuy commented 7 years ago

Hey @ek9, not sure what you mean by modules. I'm on an ubuntu box, there are only a couple packages: virtualbox and virtualbox-dkms, things always worked out of the box this way. I can even run the GNU/Hurd, Android and ReactOS, which are as uncommon as OpenBSD for VirtualBox, yet they work. So I get a big question mark here.

ek9 commented 7 years ago

It's not about running different OSs, it's about OpenBSD guest being able to setup correct networking. As networking is working in general, the modules must be loaded and installed (that's what virtualbox-dkms package is for).

Can you provide information on what version of VirtualBox are you running? Also which ubuntu version? Also what DNS servers are set on your Ubuntu host?

Just before your added patch, in the scripts, the command dhclient em0 runs. The dhclient should pickup the correct DNS settings (it does pickup the IP addresses but not DNS). There is something preventing that from working and it would be helpful if you would boot the iso and provide the verbose output of that command.

I've just rerun the openbsd builder and it all went fine. It picked up DNS servers from my network config without any problem.

I think this PR s merely works around your personal networking problem, but if we force google DNS servers like this, it will break other config. The networking part must rely on the DHCP for things to work as expected.