solo-io / unik

The Unikernel & MicroVM Compilation and Deployment Platform
Apache License 2.0
2.71k stars 191 forks source link

Pulling image fails with status 500 (invalid cross-device link) #113

Closed ryangalamb closed 7 years ago

ryangalamb commented 7 years ago

When trying to work through the "Pull and run a unikernel without building on VirtualBox" tutorial, running unik pull --image PythonExample --provider virtualbox fails with this message:

FATA[0059] [client/images.go:107] failed with status 500: [virtualbox/pull_image.go:43] renaming tmp image to /home/rjmill/.unik/virtualbox/images/PythonExample/boot.vmdk: {rename /tmp/tmp-pull-image-PythonExample035683735 /home/rjmill/.unik/virtualbox/images/PythonExample/boot.vmdk: invalid cross-device link}

Looking at the code where it fails, the daemon is trying to use os.Rename to move the image from my /tmp directory to somewhere in my /home directory.

The problem appears to be that my /home directory is on a separate partition from my /tmp directory. And using os.Rename to move a file between partitions doesn't work (hence the invalid cross-device link at the end of the error message.)

Other potentially useful info:

I'm not super familiar with Go yet, but this issue seems straightforward enough. I'll try taking a stab at this tomorrow and hopefully have a PR for this.

ilackarms commented 7 years ago

an easy workaround for this is to change the default directory that Go uses to store temporary files by overriding the default value of TMPDIR with another directory. e.g.

export TMPDIR=/path/to/custom/tmp/
unik daemon [...args]

I think a patch to fix this should be pretty simple. We already default to using ~/.unik/tmp on OSX because of an issue with Docker Machine there. We can simply make this the norm for both OSes

edit: Patched, this should be fixed now on master