Skip to content

FUSE IPNS does not update/save new hash (0.4.0) #2168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Kubuxu opened this issue Jan 6, 2016 · 6 comments · May be fixed by #9302
Open

FUSE IPNS does not update/save new hash (0.4.0) #2168

Kubuxu opened this issue Jan 6, 2016 · 6 comments · May be fixed by #9302
Labels
kind/bug A bug in existing code (including security flaws) need/maintainer-input Needs input from the current maintainer(s) topic/fuse Topic fuse

Comments

@Kubuxu
Copy link
Member

Kubuxu commented Jan 6, 2016

[root@test1 ~]# ipfs swarm peers
/ip6/2a03:7380:298:14da:2c00::103/tcp/4001/ipfs/QmPxcxqujyHGMKYPmtbtvLKypkfyvYbjVdnzubPgZDxzGM
[root@test1 ~]# ipfs mount
IPFS mounted at: /ipfs
IPNS mounted at: /ipns
[root@test1 ~]# echo "test" > /ipns/local/test
[root@test1 ~]# ls /ipns/local
test
[root@test1 ~]# pkill ipfs

Received interrupt signal, shutting down...
19:07:09.845 ERROR      mount:  (c *closer) Close(),/ipfs mount.go:91
19:07:09.845 ERROR      mount:  (c *closer) Close(),/ipns mount.go:91
[1]+  Done                    ipfs daemon
[root@test1 ~]# ipfs daemon &
[1] 120
Initializing daemon...
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip6/2001:470:c9dd:100:407d:65ff:feb9:f855/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready

[root@test1 ~]# ipfs mount
IPFS mounted at: /ipfs
IPNS mounted at: /ipns
[root@test1 ~]# ls /ipns/local
                                                  // Missing file
@em-ly em-ly added kind/bug A bug in existing code (including security flaws) topic/fuse Topic fuse labels Aug 25, 2016
@whyrusleeping
Copy link
Member

@Kubuxu is this still an issue?

@whyrusleeping whyrusleeping added the need/verification This issue needs verification label Mar 6, 2017
@Kubuxu Kubuxu self-assigned this Mar 6, 2017
@Kubuxu
Copy link
Member Author

Kubuxu commented Mar 15, 2017

Just tired it again, it is still an issue.

I also got following log during ipfs daemon close:

13:49:20.932 ERROR        mfs: republishRoot error: context canceled system.go:255

@Kubuxu Kubuxu removed the need/verification This issue needs verification label Mar 15, 2017
@Kubuxu Kubuxu removed their assignment Mar 15, 2017
@djdv djdv self-assigned this May 14, 2019
@ec1oud
Copy link

ec1oud commented Sep 25, 2022

Still an issue. Is there some reason not to fix it?

@ec1oud
Copy link

ec1oud commented Sep 25, 2022

func (api *NameAPI) Publish(ctx context.Context, p path.Path, opts ...caopts.NamePublishOption) (coreiface.IpnsEntry, error) {
	ctx, span := tracing.Span(ctx, "CoreAPI.NameAPI", "Publish", trace.WithAttributes(attribute.String("path", p.String())))
	defer span.End()
	fmt.Println("--- name.publish got here?", p, opts)

	if err := api.checkPublishAllowed(); err != nil {
		fmt.Println("--- not allowed!")
		return nil, err
	}

It's (silently) not getting very far in this function for the same reason that the ipfs name publish command doesn't work while ipns is mounted (#1186 #964) So either we need to add a new option like AllowWhileMounted to github.com/ipfs/interface-go-ipfs-core/options, or add another argument to this Publish function to allow an override, or break it up into Publish and DoPublish or something like that.

@aidanharris
Copy link

Are the linked pull requests above still relevant?

It doesn't look like this was ever reviewed properly. I'm running into the "Error: cannot manually publish while IPNS is mounted" even though I don't have IPNS mounted. I did run ipfs mount earlier but unmounted it, it doesn't seem to realise that I've unmounted it.

$ mount | grep ipfs
/dev/fuse on /ipfs type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000,allow_other)
$ mount | grep ipns
# empty (not mounted)

I could of course restart the daemon and that would fix the problem but I don't really want to do that right now.

@djdv
Copy link
Contributor

djdv commented Mar 17, 2025

Are the linked pull requests above still relevant?

Not the author but a few years ago I was reimplementing the mount command and this one of the first problems I had to solve, so I can speak to this a little.


Bypassing the lock is not going to solve the problem fundamentally, it's just going to remove the safeguard that was put in place to prevent conflicting concurrent access.

The way I ended up dealing with it was adding refining the locking semantics into a resource locking API in the daemon's core, and then utilizing it in other parts like the IPNS code. This could have been exposed to the public API as well to allow this to work remotely.
It never gave me any issues but, as expected, a resource locking API was not well received (by Protocol Labs), so that effort went nowhere.

You can see a demo of that working here though: https://www.youtube.com/watch?v=OX0vM0Ay9Z0&list=PLrZxGPqQuwHC_cZF2assuM0Vl3D5s5OSN&index=11
The IPFS node from Windows is being mounted on a remote Linux machine which updates its IPNS record via file system writes that the IPFS node on the Windows machine sees and publishes.
This is contrived on purpose to be complicated, typically I just run the daemon on my Windows desktop and mount it there and that worked well enough for me and other users when we were running it daily.


That demo uses my fork of the daemon which includes the locks to handle remote MFS and IPNS modifications without conflicts and ports the mount code to more platforms than just Linux, and without a lot of the shortcoming the current implementation has. But that was also not well received so that effort also went nowhere.

Personally, I'd rather have something that works and can be refined instead of nothing for several years.
But I think the IPFS team requires a better alternative, and despite the years that have passed, I guess nobody has presented one?

I wonder if anyone can come up with some lockless approach using some arcane magic.
Again though, if you ask me, workarounds that are reasonable enough should have been implemented first and refined into a good solution rather than just having no solution at all and waiting for a perfect one.

For what it's worth, the remote resource locking API is something I still need in order for to implement client software that mounts IPNS and MFS without requiring forking the code base and/or have access to the daemon's internal APIs.
Or at least some solution for this specific problem (publishing while mounted).

@hsanjuan hsanjuan added the need/maintainer-input Needs input from the current maintainer(s) label Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) need/maintainer-input Needs input from the current maintainer(s) topic/fuse Topic fuse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants