ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.03k stars 3k forks source link

IPFS Files root not avialable fix in 'ipfs repo fsck' #3934

Open Kubuxu opened 7 years ago

Kubuxu commented 7 years ago

Version information: 0.4.9

Type: Bug

Severity: High

Description:

I somehow managed to do this:

 ~  ipfs files rm -r /                                                                        ✘ 
Error: error loading filesroot from DAG: merkledag: not found
 ~  ipfs files stat /                                                                         ✘ 
Error: error loading filesroot from DAG: merkledag: not found
 ~  ipfs files rm /                                                                           ✘ 
Error: error loading filesroot from DAG: merkledag: not found

and this

 ipfs daemon       
Initializing daemon...
Adjusting current ulimit to 2048...
Successfully raised file descriptor limit to 2048.
^C
Received interrupt signal, shutting down...
(Hit ctrl-c again to force-shutdown the daemon.)
16:24:37.894 ERROR   cmd/ipfs: error from node construction: error loading filesroot from DAG: Failed to get block for QmP6wAYvriaFzQjWMb7CPJP6v8LvEuYRh32mEEn6b45WRK: context canceled daemon.go:337
Error: error loading filesroot from DAG: Failed to get block for QmP6wAYvriaFzQjWMb7CPJP6v8LvEuYRh32mEEn6b45WRK: context canceled

Having ipfs repo fsck check for this problem and fixing it under user confirmation (as it might lead to data loss as files root is best effort pinning would be nice).

kevina commented 7 years ago

Should we prompt or output a warning and suggest the user rerun with a flag?

whyrusleeping commented 7 years ago

I think asking the user to pass a special flag would be good.

kevina commented 6 years ago

4446 will you allow you to remove the root. I did it a separate command as removing it (even if the hash no longer exists) could lead to data loss. The assumption is that someone who uses this command knows what they are doing.