3

I'm experiencing the following.

If I download and run a base box (ubuntu/trusty64), make some modifications like installing packages, then shutdown and repackage the box, on subsequent imports it fails to connect on vagrant up.

This is not the transient wait-for-connection error, this hangs forever:

default: SSH address: 127.0.0.1:2200
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...

Workflow is:

vagrant box add ubuntu/trusty64
vagrant init
# change config.vm.box in Vagrantfile to ubuntu/trusty64
vagrant up
vagrant ssh -c "sudo apt-get -y install git"
vagrant halt
vagrant package --output some-box.box
vagrant destroy

vagrant box add --name some-box ./some-box.box
# change config.vm.box in Vagrantfile to some-box
vagrant up

... this does not work.

I suspect this has something to do with VirtualBox networking and some sort of mapping or value that I need to capture or reset prior to packaging but I don't know what.

Sam Halicke
  • 6,222
  • 1
  • 25
  • 35

3 Answers3

1

I had this issue. For me it turned out that the version of the box was set to "Ubuntu (32 bit)". Changing this to "Ubuntu (64 bit)" under Settings/General via the VirtualBox GUI fixed it. This appears to be a miss-configuration of the box image.

If this is not case for you, starting the box with GUI enabled or through the VirtualBox interface is the best way to debug reasons for hanging. For example, it may also be the boot loader waiting for input.

user228930
  • 11
  • 1
0

I've stumbled upon the same issue with the ubuntu/trusty64 box. The solution I've found was to set up your eth1 card as follows:

Create the file at /etc/network/interfaces.d/eth1.cfg with the following content.

auto eth1
iface eth1 inet dhcp
masegaloeh
  • 18,236
  • 10
  • 57
  • 106
0

I think I have same exact issue. I managed to find that your problem is actually related to vagrant package doesn't export some ubuntu "special/related" Vagrantfile that is coming with the default ubuntu box.

You can see that this file here: ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20170116.1.0/virtualbox/Vagrantfile (adjust to your own path) will include extra information that your corresponding Vagrantfile in your some-box will not.

I tried to include this file by vagrant package --vagrantfile Vagrantfile_ubuntu with no luck :/. I don't know how to fix this and I believe cloud-init is also somewhere involved in all this mess.

Have you managed to find something?