ln: failed to create symbolic link: Protocol error (in Vagrant)

允我心安 提交于 2020-03-25 17:39:06

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/60731952/ln-failed-to-create-symbolic-link-protocol-error-in-vagrant

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!