Error: root can't be a file when trying to mount

I installed IPFS, ran into a lot of problems but got it running eventually. Hitting issues with FUSE. I am on Ubuntu 18.04

I created /ipfs and /ipns. Fuse is working. My user is a member of the fuse group. I chowned /ipfs and /ipns to my user.

But when I issue ipfs mount it sits there for ~30 seconds then the daemon spits out this error (without crashing):

ERROR node: error mounting: root can't be a file (unixfs type: File) mount_unix.go:93

And I get back Error: root can't be a file (unixfs type: File) from the command line client.

I don’t even know what this error means, my / directory is definitely not a file, /ipfs and /ipns are both certainly directories and not files, I have no idea what this is even in reference to. Any guesses?

Hm… It looks like the last file you published to your IPNS key was a file, not directory. IPFS is trying to mount this at /ipns/local/ but obviously can’t.

That’s a crappy error and we should probably just not mount /ipns/local if it’s not a directory. Mind filing a bug report at https://github.com/ipfs/go-ipfs/issues?

Going to try answering again, I feel my first attempt to reply was a mess.

When I published the file /ipns and /ipfs were not mounted, as I got an error saying IPFS could not publish while they were mounted. I got the error when I tried to re-mount after publishing. I don’t understand how or why IPFS-Go would try to put the file at /ipns/local – I very much never told it to do that or had a a chance. I was following the examples on the main IPFS website as closely as I could.

I honestly don’t know what to think of your suggestion as I can think of no reason how or why my file would end up at /ipns/local. Are you saying that somehow when it went to populate these directories on mount the IPFS-go software got confused and put my file at /ipns/local?

I got the same error:

$ ipfs daemon --mount
Initializing daemon…
go-ipfs version: 0.4.18-
Repo version: 7
System version: amd64/darwin
Golang version: go1.11.1
Swarm listening on …
…
API server listening on …
17:05:48.710 ERROR node: error mounting: root can’t be a file (unixfs type: File) mount_unix.go:93
Error: root can’t be a file (unixfs type: File)

From the clue by @stebalien , I fixed it temporarily by publishing a directory to IPNS:

$ ipfs name publish <hash of any directory in IPFS>


$ ipfs daemon --mount
Initializing daemon…
go-ipfs version: 0.4.18-
Repo version: 7
System version: amd64/darwin
Golang version: go1.11.1
Swarm listening on …
…
API server listening on …
IPFS mounted at: /ipfs
IPNS mounted at: /ipns
Gateway (readonly) server listening on …
Daemon is ready

However, it’s just a workaround at best. Hopefully it will be formally solved soon.

Two more issues:

1. mount helper error: mount_osxfuse: mount point /ipns is itself on a OSXFUSE volume

$ ipfs daemon --mount
Initializing daemon…
go-ipfs version: 0.4.18-
Repo version: 7
System version: amd64/darwin
Golang version: go1.11.1
Swarm listening on …
…
API server listening on …
2019/02/21 21:52:06 mount helper error: mount_osxfuse: mount point /ipns is itself on a OSXFUSE volume
21:52:06.991 ERROR node: error mounting: mount_osxfusefs: exit status 64 mount_unix.go:93
Error: mount_osxfusefs: exit status 64

It happens after I stop the daemon while leaving other terminal accessing /ipns mountpoint. Found a workaround @(https://github.com/ipfs/go-ipfs/blob/master/docs/fuse.md#mount-command-crashes-and-mountpoint-gets-stuck)

umount /ipns

2. ERROR fuse/ipns: Error Shutting Down Filesystem: context canceled

IPFS mounted at: /ipfs
IPNS mounted at: /ipns
Gateway (readonly) server listening on …
Daemon is ready
^C
Received interrupt signal, shutting down…
(Hit ctrl-c again to force-shutdown the daemon.)
21:57:09.460 ERROR fuse/ipns: Error Shutting Down Filesystem: context canceled ipns_unix.go:68

It happens after I stop the daemon without other terminal accessing /ipns mountpoint.