4

I'm trying to setup a symlink, using the command

ln -s /var/www/data/cache/widget/overlay/ /var/www/public_html/images/overlay

but it outputs

ln: failed to create symbolic link '/var/www/public_html/images/overlay': Protocol error

The host OS is Windows 8, and the Docker image is Ubuntu. I believe the issue could be something to do with permissions, as when the Docker image is started, /var/www/public_html is mapped to a folder inside Windows 8, /C/Users/Username/Documents/development/public_html. However, I can create folders, and files via command line inside the public_html folder, which kind of goes against it being permissions.

I also can't find anyway to start Docker as admin to see if that helps, as it's just a .sh script that runs.

Has anybody else had the "Protocol error" when creating symlinks? Or any idea how I could get more information about what causes this issue?

EDIT: Also, if I try to save an image via PHP to the public_html folder or copy a file there (again, via PHP), that gives the same "Protocol error" message.

1 Answer 1

3

So /var/www/public_html is actually a Windows folder, but /var/www/data is not?  You're trying to create a symbolic link from a Windows directory into a Ubuntu directory in a virtual machine.  There's no way that Windows can support an object like that.

To expand on the above: I guess the point is that the Windows host is set up as a file server, making C:\Users\Tom_Hart\Documents\development\public_html available to clients — specifically, giving read/write access to the Ubuntu image, so Ubuntu can read, modify, and create objects in and under that Windows directory.  But, in general, servers don’t have visibility into their clients (How would you feel if Google started indexing your files and returning them in search results?)  Unless the Docker image is exporting its files, Windows has no way to access /var/www/data — or even to understand such a path; e.g.,

    C:\Users\Tom_Hart\Documents> notepad /var/www/data/cache/widget/overlay/something

won’t work (it might think you mean C:\var\www\data\cache\...).  It seems natural that Windows will refuse to create a symbolic link, in a Windows directory, to a resource that cannot be accessed by Windows processes.

5
  • Yeah that's right. It's mounted as a data volume using this, ` -v /c/Users/TomHarto/Documents/development/public_html:/var/www/public_html \ `. I thought it could be because it's a mounted dir, but I was hoping there was a way around it.
    – TMH
    Commented Apr 22, 2015 at 8:15
  • Apologies for the delayed accept!
    – TMH
    Commented Jan 29, 2016 at 14:42
  • How can we check if symlink can be created as such?
    – Starx
    Commented Oct 23, 2016 at 7:22
  • @Starx: I expanded on my original answer; I hope that clarifies matters. Commented Oct 23, 2016 at 18:37
  • Thank you for adding that explanation. It's less helpful to me in particular as I want to check through command if symlinks on a path can be created or not. Have a look. unix.stackexchange.com/questions/317881/…
    – Starx
    Commented Oct 24, 2016 at 4:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .