Re: Dualbooting with guixsd not handling grub installation
l...@gnu.org (Ludovic Courtès) writes: > I think we should keep ‘menu-entry’ bootloader-independent. What does mean “independent”? Do you mean that it's working only for Grub now? I guess others bootloaders could have this if they need to generate a configuration file like “/boot/grub/grub.cfg”. > I’m actually not sure what problem we’re trying to solve: is it that > the ‘root’ variable in GRUB gets set to the wrong partition when you > try to dual-boot? The problem is I cannot get a Grub “menu-entry” in “/boot/grub/grub.cfg” which should look like: --8<---cut here---start->8--- menuentry "Another distro" { search --label --set another-disk-label configfile /boot/grub/grub.cfg } --8<---cut here---end--->8--- Also “linux” and “initrd” fields of “menu-entry” are required to be defined which prevents from generating the snippet above. Thoughts? Oleg. signature.asc Description: PGP signature
Re: Dualbooting with guixsd not handling grub installation
Hi, Oleg Pykhalovskribis: > l...@gnu.org (Ludovic Courtès) writes: > >> Oleg Pykhalov skribis: > > [...] > >>> Are linux linux-arguments initrd in menu-entry required? >> >> Currently yes: this is how you tell GRUB what to boot. > > I see an issue with it, because not always you want them. > >>> Maybe we could have configfile field? >>> https://www.gnu.org/software/grub/manual/grub/html_node/configfile.html >> >> Yes, we could do that. One question is how to integrated properly since >> ‘menu-entry’ is now bootloader-independent. Perhaps Mathieu or Danny >> have ideas? > > We could start by adding a way to add anything. Here is a patch. > Probably ugly, but as a draft and idea about additional-options. > > From 7d7162a8ec78c84e7eba3ae9f7c4fbf07703617e Mon Sep 17 00:00:00 2001 > From: Oleg Pykhalov > Date: Thu, 1 Feb 2018 08:59:30 +0300 > Subject: [PATCH] bootloader: Add additional-options to menu-entry. > > * gnu/bootloader.scm ()[additional-options]: New field. > * gnu/bootloader/grub.scm (grub-configuration-file): Handle this. [...] > Which allows to use additional-options in menu-entry: > > (operating-system > … > (bootloader > (bootloader-configuration >(bootloader grub-efi-bootloader) >(target "/boot/efi") >(menu-entries > (list (menu-entry >(label "Another distro") >(linux "") >(initrd "") >(additional-options '("search --label --set another-disk-label" > "configfile /boot/grub/grub.cfg"))) > …) I think we should keep ‘menu-entry’ bootloader-independent. I’m actually not sure what problem we’re trying to solve: is it that the ‘root’ variable in GRUB gets set to the wrong partition when you try to dual-boot? In that case, perhaps a solution would be to add a ‘root’ field to , that could default to 'auto to obtain the current behavior? Ludo’.
Re: Dualbooting with guixsd not handling grub installation
Hello Félicien, Thank you for the report! > "Félicien" == Félicien Pillotwrites: > Le Thu, 01 Feb 2018 09:14:54 +0300, Oleg Pykhalov > a écrit : >> We could start by adding a way to add anything. Here is a patch. >> Probably ugly, but as a draft and idea about additional-options. > When I try your patch (to solve the dualboot problem I have too) I > get this error: > /etc/config.scm:17:10 : error: extraneous field initializers > (additional-options) What will “sudo guix --version” say? Please, show a “(bootloader …)” record field from your config.scm. > Why me and not you? :-) Oleg. signature.asc Description: PGP signature
Re: Dualbooting with guixsd not handling grub installation
Hi Oleg, Le Thu, 01 Feb 2018 09:14:54 +0300, Oleg Pykhalova écrit : > We could start by adding a way to add anything. Here is a patch. > Probably ugly, but as a draft and idea about additional-options. > When I try your patch (to solve the dualboot problem I have too) I get this error: /etc/config.scm:17:10 : error: extraneous field initializers (additional-options) Why me and not you? -- Félicien Pillot 2C7C ACC0 FBDB ADBA E7BC 50D9 043C D143 6C87 9372 felic...@gnu.org - felicien.pil...@riseup.net pgpLOqUmaVEEv.pgp Description: Signature digitale OpenPGP
Re: Dualbooting with guixsd not handling grub installation
Hello Ludovic, l...@gnu.org (Ludovic Courtès) writes: > Oleg Pykhalovskribis: [...] >> Are linux linux-arguments initrd in menu-entry required? > > Currently yes: this is how you tell GRUB what to boot. I see an issue with it, because not always you want them. >> Maybe we could have configfile field? >> https://www.gnu.org/software/grub/manual/grub/html_node/configfile.html > > Yes, we could do that. One question is how to integrated properly since > ‘menu-entry’ is now bootloader-independent. Perhaps Mathieu or Danny > have ideas? We could start by adding a way to add anything. Here is a patch. Probably ugly, but as a draft and idea about additional-options. From 7d7162a8ec78c84e7eba3ae9f7c4fbf07703617e Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Thu, 1 Feb 2018 08:59:30 +0300 Subject: [PATCH] bootloader: Add additional-options to menu-entry. * gnu/bootloader.scm ()[additional-options]: New field. * gnu/bootloader/grub.scm (grub-configuration-file): Handle this. --- gnu/bootloader.scm | 19 +++ gnu/bootloader/grub.scm | 27 +++ 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 736f11952..9a3c29a88 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -31,6 +31,7 @@ menu-entry-linux-arguments menu-entry-initrd menu-entry-device-mount-point +menu-entry-additional-options bootloader bootloader? @@ -65,15 +66,17 @@ (define-record-type* menu-entry make-menu-entry menu-entry? - (label menu-entry-label) - (device menu-entry-device ; file system uuid, label, or #f - (default #f)) + (label menu-entry-label) + (device menu-entry-device ; file system uuid, label, or #f + (default #f)) (device-mount-point menu-entry-device-mount-point - (default #f)) - (linux menu-entry-linux) - (linux-arguments menu-entry-linux-arguments - (default '())) ; list of string-valued gexps - (initrd menu-entry-initrd)) ; file name of the initrd as a gexp + (default #f)) + (linux menu-entry-linux) + (linux-argumentsmenu-entry-linux-arguments + (default '())) ; list of string-valued gexps + (initrd menu-entry-initrd) ; file name of the initrd as a gexp + (additional-options menu-entry-additional-options + (default '(; list of string-valued gexps ;;; diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 96e53c5c2..7613c2a84 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -324,22 +324,33 @@ entries corresponding to old generations of the system." (label (menu-entry-label entry)) (kernel (menu-entry-linux entry)) (arguments (menu-entry-linux-arguments entry)) - (initrd (menu-entry-initrd entry))) + (initrd (menu-entry-initrd entry)) + (additional-options (menu-entry-additional-options entry))) ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. ;; Use the right file names for KERNEL and INITRD in case ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a ;; separate partition. - (let ((kernel (strip-mount-point device-mount-point kernel)) -(initrd (strip-mount-point device-mount-point initrd))) -#~(format port "menuentry ~s { + (if (and (file-append? kernel) (file-append? initrd)) + (let ((kernel (strip-mount-point device-mount-point kernel)) +(initrd (strip-mount-point device-mount-point initrd))) +#~(format port "menuentry ~s { ~a linux ~a ~a initrd ~a + ~a +}~%" + #$label + #$(grub-root-search device kernel) + #$kernel (string-join (list #$@arguments)) + #$initrd + (string-join (list #$@additional-options) "\n"))) + #~(format port "menuentry ~s { + ~a + ~a }~%" - #$label - #$(grub-root-search device kernel) - #$kernel (string-join (list #$@arguments)) - #$initrd +#$label +#$(grub-root-search device kernel) +(string-join (list #$@additional-options) "\n") (mlet %store-monad ((sugar (eye-candy config (menu-entry-device (first all-entries)) -- 2.15.1 Which allows to use additional-options in menu-entry: --8<---cut here---start->8--- (operating-system … (bootloader
Re: Dualbooting with guixsd not handling grub installation
Oleg Pykhalovskribis: > l...@gnu.org (Ludovic Courtès) writes: > >> Note that if all you want is dual-boot, this should already be possible >> by defining new menu entries in the GuixSD config: >> >> >> https://www.gnu.org/software/guix/manual/html_node/Bootloader-Configuration.html#index-dual-boot > > Are linux linux-arguments initrd in menu-entry required? Currently yes: this is how you tell GRUB what to boot. > Maybe we could have configfile field? > https://www.gnu.org/software/grub/manual/grub/html_node/configfile.html Yes, we could do that. One question is how to integrated properly since ‘menu-entry’ is now bootloader-independent. Perhaps Mathieu or Danny have ideas? Thanks, Ludo’.
Re: Dualbooting with guixsd not handling grub installation
l...@gnu.org (Ludovic Courtès) writes: > Note that if all you want is dual-boot, this should already be possible > by defining new menu entries in the GuixSD config: > > > https://www.gnu.org/software/guix/manual/html_node/Bootloader-Configuration.html#index-dual-boot Are linux linux-arguments initrd in menu-entry required? Maybe we could have configfile field? https://www.gnu.org/software/grub/manual/grub/html_node/configfile.html Oleg. signature.asc Description: PGP signature
Re: Dualbooting with guixsd not handling grub installation
Hello, Martin Castilloskribis: > I realised a third option for dualbooting: > menuentry "GuixSD - grub core.img loader" { > search --set root --label guix-root --hint hd0,gpt3 > multiboot /boot/grub/i386-pc/core.img > } Indeed, that should always work. Note that if all you want is dual-boot, this should already be possible by defining new menu entries in the GuixSD config: https://www.gnu.org/software/guix/manual/html_node/Bootloader-Configuration.html#index-dual-boot HTH, Ludo’.
Re: Dualbooting with guixsd not handling grub installation
Hi On 11.12.2017 10:39, Ludovic Courtès wrote: > Hello, > > Mathieu Othaceheskribis: > This could be done by adding a cli argument for reconfigure or allowing an empty string in (grub-configuration (target "")). WDYT? >> >> An already available option would be to override the grub-installer like >> this : >> >> (define no-op-installer >> #~(lambda (bootloader device mount) >> (display "no op"))) >> >> (bootloader (bootloader >> (inherit grub-bootloader) >> (installer no-op-installer)) > > We could even define and document it as ‘no-bootloader’ or something > like that. > >> I admit this is not ideal, so I would propose two options : >> >> * Allow for target field to be #f and do not call the installer when >> this happends. > > Sounds reasonable. +1 > >> * Precise the --no-bootloader parameter of guix system to deal with >> multiple cases, for example : >> >> --bootloader=[default|no-config-file|no-install|...] >> >> WDYT ? > > What would it do in the ‘no-config-file’ case? Run ‘grub-install’ (or > similar) without regenerating ‘grub.cfg’? Does that make sense? I realised a third option for dualbooting: menuentry "GuixSD - grub core.img loader" { search --set root --label guix-root --hint hd0,gpt3 multiboot /boot/grub/i386-pc/core.img } This loads the guixsd grub image from the filesystem instead of relying on blocklists. If someone uses different bootloader for the main system and for guixsd, where the later is multiboot compatible, this would be a good way to do it. no-install should not forget to create core.img and other files besides grub.cfg. I think useful is 'default' (install new bootconfig or, if target is #f, create it only), 'no-install' (like default with target == #f) and 'no' (do nothing related to booting). Martin -- GPG: 7FDE 7190 2F73 2C50 236E 403D CC13 48F1 E644 08EC
Re: Dualbooting with guixsd not handling grub installation
Hello, Mathieu Othaceheskribis: >>> This could be done by adding a cli argument for reconfigure or allowing >>> an empty string in (grub-configuration (target "")). >>> >>> WDYT? >>> > > An already available option would be to override the grub-installer like > this : > > (define no-op-installer > #~(lambda (bootloader device mount) > (display "no op"))) > > (bootloader (bootloader > (inherit grub-bootloader) > (installer no-op-installer)) We could even define and document it as ‘no-bootloader’ or something like that. > I admit this is not ideal, so I would propose two options : > > * Allow for target field to be #f and do not call the installer when > this happends. Sounds reasonable. > * Precise the --no-bootloader parameter of guix system to deal with > multiple cases, for example : > > --bootloader=[default|no-config-file|no-install|...] > > WDYT ? What would it do in the ‘no-config-file’ case? Run ‘grub-install’ (or similar) without regenerating ‘grub.cfg’? Does that make sense? Thanks, Ludo’.
Re: Dualbooting with guixsd not handling grub installation
Hi Martin and Jelle, >> This could be done by adding a cli argument for reconfigure or allowing >> an empty string in (grub-configuration (target "")). >> >> WDYT? >> An already available option would be to override the grub-installer like this : --8<---cut here---start->8--- (define no-op-installer #~(lambda (bootloader device mount) (display "no op"))) (bootloader (bootloader (inherit grub-bootloader) (installer no-op-installer)) --8<---cut here---end--->8--- I admit this is not ideal, so I would propose two options : * Allow for target field to be #f and do not call the installer when this happends. * Precise the --no-bootloader parameter of guix system to deal with multiple cases, for example : --bootloader=[default|no-config-file|no-install|...] WDYT ? Mathieu
Re: Dualbooting with guixsd not handling grub installation
2017-12-10 0:35 GMT+01:00 Martin Castillo: > Hi guixers, > > I want to dualboot into GuixSD. My main os is currently NixOS. > Currently, I don't want to let guixsd control my grub setup. So my > situation is similar to [1]. > > One solution is to use the unreliable chainloading with blocklists by > invoking grub-install --force /dev/sda3 after every guix system > reconfigure config.scm. (The config.scm has sda3 as grub target.) > > The second (and IMHO the right) solution I am aware of is adding the > following in the grub.cfg which is handled by nix: >menuentry "GuixSD - Configloader" { > configfile (hd0,gpt3)/boot/grub/grub.cfg >} > > This way, grub loads the newest grub config file created from GuixSD. > There is only a minor annoyance: > guix system reconfigure config.scm returns non-zero and spits out an > error (because grub-install wants --force to use blocklists). But it > succeeds in everything else, especially in creating a new > /boot/grub/grub.cfg. > The alternative (guix system reconfigure --no-bootloader config.scm) > doesn't update /boot/grub/grub.cfg. > I'd like to have a way to have /boot/grub/grub.cfg updated without > reinstalling grub on the disk/partition and without having a command > return non-zero. > > This could be done by adding a cli argument for reconfigure or allowing > an empty string in (grub-configuration (target "")). > > WDYT? > > Martin Castillo > > > [1]: https://lists.gnu.org/archive/html/guix-devel/2014-12/msg00046.html > -- > GPG: 7FDE 7190 2F73 2C50 236E 403D CC13 48F1 E644 08EC > This seems like a useful change. I am currently running into a similar issue using GuixSD on a laptop /w libreboot, in a way similar to what is done at [2]. Reading your email just now reminded me that living in mediocrity is something that can be changed when you run only/mostly free software :-). Maybe the orphaned patch at [3] can be ad{o,a}pted to address both of these use-cases? - Jelle [2]: https://lists.gnu.org/archive/html/help-guix/2017-04/msg00083.html [3]: https://lists.gnu.org/archive/html/guix-devel/2016-02/msg00116.html