GNU bug report logs - #42983
"sudo -E guix pull" breaks ~/.config/guix/current for regular user

Previous Next

Package: guix;

Reported by: Danny Milosavljevic <dannym <at> scratchpost.org>

Date: Sat, 22 Aug 2020 10:29:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: 42983 <at> debbugs.gnu.org
Subject: bug#42983: "sudo -E guix pull" breaks ~/.config/guix/current for regular user
Date: Mon, 24 Aug 2020 02:11:13 +0200
[Message part 1 (text/plain, inline)]
On Sat, 22 Aug 2020 12:27:50 +0200
Danny Milosavljevic <dannym <at> scratchpost.org> wrote:

> /var/guix/profiles/per-user/dannym/current-guix

Follow-up errors (translated to English manually):

 dannym <at> dayas ~$ guix pull
Migrating profile generations to „/var/guix/profiles/per-user/dannym“ …
guix pull: error: symlink: file exists: "/var/guix/profiles/per-user/dannym/current-guix"
1 dannym <at> dayas ~$ rm ~/.config/guix/current
 dannym <at> dayas ~$ cd .config/guix/
 dannym <at> dayas ~/.config/guix$ ln -s /var/guix/profiles/per-user/dannym/current-guix current
 dannym <at> dayas ~/.config/guix$ guix pull
Refreshing channel „guix“ from Git-Repository „https://git.savannah.gnu.org/git/guix.git“ …
guix pull: error: Git-Error: failed open - '/home/dannym/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq/.git/FETCH_HEAD' is locked: Permission denied

That's some weird guix pull state.

The culprit, I think, is this:

(define (ensure-default-profile)
  (ensure-profile-directory)

  ;; In 0.15.0+ we'd create ~/.config/guix/current-[0-9]*-link symlinks.  Move
  ;; them to %PROFILE-DIRECTORY.
  ;;
  ;; XXX: Ubuntu's 'sudo' preserves $HOME by default, and thus the second
  ;; condition below is always false when one runs "sudo guix pull".  As a
  ;; workaround, skip this code when $SUDO_USER is set.  See
  ;; <https://bugs.gnu.org/36785>.
  (unless (or (getenv "SUDO_USER")
              (string=? %profile-directory
                        (dirname
                         (canonicalize-profile %user-profile-directory))))
    (migrate-generations %user-profile-directory %profile-directory))

where

  %profile-directory = "/var/guix/profiles/per-user/dannym"
  %user-profile-directory = "/home/dannym/.config/guix/current" (which is a
symlink to /var/guix/profiles/per-user/root/current-guix)
[Message part 2 (application/pgp-signature, inline)]

This bug report was last modified 4 years and 292 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.