srid / neuron

Future-proof note-taking and publishing based on Zettelkasten (superseded by Emanote: https://github.com/srid/emanote)
https://neuron.zettel.page
GNU Affero General Public License v3.0
1.52k stars 150 forks source link

Unable to upgrade, "program 'tar' failed with exit code 2" #545

Closed applejag closed 3 years ago

applejag commented 3 years ago

I'm new to nix. Not sure how to debug this.

I previously had neuron-1.1.12.0 installed, then tried to upgrade by following the https://neuron.zettel.page/install.html guide.

$ nix-env -if https://github.com/srid/neuron/archive/master.tar.gz --show-trace
unpacking 'https://github.com/NixOS/nixpkgs/archive/9ce1caa63c9c806e705cd0d282a4aa920dce76fd.tar.gz'...

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
error: while evaluating anonymous function at /nix/store/x3dnyq51pwlpsnjgs407ngx57bcdi4ky-master.tar.gz/default.nix:1:1, called from undefined position:
while evaluating the attribute 'neuron' at /nix/store/x3dnyq51pwlpsnjgs407ngx57bcdi4ky-master.tar.gz/project.nix:113:3:
while evaluating the file '/nix/store/x3dnyq51pwlpsnjgs407ngx57bcdi4ky-master.tar.gz/dep/nixpkgs/default.nix':
while evaluating the file '/nix/store/x3dnyq51pwlpsnjgs407ngx57bcdi4ky-master.tar.gz/dep/nixpkgs/thunk.nix':
while evaluating 'fetch' at /nix/store/x3dnyq51pwlpsnjgs407ngx57bcdi4ky-master.tar.gz/dep/nixpkgs/thunk.nix:2:13, called from /nix/store/x3dnyq51pwlpsnjgs407ngx57bcdi4ky-master.tar.gz/dep/nixpkgs/thunk.nix:9:4:
program 'tar' failed with exit code 2

Is this a problem with nix or neuron?

Kind regards,


Edit: Here's some environment info:

applejag commented 3 years ago

Found the command nix-store and the parameter --gc which seemed appropriate.

I uninstalled neuron, ran the garbage collection, and then tried the command again. The nix-env -if command took a while to complete (8m 21s) as it has to download and compile everything from scratch (and I've a below average internet connection), but it worked!

nix-env -e neuron

nix-store --gc

nix-env -if https://github.com/srid/neuron/archive/master.tar.gz

Closing this as resolved as I found a workaround.

applejag commented 3 years ago

Heh, now I wanted to downgrade again because I found that my editor didn't support neuron v2 even slightly. But without success.

I've done multiple GC runs and tried reinstalling both neuron v1 and neuron from master, as well as running the nix installation script multiple times just to see if that changed anything.

I'm stuck at not being able to install neuron v1, which was installed and working before..

$ nix-store --gc
finding garbage collector roots...
deleting garbage...
deleting '/nix/store/amcgza7nfnbckns1429gx1vgqwrp3vs6-source'
deleting '/nix/store/2pa0h9wqw1y6yzz7xczivbr35fyxi8q5-v1.tar.gz'
deleting '/nix/store/10x2w31y0p7a5m5r34g9vxqz1d9rh37g-v1.tar.gz'
deleting '/nix/store/trash'
deleting unused links...
note: currently hard linking saves -0.00 MiB
3 store paths deleted, 13.22 MiB freed

$ nix-env -if https://github.com/srid/neuron/archive/v1.tar.gz --show-trace
unpacking 'https://github.com/NixOS/nixpkgs/archive/3537ea7a8358abe11d07223812305faebf3d5074.tar.gz'...

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
error: while evaluating anonymous function at /nix/store/10x2w31y0p7a5m5r34g9vxqz1d9rh37g-v1.tar.gz/default.nix:1:1, called from undefined position:
while evaluating the attribute 'neuron' at /nix/store/10x2w31y0p7a5m5r34g9vxqz1d9rh37g-v1.tar.gz/project.nix:104:3:
while evaluating the file '/nix/store/10x2w31y0p7a5m5r34g9vxqz1d9rh37g-v1.tar.gz/dep/nixpkgs/default.nix':
while evaluating the file '/nix/store/10x2w31y0p7a5m5r34g9vxqz1d9rh37g-v1.tar.gz/dep/nixpkgs/thunk.nix':
while evaluating 'fetch' at /nix/store/10x2w31y0p7a5m5r34g9vxqz1d9rh37g-v1.tar.gz/dep/nixpkgs/thunk.nix:2:13, called from /nix/store/10x2w31y0p7a5m5r34g9vxqz1d9rh37g-v1.tar.gz/dep/nixpkgs/thunk.nix:9:4:
program 'tar' failed with exit code 2

Is there some other kind of cache I'm missing that I could be clearing?

Edit: Btw that nix-env -if command takes on average 6m 40s until it fails. It has been quite tedious to test different solutions I can come up with. It took it like 8m before when it succeeded and it doesn't log any errors until it completely fails, so I cannot just CTRL-C quickly and try something else.

applejag commented 3 years ago

Rebooted my WSL instance with wsl.exe -t Ubuntu, relaunched my terminal, ran the nix-env -if command again, and then it worked.

I do "love" these back-n-forth issues. So "happy" I could be the author of one... Lol.


Moral of the issue: When in doubt, restart the machine. (as always)

srid commented 3 years ago

Cloning the git repo locally and running nix-env -if . is another way to install it.

srid commented 3 years ago

I found that my editor didn't support neuron v2 even slightly.

@jilleJr If you are using vim or emacs, here's some info on making them work with v2 (shouldn't be too much effort, as I pushed the new query CLI today).

When you migrate to v2, checkout the dirtree plugin -- it helps organize your notes in directories, as well as obviates many uses of tag queries (simplify the workflow overall in the process).

applejag commented 3 years ago

Hey thanks! Yea I'm using the emacs neuron-mode plugin.

Good note on the dirtree tip. My zettelkasten is up to just 49 zettels atm but it's already getting so annoying to navigate the file structure manually.