[Solved] Issue with unstable packages after last unsuccessful update (and frozen laptop with consequent hard reboot)

Edit: sudo nix-store --verify --repair --check-contents solved the issue, as pointed out by @symphorien (just adding the final s)

A few hours ago I did update the system:

sudo nixos-rebuild switch --upgrade --show-trace

At some point, the system froze (I will post a separate topic about it). I hard rebooted, started a new update and it constantly failed installing unstable.postman (previously worked):

  /nix/store/i4105ay37n233wgqbb3jvi84c83zv34c-nixos-system-max-nixos-20.09.4407.1c1f5649bb9.drv
building '/nix/store/pl1lbg9kz17mjqlvj14187j9gn6nzihh-postman.desktop.drv'...
building '/nix/store/cxl3nqqgk069348l96xhdmf2zrvz7f3v-postman.tar.gz.drv'...
Running desktop-file validation
/build/.attr-0: line 14: /nix/store/q52xkiya9r70sr6kamqc9i838p17ayq4-desktop-file-utils-0.24/bin/desktop-file-validate: cannot execute binary file: Exec format error
builder for '/nix/store/pl1lbg9kz17mjqlvj14187j9gn6nzihh-postman.desktop.drv' failed with exit code 126
cannot build derivation '/nix/store/5hwb5zyg70gfmmzgy27r4r8apgfrdmxr-postman-9.1.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/paqypmrmkqrv61q9yih9wd2alpnpag3l-man-paths.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/gvyyial89qsmayf7bw2fhs78vp9l2r7n-postman-9.1.1_fish-completions.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/dkff608vydwzpdibkamavli88s2wp0an-system-path.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/i4105ay37n233wgqbb3jvi84c83zv34c-nixos-system-max-nixos-20.09.4407.1c1f5649bb9.drv': 1 dependencies couldn't be built
error: build of '/nix/store/i4105ay37n233wgqbb3jvi84c83zv34c-nixos-system-max-nixos-20.09.4407.1c1f5649bb9.drv' failed

I reverted postman to the current channel and, after the next update ended, I am now finding out that I have issues with several packages:

❯ google-chrome-stable 
/nix/store/ppjlp950x8lvdb2lc48c50bb3rff73ak-google-chrome-95.0.4638.54/share/google/chrome/google-chrome: error while loading shared libraries: /nix/store/1pj0qrswyq0iyfa4xzqwppnfxszvh868-glib-2.70.0/lib/libgobject-2.0.so.0: invalid ELF header

❯ google-chrome-beta 
/nix/store/z3rnd24g84pb4rkkiy0pnfgk06cih7jz-google-chrome-beta-96.0.4664.18/share/google/chrome-beta/google-chrome-beta: error while loading shared libraries: /nix/store/1pj0qrswyq0iyfa4xzqwppnfxszvh868-glib-2.70.0/lib/libgobject-2.0.so.0: invalid ELF header

❯ google-chrome-unstable 
/nix/store/vz3g147rfqkrb64grc1ir3p4i80qh614-google-chrome-dev-97.0.4676.0/share/google/chrome-unstable/google-chrome-unstable: error while loading shared libraries: /nix/store/1pj0qrswyq0iyfa4xzqwppnfxszvh868-glib-2.70.0/lib/libgobject-2.0.so.0: invalid ELF header

❯ kitty
Traceback (most recent call last):
  File "/nix/store/97w52ckcjnfiz89h3lh7zf1kysgfm2s8-python3-3.9.6/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/nix/store/97w52ckcjnfiz89h3lh7zf1kysgfm2s8-python3-3.9.6/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/nix/store/idf8k0lm75vq4mgp02p46z4vr14x9pjj-kitty-0.23.1/bin/../lib/kitty/__main__.py", line 153, in <module>
    main()
  File "/nix/store/idf8k0lm75vq4mgp02p46z4vr14x9pjj-kitty-0.23.1/bin/../lib/kitty/__main__.py", line 146, in main
    from kitty.main import main as kitty_main
  File "/nix/store/idf8k0lm75vq4mgp02p46z4vr14x9pjj-kitty-0.23.1/bin/../lib/kitty/kitty/main.py", line 12, in <module>
    from .borders import load_borders_program
  File "/nix/store/idf8k0lm75vq4mgp02p46z4vr14x9pjj-kitty-0.23.1/bin/../lib/kitty/kitty/borders.py", line 9, in <module>
    from .fast_data_types import (
ImportError: /nix/store/1pj0qrswyq0iyfa4xzqwppnfxszvh868-glib-2.70.0/lib/libglib-2.0.so.0: invalid ELF header

No idea so far how many packages are affected. Reverting to the current channel versions, packages are successfully installed and run normally.

Any hint? Should I open issue(s) on the repo?

The hard reboot may have corrupted files on your filesystem.
Try sudo nix-store --verify --repair --check-content to check for any corruption in the store. (Note: It might take a while.)

1 Like

Thank you very much, you nailed it. This solved the issue.

–check-contents

I will leave the output here as reference:

❯ sudo nix-store --verify --repair --check-contents
reading the Nix store...
checking path existence...
checking hashes...
path '/nix/store/1pj0qrswyq0iyfa4xzqwppnfxszvh868-glib-2.70.0' was modified! expected hash 'sha256:0sl5bm181z1la5njmry12c0dmnynqr7gs6glqzbbm25fpk2jmwc5', got 'sha256:1sklk872wvf5ryqac2kifag32lx0dfrfp0cxn23njjp4kk8vnqgm'
copying path '/nix/store/1pj0qrswyq0iyfa4xzqwppnfxszvh868-glib-2.70.0' from 'https://cache.nixos.org'...
path '/nix/store/1v7gfx6vakjidi24h15ch23j19mm3hzh-gcc-10.3.0' was modified! expected hash 'sha256:0w3jdbkmq0qwz8n5jw9jaa4vsb7bh47assqhsbqgs04nzbk5a162', got 'sha256:01ixck7zawv82ddr2ywvpcpl9rs2zrnm95bx29rqb0a2jrnxhj9v'
copying path '/nix/store/1v7gfx6vakjidi24h15ch23j19mm3hzh-gcc-10.3.0' from 'https://cache.nixos.org'...
path '/nix/store/2s9z6fsfpvkxfhm83rwv6sdlhlgahd06-dconf-0.40.0-lib' was modified! expected hash 'sha256:0l6n4nkxgfh61rcw6isk6q752rmygbz4cjgg9h608a7xxyv9a709', got 'sha256:0bz975r7dvy1fdp5y040ks2hz9j9m1ykadax3p7d25p271gh364c'
copying path '/nix/store/2s9z6fsfpvkxfhm83rwv6sdlhlgahd06-dconf-0.40.0-lib' from 'https://cache.nixos.org'...
path '/nix/store/nvqywx11fx6grglvg2yq2vrvxz0f5b0w-gamin-0.1.10' was modified! expected hash 'sha256:1m2yncvjxknaih6a2x2m0cal48qkg5yrg3mksy7s20lhyay5kzhb', got 'sha256:1wv6031gnmykgcl1c3hnc43pz5p08y3jcmrfzqanfrracbri5x0j'
copying path '/nix/store/nvqywx11fx6grglvg2yq2vrvxz0f5b0w-gamin-0.1.10' from 'https://cache.nixos.org'...
path '/nix/store/q52xkiya9r70sr6kamqc9i838p17ayq4-desktop-file-utils-0.24' was modified! expected hash 'sha256:09n58n2vizjnxwxm2p3i9a7ikwvmzykibag4c0x8capljrg120kb', got 'sha256:0kafy8fk6j1mj48891w8h1gxl37d4wd5q8wpy1yck8kv68vcfvgl'
copying path '/nix/store/q52xkiya9r70sr6kamqc9i838p17ayq4-desktop-file-utils-0.24' from 'https://cache.nixos.org'...
path '/nix/store/zdz1sd3fragbaaapknny12ajzx20g9wq-atk-2.36.0' was modified! expected hash 'sha256:0942838312mgjwsd931hi0fy5fkvz50kf17dnysr3zl5m5jwny24', got 'sha256:0pwz5i2hxk1bgl2kjw2a6ywlb2vwd5bi35ip1d27rw2gn7h1mjfr'
copying path '/nix/store/zdz1sd3fragbaaapknny12ajzx20g9wq-atk-2.36.0' from 'https://cache.nixos.org'...
path '/nix/store/zzc683ygmmaw81w4g8s8wvrsbdcpak57-gcc-wrapper-10.3.0' was modified! expected hash 'sha256:03rnv2gj5y6ys2nbhbfpxhflnrdj2wk45knawccz3dxvni07s9jv', got 'sha256:0mdkfjsfmyp9k2v5xs55cfn0mkkvhiqlzzhavdjbbxsqi9l38mzc'
copying path '/nix/store/zzc683ygmmaw81w4g8s8wvrsbdcpak57-gcc-wrapper-10.3.0' from 'https://cache.nixos.org'...

I did not even thought this could be the case: after the freeze, I went back a couple generations and started from there updating again. I assumed that previous generations would not be corrupted anyway. This is the second time I fall in this error.