Virtualbox / Vagrant "closed by remote host" during routine use
I encountered the same issue, and it was the RAM, was filled by a huge rsync
command. Same applys for cp
or mv
from within a VM. I imagine that it will be the same with a big apt install ...
on pip install ...
. You need more RAM or find workarounds.
You can try to figure it out too by running your script/provision and in another tab, htop
from the host. For me, the RAM get filled more and more each seconds until the crash when Out Of Memory (OOM killer) occurs. The ssh
error is just a consequence, not the root cause.
A posssible workaround is:
mount --bind host-shared-dir mountpoint
Note
If someone knows why cp/mv/rsync takes so much RAM from host when you rsync
from within a VM, please explain ;)
Related videos on Youtube
Patrick Moore
Updated on September 18, 2022Comments
-
Patrick Moore over 1 year
I am attempting to install OpenTreeMap in a Ubuntu environment. Hosted at DigitalOcean, one of their "Droplets". As part of the install process I have installed and configured Virtual Box and Vagrant to virtualize the environment. I have made it part-way through various
apt-get install
and each time, I am disconnected from the Virtual box.[Unpacking libicu48 (from .../libicu48_4.8.1.1-3_i386.deb) ... [/*varies*/] Connection to 127.0.0.1 closed by remote host. Connection to 127.0.0.1 closed.
I execute using:
vagrant up vagrant ssh
Once virtualized, the connection is closed when downloading/installing packages. Not always the same stop point, but it always forces a disconnect. I am still connected to my box via SSH, and when I run
vagrant status
I show the virtual box as "aborted":Current VM states: default aborted The VM is in an aborted state. This means that it was abruptly stopped without properly closing the session. Run `vagrant up` to resume this virtual machine. If any problems persist, you may have to destroy and restart the virtual machine.
UPDATE: Tried the recommendation in the comments, I got further through the process and closer, but it is still forcing a disconnect through normal use of
vagrant
. This time, at apip install
command.Any clue as to why this might be occurring?
-
Danila Ladner over 10 yearswhat if you install packages one by one?
-
Patrick Moore over 10 years@DanilaLadner thank you, I tried one by one and was able to get through part of the install process. Even still, I continue to get disconnected through normal use of
vagrant ssh
virtualization. -
nickgrim over 10 yearsIs it possible that your server is running out of RAM, and the OOM-killer is killing your VirtualBox process?
-
Gilles Quenot over 3 yearsDid you find a solution, I have the same issue
-
Patrick Moore over 3 years@GillesQuenot I never did :( I did manage to get OTP running, without virtualization, but it was still many other challenges.
-
-
Gilles Quenot over 3 yearsIf the vm crash, it's not a ssh config that will prevent this. The issue is not ssh, see my answer