Subject: Guix commands throws after running `sudo -i guix pull` on foreign distro. Wrong guile version used for regular user.

From: Simen Endsjø <[email-masked]>
Date: Thu, 17 Feb 2022 09:55:55 +0100

Not sure if this is a bug, or if it's somehow my fault.

I'm using Guix on a foreign distro, and I think I broke my system after
running `$ sudo -i guix pull`.  When running `$ guix pull` I get
lots of warnings like the following

    ;;; WARNING: loading compiled file (.. snip ..) failed:
    ;;; In procedure load-thunk-from-memory: incompatible bytecode version

And commands like `pull` and `update` throws exceptions. I've tried
rebooting my system to no effect.

Both roots and my `realpath $(which guix)` returns
`/gnu/store/rkm49zf7gk3xj94bnscjsr3c1vaam977-guix-command`.
This is a shebang script, calling
`/gnu/store/549xzhnm3q810py1v0jbv0px0prd3a21-guile-wrapper/bin/guile`.

The strange thing is that the wrapper script invokes a different version
of guile for root and my user. Root doesn't have guile installed, while
my user have guile installed. That script uses 3.0.8 for root and 3.0.7
for my user. Discussed this on IRC yesterday, and another user had a
similar setup, but the script retured 3.0.8 for both users.

    # guix describe
    Generation 12	Feb 17 2022 09:50:18	(current)
    guix 755c7c8
        repository URL: https://git.savannah.gnu.org/git/guix.git
        branch: master
        commit: 755c7c80825c150b5a8b38072bcfb78699f2fbf2

    $ guix describe
    # (.. lots of incompatible bytecode warnings ..)
    Generation 11	Feb 16 2022 19:06:25	(current)
    guix 373c77b
        repository URL: https://git.savannah.gnu.org/git/guix.git
        branch: master
        commit: 373c77bf22ad69bdb303742ff5e18ec47de20d4f
    guix-gaming-games 43aa8af
        repository URL: https://gitlab.com/guix-gaming-channels/games.git
        branch: master
        commit: 43aa8af5f2bfbf4400fc46925909da56d4094cb7
    flat ece373b
        repository URL: https://github.com/flatwhatson/guix-channel.git
        branch: master
        commit: ece373bcd1e00ef746fb7b104e56ab610cc4af2a
    nonguix 35533c7
        repository URL: https://gitlab.com/nonguix/nonguix
        branch: master
        commit: 35533c763a81365e14d0b58ad262e8f88c82872c

    $ guix pull
    # (.. lots of incompatible bytecode warnings ..)
    Backtrace:
            19 (_ #<procedure 7f60fbde9700 at ice-9/eval.scm:330:13 ()> …)
            18 (_ #<procedure 7f60fbde9600 at ice-9/eval.scm:330:13 ()> …)
    In ice-9/eval.scm:
    191:27 17 (_ #(#(#<directory (guix store) 7f6137c78000> #<pr…>) …))
    196:35 16 (_ #(#(#(#<directory (guix store) 7f6137c78000> …) #) #))
    298:34 15 (_ #(#(#(#<directory (guix channels) 7f6135e4b460>) …) …))
    In ice-9/boot-9.scm:
    2835:4 14 (save-module-excursion _)
        152:2 13 (with-fluid* _ _ _)
    In unknown file:
            12 (primitive-load "/gnu/store/8zwkzd3a3m5s8baqbcqq4wac5p6…")
    In ice-9/eval.scm:
    626:19 11 (_ #<directory (build-self) 7f6123411d20>)
    293:34 10 (_ #<directory (build-self) 7f6123411d20>)
    293:34  9 (_ #(#(#<directory (gnu packages) 7f613447dc80>) "gu…" …))
        619:8  8 (_ #(#(#(#<directory (gnu packages) 7f613447dc80>) …) #))
    626:19  7 (_ #(#(#(#<directory (gnu packages) 7f613447dc80>) …) #))
    293:34  6 (_ #(#(#(#<directory (guix memoization) 7f6137…> …) …) …))
    In ice-9/boot-9.scm:
    1747:15  5 (with-exception-handler #<procedure 7f60f7680c00 at ic…> …)
    In ice-9/eval.scm:
        619:8  4 (_ #(#(#(#<directory (gnu packages) 7f613447dc80> #)) #))
    626:19  3 (_ #(#(#(#<directory (gnu packages) 7f613447dc80> #)) #))
    In unknown file:
            2 (load-compiled/vm "/home/simendsjo/.config/guix/current…")
    In ice-9/boot-9.scm:
    1685:16  1 (raise-exception _ #:continuable? _)
    1685:16  0 (raise-exception _ #:continuable? _)

    ice-9/boot-9.scm:1685:16: In procedure raise-exception:
    In procedure load-thunk-from-memory: incompatible bytecode version

    $ guix package -u guile
    # (.. lots of incompatible bytecode warnings ..)
    Backtrace:
    In ice-9/boot-9.scm:
        152:2 19 (with-fluid* _ _ _)
        152:2 18 (with-fluid* _ _ _)
        152:2 17 (with-fluid* _ _ _)
        724:2 16 (call-with-prompt _ _ #<procedure 7f1341be2a20 at ice-9…>)
        152:2 15 (with-fluid* _ _ _)
        142:2 14 (dynamic-wind #<procedure 7f131f5639c0 at ice-9/eval.s…> …)
    In ice-9/eval.scm:
    293:34 13 (_ #(#(#(#(#(#<directory (guix scripts pac…> …)) …) …) …))
        619:8 12 (_ #(#(#(#<directory (guix scripts package) 7f13…>) …) …))
    626:19 11 (_ #(#(#(#<directory (guix scripts package) 7f13…>) …) …))
    In srfi/srfi-1.scm:
    460:18 10 (fold #<procedure 7f131ebd12a0 at ice-9/eval.scm:336:1…> …)
    In ice-9/eval.scm:
    293:34  9 (_ #(#(#(#(#(#(#(#(#(#(#(…) …) …) …) …) …) …) …) …) …) …))
    293:34  8 (_ #(#(#<directory (gnu packages) 7f1343281280>) "gu…" …))
        619:8  7 (_ #(#(#(#<directory (gnu packages) 7f1343281280>) …) #))
    626:19  6 (_ #(#(#(#<directory (gnu packages) 7f1343281280>) …) #))
    293:34  5 (_ #(#(#(#<directory (guix memoization) 7f1345…> …) …) …))
    In ice-9/boot-9.scm:
    1747:15  4 (with-exception-handler #<procedure 7f132050b300 at ic…> …)
    In ice-9/eval.scm:
        619:8  3 (_ #(#(#(#<directory (gnu packages) 7f1343281280> #)) #))
    626:19  2 (_ #(#(#(#<directory (gnu packages) 7f1343281280> #)) #))
    In unknown file:
            1 (load-compiled/vm "/home/simendsjo/.config/guix/current…")
    In ice-9/boot-9.scm:
    1685:16  0 (raise-exception _ #:continuable? _)

    ice-9/boot-9.scm:1685:16: In procedure raise-exception:
    In procedure load-thunk-from-memory: incompatible bytecode version