Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot allocate memory (runtime error) #11166

Closed
meyerdg opened this issue Oct 29, 2019 · 6 comments
Closed

cannot allocate memory (runtime error) #11166

meyerdg opened this issue Oct 29, 2019 · 6 comments

Comments

@meyerdg
Copy link

meyerdg commented Oct 29, 2019

Vagrant version

2.2.6

Host operating system

Windows 10 with October 2019 updates

Guest operating system

CentOS 7 (7.7)

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  BOX_NAME = "centos7basekde"
  VM_NAME = "centos7basekde"

  config.vm.box = BOX_NAME
  config.vm.hostname = VM_NAME
  config.vm.define VM_NAME

  config.vm.provider "virtualbox" do |vb|
    vb.gui = true
        vb.name = VM_NAME
  end

  config.vm.provision "file", source: "../scripts/config.sh", destination: "/home/vagrant/config.sh"
  config.vm.provision "file", source: "../scripts/myvars.sh", destination: "/home/vagrant/myvars.sh"
  config.vm.provision "file", source: "~/.ssh/id_rsa", destination: "/home/vagrant/.ssh/id_rsa"
  config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "/home/vagrant/.ssh/id_rsa.pub"
  config.vm.provision "shell", inline: ". /home/vagrant/config.sh"

end

Debug output

https://gist.github.com/meyerdg/6f4e4e387decb2905be5a03d1712fb2c

Expected behavior

VM provisioned and running normally. Available for login and continued development work.

Actual behavior

Crash on ssh key update and remove VM from Virtualbox.

Steps to reproduce

  1. Windows 10 with the latest updates.
  2. CentOS 7 vagrant box VirtualBox target built locally with packer and installed from local
  3. vagrant up as normal - crashes out 9 times out of 10.

Host OS has 32GB ram. Guest OS uses 8GB. These were working correctly prior to Windows update.

VirtualBox 6.0.14
Packer 1.4.2
cygwin 3.0.7
Vagrant 2.2.6
CentOS 7.7

References

maybe issue 5600? It looks similar

@chrisroberts
Copy link
Member

Hi there,

Based on the debug information you have provided, your host system has run out of memory and cannot allocate required memory to perform an operation:

ERROR warden: Error occurred: scp: /tmp/vagrant-insert-pubkey-1572381127: Cannot allocate memory

Freeing up some memory on the host system should resolve the issue.

Cheers!

@meyerdg
Copy link
Author

meyerdg commented Oct 29, 2019

Disagree. The host never got above 12GB out of 32 available. I'm not even at half my capacity.

A new more recent run of vagrant up has crashed in a different place and left the VM in tact.

user@host ~/git2/vagrant/centos7/base-kde
$ vagrant up
...
mkdir -p /vagrant
Stdout from the command:

Stderr from the command:
mkdir: cannot create directory ‘/vagrant’: Cannot allocate memory

user@host ~/git2/vagrant/centos7/base-kde
$ 

This isn't a host memory issue.

@briancain
Copy link
Member

@meyerdg - The fact that you can't run mkdir on the guest tells me that it's an issue with your virtual machine. If you can't run mkdir, then neither can Vagrant. Vagrant is essentially just calling out to these system tools to perform these operations like making directories. And that's true of any other tool Vagrant needs to use to configure and provision a guest. I'm guessing @chrisroberts meant guest, not host. Regardless, if you can't get Vagrant to run scp to copy a key to the guest, or make a directory on the guest, it's clearly and issue with the guest not being able to allocate enough memory to perform these operations. This isn't a Vagrant issue, you need to make sure your guest has enough memory to perform these operations.

@meyerdg
Copy link
Author

meyerdg commented Oct 30, 2019

@briancain What's odd is I was able to do the same on the machine manually immediately after it failed and the typed command worked without issue.

@p4ulie
Copy link

p4ulie commented Jan 20, 2020

For me, Virtualbox parameters were the problem;

    vb.cpus = 1
    vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]

without them it works normally.

Virtualbox 6.0.14 r133895 (Qt5.12.4) (similar version as original post, I wonder if it is the cause)
Vagrant 2.2.3
Host: Ubuntu 19.10
Guest: Redhat 7.6 (bento/centos-7.6)

@ghost
Copy link

ghost commented Jan 28, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jan 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants