Subject: bug#39195: guix pull switching between profiles/per-user and profiles/default

From: Jimmy Thrasibule <[email-masked]>
Date: Sun, 19 Jan 2020 20:22:58 +0100

After a fresh Guix install, when calling subsequent ``guix pull`` it will
always try to migrate the profile at ``/root/.cong/guix/current`` between
``/var/guix/profiles/default`` and ``/var/guix/profiles/per-user/root``.

The issue is that if there are any existing links in the target folder,
``guix pull`` will fail:

     guix pull: error: symlink: File exists:
"/var/guix/profiles/per-user/root/current-guix

For example after unpacking the store, the first ``guix pull`` will migrate
the profile to ``profiles/default``:

    # ls -l .config/guix/
    total 0
    lrwxrwxrwx    1 root     root            45 Jan 19 18:33 current ->
/var/guix/profiles/per-user/root/current-guix
    # guix pull
    Migrating profile generations to '/var/guix/profiles/default'...
    Updating channel 'guix' from Git repository at '
https://git.savannah.gnu.org/git/guix.git'...
    [...]

Then calling ``guix pull`` again will fail:

    # ls -l .config/guix/
    total 0
    lrwxrwxrwx    1 root     root            39 Jan 19 18:37 current ->
/var/guix/profiles/default/current-guix
    # guix pull
    Migrating profile generations to '/var/guix/profiles/per-user/root'...
    guix pull: error: symlink: File exists:
"/var/guix/profiles/per-user/root/current-guix"

The workaround is to link back the profile to ``per-user/root`` and delete
``/var/guix/profiles/default/current-guix*``. After this action, any other
``guix pull`` will run as expected.