Vagrant refusing to start (Remote connection disconnect) - linux

Vagrant refuses to start after making some changes to networking, I was getting the following;
$ vagrant up
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
I tried to fix this by restarting the service (which failed), which then resulted in this;
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["hostonlyif", "create"]
Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterface, interface IHostNetworkInterface
VBoxManage: error: Context: "int handleCreate(HandlerArg*, int, int*)" at line 66 of file VBoxManageHostonly.cpp
Others recommended restarting VirtualBox service, but this also failed;
✗ sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart
Unloading VBoxDrv.kext
(kernel) Can't remove kext org.virtualbox.kext.VBoxDrv; services failed to terminate - 0xe00002c7.
Failed to unload org.virtualbox.kext.VBoxDrv - (iokit/common) unsupported function.
Error: Failed to unload VBoxDrv.kext
Fatal error: VirtualBox

After much digging, it appears the restart command was failing due to VirtualBox processes holding locks.
This was fixed by doing;
# kill all virtualbox related processes
$ ps aux | grep vbox -i | awk -F ' ' '{print $2}' | xargs
# restart virtualbox service
$ sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart
# try again
$ vagrant up

This worked for me..
make sure you have enable adapter 2 on virtualbox

Related

dovecot unable to start due to address already in use

I upgraded my Linux kernel and dovecot failed to start with the following error messages:
Error: service(managesieve-login): listen(*, 4190) failed: Address already in use
Error: service(pop3-login): listen(*, 110) failed: Address already in use
Error: service(pop3-login): listen(*, 995) failed: Address already in use
Error: service(imap-login): listen(*, 143) failed: Address already in use
Error: service(imap-login): listen(*, 993) failed: Address already in use
Fatal: Failed to start listeners
Strangely enough, I couldn't find any process bounded to those port numbers. All commands below return nothing.
# netstat -tulpn | grep 110
# ss -tulpn |grep 110
# fuser 110/tcp
# lsof -i :110
I also tried to change the listen setting to my specific IP address and it still failed the same way.
Any idea how I can solve this problem? Here's my version info:
# uname -a
Linux ip-172-31-26-222 4.14.177-107.254.amzn1.x86_64 #1 SMP Thu May 7 18:30:14 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
# dovecot --version
2.2.36 (1f10bfa63)
Hi it looks like you are using AWS as I am. I recently updated via Yum as well. I noticed that a new package named 'portreserve' was also installed. I killed that process, left the /etc/dovecot/dovecot.conf as it was before and then started Dovecot successfully. I was also immediately able to reconnect my mail clients connection. I hope that helps you.
I also restarted the portreserve program since it seems useful to limit port access.

Vagrant will not boot up Ubuntu

I am trying to boot a new machine up using Vagrant on my MacBook Pro. I already have one working linux machine on my Macbook but trying to boot up another.
Here is the error I am getting when running vagrant up.
==> default: Checking if box 'ubuntu/trusty64-juju' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 => 2122 (adapter 1)
default: 80 => 6080 (adapter 1)
default: 6079 => 6079 (adapter 1)
default: 22 => 2200 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
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: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
I have also tried vagrant reload but same problem.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/trusty64-juju"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL
end
Can anyone suggest a fix?
I can confirm that the issue was I had created a 64-bit Ubuntu box which is not supported by my CPU.
I installed ubuntu/trusty32 package and it worked first time.
vagrant init ubuntu/trusty32
I hope this helps someone else.

Faillure to launch docker on OSX Yosemite

I'm having troubles to install Docker on Mac OS X Yosemite (10.10.4): when I try with the Docker Quickstart Terminal from the Docker Toolbox I get this:
. '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
bash-3.2$ . '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
Creating Machine default...
executing: /usr/local/bin/VBoxManage
STDOUT: Oracle VM VirtualBox Command Line Management Interface Version 5.0.2
(C) 2005-2015 Oracle Corporation
All rights reserved.
Usage:
VBoxManage [<general option>] <command>
STDERR:
Creating VirtualBox VM...
Creating SSH key...
Creating disk image...
Creating 20000 MB hard disk image...
Converting from raw image file="stdin" to file="/Users/arbi/.docker/machine/machines/default/disk.vmdk"...
Creating dynamic image with size 20971520000 bytes (20000MB)...
executing: /usr/local/bin/VBoxManage createvm --basefolder /Users/arbi/.docker/machine/machines/default --name default --register
STDOUT: Virtual machine 'default' is created and registered.
UUID: e0f2a54b-b11a-47e2-9f3e-450f6fea78c8
Settings file: '/Users/arbi/.docker/machine/machines/default/default/default.vbox'
STDERR:
VM CPUS: 1
VM Memory: 2048
executing: /usr/local/bin/VBoxManage modifyvm default --firmware bios --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 0 --biosbootmenu disabled --ostype Linux26_64 --cpus 1 --memory 2048 --acpi on --ioapic on --rtcuseutc on --natdnshostresolver1 off --natdnsproxy1 off --cpuhotplug off --pae on --hpet on --hwvirtex on --nestedpaging on --largepages on --vtxvpid on --accelerate3d off --boot1 dvd
STDOUT:
STDERR:
executing: /usr/local/bin/VBoxManage modifyvm default --nic1 nat --nictype1 82540EM --cableconnected1 on
STDOUT:
STDERR:
using 192.168.99.1 for dhcp address
executing: /usr/local/bin/VBoxManage list hostonlyifs
STDOUT: Name: vboxnet0
GUID: 786f6276-656e-4074-8000-0a0027000000
DHCP: Disabled
IPAddress: 192.168.99.1
NetworkMask: 255.255.255.0
IPV6Address:
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:00
MediumType: Ethernet
Status: Down
VBoxNetworkName: HostInterfaceNetworking-vboxnet0
STDERR:
executing: /usr/local/bin/VBoxManage modifyvm default --nic2 hostonly --nictype2 82540EM --hostonlyadapter2 vboxnet0 --cableconnected2 on
STDOUT:
STDERR:
executing: /usr/local/bin/VBoxManage storagectl default --name SATA --add sata --hostiocache on
STDOUT:
STDERR:
executing: /usr/local/bin/VBoxManage storageattach default --storagectl SATA --port 0 --device 0 --type dvddrive --medium /Users/arbi/.docker/machine/machines/default/boot2docker.iso
STDOUT:
STDERR:
executing: /usr/local/bin/VBoxManage storageattach default --storagectl SATA --port 1 --device 0 --type hdd --medium /Users/arbi/.docker/machine/machines/default/disk.vmdk
STDOUT:
STDERR:
executing: /usr/local/bin/VBoxManage guestproperty set default /VirtualBox/GuestAdd/SharedFolders/MountPrefix /
STDOUT:
STDERR:
executing: /usr/local/bin/VBoxManage guestproperty set default /VirtualBox/GuestAdd/SharedFolders/MountDir /
STDOUT:
STDERR:
executing: /usr/local/bin/VBoxManage sharedfolder add default --name Users --hostpath /Users --automount
STDOUT:
STDERR:
executing: /usr/local/bin/VBoxManage setextradata default VBoxInternal2/SharedFoldersEnableSymlinksCreate/Users 1
STDOUT:
STDERR:
Starting VirtualBox VM...
executing: /usr/local/bin/VBoxManage showvminfo default --machinereadable
STDOUT: name="default"
groups="/"
ostype="Linux 2.6 / 3.x / 4.x (64-bit)"
UUID="e0f2a54b-b11a-47e2-9f3e-450f6fea78c8"
CfgFile="/Users/arbi/.docker/machine/machines/default/default/default.vbox"
SnapFldr="/Users/arbi/.docker/machine/machines/default/default/Snapshots"
LogFldr="/Users/arbi/.docker/machine/machines/default/default/Logs"
hardwareuuid="e0f2a54b-b11a-47e2-9f3e-450f6fea78c8"
memory=2048
. . .
SharedFolderNameMachineMapping1="Users"
SharedFolderPathMachineMapping1="/Users"
STDERR:
using 192.168.99.1 for dhcp address
executing: /usr/local/bin/VBoxManage list hostonlyifs
STDOUT: Name: vboxnet0
GUID: 786f6276-656e-4074-8000-0a0027000000
DHCP: Disabled
IPAddress: 192.168.99.1
NetworkMask: 255.255.255.0
IPV6Address:
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:00
MediumType: Ethernet
Status: Down
VBoxNetworkName: HostInterfaceNetworking-vboxnet0
STDERR:
executing: /usr/local/bin/VBoxManage modifyvm default --nic2 hostonly --nictype2 82540EM --hostonlyadapter2 vboxnet0 --cableconnected2 on
STDOUT:
STDERR:
executing: /usr/local/bin/VBoxManage modifyvm default --natpf1 delete ssh
STDOUT:
STDERR: VBoxManage: error: Code NS_ERROR_INVALID_ARG (0x80070057) - Invalid argument value (extended info not available)
VBoxManage: error: Context: "RemoveRedirect(Bstr(ValueUnion.psz).raw())" at line 1766 of file VBoxManageModifyVM.cpp
executing: /usr/local/bin/VBoxManage modifyvm default --natpf1 ssh,tcp,127.0.0.1,52532,,22
STDOUT:
STDERR:
executing: /usr/local/bin/VBoxManage startvm default --type headless
STDOUT: Waiting for VM "default" to power on...
VM "default" has been successfully started.
STDERR:
Error creating machine: exit status 1
You will want to check the provider to make sure the machine and associated resources were properly removed.
Starting machine default...
exit status 1
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
Setting environment variables for machine default...
host is not running
docker is configured to use the default machine with IP
For help getting started, check out the docs at https://docs.docker.com
default is not running. Please start this with docker-machine start default
When I try to start the machine manually, it fails to run again:
$ docker-machine create --driver virtualbox default
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Error creating machine: exit status 1
You will want to check the provider to make sure the machine and associated resources were properly removed.
But then when I open VirtualBox, I see the default machine powered off, If I try to start it manually it fails and I get the following error:
Failed to open a session for the virtual machine default.
Failed to load VMMR0.r0 (VERR_VMM_SMAP_BUT_AC_CLEAR).
Result Code: NS_ERROR_FAILURE (0x80004005)
Component: ConsoleWrap
Interface: IConsole {872da645-4a9b-1727-bee2-5585105b9eed}
Any idea why it's failing to start the default machine?
I had to downgrade to VirtualBox 4.3 to make the Docker host starts successfully.
Uninstall VirtualBox:
To uninstall VirtualBox, open the disk image (dmg) file again and double-click on the uninstall icon contained therein.
Then re-install the Docker toolbox.

"vagrant up" succeeds but "vagrant ssh" fails with "VM must be running to open SSH connection"

On a Fedora Linux 3.6.11 system I'm using Jenkins to concurrently run two jobs that use the same script to test a software package on two different VMs. One of the jobs routinely fails because Vagrant can't ssh(1) to the VM that it just created.
The script contains this:
set -e
$vmName=...
( flock 9; vagrant up $vmName # attempt to prevent concurrent "vagrant up"
) 9>/tmp/`basename $0`-$USER
trap "vagrant destroy --force $vmName; `trap -p EXIT`" EXIT
# Execute test commands on the virtual machine:
vagrant ssh $vmName -- -T <<EOF
...
EOF
Here's the failure output (with some elision):
+ flock 9
+ vagrant up centos64_64
Bringing machine 'centos64_64' up with 'virtualbox' provider...
==> centos64_64: Importing base box 'centos-6.4-x86_64-devel'...
[KProgress: 10%
...
[K==> centos64_64: Matching MAC address for NAT networking...
==> centos64_64: Setting the name of the VM: delivery_centos64_64_1425494409930_40170
==> centos64_64: Fixed port collision for 22 => 2222. Now on port 2200.
==> centos64_64: Clearing any previously set network interfaces...
==> centos64_64: Preparing network interfaces based on configuration...
centos64_64: Adapter 1: nat
==> centos64_64: Forwarding ports...
centos64_64: 22 => 2200 (adapter 1)
==> centos64_64: Booting VM...
==> centos64_64: Waiting for machine to boot. This may take a few minutes...
centos64_64: SSH address: 127.0.0.1:2200
centos64_64: SSH username: vagrant
centos64_64: SSH auth method: private key
centos64_64: Warning: Connection timeout. Retrying...
centos64_64: Warning: Connection timeout. Retrying...
centos64_64: Warning: Remote connection disconnect. Retrying...
==> centos64_64: Machine booted and ready!
==> centos64_64: Checking for guest additions in VM...
==> centos64_64: Mounting shared folders...
centos64_64: /vagrant = <http://spock:8080/jenkins/job/LDM_Acceptance_64 bit_CentOS_6.4/ws/archive/delivery>
centos64_64: /tmp/vagrant-puppet-2/manifests => <http://spock:8080/jenkins/job/LDM_Acceptance_64-bit_CentOS_6.4/ws/archive/delivery/puppet>
==> centos64_64: Running provisioner: puppet...
==> centos64_64: Running Puppet with centos-devel.pp...
==> centos64_64: Notice: Compiled catalog for centos6464.unidata.ucar.edu in environment production in 1.30 seconds
++ trap -p EXIT
+ trap 'vagrant destroy --force centos64_64; ' EXIT
+ vagrant ssh centos64_64 -- -T
VM must be running to open SSH connection. Run `vagrant up`
to start the virtual machine.
+ vagrant destroy --force centos64_64
==> centos64_64: Destroying VM and associated drives...
==> centos64_64: Running cleanup tasks for 'puppet' provisioner...
Both VMs are NATed. The successful job's VM got port 2222 for ssh(1) while the failed job's VM (above) got port 2200. Each job has its own directory and copy of the Vagrantfile.
Any advice on how to ensure that both vagrant ssh-s succeed would be appreciated.

Vagrant up and reload - default: Warning: Connection timeout. Retrying...

I had a fully functional vagrant for three months now, but for the last three days, I am getting errors whenever I try to run vagrant up or vagrant reload.
This is the error I get when running vagrant reload
default: Attempting graceful shutdown of VM...
default: Guest communication could not be established! This is usually because
default: SSH is not running, the authentication information was changed,
default: or some other networking issue. Vagrant will force halt, if
default: capable.
default: Forcing shutdown of VM...
default: Clearing any previously set forwarded ports...
default: Clearing any previously set network interfaces...
default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
default: Forwarding ports...
default: 80 => 8080 (adapter 1)
default: 22 => 2222 (adapter 1)
default: Running 'pre-boot' VM customizations...
default: Booting VM...
default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
I am using Elementary OS Luna and updated the latest versions of vagrant as well as virtualbox as some answers suggested. But the problems persist.
I have tried most of the popular solutions including enabling the GUI and this. I also tried the solution given here but could not since my virtual box doesn't login.
However, the GUI presented me with this:
keys: press S to skip mounting or M for manual recovery
I tried both the keys one by one but the problem still remains.
Has anyone had this before who could offer a solution, vagrant isn't widely covered on the web yet and I cant find a reason why this is occurring.
After struggling with all the various options available on different questions, I was still facing the same problem.
Finally, I did a
vagrant destroy
followed by
vagrant up
And I have my system working again.
Note: If you too have the habit to directly switch off your computer, you might face this problem soon! In your vagrant terminal (vagrant ssh), always go for a:
sudo shutdown -h now
or you can just type
vagrant halt
after you logout from your ssh.
PS: For those of you who might be afraid to lose your data/code/anything during vagrant destroy, you might relax! I was hesitant using the command, but as per the documentation, all it does is:
This command stops the running machine Vagrant is managing and destroys all resources that were created during the machine creation process. After running this command, your computer should be left at a clean state, as if you never created the guest machine in the first place.
This implies that your code will remain intact, and the next vagrant up would lead you to the same state as you left, only with the problem solved now. :)
Instead of destroying the image. I was able to fix the issue by first adding the following lines/uncomment inside Vagrantfile to turn the virtualbox gui on.
config.vm.provider "virtualbox" do |vb|
vb.gui = true
vb.memory = "1024"
end
Then I did vagrant up to reboot it. It started both command line and virtualbox gui. Gui asked me for SSH passphrase (which I set up when I was playing with ssh last time I was logged into the machine) and I was able to login. Later I powered off the image. Later I removed above lines for gui from Vagrantfile and it was still booting fine.

Resources