Varying-Vagrant-Vagrants / VVV

An open source Vagrant configuration for developing with WordPress
https://varyingvagrantvagrants.org
MIT License
4.54k stars 847 forks source link

Vagrant Up Error #2199

Closed saintaze closed 4 years ago

saintaze commented 4 years ago

when I run vagrant up I get the following error

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["clonemedium", "/Users/ayaz/VirtualBox VMs/vagrant-local_4f281cf1fdb/ubuntu-bionic-18.04-cloudimg.vmdk", "/Users/ayaz/VirtualBox VMs/vagrant-local_4f281cf1fdb/ubuntu-bionic-18.04-cloudimg.vdi", "--format", "VDI"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...
Progress state: NS_ERROR_INVALID_ARG
VBoxManage: error: Failed to clone medium
VBoxManage: error: Cannot register the hard disk '/Users/ayaz/VirtualBox VMs/vagrant-local_4f281cf1fdb/ubuntu-bionic-18.04-cloudimg.vdi' {a3b0c9c7-90e7-4a83-8990-606de9a4dcc9} because a hard disk '/Users/ayaz/VirtualBox VMs/vagrant-local_4f281cf1fdb/ubuntu-bionic-18.04-cloudimg.vdi' with UUID {060b8e2c-b3b0-40ad-a278-6a7bcfb16380} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBoxWrap, interface IVirtualBox
VBoxManage: error: Context: "RTEXITCODE handleCloneMedium(HandlerArg *)" at line 1071 of file VBoxManageDisk.cpp
welcome[bot] commented 4 years ago

Thanks for opening your first issue here! Be sure to follow the issue template and include your OS/Vagrant/VVV versions! Don't forget you can get support in the VVV slack at https://varyingvagrantvagrants.org/docs/en-US/slack/

Varying Vagrant Vagrants
VVV Slack Workspace
Join the VVV Slack Workspace
tomjn commented 4 years ago

Hello!

When you open an issue it asks you some super important questions but those aren’t answered in your issue :(

We really need to know some basics like what OS you use, the version of vagrant and virtual box you’re trying to use.

Additionally, when you said you ran vagrant up can we see the full output not just the error message? Is this a brand new VM? An old VM?

Give us as much info as possible. If you don’t know the answer that’s okay but say so. We need that information to help you, it isn’t optional

saintaze commented 4 years ago

OS: Catalina 10.15.5 Vagrant: 2.2.9 Virtual Box: 6.1.10

Following is the full log including error at the end

Platform: platform-darwin19.2.0 shell:/bin/zsh vagrant-hostsupdater vagrant-disksize shared_db_folder_disabled, VVV Path: "/Users/ayaz/vagrant-local"
Vagrant: v2.2.9, VirtualBox: v6.1.10r138449

Docs:       https://varyingvagrantvagrants.org/
Contribute: https://github.com/varying-vagrant-vagrants/vvv
Dashboard:  http://vvv.test

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/bionic64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/bionic64'
    default: URL: https://vagrantcloud.com/ubuntu/bionic64
==> default: Adding box 'ubuntu/bionic64' (v20200617.0.0) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/ubuntu/boxes/bionic64/versions/20200617.0.0/providers/virtualbox.box
Download redirected to host: cloud-images.ubuntu.com
==> default: Successfully added box 'ubuntu/bionic64' (v20200617.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/bionic64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/bionic64' version '20200617.0.0' is up to date...
==> default: Setting the name of the VM: vagrant-local_4f281cf1fdb
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:

  https://www.virtualbox.org/manual/ch04.html#sharedfolders

This option can be disabled globally with an environment variable:

  VAGRANT_DISABLE_VBOXSYMLINKCREATE=1

or on a per folder basis within the Vagrantfile:

  config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> 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 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["clonemedium", "/Users/ayaz/VirtualBox VMs/vagrant-local_4f281cf1fdb/ubuntu-bionic-18.04-cloudimg.vmdk", "/Users/ayaz/VirtualBox VMs/vagrant-local_4f281cf1fdb/ubuntu-bionic-18.04-cloudimg.vdi", "--format", "VDI"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...
Progress state: NS_ERROR_INVALID_ARG
VBoxManage: error: Failed to clone medium
VBoxManage: error: Cannot register the hard disk '/Users/ayaz/VirtualBox VMs/vagrant-local_4f281cf1fdb/ubuntu-bionic-18.04-cloudimg.vdi' {a3b0c9c7-90e7-4a83-8990-606de9a4dcc9} because a hard disk '/Users/ayaz/VirtualBox VMs/vagrant-local_4f281cf1fdb/ubuntu-bionic-18.04-cloudimg.vdi' with UUID {060b8e2c-b3b0-40ad-a278-6a7bcfb16380} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBoxWrap, interface IVirtualBox
VBoxManage: error: Context: "RTEXITCODE handleCloneMedium(HandlerArg *)" at line 1071 of file VBoxManageDisk.cpp
tomjn commented 4 years ago

Have you ever ran vagrant commands using sudo or as the root user?

saintaze commented 4 years ago

emmm... no I guess I never did that

tomjn commented 4 years ago

I also see the vagrant disk size plugin is active, is this a recent addition? And have you set the disk size in your config file to something other than the default?

saintaze commented 4 years ago

In Vagrant file I added config.disksize.size = '50GB'

in config.yml

vagrant-plugins:
  disksize: 50GB 
tomjn commented 4 years ago

Hmm so if you do that but a VM has already been created then Virtualbox doesn’t know how to resize it. To use vagrant disk size you might need to destroy and recreate the VM so that resizing is possible.

saintaze commented 4 years ago

I actually tried that, deleting the VM from Virtual Box and also deleting it from VirtualBox Vms folder

But again when I run vagrant up I get this error

tomjn commented 4 years ago

You would need to undo the changes, vagrant destroy, redo the changes, then provision the new VM. By manually destroying the VM you might have cause issues that require manual clean up, as there’s a virtual disk file present that shouldn’t be there

saintaze commented 4 years ago

ok so i destroyed. Would that still show vagrant-local_{hash} in VirtualBox Vms folder

I see one there still, but Virtual Box is empty

saintaze commented 4 years ago

so i removed config.disksize.size = '50GB' from Vagrant file ran vagrant destroy then vagrant up still the same error

tomjn commented 4 years ago

Have you tried deleting the /Users/ayaz/VirtualBox VMs/vagrant-local_4f281cf1fdb/ folder? VB might think there's nothing there, but it's been known to leave things behind and not clean up after itself properly.

saintaze commented 4 years ago

Hey Tom,

so I did the steps you said and it was still giving me the same error. So I uninstalled and reinstalled Virtualbox and Vagrant and I also deleted the vagrant-local. And took the following steps.

config.yml

and get the following error at the very end. But I guess I am getting some others in between as well.

 default: Job for mariadb.service failed because the control process exited with error code.
 default: See "systemctl status mariadb.service" and "journalctl -xe" for details.

full log

Now the interesting thing is that if I don't include my project repo in config.ymland let vagrant run with default WordPress templates repo only, everything works fine. It will provision those projects and I can go to vvv.test and open those projects and can get into phpMyAdmin as well.

But when I include my project repo in config.yml I get this error. Now, I have been told that other guys in the company have been easily able to provision this said project and there are no problems on their side. So I guess it is only related to my side, only I am getting this error over and over. The provisioning of this repo takes 5 hours. So if I start from scratch I have to wait for 5 every time for it to be setup. And I am trying for 5 days in different ways to get this project to work but to no avail.

If I need to start fresh I can afford that. I need to get this project up and running so I can work on it.

tomjn commented 4 years ago

Are you sure that you need this vagrant plugin? That folder is a mapped mounted folder, it could contain 50 terabytes of data and as long as the host system has 50 TB to spare it would work. It is not stirred in the virtual disk so it does not count.

If 50GB of disk space inside the VM is not enough then I have to question what exactly you’re storing in non mapped folders. People who’ve ran into the default 10GB are uncommon and do so because they have massive databases.

Are you sure this isn’t your host machine just running out of disk space?

And what on Earth is that provisioner doing that takes 5-6 hours?!

On Fri, 19 Jun 2020 at 19:51, Ayaz Ahmed notifications@github.com wrote:

Hey Tom,

so I did the steps you said and it was still giving me the same error. So I uninstalled and reinstalled Virtualbox and Vagrant and I also deleted the vagrant-local. And took the following steps.

  • cloned vagrant repo
  • added config.yml
  • included my repo into the config.yml
  • cd into vagrant-local
  • ran vagrant up

config.yml https://gist.github.com/saintaze/437a9626a7ebdb4a4e3f205d157567ad

and get the following error.

error log https://gist.github.com/saintaze/7f35a3a95535f51e2d777eb3c29020ea

Now the interesting thing is that if I don't include my project repo in config.yml and let vagrant run with default WordPress templates repo only, everything works fine. It will provision those projects and I can go to vvv.test and open those projects and can get into phpMyAdmin as well.

But when I include my project repo in config.yml I get this error. Now, I have been told that other guys in the company have been easily able to provision this said project and there are no problems on their side. So I guess it is only related to my side, only I am getting this error over and over. The provisioning of this repo takes 5 hours. So if I start from scratch I have to wait for 5 every time for it to be setup. And I am trying for 5 days in different ways to get this project to work but to no avail.

If I need to start fresh I can afford that. I need to get this project up and running so I can work on it.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/Varying-Vagrant-Vagrants/VVV/issues/2199#issuecomment-646814883, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOLZ36YWCP4P55DCLES63RXOXSDANCNFSM4OCGTO5A .

poncho1290 commented 4 years ago

Hey, I'm getting a similar error when run vagrant up OS: Mojave 10.14.6 Vagrant: 2.2.9 Virtual Box: 6.0.22

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/bionic64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/bionic64' version '20200618.0.0' is up to date...
==> default: Setting the name of the VM: vagrant-local_f79e87d1c3d
==> 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 HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 94 of file VBoxManageHostonly.cpp
saintaze commented 4 years ago

And what on Earth is that provisioner doing that takes 5-6 hours?!

Beats me I am a new recruit to the project and also to the vagrant world. I have no idea why it takes hours. I guess a huge database.

My host currently has 300GB Storage available.

As I have mentioned I have uninstalled and reinstalled things, so in the new setup, I haven't included the disk size plugin.

So now I am getting mariadb.service error that you can see in the log. Any idea how I can fix that?

Mte90 commented 4 years ago

Usually this is an issue of virtualbox that doesn't involve VVV. The 2 issues are different the first one is a virtual image issue this one instead is about connectivity.

tomjn commented 4 years ago

Hey, I'm getting a similar error when run vagrant up

@poncho1290 can you open a new issue? There is no overlap between these issues.

tomjn commented 4 years ago

@saintaze this is the problem:

default: WordPress database error Disk full (/tmp/#sql_12a6_0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")

Everything that happens after that is caused by that. Always try to fix the first error you encounter when debugging, not the last. If a single site requires a 50GB+ database for local development then there are serious problems. The specific queries it says it was trying to run when it ran out of memory implies this database contains all the form submissions, which could be a major problem especially in the EU. Any personal data means this is toxic and could have major legal consequences. E.g. if you lost your machine that would be a data breach that would need to be reported.

For context, I've worked with sites that get billions of page views daily and have very large databases, but to see something that wouldn't fit in 10GB or even 50 is rare. You should not need something capable of storing that much data to do local development.

You can try to bump up the size of the VM ( assuming it is indeed 50GB ), but I recommend downsizing to a more manageable database size, if not for practical reasons, or performance reasons, but because it sounds like the setup uses a full production database, and that carries legal and privacy risks. Nobody needs 50GB+ of database, and your colleagues should be able to tell you how big it is rather than having to guess.

Additionally, it looks like this isn't a standard site. I don't know what git@bitbucket.org:incsub/incsub-site-template.git contains, so it's mystery sauce, and I can't debug that. It does seem to be doing a lot of weird stuff, e.g. installing system level packages.

There's also the chance that the vagrant disksize plugin doesn't work, but there's no confirmation that you got a 50GB disk when you asked for a 50GB dsk. If that's the case then there's nothing that can be done at the VVV side of things to fix that plugin.

TLDR:

  1. That database is huuuuuuuge, your VM ran out of disk space.
  2. There's nothing wrong with MariaDB, it just ran out of disk space trying to import that massive DB in that repo
  3. Talk to your colleagues, find out how big it actually is instead of guessing so you can ask for the right amount of space on config/config.yml
  4. you don't need multi-GB production databases in the double figures to do local development ( maybe if you're a data scientist )
  5. Custom provisioners, we can't see them, no way to debug or assist from here. You need to speak with your colleagues about those.
saintaze commented 4 years ago

wow, Thanks, Tom for your detailed reply.

I have the same concerns you have especially about huge DB. The local environment should be lean and snappy, easy to spin up, and halt. having such large DB bogs it down.

Could you tell me how I can resize the disk?

There is this plugin

vagrant plugin install vagrant-disksize

with the following setting in Vagrant file

vagrant.configure('2') do |config|
    config.disksize.size = '50GB'
end

On Vagrant docs for Resizing primary disk, I find:

This feature currently requires the experimental flag to be used. To explicitly enable this feature, you can set the experimental flag to:

VAGRANT_EXPERIMENTAL="disks"

config.vm.disk :disk, size: "50GB", primary: true

In config.yml I have

vagrant-plugins:
  disksize: 50GB 

Could you tell me how all these three work, do they all work together or individually? What do I have to do to resize to 50GB

How can I know if it has been successfully resized? Because maybe I think it is resized to '50GB' but under the hood, it may not be the case.

If I make changes to the Vagrant file, can I simply say vagrant up and the changes would be factored in or I have to run some command to affect Vagrantfile changes?

So maybe after it has been resized successfully to '50gb' I can try to import the database again.

Also another question along the database lines.

in config.yml I have

db_backup: true
db_restore: true

Would the above lines backup my DB by itself or I have to do some additional setup?

And say if the very first time I am setting up a project it takes 4 hours to import DB. Would that mean that every time I do vagrant halt and it starts to back up DB it would again take 4 hours? and If it needs to restore the DB if somehow it gets destroyed, it would again take 4 hours?

Also today I ran 'vagrant up' and I go to vvv.test and get 502 Bad Gateway error. Any idea what is causing that and how I can rectify that?

tomjn commented 4 years ago

Could you tell me how I can resize the disk?

I believe I already have. A normal vagrant machine cannot be resized. To resize the disk you need that plugin, and you need a new VM. You can't resize a VM that wasn't created with that plugin. This takes us right back to the beginning of our discussion.

As I said before TLDR:

with the following setting in Vagrant file

If you make any changes of any kind to that file then we cannot offer you support. Do not do this, it is not required. Remove that change and undo any other changes made to the vagrantfile. No ifs, no buts, no conditions, do not change that file.

Could you tell me how all these three work, do they all work together or individually? What do I have to do to resize to 50GB

Go back to the beginning, where you did everything correctly but you tried to do it to a VM that already exists. Destroy the VM, then create a new one.

TLDR: To use vagrant disk size you need to create a new VM. You can't do that if one is already there.

How can I know if it has been successfully resized? Because maybe I think it is resized to '50GB' but under the hood, it may not be the case.

The same way you would check the size of the disk on any Linux machine, vagrant ssh in then check how much space there is. Remember, the VVV VM is just an Ubuntu VM, you don't need VVV specific commands just googling for how to do it in Ubuntu works.

So maybe after it has been resized successfully to '50gb' I can try to import the database again.

I don't know, your database might be 100GB, I don't have that information. Don't just guess if 50GB is enough space, ask your colleagues. Clearly they figured this out somehow and aren't sharing what they did. Vanilla stock VVV doesn't ask for enough disk space to do what they've done, so they've clearly changed something.

Would the above lines backup my DB by itself or I have to do some additional setup?

I recommend turning off DB backups. If it takes 5+ hours to import the database, do you really want it to try to export it everytime you turn off the database? Automated backups in this scenario are unrealistic and unfeasible. Set it to false.

Also today I ran 'vagrant up' and I go to vvv.test and get 502 Bad Gateway error. Any idea what is causing that and how I can rectify that?

If this happens on a VM with that site with the super-huge DB then it's a waste of time trying to debug this.

If it happens on a VM that has free disk space and does not have that site with the super-huge DB, then we can look at this but it will require a new issue, and full log output. Otherwise it's just going to get really confusing.


Honestly, I think it's crazy that your colleagues are making you import a database that large just for local development work. They should be making it smaller rather than forcing you to jump through technical hoops. If this is a new project or a new job consider this a major red flag. I would offer to look at that repo privately but if it contains customer data like I suspect it does then that would be a major data breach.

The real fix is to make the DB smaller. Even if you get this DB imported, having such a big database carries lots of downsides and disadvantages. I'm no stranger to large databases, and I understand that the default 10GB isn't enough for some people who have lots of sites, but needing 50GB for a single site is insane.

tomjn commented 4 years ago

I'm going to close this out due to inactivity, feel free to reopen though if there's more to do