GNU bug report logs - #20067
File name of initrd and kernel image in 'menu-entry' should not be forced

Previous Next

Package: guix;

Reported by: Tomáš Čech <sleep_walker <at> suse.cz>

Date: Mon, 9 Mar 2015 20:36:01 UTC

Severity: normal

Tags: fixed

Fixed in version 0.11.1

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 20067 in the body.
You can then email your comments to 20067 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#20067; Package guix. (Mon, 09 Mar 2015 20:36:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tomáš Čech <sleep_walker <at> suse.cz>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 09 Mar 2015 20:36:02 GMT) Full text and rfc822 format available.

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

From: Tomáš Čech <sleep_walker <at> suse.cz>
To: bug-guix <at> gnu.org
Subject: fix interpretation of grub configuration
Date: Mon, 9 Mar 2015 21:34:43 +0100
[Message part 1 (text/plain, inline)]
Grub configuration interpretes `linux' as directory where is located
bzImage. If I enter file name instead, result configuration will be
wrong.


Example of system configuration:
(bootloader (grub-configuration
	      (device "/dev/sda")
	      (menu-entries
	       (list
		(menu-entry
		 (label "Gentoo")
		 (linux "/vmlinuz-gentoo") ; vmlinuz-gentoo is file
		 (linux-arguments (list
				   "root=/dev/venom/gentoo"
				   "init=/usr/lib/systemd/systemd"))
		 (initrd "/initramfs-gentoo")
		 )))))



Result part of grub.cfg:
menuentry "Gentoo" {
 # Set 'root' to the partition that contains the kernel.
 search --file --set /vmlinuz-gentoo/bzImage


 linux /vmlinuz-gentoo/bzImage root=/dev/venom/gentoo init=/usr/lib/systemd/systemd
 initrd /initramfs-gentoo
}



It would be nice if the the string would be simply copied into
grub.cfg, so I could use even `(hd0,msdos1)/vmlinuz'.
[Message part 2 (application/pgp-signature, inline)]

Changed bug title to 'File name of initrd and kernel image in 'menu-entry' should not be forced' from 'fix interpretation of grub configuration' Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Tue, 23 Feb 2016 13:40:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#20067; Package guix. (Tue, 23 Feb 2016 13:46:02 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: 20067 <at> debbugs.gnu.org
Subject: Re: bug#20067: fix interpretation of grub configuration
Date: Tue, 23 Feb 2016 14:45:36 +0100
Tomáš Čech <sleep_walker <at> suse.cz> skribis:

> Grub configuration interpretes `linux' as directory where is located
> bzImage. If I enter file name instead, result configuration will be
> wrong.

The solution will be to not automatically append “/bzImage” (and
likewise for the initrd.)

We could change places where ‘menu-entry’ is instantiated to:

  #~(string-append #$kernel "/bzImage")

However, there’s the problem that the image name appears in the
‘parameters’ file of the system (as seen in the output of ‘guix system
build foo.scm’), where it is unevaluated.  If we use ‘string-append’ as
above, a raw (string-append …) sexp will appear in there, which is not
nice.

To address this, an idea is to add “expanders” for gexps: gexps already
have “compilers”, and expanders would be similar except that they would
produce something possibly different from just the derivation’s output
file name.  For instance, we could write:

  (file-append kernel "/bzImage")

and that would expand directly to:

  "/gnu/store/…/bzImage"

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#20067; Package guix. (Wed, 03 Aug 2016 16:53:01 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: Tomáš Čech <sleep_walker <at> gnu.org>
Cc: guix-devel <at> gnu.org, 20067 <at> debbugs.gnu.org
Subject: Re: [PATCH] system: grub: Introduce foreign-menu-entry.
Date: Wed, 03 Aug 2016 18:52:32 +0200
[Message part 1 (text/plain, inline)]
Hi!

Tomáš Čech <sleep_walker <at> gnu.org> skribis:

> * gnu/system/grub(foreign-menu-entry): New record type.
>
> menu-entry type is suitable for kernel and initrd from GuixSD as it is looking
> for menu-entry-linux/bzImage for kernel in every case which makes pasing any
> other form impossible.

AIUI, this is a followup to <http://bugs.gnu.org/20067>, and it’s
admittedly a shame that this isn’t fixed!

I still think that the approach proposed at
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20067#10> is more
appropriate; ‘menu-entry’ would always work, no duplication would be
necessary.

As a stop-gap measure, I would prefer to (1) allow:

  (menu-entry
    ;; …
    (linux #~(string-append #$kernel "/bzImage")))

(2) remove the “/bzImage” assumption and use the above idiom everywhere
in the current code, and (3) and have a hack along these lines to
correctly interpret (string-append …) in the ‘parameters’ file:

[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/system.scm b/gnu/system.scm
index d6bf6c4..467d907 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -766,7 +766,11 @@ this file is the reconstruction of GRUB menu entries for old configurations."
      (boot-parameters
       (label label)
       (root-device root)
-      (kernel linux)
+      (kernel (match linux
+                (('string-append (? string? strings) ...)
+                 (string-concatenate strings))
+                (_
+                 linux)))
       (kernel-arguments
        (match (assq 'kernel-arguments rest)
          ((_ args) args)
[Message part 3 (text/plain, inline)]
Thoughts?

Thanks,
Ludo’.

Information forwarded to bug-guix <at> gnu.org:
bug#20067; Package guix. (Thu, 04 Aug 2016 05:39:02 GMT) Full text and rfc822 format available.

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

From: Chris Marusich <cmmarusich <at> gmail.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: guix-devel <at> gnu.org, 20067 <at> debbugs.gnu.org,
 Tomáš Čech <sleep_walker <at> gnu.org>
Subject: Re: bug#20067: [PATCH] system: grub: Introduce foreign-menu-entry.
Date: Wed, 03 Aug 2016 22:38:24 -0700
[Message part 1 (text/plain, inline)]
ludo <at> gnu.org (Ludovic Courtès) writes:

> I still think that the approach proposed at
> <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20067#10> is more
> appropriate; ‘menu-entry’ would always work, no duplication would be
> necessary.
>
> As a stop-gap measure, I would prefer to (1) allow:
>
>   (menu-entry
>     ;; …
>     (linux #~(string-append #$kernel "/bzImage")))
>
> (2) remove the “/bzImage” assumption and use the above idiom everywhere
> in the current code, and (3) and have a hack along these lines to
> correctly interpret (string-append …) in the ‘parameters’ file:
>
>
> diff --git a/gnu/system.scm b/gnu/system.scm
> index d6bf6c4..467d907 100644
> --- a/gnu/system.scm
> +++ b/gnu/system.scm
> @@ -766,7 +766,11 @@ this file is the reconstruction of GRUB menu entries for old configurations."
>       (boot-parameters
>        (label label)
>        (root-device root)
> -      (kernel linux)
> +      (kernel (match linux
> +                (('string-append (? string? strings) ...)
> +                 (string-concatenate strings))
> +                (_
> +                 linux)))
>        (kernel-arguments
>         (match (assq 'kernel-arguments rest)
>           ((_ args) args)
>
>
> Thoughts?

Yes, that approach seems better to me.

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

Information forwarded to bug-guix <at> gnu.org:
bug#20067; Package guix. (Fri, 09 Sep 2016 22:04:02 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: 20067 <at> debbugs.gnu.org
Subject: Re: bug#20067: fix interpretation of grub configuration
Date: Sat, 10 Sep 2016 00:03:38 +0200
Good news!

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

> Tomáš Čech <sleep_walker <at> suse.cz> skribis:
>
>> Grub configuration interpretes `linux' as directory where is located
>> bzImage. If I enter file name instead, result configuration will be
>> wrong.
>
> The solution will be to not automatically append “/bzImage” (and
> likewise for the initrd.)
>
> We could change places where ‘menu-entry’ is instantiated to:
>
>   #~(string-append #$kernel "/bzImage")
>
> However, there’s the problem that the image name appears in the
> ‘parameters’ file of the system (as seen in the output of ‘guix system
> build foo.scm’), where it is unevaluated.  If we use ‘string-append’ as
> above, a raw (string-append …) sexp will appear in there, which is not
> nice.
>
> To address this, an idea is to add “expanders” for gexps: gexps already
> have “compilers”, and expanders would be similar except that they would
> produce something possibly different from just the derivation’s output
> file name.  For instance, we could write:
>
>   (file-append kernel "/bzImage")
>
> and that would expand directly to:
>
>   "/gnu/store/…/bzImage"

AFAICS this is finally fixed!

  expanders in commit ebdfd776f4504c456d383ee8afa59fc6fdfc6756
  ‘file-append’ in commit a9e5e92f940381e3a4ee828c6d8ff22a73067e17
  kernel file name in commit 44d5f54e31039d78f156bd9562dca293124eaa76

Please let me know how it goes!  In particular, does it work for the
dual-boot scenario you were interested in?

Thanks,
Ludo’.




Added tag(s) fixed. Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Fri, 09 Sep 2016 22:05:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 0.11.1, send any further explanations to 20067 <at> debbugs.gnu.org and Tomáš Čech <sleep_walker <at> suse.cz> Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Fri, 09 Sep 2016 22:05:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#20067; Package guix. (Wed, 14 Sep 2016 16:42:02 GMT) Full text and rfc822 format available.

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

From: Tomáš Čech <tcech <at> suse.com>
To: 20067 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: bug#20067: fix interpretation of grub configuration
Date: Wed, 14 Sep 2016 18:16:29 +0200
[Message part 1 (text/plain, inline)]
On Sat, Sep 10, 2016 at 12:03:38AM +0200, Ludovic Courtès wrote:
>Good news!

Good news indeed!

>
>ludo <at> gnu.org (Ludovic Courtès) skribis:
>
>> Tomáš Čech <sleep_walker <at> suse.cz> skribis:
>>
>>> Grub configuration interpretes `linux' as directory where is located
>>> bzImage. If I enter file name instead, result configuration will be
>>> wrong.
>>
>> The solution will be to not automatically append “/bzImage” (and
>> likewise for the initrd.)
>>
>> We could change places where ‘menu-entry’ is instantiated to:
>>
>>   #~(string-append #$kernel "/bzImage")
>>
>> However, there’s the problem that the image name appears in the
>> ‘parameters’ file of the system (as seen in the output of ‘guix system
>> build foo.scm’), where it is unevaluated.  If we use ‘string-append’ as
>> above, a raw (string-append …) sexp will appear in there, which is not
>> nice.
>>
>> To address this, an idea is to add “expanders” for gexps: gexps already
>> have “compilers”, and expanders would be similar except that they would
>> produce something possibly different from just the derivation’s output
>> file name.  For instance, we could write:
>>
>>   (file-append kernel "/bzImage")
>>
>> and that would expand directly to:
>>
>>   "/gnu/store/…/bzImage"
>
>AFAICS this is finally fixed!
>
>  expanders in commit ebdfd776f4504c456d383ee8afa59fc6fdfc6756
>  ‘file-append’ in commit a9e5e92f940381e3a4ee828c6d8ff22a73067e17
>  kernel file name in commit 44d5f54e31039d78f156bd9562dca293124eaa76
>
>Please let me know how it goes!  In particular, does it work for the
>dual-boot scenario you were interested in?

It is almost perfect.

Configuration excerpt...

(bootloader (grub-configuration
             (device "/dev/sda")
             (menu-entries
              (list
               (menu-entry
                (label "openSUSE")
                (linux "(hd0,msdos1)/vmlinuz")
                (linux-arguments (list
                                  "root=/dev/venom/opensuse"
                                  "init=/usr/lib/systemd/systemd"))
                (initrd "(hd0,msdos1)/initrd"))))))


...transforms into

menuentry "openSUSE" {
  search --file --set (hd0,msdos1)/vmlinuz
  linux (hd0,msdos1)/vmlinuz root=/dev/venom/opensuse init=/usr/lib/systemd/systemd
  initrd (hd0,msdos1)/initrd
}

I think that if linux contains prefix '(.*)/', there should be no
search for kernel.

Thank you very much for fixing this bug (especially when I wasn't
able). I believe that fixing this bug is big step in more friendly
behavior to other OS.

Best regards,

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

Information forwarded to bug-guix <at> gnu.org:
bug#20067; Package guix. (Sun, 25 Sep 2016 15:58:03 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: Tomáš Čech <tcech <at> suse.com>
Cc: 20067 <at> debbugs.gnu.org
Subject: Re: bug#20067: fix interpretation of grub configuration
Date: Mon, 26 Sep 2016 00:56:59 +0900
Hi,

Tomáš Čech <tcech <at> suse.com> skribis:

> Configuration excerpt...
>
> (bootloader (grub-configuration
>              (device "/dev/sda")
>              (menu-entries
>               (list
>                (menu-entry
>                 (label "openSUSE")
>                 (linux "(hd0,msdos1)/vmlinuz")
>                 (linux-arguments (list
>                                   "root=/dev/venom/opensuse"
>                                   "init=/usr/lib/systemd/systemd"))
>                 (initrd "(hd0,msdos1)/initrd"))))))
>
>
> ...transforms into
>
> menuentry "openSUSE" {
>   search --file --set (hd0,msdos1)/vmlinuz
>   linux (hd0,msdos1)/vmlinuz root=/dev/venom/opensuse init=/usr/lib/systemd/systemd
>   initrd (hd0,msdos1)/initrd
> }
>
> I think that if linux contains prefix '(.*)/', there should be no
> search for kernel.

Oh, right.  I believe this is fixed by
5babe521c8adc722c2411b255cbeeef308339d06.

Please let me know if anything’s missing now.

Thanks!

Ludo’.




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

This bug report was last modified 7 years and 183 days ago.

Previous Next


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