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

前端 未结 3 1582
难免孤独
难免孤独 2020-12-04 04:12

I\'m using Laravel Homestead (Vagrant, Ubuntu). My host computer is Windows 10 running VirtualBox.

As admin (since I\'ve already seen tons of answer

相关标签:
3条回答
  • 2020-12-04 04:33

    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

    0 讨论(0)
  • 2020-12-04 04:39

    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.

    0 讨论(0)
  • 2020-12-04 04:44

    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.

    0 讨论(0)
提交回复
热议问题