I'm using Laravel Homestead (Vagrant, Ubuntu). My host computer is Windows 10 running VirtualBox.
As admin (since I've already seen tons of answers that say lack of permissions is usually why people have problems with symlinks), I open Git Bash and run this:
vagrant#vboxHomestead:~/Code/myproject$ ls -lah /home/vagrant/foo/blah
total 0
drwxrwxrwx 1 vagrant vagrant 0 Mar 17 23:09 .
drwxrwxrwx 1 vagrant vagrant 0 Mar 17 22:36 ..
-rwxrwxrwx 1 vagrant vagrant 0 Mar 17 23:09 asdf.txt
vagrant#vboxHomestead:~/Code/myproject$ sudo ln -s /home/vagrant/foo/blah /home/vagrant/Code/myproject/storage/app/public/blah
ln: failed to create symbolic link '/home/vagrant/Code/myproject/storage/app/public/blah': Protocol error
What is the problem? Does it have something to do with the folder mappings of Homestead? How can I achieve my goal?
(My /home/vagrant/Code/ and /home/vagrant/foo/ map to separate drives on my Windows machine.)
P.S. And before trying the steps above, I even deleted the Homestead standard public symlink just to avoid other possible complications.
P.P.S. I've also tried adding this near the bottom (above the final end) of my Homestead Vagrantfile before spinning up the box:
config.vm.provider "virtualbox" do |v|
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
end
I noticed that php artisan storage:link was now causing a "Protocol error" too.
So to narrow down the problem I created a totally fresh Homestead project and box and tried creating symlinks (including php artisan storage:link) in there but got the "Protocol error" too.
And I was very careful to be using Git Bash (my terminal / command line client) as Administrator, so I was already following the advice of most answers on StackExchange.
I also decided to move one of my Windows folders (the one that I'd had Homestead map to /home/vagrant/foo/) to be within the Windows folder that Homestead mapped to /home/vagrant/Code/.*
I decided to restart Windows 10 completely. Now after spinning up new vagrant boxes, php artisan storage:link and creating my other symlink worked.
*I'm not sure moving the Windows folder was even necessary. Maybe I could have left the folders on separate Windows drives. But at the time, I wanted to minimize possible complications.
When using Homestead, making a symlink in your public directory in Windows will also create a symlink on vagrant. The other way round may (!) create this error and will leave a not working symlink in your Windows directory.
The error sometimes return after you shutdown the VM and restart or still persists. Basically you need to again tell VirtualBox to enable symlinks. Here's the complete solution
Obviously have this in your vagrant file, as suggested above
config.vm.provider "virtualbox" do |v|
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/Folder_Name", "1"]
end
I recommended comment out any sync folder and let default ./(at host) synced at /vagrant(at guest). This will make sure your shared folder(Folder_Name) name is always vagrant as mentioned here https://www.vagrantup.com/docs/synced-folders/. Also, you won't face issues with ssh
If the symlink protocol error returns after restart or still persists run
VBoxManage setextradata "VM_Name" VBoxInternal2/SharedFoldersEnableSymlinksCreate/Folder_Name 1
vagrant halt
vagrant up
vagrant ssh
Usually, VBoxManagee is located at C:\Program Files\Oracle\VirtualBox\
Verify working of symlink by going to /vagrant and running
touch test.txt && ln -s test.txt test1.txt
PS: I have tried this on Windows Home which has limited accessibility to security settings
Protocol error means that the language of communication between the folders is different. You musst have the same version of PHP. So you have to bring the PHP in the VM and on your Windows OS on the same version state.
Go like this:
update your PHP on you computer (i.e. download from php.org)
then open cmd as admin
cd homestead -> vagrant up -> cd code -> cd "your-APP"
sudo apt update -> sudo apt upgrade
ln -sr storage/app/public public/storage
and now there is no error and the folder puplic/storage has been created.
Good luck...
Related
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.
I have installed homestead with Vagrant in my MacOS. I have installed all with Virtual Box, but when i try to use vagrant command in my terminal for running Virtual Machine appear this error:
The VirtualBox VM was created with a user that doesn't match the
current user running Vagrant. VirtualBox requires that the same user
be used to manage the VM that was created. Please re-run Vagrant with
that user. This is not a Vagrant issue.
I try with sudo vagrant up and it work but is not the best choice.
Anyone can help me?
There's a screenshot of the terminal Error:
Terminal Error with command vagrant up and vagrant ssh.
Try deleting .vagrant directory
rm -r .vagrant
I suspect you copied or moved project folder from one place to another.
Alternatively you need to update the creator_uid file in .vagrant/. Check out this blog post.
I refer to Laravel's official documentation to install Homestead.
When I run the vagrant reload --provision , I get the error message shown below.
I found my mac .ssh directory, it is empty.
But Homestead.yaml includes this line authorize: ~ / .ssh / id_rsa.pub, I do not understand what is wrong.
I'm not sure, but I thought that keys where created when you add the homestead box to vagrant.
Anyway, the error says what the problem is. You don't have a ssh key so you need to create a new.
Enter your home directory (on your mac) and run this command:
ssh-keygen -t rsa -C "you#yourmail.com"
Then check directory: ~/.ssh/ so files are created and have the same name as referenced in Homestead.yaml
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
Okay, so here is my problem:
I use vagrant with VirtualBox. The host is Windows 8.1, the guest is Ubuntu (64bit). I am trying to use a symlinked windows folder created by
mklink /j somefolder someotherfolder
as synced folder in Vagrant. In my Vagrantfile I have
# disable the default synced folder
config.vm.synced_folder ".", "/vagrant", disabled: true
# sync my desired folder
config.vm.synced_folder "./somefolder", "/vagrant"
Unfortunately this does not work, but gives the following error:
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3`
vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
The error output from the last command was:
stdin: is not a tty
/sbin/mount.vboxsf: mounting failed with the error: Invalid argument
Before you ask: Guest additions are installed, and mounting regular folders works flawlessly.
Is there a way to use symlinked directories as synced folders in vagrant with vbox?
Thanks for your help!
I was having a similar issue. I couldn't get Symlinks working with vagrant but a Hardlink Clone did. I was trying to have my Dev folder in sync with Google Drive but did not want to relocate the folder.
My Solution: Hardlink Clone
Download and install Linkshell for windows (and the listed prerequisite package) [ direct Link to actual file I downloaded | direct link to prerequisite package I downloaded ] Direct link good for Windows XP64,
Windows Vista64,
Windows Server ,
2003/2008/20012 64bit,
Windows 7/8/10 64bit
Right click on source folder (in my case the one I copied to Google drive) and select pick link source
In location where you want your "symlink", right click and select Drop as -> Hardlink Clone
Thats what it took for me to get it working with vagrant. I originally tried as symbolic link without success.
Cut the folder to where you need it from the VM, after that create the junction (or symlink) at the original location.