HHVM with Homestead - HHVM refusing NFS - laravel

I'm trying to set up Homestead with VirtualBox and the HHVM option.
My host is Mac OS, and I'm not enabling the nfs option in Homestead.yaml.
However, as soon as I add a Hack file and run hh_client, hh_server dies because it refuses to run on NFS
I understand the rational of not supporting NFS but I'm wondering why is NFS actually involved here, and what could be done to workaround this?

VirtualBox shared folders are effectively a network folder, causing the same problems as NFS. This answer, and my comments on it, explain why hh_server (and thus Hack code) doesn't work on NFS -- the kernel doesn't provide the right inotify events to update its internal state.

Related

Vagrant up does not work with VMWare provider

I'm using Vagrant on the latest Linux Mint. It works fine with VirtualBox, however with VMWare it fails with this error: sudo helper setuid-wrapper must run as root.
The very few discussions about this issue I found on the net suggested to symlink ~/.vagrant.d to an not encrypted disk. This is what I tried, but unfortunately without any success at all. I also created symlinks for ~/vmware and ~/.vmware, but again without success.
Has anyone come across this error and found a solution?
Thank you very much.
This is still an issue today (Vagrant 1.9.3/Ubuntu 17.04/VMWare Workstation 12.5.5) if using an encrypted homedir. For me, the easiest solution was just to move the vagrant directory onto a non-encrypted filesystem as the OP suggested:
sudo mkdir /vagrant
sudo mv ~/.vagrant.d/ /vagrant/
ln -s /vagrant/.vagrant.d/ ~/.vagrant.d
Running in debug mode I can see the command its trying to run as root exists within the directory I moved:
INFO subprocess: Starting process: ["/home/geoff/.vagrant.d/gems/2.2.5/gems/vagrant-vmware-workstation-4.0.18/bin/vagrant_vmware_desktop_sudo_helper_wrapper_linux_amd64", "prune-forwarded-ports", "/tmp/vagrant-sudo-helper20170422-15385-brgg1q"]
And sure enough after vagrant up the VM now runs. Putting everything under /vagrant like this is a bit of a bodge and you would need to figure out something more elegant if you have more then one user, perhaps /vagrant/$USER. The directory I chose isn't Linux FHS compliant either but who cares ;-)
I wish this worked out the box but perhaps this will help someone

Running Composer on guest VM with Vagrant and rsync only keeps

I searched about this topic and could not find anything so here I go with my question: I have Linux running in Vagrant as guest, Windows as host; I shared folders with rsync to speed up development with Rails (using NFS or SMB is extremely slow); some of my PHP dependencies get installed with Composer within my project, so when I run Composer via SSH from the guest it downloads and installs them, however, when I restart my VM I lost the dependencies downloaded and need to start over.
So is there anything I could do to run Composer remote or locally, and not loose my changes? so far I've tried changing the sync type to SMB, run Composer, and then go back to rsync, however, I need to switch on and off and I'd like something more automated...
Thank you for your help!
Carlos.
From the docs:
The rsync synced folder does a one-time one-way sync from the machine running to the machine being started by Vagrant.
So this is intentional: If you don't get the result of ANY changes (not just Composer) out of the vagrant machine onto your copy on Windows, it will always get lost inside the VM.
Use SMB or shared folders and bear the performance penalty. Or try and get a NFS server for Windows and install the files inside the VM via NFS.

Vagrant synced_folder overwriting guest folder

I'm having an issue, where after starting the vagrant box, the synced_folder is erasing all the contents of the target folder on the guest machine (I'm guessing that it's overwriting it).
I have the following line in my Vagrantfile
config.vm.synced_folder "folder/", "/home/vagrant/src/folder/"
I verified that /home/vagrant/src/folder has content, then adding the synced_folder command to Vagrant file causes it to be empty after startup.
I don't know if it's because I'm missing some configuration options, a permissions issue, or what.
I'm on mac OS X 10.9.2 with VirtualBox 4.3.12
Any help with this would be greatly appreciated.
Thanks!
If the folder /home/vagrant/src/folder/ exists inside the guest OS (which is sounds like), any contents there won't be overwritten, but they will be hidden because Vagrant will use that same path as the mount point. If you disable the share, then do a vagrant reload and vagrant ssh, you'll probably see the old contents reappear.
The sharing is mainly helpful for getting files on the host OS to be visible in the guest OS, not so much the other way around.
One workaround might be to use the normal folder share (into /vagrant), then inside the guest OS create a symbolic link to the content you want visible back on the host OS. You could add that to your .profile to run it each time you ssh into the guest.
As BrianC mentioned, it is NOT overwriting, but expected behaviour.
Vagrant mounts the folder in your project folder to /home/vagrant/src/folder/ within the guest. As a result, the contents in the original folder will be hidden unless you manually unmount the vagrant share (by default vboxsf).
You can change the mount point (within guest) of the share to workaround the issue.
BTW: The default vboxsf has its limitations, there are new type of synced fodlers, e.g. rsync, NFS, smb. I personally would recommend using rsync type.

Where is Vagrant saving changes to the VM?

I am just starting with Vagrant and I am having a little trouble understanding a few details. I have read through the docs but still am missing a basic concept. When I want to start a Vagrant box I run:
vagrant up
This will "build the VM based on the box" I understand that the boxes are stored at ~/.vagrant.d and in fact I have packaged up my own box from a base Ubuntu box. However, when I run vagrant up and start to add files to the vm, where is the virtual hard drive for the vm stored? For example, when I run apt-get install apache2 and the root system is modified, where is this modified?
When I do a du on my current directory I do not see any changes. I also do not see any changes in the ~/.vagrant.d directory. However, I can do vagrant halt, restart my local machine and then run vagrant up again and the changes are persisted somewhere.
vagrant up also reports
[default] VM already created. Booting if its not already running...
Can someone tell me where the VM is created and where the changes are made?
Vagrant imports the base box which is located at ~/.vagrant.d/boxes/, like you said.
This is where the base boxes are kept. It uses it to start a VM from the clean state. When importing a VM, the responsibility of where to store data files and VM state is up to VirtualBox itself. This is a configurable location but typically defaults to ~/VirtualBox\ VMS for Mac OS X and Linux. In Windows the boxes are kept in %userprofile%\.vagrant.d\boxes
It is easy to find the place where they are getting created, regardless of what platform you happen to be using.
1. Start VirtualBox.
2. Go to the VM that shows as running instance.
3. Check out the Settings ->Storage.
4. You can find the path to location where VMs are created and stored in your file system.
I always change the directory that Virtualbox uses by default for VMs. Normally it is in your profile folder in Windows.
I change it to something like "D:\VHDs\VBox\" and there I found my vagrant test vm: "test01_1347456065". It was called test01, so I guess vagrant adds the numbers to keep things unique.

Developing on Windows -> Deploying on a Virtual Machine?

Is there an easy way to integrate with VirtualBox such that I could develop under the host, Windows, and deploy and run scripts via a mounted folder in a guest linux system?
I'm looking to develop for Linux under Windows, kind of.
You can use VirtualBox's Shared Folders feature to enable your Ubuntu virtual machine to mount a directory of your Windows host. However, you're likey to be deal with some impedance mismatches like different line endings. I hope that is the least of your worries.
You might want to check out vagrant http://vagrantup.com/
It provides a nice and easy system to create a VM from a template in Virtual Box, and will automatically mount the project folder in the guest VM. The config can also easily be included in your project so others can use it.
I develop in PHP. And I use Debian as guest OS, and Win7 as host OS.
You can done automaticly mount share folder by:
new a file in /etc/init.d/ named mnt_win_sf, than you edit it:
It must has the same info head with /etc/init.d/apache2. And you need just one line of command:
mount -t vboxsf share_folder_name mount_point
We also need to excute this script before apache2, so we edit /etc/init.d/apache2. In the Require Start line, add mnt_win_sf
update them by:
sudo update-rc.d mnt_win_sf defaults
sudo update-rc.d apache2 defaults

Resources