For debugging purposes it can be very(!) helpfull to actually see what's going on on the system.
Either of this commands should work:
$ VAGRANT_LOG=debug vagrant up <machine> $ vagrant up --debug <machine>
An error occurred during installation of VirtualBox Guest Additions 4.3.20. Some functionality may not work as intended.
Very annoying error which is discussed in details here.
- Install OS in VirtualBox.
Configure the box like this:
Create vagrant user
$ useradd -m -G wheel vagrant $ passwd vagrant
$ visudo - # %wheel .... + %wheel
Import Vagrant Public Keys into
$ chown 0400 /home/vagrant/.ssh/authorized_keys $ chown 0700 /home/vagrant/.ssh
Disable DNS resolving for SSH
$ vim /etc/ssh/sshd_conf ... - #UseDNS yes UseDNS no
$ yum install dkms kernel-header kernel-devel make gcc bzip2 perl $ mkdir /mnt/cdrom $ mount /dev/cdrom /mnt/cdrom $ /mnt/cdrom/VBoxLinuxAdditions.run
Create Vagrant folder
$ mkdir /vagrant $ chown vagrant: /vagrant
Shutdown and package the box:
$ vagrant package --base <machine-name> --output <outputfile.box>
... ==> rhel55: Configuring and enabling network interfaces... The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed! cat /etc/redhat-release Stdout from the command: Stderr from the command: sudo: sorry, you must have a tty to run sudo
Put this line in your Vagrant file:
config.ssh.pty = true
NB: This can prevent provisioning scripts from terminating! See next error for details.
Sending SSH keep-alive
When provisioning a host via Vagrant the provisioning script does not seem to terminate and the commands stays in den terminal indefinitly. This affects multiple hosts with different scripts and cannot be pinpointed to a part or command within the provisining script.
Adding more debug output shows the last, repeating command is
DEBUG ssh: Sending SSH keep-alive DEBUG ssh: Sending SSH keep-alive DEBUG ssh: Sending SSH keep-alive ...
This might be related to the SSH pty that cannot be aquired during the process. Set the pty for the machine to false and try again.
config.ssh.pty = false