IPFS Repo Migration problems

I just installed IPFS version 0.4.22 on my Mac.

When I try to upload/add a file in TERMINAL - using the following command:

ipfs add myLogo.jpg

I get this error:

Error: ipfs repo needs migration

My repo version is ipfs repo version fs-repo@7

Additionally, when I try to run:

ipfs daemon

I get this error:

Initializing daemon...
go-ipfs version: 0.4.22-
Repo version: 7
System version: amd64/darwin
Golang version: go1.12.7
Found outdated fs-repo, migrations need to be run.
Run migrations now? [y/N]

So I tap on “y” to run these migrations, and then I get:

=> Looking for suitable fs-repo-migrations binary.
=> None found, downloading.
=> Running: /var/folders/l_/793j9l1j7fx4n6pb0zd2tww40000gn/T/go-ipfs-migrate464045646/fs-repo-migrations -to 7 -y
Found fs-repo version 2 at /Users/johnSmith/.ipfs
===> Running migration 2 to 3...
applying 2-to-3 repo migration
locking repo at "/Users/johnSmith/.ipfs"
- verifying version is '2'
beginning pin transfer
- opening datastore at "/Users/johnSmith/.ipfs"
- created version 3 pinner
- loading recursive pins
ipfs migration: migration 2 to 3 failed: datastore: key not found
=> Failed: /var/folders/l_/793j9l1j7fx4n6pb0zd2tww40000gn/T/go-ipfs-migrate464045646/fs-repo-migrations -to 7 -y
The migrations of fs-repo failed:
migration failed: exit status 1
If you think this is a bug, please file an issue and include this whole log output.

I’ve already spent a few hours trying to troubleshoot this with no luck. So, what in the world is going on - and what do I need to do to fix this?

What version were you on before upgrading to 0.4.22?

I honestly don’t know. Is there a way to find out? And either way, how should I proceed to fix this?

I think we can get down to a range of versions based on the table in the fs-repo-migrations repo.

            1 |  0.0.0 - 0.2.3
            2 |  0.3.0 - 0.3.11
            3 |  0.4.0 - 0.4.2
            4 |  0.4.3 - 0.4.5
            5 |  0.4.6 - 0.4.10
            6 |  0.4.11 - 0.4.15
            7 |  0.4.16 - current

It looks like your repo is on version 2, which was used between versions 0.3.0 and 0.3.11. For context, 0.4.0 seems to have been released on April 7, 2016.

From the error it almost sounds like there could be some datastore corruption (datastore: key not found); but I’m also not very familiar with the datastore migration process. If you were to install 0.3.11 temporarily just to access the repo, I’m curious what the output of ipfs repo verify would be.

It might be worth trying to upgrade the repo with version 0.4.0 or 0.4.2 to see if an older version can migrate the repo from 2 to 3. But maybe it will just use the same migration process.

Or maybe this is a bug in the migration code and worthy of an issue. I’m just not sure either way, though.

link to all versions of go-ipfs binaries

ok, I’m game - but how would I install version 0.3.11?

Here’s a direct link to the darwin-flavored binary:

The link at the end of my previous post also has links for a bunch of other historical and current binaries.

Oh I see - ok cool - I’ll try it and let you know what happens.

1 Like

I was also just thinking, this all assumes there’s something in the old repo you want to salvage. If the only data in the repo is from toying around with go-ipfs 3+ years ago and there’s nothing in it you care about, you could also just delete the old test repo (.ipfs directory) in your home folder and start over fresh with v0.4.22 using ipfs init.

well I have tried to do that. But every time I try to run ipfs init, it tells me:

Error: ipfs configuration file already exists!
Reinitializing would overwrite your keys.

And I’m like “fine! I don’t care! just do it!” - but it won’t let me.

I mean I would LOVE to just start fresh - but HOW?

Your repo is located in ~/.ipfs by default. You could rm -rf ~/.ipfs before running ipfs init again if you wanted to start fresh.

I’ve just been trashing my repo the old fashion way: dragging and dropping it to the Trash.
I don’t imagine there’s a difference between doing that and what you’re suggesting with rm -rf ~/.ipfs, is there?
If there is, how do I do that?
Meaning, I just did a cd to my usr/local/bin - which is where my ipfs repo is, and then tried your line-command from Terminal - but nothing happened. The repo is still there. So the line command basically doesn’t seem like its working for me.

So is this a big deal - or can I just drag n’ drop it to the trash?

There are some differences, but it’s similar. Dragging the .ipfs folder to the trash should be the close enough for this purpose.

The command I posted doesn’t depend on your current directory. ~ resolves to your home directory. And based on your first post, your repository is in /Users/johnSmith/.ipfs, which would be the default. The /usr/local/bin folder would be a strange place for a repository; but that is one of the places the ipfs binary can be installed.

The command I posted doesn’t return any output. So unless you got an error, it likely worked.

I’d expect that if you were to run ipfs init it would work now.

Not a big deal at all. If /Users/johnSmith/.ipfs is still there for some reason, then feel free to drag and drop it into the trash.

Well, I deleted everything, did a fresh install - of the version you suggested, 0.3.11 - and then ran
ipfs init

here’s what I got:

jonSmiths-MBP:bin jonSmith$ ipfs init
initializing ipfs node at /Users/jonSmith/.ipfs
generating 2048-bit RSA keypair...done
peer identity: QmUvF76ccLwhRcQ6DW26NtzC8YxcDpUivmZ1tkiNwbuAoM
panic: sync: inconsistent mutex state

And FYI, I’ve gotten this panic error before, several times when doing this fresh install thing.

The full error message is actually much longer than that. Here’s what comes right after what I just posted above:

goroutine 1 [running]:


/usr/local/Cellar/go/1.5.3/libexec/src/sync/mutex.go:74 +0x16d

github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage.(*fileStorage).GetFiles(0xc820437c20, 0x200000002, 0x0, 0x0, 0x0, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go:166 +0xad

github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.(*session).getFiles(0xc820411ce0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/session_util.go:44 +0x66

github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.(*DB).recoverJournal(0xc820094dc0, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:454 +0x63

github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.openDB(0xc820411ce0, 0x0, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:111 +0x6eb

github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.Open(0x178a488, 0xc820437c20, 0xc820126f58, 0x0, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:177 +0x17d

github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb.OpenFile(0xc82047ad50, 0x22, 0xc820126f58, 0x0, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:199 +0x97

github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/leveldb.NewDatastore(0xc82047ad50, 0x22, 0xc8201273a0, 0xc82047ad50, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/leveldb/datastore.go:23 +0x92

github.com/ipfs/go-ipfs/repo/fsrepo.(*FSRepo).openDatastore(0xc82046d000, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/repo/fsrepo/fsrepo.go:351 +0x171

github.com/ipfs/go-ipfs/repo/fsrepo.open(0xc8201d3a60, 0x18, 0x0, 0x0, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/repo/fsrepo/fsrepo.go:159 +0x488

github.com/ipfs/go-ipfs/repo/fsrepo.Open.func1(0x0, 0x0, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/repo/fsrepo/fsrepo.go:106 +0x4e

github.com/ipfs/go-ipfs/repo.(*OnlyOne).Open(0xfa7fd0, 0x79cfa0, 0xc8204788c0, 0xc820127720, 0x0, 0x0, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/repo/onlyone.go:35 +0x150

github.com/ipfs/go-ipfs/repo/fsrepo.Open(0xc8201d3a60, 0x18, 0x0, 0x0, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/repo/fsrepo/fsrepo.go:108 +0xd4

main.addDefaultAssets(0x1784198, 0xc820098008, 0xc8201d3a60, 0x18, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/cmd/ipfs/init.go:164 +0xd8

main.doInit(0x1784198, 0xc820098008, 0xc8201d3a60, 0x18, 0xc820260000, 0x800, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/cmd/ipfs/init.go:124 +0x3b3

main.glob.func2(0x1785b10, 0xc82012a480, 0x1785c78, 0xc82017bc00)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/cmd/ipfs/init.go:79 +0x405

github.com/ipfs/go-ipfs/commands.(*Command).Call(0xfaa580, 0x1785b10, 0xc82012a480, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/commands/command.go:110 +0x471

main.callCommand(0x1785be8, 0xc82024e380, 0x1785b10, 0xc82012a480, 0xfaa580, 0xf9fc80, 0x0, 0x0, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/cmd/ipfs/main.go:343 +0xa5c

main.(*cmdInvocation).Run(0xc82024e340, 0x1785be8, 0xc82024e380, 0x0, 0x0, 0x0, 0x0)

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/cmd/ipfs/main.go:186 +0x1e5


/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/cmd/ipfs/main.go:151 +0x65b

goroutine 17 [syscall, locked to thread]:


/usr/local/Cellar/go/1.5.3/libexec/src/runtime/asm_amd64.s:1721 +0x1

goroutine 27 [select, locked to thread]:

runtime.gopark(0xc1d6e8, 0xc820030f28, 0xa72a68, 0x6, 0xc1d618, 0x2)

/usr/local/Cellar/go/1.5.3/libexec/src/runtime/proc.go:185 +0x163

runtime.selectgoImpl(0xc820030f28, 0x0, 0x18)

/usr/local/Cellar/go/1.5.3/libexec/src/runtime/select.go:392 +0xa64


/usr/local/Cellar/go/1.5.3/libexec/src/runtime/select.go:212 +0x12


/usr/local/Cellar/go/1.5.3/libexec/src/runtime/signal1_unix.go:227 +0x323


/usr/local/Cellar/go/1.5.3/libexec/src/runtime/asm_amd64.s:1721 +0x1

goroutine 20 [chan receive]:


/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/codahale/metrics/metrics.go:321 +0x73

created by github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/codahale/metrics.init.1

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/codahale/metrics/metrics.go:328 +0x7b

goroutine 21 [select]:


/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/vendor/QmQg1J6vikuXF9oDvm4wpdeAUvvkVEKW1EYDw9HhTMnP2b/go-log/writer.go:71 +0x33c

created by github.com/ipfs/go-ipfs/vendor/QmQg1J6vikuXF9oDvm4wpdeAUvvkVEKW1EYDw9HhTMnP2b/go-log.NewMirrorWriter

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/vendor/QmQg1J6vikuXF9oDvm4wpdeAUvvkVEKW1EYDw9HhTMnP2b/go-log/writer.go:38 +0xe2

goroutine 22 [syscall]:


/usr/local/Cellar/go/1.5.3/libexec/src/os/signal/signal_unix.go:22 +0x18

created by os/signal.init.1

/usr/local/Cellar/go/1.5.3/libexec/src/os/signal/signal_unix.go:28 +0x37

goroutine 29 [select]:


/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go:205 +0x271

created by github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util.NewBufferPool

/Users/dignifiedquire/opensource/ipfs/distributions/dists/go-ipfs/gopath/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go:236 +0x26b

crazy, isn’t it?

Pretty much makes me wanna give up.

Or just use Infura to access IPFS - though that doesn’t seem to work perfectly either.


You should’ve tried to init with 0.4.22; it doesn’t make any sense to start fresh with a version so old that it probably can’t even connect to anything anymore. I would suggest getting rid of that old repo and then trying again with 0.4.22. The suggestion to temporarily try 0.3.11 from years ago to verify your old repo was only if you wanted to continue troubleshooting your old repo.

Partially out of curiosity, what version of macOS are you on?

To answer your question I’m on MacOS 10.14.5 - Mojave.

In terms of the IPFS versions - I tried everything with both 0.3.11 and 0.4.22 - but I’m not 100% sure if my installation process is correct?

Here’s what I’m doing:

  1. Downloaded go-ipfs_v0.4.22_darwin-amd64.tar.gz from ipfs.io
    -as per usual, the file automatically downloads to my “Downloads” folder

  2. I double-click the file there to expand it - which creates a folder called “go-ipfs”
    -this folder contains 4 files:

  3. Double-clicking on the README.md file, it says:

    "This is the ipfs commandline tool. It contains a full ipfs node.
    To install it, move the binary somewhere in your $PATH:

       sudo mv ipfs /usr/local/bin/ipfs

    (This by the way, is why I put my ipfs in “usr/local/bin/”, cause the instructions say so - unless I’m not understanding them correctly?)

    -When I run this sudo command from Terminal, I get this:

    No such file or directory

    I’m assuming that’s because I’m supposed to first cd into my Downloads, before running that command. So I do that. I cd into Downloads, run that command, and bingo, ipfs gets moved to my
    usr/local/bin/ directory.

  4. Next, the “README” file says:

    "First, you must initialize your local ipfs node:

     ipfs init

    OK, so I run ipfs init - and I get this:

    initializing IPFS node at /Users/johnSmith/.ipfs
    Error: ipfs configuration file already exists!
    Reinitializing would overwrite your keys.

Needless to say, I’ve already deleted and trashed my previous installation of ipfs from my /usr/local/bin/, so I don’t understand why I’m getting this error.

OK, so now I’m curious so I type ‘ipfs version’ and it says:

ipfs version 0.4.22

-For kicks I type in ipfs config show, and I get this nice long JSON with all this info, like

  "API": {
    "HTTPHeaders": null
  "Addresses": {
    "API": "/ip4/",
    "Gateway": "/ip4/",
    "Swarm": [
  "Bootstrap": [

It goes on for a bit - and importantly, it does include:

"Identity": {
    "PeerID": "Qmxxxxxxxxxxxxxxxxxxxxxx"

(I put all those x’s in)

So part of me thinks “ok, that means my ipfs is already init’d and I’m good to go!” - BUT, when I then do

ipfs id

I get:

Error: ipfs repo needs migration

So…I don’t really know what I’m supposed to do at this point.


Yes, what you did is correct for installing ipfs on macOS. There’s a difference between the ipfs “binary” and the ipfs “repository”. The binary file is the ipfs executable. The repository is referring to where IPFS stores its configuration files and data structures.

Everything up through #3 sounds fine in your last post. You don’t need to touch the installed ipfs any more to get a fresh repo.

I think this is because after we cleaned up your old repo, you initialized a new (outdated) one with 0.3.11 instead of 0.4.22. Once you said you don’t care about the old repo anymore, that removed any need to use 0.3.11.

Without the $ symbols:

# remove your outdated 0.3.11 repo (leave the 0.4.22 binary as is)
$ rm -rf /Users/johnSmith/.ipfs
# initialize a new repo assuming *0.4.22* is still installed
$ ipfs init
# test it with a simple command
$ ipfs id
1 Like

hey you know what?

that seems to have worked!

I’m gonna fiddle with it for a bit just to make sure, but you may have solved it!

1 Like

I went through all of this before learning about https://github.com/ipfs/ipfs-update