Our linux server has been rebooted after server crash/freeze.
Trying to use a virtual machine (using vagrant up) , I've noticed the VM (created with vagrant) reverted to a prior version (version of the first week since vm creation).
I 'm now trying to recover the data (important data).
I've got the original files of the vm in "VirtualBox VMs folder" and the same files backuped on ftp server (the backup were created 1 day before crash) :
The Folders contain :
**- vm.vbox ,
vm.vbox-prev ,
vm.vmdk ,
vm.vdi**
I tried to mount each of the "vm.vdi" ("qemu-nbd -c ...")(the backup "vm.vdi" and the original one).
I then tried to clone the vm ("VBoxManage clonevm ...") and check for new files in the cloned vm , clone the vdis ("VBoxManage clonehd") and mount the cloned ones, package the box and create a new vagrant box from the original one packaged , but nothing to do, the data has been reverted to the creation of the virtual machine.
In the past, we've shutdown the host and the vm many times without troubles (gracefull shutdown ).
**Host and VM : ubuntu bionic 18.04 ,
Virtualbox : 5.2.18 ,
Vagrant : 2.0.3**
Any suggestions ?
Related
I git cloned a project which uses Vagrant. I used to have everything working with Vagrant, I mean I run vagrant up & vagrant ssh, then start my web application project.
Today, I ssh to my vagrant virtual box by vagrant ssh. Then under the virtual box, I import my database by:
$ mysql -u root -p mydb < /vagrant/db.sql
After a while, I restarted my MacBook, then I bring up vagrant VM by command vagrant up under project folder. I start getting following error:
/opt/vagrant/embedded/gems/gems/net-scp-1.2.1/lib/net/scp.rb:398:in `await_response_state': scp: /tmp/vagrant-network-entry: No space left on device (RuntimeError)
My first question:
Is it because I import database to it so the space is running out?
(I know by googling, there are answers on how to increase space on Vagrant vm, but that's not I want)
My second question:
How can I revert back to the state when I haven't imported the database? Imaging now I am not able to bring up (neither can SSH to)the Vagrant vm due to the above error.
Open the VM in virtual box capture keyboard and drop database from there. You can't revert if you don't have a backup.
During vagrant up command I saw that it is generating settler_default_xxxxx folder in my virtual machines folder, and then it renames the folder to homestead-7, and then tries to run the machine and fails with:
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state.
When I look at the machine, I see that it has wrong hard disk attachment. The disk still points to the path in settler_ folder which no longer exists. I have to manually remove the attached disk and attach the right one in the homestead-7 folder instead.
Why doesn't Vagrant rename the disk attachment to homestead-7? Am I doing something wrong? If it's a bug, then is it Vagrant's, Laravel's or VirtualBox's bug?
My config:
Vagrant 1.8.1
VirtualBox 5.0.14
VAGRANT_HOME points to V:\VAGRANT_HOME
VirtualBox File -> Preferences -> Default Machine Folder points to V:\
Computer:
Windows 10 64-bit
8GB RAM
I'm using Vagrant on Windows to create my dev environment. But today when I start it with the command vagrant up, it created another VM instead of using the one I always used it.
Looking in the folder C:/Users/My_User/VirtualBox VMs I found the default VM files.
How to proced to make Vagrant recognize this default VM?
PS: Sorry for my bad english!
When I attempt to initiate 'vagrant up' the script executes as normal until it gets to the last line, where NFS shared drives are mounted.
I have tried deleting the exports file in /etc/ followed by a nfsd restart and vagrant destroy / vagrant up but to no avail.
After some considerable amount of time the console outputs the following [certain details redacted]:
*==> default: Mounting NFS shared folders...*
*The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed!*
*mount -o 'nolock,vers=3,udp,noatime' XXX.XXX.XX.X:'/Users/dhatton/Google Drive/moodle-doodle/site' /var/www/site*
*Stdout from the command:*
*Stderr from the command:*
*mount.nfs: Connection timed out*
UPDATE
The above problem was encountered when using a VPN into the office network. Upon logging in on-site without the VPN, everything works again.
For macOS Monterey 12.1 with virtualBox 6.1.30 and vagrant Vagrant 2.2.19/18:
create vbox folder in /etc
create a file inside /etc/vbox named networks.conf
add the following inside networks.conf
* 0.0.0.0/0 ::/0
Note: if you get the ip address range error, add your IP here too.
I had similar issue. I searched a lot, and tried following solutions:
Check /etc/exports and /etc/hosts files, if there are invalid entries in file, remove them.
Check your firewall is not blocking access
Restart NFS system
install vagrant plugin install vagrant-vbguest plugin
do vagrant reload --provision
Reboot your pc
Reinstall vagrant
For me reinstalling vagrant worked.
I've ran across this before and the problem turned out to be related to my companies VPN. If I tried running vagrant up connected to the VPN it would hang on mounting NFS, but if I disconnected from VPN and tried again it worked. Once running I could connect to VP Probably goes back to it needing a stable internet connection.
Assuming you are trying to mount from guest to host (host being OSX?) trying mounting to a different path. You might be encountering issues with the space in Google Drive?
Vagrant downloads binaries from its cloud while configuring a VM, so a stable internet connection is needed. In fact, an internet connection is necessary for using most of the Hashicorp products.
I switch between four projects on my local machine and I use vagrant for each on of them.
$ vagrant global-status
id name provider state directory
-------------------------------------------------------------------------
3e1f21e default virtualbox running d:/www/project1/source
9080cd0 default virtualbox poweroff d:/www/project2/source
c4e0461 default virtualbox poweroff d:/www/project3/source
b75805d default virtualbox running d:/www/project4/source
However, my C drive (I'm on a windows 7 machine) is showing that I'm using 16.4GB on the \User\VirtualBox VMs
It seems a little excessive for just 4 VMs. So I opened VirtualBox and saw that I had 7 VMs on there.
I'm thinking these are boxes that I previously destroyed but I could very well be wrong.
I couldn't find anything about it on the web. But could I just delete these items or are they important to vagrant? If so, how can I set up vagrant without having to use up too much space on my laptop?
If you destroyed the boxes with vagrant destroy and it finished without errors, the box should be gone from Virtualbox as well. If this didn't happen, you can remove the box manually from Virtualbox. Just make sure to also delete the local files (Virtualbox will ask you if you wanna keep the HD, which you don't)!
If you are unsure which boxes to remove from Virtualbox because they are all named he same, you can either destroy all boxes from vagrant and then remove all boxes left to Virtualbox. Or you can start all vagrant boxes using vagrant up and then delete the ones from Virtualbox which don't run.