hypercore-protocol / hyperdrive-daemon

Hyperdrive, batteries included.
MIT License
156 stars 23 forks source link

FUSE support on Windows? #18

Open sammacbeth opened 4 years ago

sammacbeth commented 4 years ago

I tried to set this up on Windows, but fuse-shared-library does not currently support windows. From this issue: https://github.com/fuse-friends/fuse-native/issues/3 I see that the new fuse native library that this project uses explicitly does not support Windows, though the predecessor did via Dokan. Is adding support planned?

mafintosh commented 4 years ago

Would love to support windows! We just down have the resources to do this atm. If someone wants to take a stab at it (and help support it), we'd of course love to add it.

mafintosh commented 4 years ago

(The daemon itself should run on windows fine tho, just not the magic fs)

andrewosh commented 4 years ago

@sammacbeth As @mafintosh mentioned the FUSE components of the daemon won't work on Windows now (though hopefully we'll have support for that in the future), but the daemon installation and all the non-FUSE bits should work. That said, we haven't done much Windows testing, so if you're hitting an issue at install time that's a bug.

We're trying to make it so that the FUSE portion is an optional part of the installation, but there might still be problems there. Any extra info you have would be super helpful.

sammacbeth commented 4 years ago

Thanks for the responses. The install seems to run ok, apart from the error with fuse-shared-library. However I get some errors when using the cli API:

PS C:\Users\samma_000> hyperdrive start
FUSE installation failed. You will be unable to mount your hyperdrives.
Daemon started at localhost:3101
PS C:\Users\samma_000> hyperdrive fs status
FUSE installation failed. You will be unable to mount your hyperdrives.
C:\Users\samma_000\AppData\Roaming\npm\node_modules\hyperdrive-daemon\node_modules\hyperdrive-daemon-client\bin\fs\status.js:14
    client.fuse.status((err, { available, configured }) => {
                               ^

TypeError: Cannot destructure property `available` of 'undefined' or 'null'.
    at C:\Users\samma_000\AppData\Roaming\npm\node_modules\hyperdrive-daemon\node_modules\hyperdrive-daemon-client\bin\fs\status.js:14:30
    at C:\Users\samma_000\AppData\Roaming\npm\node_modules\hyperdrive-daemon\node_modules\call-me-maybe\index.js:13:28
    at processTicksAndRejections (internal/process/task_queues.js:76:11)
mafintosh commented 4 years ago

Seems like a silly desctructuring bug. Shouldn't be too hard to fix :)

bltavares commented 4 years ago

As of now, not using the setup and just trying to start will not work as it uses some POSIX exclusive node methods on start. I've tried even a hyperdrive --help and it fails on the same point.

I'm post here to document if others endup searching, until I can figure out how to fix this :)

PS C:\Users\bltav>  hyperdrive start
FUSE installation failed. You will be unable to mount your hyperdrives.
C:\Users\bltav\AppData\Roaming\npm\node_modules\hyperdrive-daemon\bin\setup.js:23
    default: process.geteuid(),
                     ^

TypeError: process.geteuid is not a function
    at Object.<anonymous> (C:\Users\bltav\AppData\Roaming\npm\node_modules\hyperdrive-daemon\bin\setup.js:23:22)
    at Module._compile (internal/modules/cjs/loader.js:1144:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
    at Module.load (internal/modules/cjs/loader.js:993:32)
    at Function.Module._load (internal/modules/cjs/loader.js:892:14)
    at Module.require (internal/modules/cjs/loader.js:1033:19)
    at Object.require (internal/modules/cjs/helpers.js:72:18)
    at C:\Users\bltav\AppData\Roaming\npm\node_modules\hyperdrive-daemon\node_modules\require-directory\index.js:76:17
    at Array.forEach (<anonymous>)
    at requireDirectory (C:\Users\bltav\AppData\Roaming\npm\node_modules\hyperdrive-daemon\node_modules\require-directory\index.js:59:24)
bltavares commented 4 years ago

I've tried using it with WSL2 and I could not load it either. There is a /dev/fuse available on the system, but no kernel extension to load.

bruno@Vaporware /mnt/c/Users/bltav % ls -la /dev/fuse
crw-rw-rw- 1 root root 10, 229 Feb  5 12:22 /dev/fuse

bruno@Vaporware /mnt/c/Users/bltav % modinfo fuse
libkmod: ERROR ../libkmod/libkmod.c:586 kmod_search_moddep: could not open moddep file '/lib/modules/4.19.84-microsoft-standard/modules.dep.bin'
modinfo: ERROR: Module alias fuse not found.

bruno@Vaporware /mnt/c/Users/bltav % dpkg -s fuse
Package: fuse
Status: install ok installed
Priority: optional
Section: utils
Installed-Size: 141
Maintainer: Laszlo Boszormenyi (GCS) <gcs@debian.org>
Architecture: amd64
Version: 2.9.9-1
Depends: libc6 (>= 2.28), libfuse2 (= 2.9.9-1), adduser, mount (>= 2.19.1), sed (>= 4)
Conffiles:
 /etc/fuse.conf 298587592c8444196833f317def414f2
Description: Filesystem in Userspace
 Filesystem in Userspace (FUSE) is a simple interface for userspace programs to
 export a virtual filesystem to the Linux kernel. It also aims to provide a
 secure method for non privileged users to create and mount their own filesystem
 implementations.
Homepage: https://github.com/libfuse/libfuse/wiki

bruno@Vaporware /mnt/c/Users/bltav % hyperdrive setup
FUSE installation failed. You will be unable to mount your hyperdrives.
Could not configure FUSE.
FUSE installation failed.
FUSE bindings are not available on this platform.
bltavares commented 4 years ago

More updates on this.

hyperdrive-daemon does work on WSL2 as previously expected :)

Due to Windows executable being available on Linux ~(Crazy! I Know!)~, when executing hyperdrive setup it was using the windows installed version and trying to setup FUSE on Windows instead of inside Linux.

Running with npx hypedrive setup worked on WSL as it selected the correct binary. It will not have MDNS as WSL runs inside a virtual network, and the broadcast will not reach other computers on LAN