Subject: Re: bug#29662: 'guix gc' as user makes system unbootable

From: [email-masked] (Ludovic Courtès)
Date: Mon, 18 Dec 2017 15:31:59 +0100

Hi,

Martin Castillo <[email-masked]> skribis:

>> Normally the current ‘grub.cfg’ is a GC root, which prevents the
>> background image and other items from being deleted:
>> 
>> --8<---------------cut here---------------start------------->8---
>> $ ls -l /var/guix/gcroots/bootcfg 
>> lrwxrwxrwx 1 root root 52 Dec  7 23:21 /var/guix/gcroots/bootcfg -> /gnu/store/2bnr3z8q0rpvdc9zrshhyq4znx7jpzq6-grub.cfg
>> $ guix gc --references /var/guix/gcroots/bootcfg 
>> /gnu/store/i3l4cv1mz30l4jafbghmbgmafc0xb38h-grub-image.png
>> /gnu/store/j5x3dfappv9fdp7h46kgm8wxjbcqv5r6-system
>> /gnu/store/qkhhqqkr0lkczwqwbp95gx4s8v0pjj41-raw-initrd
>> /gnu/store/xqfpwxbghvi3h85pfji6kdzw7db2sgxz-grub-2.02
>> /gnu/store/zi4awdcvrlj0fp74yb0y4ngah4qmcri0-linux-libre-4.14.4
>> $ sudo diff /var/guix/gcroots/bootcfg /boot/grub/grub.cfg 
>> $ echo $?
>> 0
>> --8<---------------cut here---------------end--------------->8---

[...]

> Like I said, I cannot reproduce currently. guix gc --list-dead doesn't
> mention grub files anymore.
>
> below you see what I wrote while doing stuff. it starts with a missing
> bootcfg, then doing stuff and at '--- end' I start again with a bootcfg.
>
> --- start missing bootcfg
>
> $ ls /var/guix/gcroots
> auto/  booted-system  current-system  profiles
>
> I don't have bootcfg in there.

Under what circumstances did you have a system without
/var/guix/gcroots/bootcfg?

> # guix system switch-generation 14
> substitute: updating list of substitutes from
> 'https://berlin.guixsd.org'... 100.0%
> substitute: updating list of substitutes from
> 'https://mirror.hydra.gnu.org'... 100.0%
> The following derivation will be built:
>    /gnu/store/31bxx2nwp3lxzdkcy8bmybabfl1pi0af-grub.cfg.drv
> Von Generation »10« zu »14« gewechselt
> $ diff /var/guix/gcroots/bootcfg /boot/grub/grub.cfg
> ## no-output, grub.cfg has still the same content->
> /var/guix/gcroots/bootcfg changed
> # guix system reconfigure confs/config.scm
> ## mentions expected grub error
> $ diff /var/guix/gcroots/bootcfg /boot/grub/grub.cfg
> see diff [2]
>
> it does not seem to update /var/guix/gcroots/bootcfg.
> and bootcfg somehow lists the generation number in the default entry.

Are you saying that ‘guix system switch-generation’ does not update the
target of the /var/guix/gcroots/bootcfg symlink?  (From a quick look at
the code it seems to update it.)

Thanks,
Ludo’.