So, with Kubo out, I thought it was time to tinker with it and manually compile the latest & greatest version (0.15.0-dev) on my public node, straight from the GitHub sources, using Go 1.18.4 under Ubuntu 22.04.1 LTS.
How naĆÆve of meā¦
Basically, the compilation didnāt work ā I definitely got the binaries for ipfs
and ipfs-update
, and they certainly launched, but they were also having some issues with the quic-go
component (which is not directly under the dev teamās control ā at least not totally ā and possibly requires compiling with earlier versions of Go). This isnāt easily fixable (at least not yet), so it was time to download the official binaries for kubo, including ipfs
, ipfs-update
, and (for good measure) fs-repo-migrate
, and install them by simply placing them in the proper places (in my case, /usr/bin
owned by the user ipfs
)
And here is the strange thing that I got:
$ ipfs daemon
Initializing daemon...
Kubo version: 0.14.0
Repo version: 12
System version: amd64/linux
Golang version: go1.18.3
Error: Your programs version (12) is lower than your repos (14).
Please update ipfs to a version that supports the existing repo, or run
a migration in reverse.
See https://github.com/ipfs/fs-repo-migrations/blob/master/run.md for details.
Ok. That was baffling, since at the time of writing, repo version 12 is the latest one. There is no version 14. So where did that come from?!
All right, I read the instructions, and itās not the first time I had to tweak the migration manually; itās usually a painless experience. So, I tried to do a reverse migration (also using the user ipfs
) the following way:
$ fs-repo-migrations --revert-ok
Found fs-repo version 14 at /var/local/ipfs/.ipfs
Do you want to upgrade this to version 12? [y/n] y
2022/08/03 12:16:28 Looking for suitable migration binaries.
2022/08/03 12:16:28 Need 2 migrations, downloading.
2022/08/03 12:16:28 Downloading migration: fs-repo-13-to-14...
2022/08/03 12:16:28 Downloading migration: fs-repo-12-to-13...
2022/08/03 12:16:28 could not get latest version of migration fs-repo-12-to-13: GET https://ipfs.io/ipns/dist.ipfs.io/fs-repo-12-to-13/versions error: 404 Not Found: ipfs resolve -r /ipns/dist.ipfs.io/fs-repo-12-to-13/versions: no link named "fs-repo-12-to-13" under QmcSiPhsEFp8iHZVC1zGj8Yd4FxqHnCMtM5TJ9yMaVneCa
2022/08/03 12:16:28 could not get latest version of migration fs-repo-13-to-14: GET https://ipfs.io/ipns/dist.ipfs.io/fs-repo-13-to-14/versions error: 404 Not Found: ipfs resolve -r /ipns/dist.ipfs.io/fs-repo-13-to-14/versions: no link named "fs-repo-13-to-14" under QmcSiPhsEFp8iHZVC1zGj8Yd4FxqHnCMtM5TJ9yMaVneCa
2022/08/03 12:16:28 Failed to download migrations.
ipfs migration: failed to download migrations: fs-repo-13-to-14 fs-repo-12-to-13
(fs-repo-migration
is v2.0.2, straight from the official binaries for Linux amd64)
Ok, this makes sense: there are no versions above 12, so it makes sense that there are no official āpatchesā from 12 to 13 and 13 to 14. To check that there wasnāt an overnight upgrade by some reason, I tried:
$ fs-repo-migrations -v
12
Again, thatās exactly what is expected.
So, how on Earth did IPFS jump its repo version to 14?!?
My only (rational) explanation is that, during my many attempts at compiling a more recent version from the GitHub sources, and testing each run, one of them may have corrupted the repo version number, using a (yet) inexistent version 14 (strangely, not version 13, which would make more sense). It might not even have corrupted the data itself, only the version number; but there is no way I can tell, since, well, the only tool Iāve got to fix/repair things is ipfs
itself, and itās as baffled as I am from a version ācoming from the futureā.
I was reading the GitHub notes for fs-repo-migrations
, and I somehow understand how the process works: basically, for every repo version bump, one is expected to provide a plugin which does the migration but also the reverse migration; such plugins are applications with their own Git (sub-)repository. By taking a peek at the source for fs-repo-migrations
, itās clear that the greatest and latest repo version is, indeed, 12, and that all the migration plugins are available, up to 11-to-12, which was developed half a year ago. Again ā no surprises there.
There are instructions on how to write oneās own migration plugin. I could do that, of course, but then I would have to know what changes were made to the repo on versions 13 and 14 ā none of which exist yet. This is really quite intriguing, and I suspect that really there arenāt any changes on my repo at all, except for the wrongly set version number.
Naturally, I tried to read some of the answers provided here (such as this old one) but none applied to my particular case.
Well, frustrated, all that remained for me to do was to make a repo backup and then manually edit ~/.ipfs/version
which did indeed have version number 14 ā and change it to 12.
Huh. That seemed to do the trick. ipfs
now launches without complaints, and, as far as I can see, all the data I had (namely, the pinned files/directories) seems to be in the right place and all. The configuration seems to be working well, since all the extra goodies Iāve got running on top of ipfs
seem to be operational. At least nothing shows up on the logs, and, as far as I can test things, they work.
Obviously, Iām happy now and Iām pretty sure that even if I have lost some data, the built-in mechanisms (checksums/hashes, signatures, etc.) will eventually drop any truncated/mangled blocks, refresh them from one of the peers, and, over time, repair itself (if, indeed, it requires repairingā¦). However, I cannot be 100% sure that this is the case. I mean, if I go back and edit the version
file to display, say, 11, things wonāt work that easily ā at best, ipfs
would consider the version to be wrong, and attempt a repair, which might not necessarily fail but just ādo nothingā, eventually updating the version
back to 12 again, and everything would continue to run smoothly.
But it could be much worse than that, and the migration process might simply break everything along the way. And, who knows, the backup might stop working as well ā I have no idea if the repo version is somehow āembeddedā in the blocks themselves. There are too many variables there ā too many things that can go wrong in different ways ā and just because by sheer chance my configuration seems to be working, this is not really a āfixā, but rather a āhackā.
Naturally, Iām still baffled at what changed the version number to ā14ā. All I can see is that the last change to the version
file was made on July 20. I think I wasnāt tinkering with ipfs
that early, but only much later, i.e. on July 29 or 30, so, strangely, this ābumpā to repo version 14 seems to have happened well before I was attempting a new compilation.
And thatās a bit scary, IMHO ā I donāt expect that the ipfs
daemon simply ādecidedā for itself what the repo version ought to be, and changes it in silence, in the background.
Then again, I was running a self-compiled, developer version of ipfs
before, so perhaps I stumbled upon a bugā¦ but the truth is that the commit history for the ipfs
sources donāt seem to refer to such a bug (itās still possible that it has been fixed and commented with an overarching description which includes the fix among others ā I did not look into the code, mind you).
Did anyone ever encounter such a strange situation, i.e. that ipfs
suddenly and unexpectedly changes the repo version number to the future, self-breaking its own ability to repair/migrate the repo?
And ā besides manually editing the version number and praying that it works ā is there any other way to get ipfs
to somehow check if the repo structure does match the version it thinks it has? (that seems to be tricky to accomplish, though)
Can anyone who delved deep into the code confirm that the only place where ipfs
and the other tools look for the repo version is at ~/.ipfs/version
?
Thanks in advance for any input or suggestions; as said, my simple hack seems to be working for now, and Iāll keep a close eye on the logs to see if there are some unexpected new errors popping upā¦
Cheers,
- Gwyn