Vagrant -- E: Couldn't determine free space - vagrant

Yesterday my vagrant box was working fine. Now it's not. When I try to provision my box again, or run this command (or any apt-get):
sudo /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install postgresql
I get this error:
E: Couldn't determine free space in /var/cache/apt/archives/ - statvfs (20: Not a directory)
I've:
done a destroy, and I still get this error.
removed all but a couple packages from my provisioner I still get this error.
created a new vagrant file, using the same box, and I do NOT get this error.
cloned my vagrant file into a new folder, and I still get this error.
What is going on here?
UPDATE: It looks like there is a lock file in /var/cache/apt/archives/

I was using the vagrant-cachier pluggin, and it had cached a bad apt-get request that put in a lock. When I disabled this pluggin and rebuild the machine there were no issues.

Related

Vagrant was unable to mount VirtualBox shared folders. ERROR: INVALID ARGUMENT

I know that other people during the years had met similar problems (like this ) however in my case the guest addition is installed (0.30.0 version) and I tried to reinstall it a lot of times.
I work on Windows10 and those are the version of VirtualBox and Virtual Machine.
Virtualbox on your host claims: 5.2.8
VBoxService inside the vm claims: 6.1.22
This is the code of the problem:
default: /vagrant => C:/Users/XXXX XXXX/Documents/src
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:
mount -t vboxsf -o uid=1000,gid=1000,_netdev vagrant /vagrant
The error output from the command was:
/sbin/mount.vboxsf: mounting failed with the error: Invalid argument
I never found the error Invalid argument in similar cases so my question is if this need a particular procedure.
Thank you very much
Just had a similar problem after an update - was getting the same:
/sbin/mount.vboxsf: mounting failed with the error: Invalid argument
What I found in virtualbox startup was the message:
VirtualBox Guest Additions: Kernel headers not found for target kernel
5.4.0-81-generic. Please install them and execute
/sbin/rcvboxadd setup
Used "vagrant ssh" to access the virtualbox command line and ran:
sudo apt-get install linux-headers-$(uname -r)
After that restarted vagrant:
vagrant halt
vagrant up
Then it actually built the VirtualBox Guest Additions properly and mounted my shared folders.
Had the same exact error as you after making my second vagrant project - specifically after changing my public_network setting.
mount -t vboxsf -o uid=1000,gid=1000,_netdev vagrant /vagrant
The error output from the command was:
/sbin/mount.vboxsf: mounting failed with the error: Invalid argument
At I also tried several solutions from people's answers like the one mentioned here and updated my VirtualBox.
I'm not really sure how mine works but here's what I did:
I logged into the VM (vagrant ssh) and installed the guest additions manually
cd /opt
sudo wget -c
http://download.virtualbox.org/virtualbox/6.1.26/VBoxGuestAdditions_6.1.26.iso O VBoxGuestAdditions_6.1.26.iso
And then tried:
sudo mount VBoxGuestAdditions_5.1.28.iso -o loop /mnt
sudo sh /mnt/VBoxLinuxAdditions.run
But I got an error saying something like permission denied or no directory.
So I reload vagrant (vagrant reload), but the error still occurred. However, I still continued trying something else, so I thought maybe I should install the vbguest plugin and did this:
vagrant plugin install vagrant-vbguest
That removed the error for me after reload but when I logged into vagrant again, I still can't see my shared folders so I halted my vb and run provision:
vagrant up --provision
Then I got a message which said that there was an error while executing VBoxManage so on and so forth. So I paused all running machine in my VB, closed all running VB apps in my desktop, and run the command:
vagrant destroy
After recreating vagrant vagrant up, everything miraculously worked! I can now navigate to my shared folders' directory.
I'm still in the process of learning vagrant so I can't really explain what actually happened in my machine but I hope this can somehow be of help to you or to someone who have the same issue.
Step 1: open virtual box then right click on installation machine then ->close->power off.
Step 2: then run below command
vagrant halt
vagrant up
Finally got it working the following way (this related answer was of great help along with Paul_Z's answer in this same question).
Step 1:
Make sure VirtualBox Guest Additions Software is installed.
If this solved your Issue, then great! If not, continue on to step 2.
Step 2:
Read the VirtualBox Guest Additions installation output carefully.
(If no longer possible, you can rerun the setup by using cd to go to
/opt/VBoxGuestAdditions-*your-version-number-here*/init/
and then run:
sudo ./vboxadd setup)
Step 3:
Install the needed dependencies with the distribution's package manager that the error message shows. (In my particular case, it mentioned that the system couldn't perform kernel module builds because gcc make and perl were not present in the system).
Step 4:
Rerun the VirtualBox Guest Additions setup by going to
/opt/VBoxGuestAdditions-*your-version-number-here*/init/
and then run:
sudo ./vboxadd setup
(If more dependencies are requested, go back to step 3)
Step 5: Reboot
Step 6 (Optional):
Add user to vboxsf group so that it is able to access the shared folder if needed. (As explained in this answer).
sudo usermod -G vboxsf -a your_user_name
I have the issue i Ubuntu 20.04 and simply download a more recent version of VirtualBox, then extract the GuestAditions ISO and installed it
I ran just
vagrant plugin install vagrant-vbguest
and after this the box came up.

Vagrant dev build throwing errors

So I am having some issues with vagrant. I had initially tried to report this as an issue on the vagrant github issue boards, but they kept closing the issues without responding to them. I guess they decided I wasn't worth their time, or they were just behaving unprofessionally. Anyway, Here is the problem: I use vagrant with virtualbox, and a new version of virtualbox was recently released that is, unfortunately, not compatible with the latest vagrant installation.
However, the people at hashicorp have already updated the source code so that it is compatible with the new version of virtualbox, but you have to build the vagrant executable from the source repo (instructions here). So I followed the instructions and vagrant is working just like it used to.....when the only command I need to run is vagrant up. I should also mention ahead of time that, in order to run the vagrant dev build, the current working directory needs to be the root of the source code repo and the dev build can only be run using the following command with ruby:
bundle exec vagrant
With that being said, I needed to update one of my custom boxes, so I built a vm in the updated version of virtualbox and ran the below command
bundle exec vagrant package --base go --vagrantfile ../../vagrant/vagrantfile
After an extended period of time, vagrant spat back out the following error
The executable 'bsdtar' Vagrant is trying to run was not found in the %PATH% variable. This is an `error. Please verify this software is installed and on the path.`
I should also note that I use a windows machine and that this error never occurred when using the installed version of vagrant. At this point, I had posted the issue on github to get some input from the devs, but they (very unprofessionally) decided to ignore my requests for help and close the issues without providing any response. I used the GNUwin32 project to make numerous unix commands available to my Windows environment and added the folder to my PATH environment variable. I then run the same command again to create my new box and it works!! So then I upload it to the vagrant cloud and attempt to update the vagrant box that is stored on my system by running the following command:
bundle exec vagrant box update
Then, after waiting for a while, vagrant then spat this error out at me:
The box failed to unpackage properly. Please verify that the box
file you're trying to add is not corrupted and that enough disk space
is available and then try again.
The output from attempting to unpackage (if any):
C:\gnuwin32\bin/bsdtar.EXE: invalid option -- s
Usage:
List: bsdtar.EXE -tf <archive-filename>
Extract: bsdtar.EXE -xf <archive-filename>
Create: bsdtar.EXE -cf <archive-filename> [filenames...]
Help: bsdtar.EXE --help
Another error, and still involving this bsdtar tool. It does not appear that anyone else is reporting the issue I am running into because I think they are just waiting for hashicorp to release the new official installation, but, just to give you a look into their priorities, the version of virtualbox that was released which no longer worked with vagrant was released back on December 10. It has been over a month since and there is still no updated release.
So, I am hoping that someone out there might be able to find out why I keep running into these errors when trying to use vagrant's dev build and provide a solution. If not, then maybe if someone else is able to reproduce the issue and report it to hashicorp, maybe they will listen to someone else.
If you are on Ubuntu 20.04 then bsdtar was removed. Try to install libarchive-tools package.
$ sudo apt-get install libarchive-tools
I figured it out. My original hypothesis was correct: since vagrant is a tool that was built primarily to be run on linux machines, then vagrant runs in windows, the installation includes a mingw environment with all of the dependencies vagrant needs to function and which the installed vagrant executable imports into the console session when run. This why the dev build kept failing: because it was not importing this mingw environment. So, in order to fix the issue, I first cloned the vagrant source code repo from github and followed the instructions I linked to above to build the executable from the source repo. I then copied all of the files in the source repo into the following folder:
<hashicorp install folder root>\Vagrant\embedded\gems\2.2.6\gems\vagrant-<version num>
So, for me, the destination directory is C:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6
This directory is identical to the source code repo, and copying the source code repo to the above folder replaces the installation version of vagrant with the dev build. After I did this, running the vagrant commands which had failed previously normally (as in, without using ruby or bundle) worked. I hope this helps someone else out there who Hashicorp has decided is not worth their time.

The 'host_compress_magento_code' provisioner could not be found

So I'm trying to install a second vagrant VM, specifically configured for Magento 2. Which I found here: https://github.com/paliarush/magento2-vagrant-for-developers
on windows 10.
I couldn't clone the repository, because I got "Access denied", so instead I just downloaded the rar and extracted it into a folder.
Afterwards I launched my GitBash and did "vagrant up" into the folder.
After about an hour of downloading I get this error:
"There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The 'host_compress_magento_code' provisioner could not be found."
Additionally it had a problem with hosts manager as well, but I quickly found out I can do "vagrant plugin install vagrant-hostmanager" and it solved that error, but the missing "host_compress_magento_code" continues to not let me up the vagrant.
In "Vagrantfile" I found the following line:
config.vm.provision "host_compress_magento_code", type: "host_shell", inline: "tar -cf scripts/host/magento2ce.tar magento2ce"
Quick search about the command lead me to believe that it needs "magento2ce" file in the vagrant root dir in order to create that "magento2ce.tar" archive.
But I have no clue what that file should be.
Can anyone point me in the right direction? Google searches just lead to threads where "vagrant plugin install vagrant-hostmanager" has been the solution.
Thanks in advance!
After cloning of Vagrant Box for Magento 2 Developers you should (simplified version):
Copy etc/composer/auth.json.dist to etc/composer/auth.json.
Add the Magento Marketplace keys for Marketplace authorization to the repo.magento.com section.
Run init_project.sh
Please, read more carefully Installation steps section. It contains more details of how you can configure and work with this vagrant box.
init_project.sh install all needed vagrant plugins and after that run vagrant up. After you init of project you can work as ordinary vagrant suspend, vagrant resume and etc

Bundler error whilst trying to install Varying Vagrant Vagrants and Vagrant plug-ins

I am new to Vagrant, Laraval, and Varying Vagrant Vagrants. I am attempting to get this environment installed and operational. I am on Mac OS X 10.11.6.
I am following the instructions posted here.
Step 1 is install VirtualBox 5.0.x. Done that.
Step 2 is install Vagrant 1.8.5. Done that.
After installing Vagrant with the pgk file I downloaded... I created a directory at ~/vagrant. In that directory I did a vagrant init hashicorp/precise64 command. I then vagrant up.
Step 3 Install the vagrant-hostsupdater plugin with vagrant plugin install vagrant-hostsupdater
When I try to do this, I get the following error:
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:
There was an error while trying to write to
/Users/jonathan/.bundle/cache/compact_index/gems.hashicorp.com.443.68db9b3ad4be8461ccdecca2ae96d12a.
It is likely that you need to grant write permissions for that path.
Warning: this Gemfile contains multiple primary sources. Using
source more than once without a block is a security risk, and may
result in installing unexpected gems. To resolve this warning, use a
block to indicate which gems should come from the secondary source. To
upgrade this warning to an error, run bundle config
disable_multisource true.
Just to see if it made any difference, I changed the permissions on that file to 777. The same error occurs though.
I also get this error if I try to install any of the other plugins mentioned in the instructions on the VVV site.
I have no idea why this occurs, or what to do about it.
Any suggestions would be greatly appreciated.
Whilst I don't know the original cause of the issue, the came to light through my discussion (in comments) with Frédéric Henri.
For some reason the permissions on the ~/.bundle file had the owner set to root.
This was preventing the Vagrant plug-ins from installing. To correct this issue I changed the owner to my username.
From the home folder (cd ~/) use the following command, sudo chown -R <USERNAME>:staff ~/.bundle
This resolved the issue.

unable to install laravel homestead using command line

i am trying to install laravel homestead in my windows 7 pc but every time fails it starts downloading but after some percentage it stops and display errors like
"SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054"
i have restarted download but every time after some percentage it stops i am tired now please help me
i have installed "vagrant_1.7.4.msi" and "VirtualBox-4.3.30-101610-Win.exe" also
I'm also unable to install it online in Windows 7, it will always stop downloading at some point before 15%.
What I had to do was to download the .box file and add it locally.
You can download the file from:
https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.2.7/providers/virtualbox.box
For convenience rename it to something like homestead-0-2-7-vb.box and do the following:
vagrant box add laravel/homestead file:///c:/homestead-0-2-7-vb.box
Try
vagrant box add --insecure -c laravel/homestead http://atlas.hashicorp.com/laravel/boxes/homestead
It worked for me.
Got it from here
If you can't finish even the manual download, try to download from this mirror. This is a copy of laravel/homestead 0.5.0. Use this command to add:
vagrant box add laravel/homestead "path-to-your-file"
I also had the same error "errno 10054".
However, in my environment I solved it with the following contents.
Windows10 64bit
Git bash 2.21.0
Virtual Box 6.0.4
vagrant 2.2.4
As a result, this was necessary for me.
MSVCR100.DLL
https://www.microsoft.com/en-us/download/details.aspx?id=14632
In my case, the installation was successful if I do it as follows.
To install "MSVCR100.DLL" on windows
To command "Vagrant box add laravel/homestead" at terminal.

Resources