GNU bug report logs - #26271
'guix system' does not support common build option '--root'

Previous Next

Package: guix;

Reported by: Chris Marusich <cmmarusich <at> gmail.com>

Date: Mon, 27 Mar 2017 04:55:02 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26271 in the body.
You can then email your comments to 26271 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#26271; Package guix. (Mon, 27 Mar 2017 04:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Marusich <cmmarusich <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 27 Mar 2017 04:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Chris Marusich <cmmarusich <at> gmail.com>
To: bug-guix <at> gnu.org
Subject: 'guix system' does not support common build option '--root'
Date: Sun, 26 Mar 2017 21:54:23 -0700
[Message part 1 (text/plain, inline)]
Hi,

The manual says ((guix) Invoking guix system) that the options to 'guix
system' "can contain any of the common build options".  Although some
common build options (e.g. '--fallback') do seem to work, I have noticed
that the '--root' option does not.  Consider the following:

--8<---------------cut here---------------start------------->8---
[0] marusich <at> garuda:/tmp
$ GUIX_BUILD_OPTIONS=--root=foo guix system disk-image --image-size=1G ~/guix/gnu/system/install.scm
guix system: error: root=foo: unrecognized option
[1] marusich <at> garuda:/tmp
$ guix system disk-image --root=foo --image-size=1G ~/guix/gnu/system/install.scm
guix system: error: root=foo: unrecognized option
[1] marusich <at> garuda:/tmp
$ guix system disk-image -r foo --image-size=1G ~/guix/gnu/system/install.scm
guix system: error: r: unrecognized option
[1] marusich <at> garuda:/tmp
$ 
--8<---------------cut here---------------end--------------->8---

I expected the 'guix system' command to run normally and produce an
indirect GC root at path /tmp/foo.  Instead, the command failed.  The
'--root' option does work with 'guix build'.  Is the documentation
incorrect, or is this a bug?

-- 
Chris
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#26271; Package guix. (Mon, 27 Mar 2017 08:59:02 GMT) Full text and rfc822 format available.

Message #8 received at 26271 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Chris Marusich <cmmarusich <at> gmail.com>
Cc: 26271 <at> debbugs.gnu.org
Subject: Re: bug#26271: 'guix system' does not support common build option
 '--root'
Date: Mon, 27 Mar 2017 10:58:09 +0200
Hi Chris,

Chris Marusich <cmmarusich <at> gmail.com> skribis:

> The manual says ((guix) Invoking guix system) that the options to 'guix
> system' "can contain any of the common build options".  Although some
> common build options (e.g. '--fallback') do seem to work, I have noticed
> that the '--root' option does not.  Consider the following:

That’s because ‘--root’ is not a “common build option” in the sense of
"(guix) Common Build Options".  :-)

That said, I agree we should either make it a common option (i.e., add
it to ‘%standard-build-options’ in (guix scripts build)) or add it
explicitly to ‘guix system’.  The latter may be simpler.

Thoughts?

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#26271; Package guix. (Mon, 27 Mar 2017 14:14:01 GMT) Full text and rfc822 format available.

Message #11 received at 26271 <at> debbugs.gnu.org (full text, mbox):

From: Chris Marusich <cmmarusich <at> gmail.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 26271 <at> debbugs.gnu.org
Subject: Re: bug#26271: 'guix system' does not support common build option
 '--root'
Date: Mon, 27 Mar 2017 07:12:57 -0700
[Message part 1 (text/plain, inline)]
ludo <at> gnu.org (Ludovic Courtès) writes:

> Hi Chris,
>
> Chris Marusich <cmmarusich <at> gmail.com> skribis:
>
>> The manual says ((guix) Invoking guix system) that the options to 'guix
>> system' "can contain any of the common build options".  Although some
>> common build options (e.g. '--fallback') do seem to work, I have noticed
>> that the '--root' option does not.  Consider the following:
>
> That’s because ‘--root’ is not a “common build option” in the sense of
> "(guix) Common Build Options".  :-)
>
> That said, I agree we should either make it a common option (i.e., add
> it to ‘%standard-build-options’ in (guix scripts build)) or add it
> explicitly to ‘guix system’.  The latter may be simpler.
>
> Thoughts?

As long as 'guix system' will create an indirect gc root as expected,
regardless of whether '--root' was specified in the environment variable
for build options or as a command-line option for the 'guix system'
command, adding it explicitly to 'guix system' seems OK to me.

I'll see if I can submit a patch later this week.

-- 
Chris
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#26271; Package guix. (Tue, 04 Apr 2017 07:40:02 GMT) Full text and rfc822 format available.

Message #14 received at 26271 <at> debbugs.gnu.org (full text, mbox):

From: Chris Marusich <cmmarusich <at> gmail.com>
To: Chris Marusich <cmmarusich <at> gmail.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 26271 <at> debbugs.gnu.org
Subject: Re: bug#26271: 'guix system' does not support common build option
 '--root'
Date: Tue, 04 Apr 2017 00:39:12 -0700
[Message part 1 (text/plain, inline)]
Chris Marusich <cmmarusich <at> gmail.com> writes:

> ludo <at> gnu.org (Ludovic Courtès) writes:
>
>> Hi Chris,
>>
>> Chris Marusich <cmmarusich <at> gmail.com> skribis:
>>
>>> The manual says ((guix) Invoking guix system) that the options to 'guix
>>> system' "can contain any of the common build options".  Although some
>>> common build options (e.g. '--fallback') do seem to work, I have noticed
>>> that the '--root' option does not.  Consider the following:
>>
>> That’s because ‘--root’ is not a “common build option” in the sense of
>> "(guix) Common Build Options".  :-)
>>
>> That said, I agree we should either make it a common option (i.e., add
>> it to ‘%standard-build-options’ in (guix scripts build)) or add it
>> explicitly to ‘guix system’.  The latter may be simpler.
>>
>> Thoughts?
>
> As long as 'guix system' will create an indirect gc root as expected,
> regardless of whether '--root' was specified in the environment variable
> for build options or as a command-line option for the 'guix system'
> command, adding it explicitly to 'guix system' seems OK to me.
>
> I'll see if I can submit a patch later this week.

I've attached a small patch series which adds support.  Please let me
know what you think.  (If you prefer that I send the patches to you via
some other email list or something, please let me know.)  I've verified
manually that the patches fix the issue.  For example:

--8<---------------cut here---------------start------------->8---
$ GUIX_BUILD_OPTIONS='--root=my-indirect-root' ./pre-inst-env guix system disk-image ~/guix/gnu/system/install.scm
/gnu/store/qr83vk7lifm63jscrv1gfqzj80zwkmca-disk-image
$ ls -l | grep indir
lrwxrwxrwx 1 marusich users       54 Apr  3 23:44 my-indirect-root -> /gnu/store/qr83vk7lifm63jscrv1gfqzj80zwkmca-disk-image
$ ls -l /var/guix/gcroots/auto/ | grep indir
lrwxrwxrwx 1 root root 36 Apr  3 23:44 wk6bx8f7xjq8ab7dz683n64ly21dyw8x -> /home/marusich/guix/my-indirect-root
--8<---------------cut here---------------end--------------->8---

It works the same when I pass the option directly on the command line as
'--root=foo' or '-r foo', too.

-- 
Chris
[0001-build-Export-register-root-procedure.patch (text/x-patch, attachment)]
[0002-system-Support-the-root-option-in-guix-system.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#26271; Package guix. (Tue, 04 Apr 2017 21:35:02 GMT) Full text and rfc822 format available.

Message #17 received at 26271 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Chris Marusich <cmmarusich <at> gmail.com>
Cc: 26271 <at> debbugs.gnu.org
Subject: Re: bug#26271: 'guix system' does not support common build option
 '--root'
Date: Tue, 04 Apr 2017 23:34:31 +0200
Hi Chris,

Chris Marusich <cmmarusich <at> gmail.com> skribis:

> I've attached a small patch series which adds support.  Please let me
> know what you think.  (If you prefer that I send the patches to you via
> some other email list or something, please let me know.)  I've verified
> manually that the patches fix the issue.  For example:
>
> $ GUIX_BUILD_OPTIONS='--root=my-indirect-root' ./pre-inst-env guix system disk-image ~/guix/gnu/system/install.scm
> /gnu/store/qr83vk7lifm63jscrv1gfqzj80zwkmca-disk-image
> $ ls -l | grep indir
> lrwxrwxrwx 1 marusich users       54 Apr  3 23:44 my-indirect-root -> /gnu/store/qr83vk7lifm63jscrv1gfqzj80zwkmca-disk-image
> $ ls -l /var/guix/gcroots/auto/ | grep indir
> lrwxrwxrwx 1 root root 36 Apr  3 23:44 wk6bx8f7xjq8ab7dz683n64ly21dyw8x -> /home/marusich/guix/my-indirect-root
>
> It works the same when I pass the option directly on the command line as
> '--root=foo' or '-r foo', too.

Nice.

> From ccf03e4bb5d5c2d3a47efdf64e36a7d903bfb2c5 Mon Sep 17 00:00:00 2001
> From: Chris Marusich <cmmarusich <at> gmail.com>
> Date: Mon, 3 Apr 2017 23:47:22 -0700
> Subject: [PATCH 1/2] build: Export register-root procedure.
>
> * guix/scripts/build.scm: Export register-root procedure.

Applied.

> From e96c877459555f4cf868fb5fe4579183f6a773d5 Mon Sep 17 00:00:00 2001
> From: Chris Marusich <cmmarusich <at> gmail.com>
> Date: Mon, 3 Apr 2017 23:49:22 -0700
> Subject: [PATCH 2/2] system: Support the --root option in 'guix system'.
>
> Fixes <https://bugs.gnu.org/26271>.
>
> * guix/scripts/system.scm (perform-action): Add parameters 'store' and
>   'gc-root'.  Update docstring.
>   (perform-action) [gc-root]: Add an indirect GC root using store.
>   (%options): Add 'root'.
>   (process-action): Pass 'store' and 'root' to perform-action.

[...]

> -(define* (perform-action action os
> +(define* (perform-action store action os
>                           #:key grub? dry-run? derivations-only?
>                           use-substitutes? device target
>                           image-size full-boot?
> -                         (mappings '()))


[...]

>               ;; All we had to do was to build SYS.
> -             (return (derivation->output-path sys))))))))
> +             (return (let ((output-path (derivation->output-path sys)))
> +                       (if gc-root
> +                           (register-root store (list output-path) gc-root)
> +                           output-path)))))))))

‘perform-action’ is a monadic procedure; IOW, the ‘store’ parameter is
already threaded into it.  Thus, instead of adding an explicit ‘store’
parameter, which must “lift” ‘register-root’ in the store monad:

  (define register-root*
    (store-lift register-root))

and then use it like a normal monadic procedure:

  (let ((output (derivation->output-path sys)))
    (mbegin %store-monad
      (mwhen gc-root
        (register-root* (list output) gc-root))
      (return output)))

Could you change this patch along these lines?

Also please make sure to mention ‘--root’ in ‘show-help’ and in
guix.texi.

Thank you!

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#26271; Package guix. (Thu, 06 Apr 2017 07:07:02 GMT) Full text and rfc822 format available.

Message #20 received at 26271 <at> debbugs.gnu.org (full text, mbox):

From: Chris Marusich <cmmarusich <at> gmail.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 26271 <at> debbugs.gnu.org
Subject: Re: bug#26271: 'guix system' does not support common build option
 '--root'
Date: Thu, 06 Apr 2017 00:05:49 -0700
[Message part 1 (text/plain, inline)]
ludo <at> gnu.org (Ludovic Courtès) writes:

>> From ccf03e4bb5d5c2d3a47efdf64e36a7d903bfb2c5 Mon Sep 17 00:00:00 2001
>> From: Chris Marusich <cmmarusich <at> gmail.com>
>> Date: Mon, 3 Apr 2017 23:47:22 -0700
>> Subject: [PATCH 1/2] build: Export register-root procedure.
>>
>> * guix/scripts/build.scm: Export register-root procedure.
>
> Applied.

Thank you!

>> From e96c877459555f4cf868fb5fe4579183f6a773d5 Mon Sep 17 00:00:00 2001
>> From: Chris Marusich <cmmarusich <at> gmail.com>
>> Date: Mon, 3 Apr 2017 23:49:22 -0700
>> Subject: [PATCH 2/2] system: Support the --root option in 'guix system'.
>>
>> Fixes <https://bugs.gnu.org/26271>.
>>
>> * guix/scripts/system.scm (perform-action): Add parameters 'store' and
>>   'gc-root'.  Update docstring.
>>   (perform-action) [gc-root]: Add an indirect GC root using store.
>>   (%options): Add 'root'.
>>   (process-action): Pass 'store' and 'root' to perform-action.
>
> [...]
>
>> -(define* (perform-action action os
>> +(define* (perform-action store action os
>>                           #:key grub? dry-run? derivations-only?
>>                           use-substitutes? device target
>>                           image-size full-boot?
>> -                         (mappings '()))
>
>
> [...]
>
>>               ;; All we had to do was to build SYS.
>> -             (return (derivation->output-path sys))))))))
>> +             (return (let ((output-path (derivation->output-path sys)))
>> +                       (if gc-root
>> +                           (register-root store (list output-path) gc-root)
>> +                           output-path)))))))))
>
> ‘perform-action’ is a monadic procedure; IOW, the ‘store’ parameter is
> already threaded into it.  Thus, instead of adding an explicit ‘store’
> parameter, which must “lift” ‘register-root’ in the store monad:
>
>   (define register-root*
>     (store-lift register-root))
>
> and then use it like a normal monadic procedure:
>
>   (let ((output (derivation->output-path sys)))
>     (mbegin %store-monad
>       (mwhen gc-root
>         (register-root* (list output) gc-root))
>       (return output)))
>
> Could you change this patch along these lines?

Thank you for reminding me that we can do it this way!  I've updated the
patch and verified that it still works.

> Also please make sure to mention ‘--root’ in ‘show-help’ and in
> guix.texi.

In the attached patch series, I've mentioned '--root' in 'show-help'.
However, since there is already a link in the '(guix) Invoking guix
system)' section to the section which describes the common build options
((guix) Common Build Options), I decided not to duplicate the
documentation for '--root' in that section.

If you still think we should mention '--root' in '(guix) Invoking guix
system)', let me know and I will submit another small patch to add it.

Now we can generate system images without fear of the reaper!  The
garbage reaper, that is :-)

-- 
Chris
[0001-build-Add-and-export-procedure-register-root.patch (text/x-patch, attachment)]
[0002-system-Support-the-root-option-in-guix-system.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Thu, 06 Apr 2017 08:24:02 GMT) Full text and rfc822 format available.

Notification sent to Chris Marusich <cmmarusich <at> gmail.com>:
bug acknowledged by developer. (Thu, 06 Apr 2017 08:24:02 GMT) Full text and rfc822 format available.

Message #25 received at 26271-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Chris Marusich <cmmarusich <at> gmail.com>
Cc: 26271-done <at> debbugs.gnu.org
Subject: Re: bug#26271: 'guix system' does not support common build option
 '--root'
Date: Thu, 06 Apr 2017 10:23:33 +0200
Hi,

Chris Marusich <cmmarusich <at> gmail.com> skribis:

> In the attached patch series, I've mentioned '--root' in 'show-help'.
> However, since there is already a link in the '(guix) Invoking guix
> system)' section to the section which describes the common build options
> ((guix) Common Build Options), I decided not to duplicate the
> documentation for '--root' in that section.
>
> If you still think we should mention '--root' in '(guix) Invoking guix
> system)', let me know and I will submit another small patch to add it.

I decided to add --root under “Invoking guix system” because “Common
Build Options” doesn’t mention it.

> Now we can generate system images without fear of the reaper!  The
> garbage reaper, that is :-)

Heheh.  :-)

Note that previously the image could be GC’d only once ‘guix system’ had
completed.

> From 8b768570b26d9a44ea140b0cd29383d32d37a0df Mon Sep 17 00:00:00 2001
> From: Chris Marusich <cmmarusich <at> gmail.com>
> Date: Tue, 4 Apr 2017 20:24:54 -0700
> Subject: [PATCH 1/2] build: Add and export procedure 'register-root*'.
>
> * guix/scripts/build.scm (register-root*): Add and export it.

Applied.

> From 430fdb321f3401d5a498f002291ae520d47f1dcf Mon Sep 17 00:00:00 2001
> From: Chris Marusich <cmmarusich <at> gmail.com>
> Date: Mon, 3 Apr 2017 23:49:22 -0700
> Subject: [PATCH 2/2] system: Support the --root option in 'guix system'.
>
> Fixes <https://bugs.gnu.org/26271>.
>
> * guix/scripts/system.scm (perform-action): Add #:gc-root parameter and honor
>   it.
>   (show-help): Document the --root option.
>   (%options): Add 'root'.
>   (process-action): Pass 'root' option to perform-action as #:gc-root.

Applied with minor changes:

> @@ -665,8 +669,11 @@ building anything."
>                        #:grub.cfg (derivation->output-path grub.cfg)
>                        #:device device))
>              (else
> -             ;; All we had to do was to build SYS.
> -             (return (derivation->output-path sys))))))))
> +             ;; All we had to do was to build SYS and maybe register an
> +             ;; indirect GC root.
> +             (mwhen gc-root
> +               (register-root* (list (derivation->output-path sys))
> +                               gc-root))))))))

I changed it so that it would still return the output file name.

>    (display (_ "
> +  -r, --root=FILE        for 'vm', 'vm-image', 'disk-image', 'container',
> +                         and 'build', make FILE a symlink to the result, and
> +                         register it as a garbage collector root."))

I removed the period for consistency.

Thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 04 May 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 359 days ago.

Previous Next


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