Discussion:
Dualbooting with guixsd not handling grub installation
(too old to reply)
Martin Castillo
2017-12-09 23:35:15 UTC
Permalink
Raw Message
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
Jelle Licht
2017-12-10 01:11:54 UTC
Permalink
Raw Message
Post by 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
menuentry "GuixSD - Configloader" {
configfile (hd0,gpt3)/boot/grub/grub.cfg
}
This way, grub loads the newest grub config file created from GuixSD.
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
Mathieu Othacehe
2017-12-10 11:41:28 UTC
Permalink
Raw Message
Hi Martin and Jelle,
Post by Martin Castillo
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
Ludovic Courtès
2017-12-11 09:39:24 UTC
Permalink
Raw Message
Hello,
Post by Mathieu Othacehe
Post by Martin Castillo
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
(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.
Post by Mathieu Othacehe
* Allow for target field to be #f and do not call the installer when
this happends.
Sounds reasonable.
Post by Mathieu Othacehe
* Precise the --no-bootloader parameter of guix system to deal with
--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’.
Martin Castillo
2017-12-14 02:27:46 UTC
Permalink
Raw Message
Hi
Post by Ludovic Courtès
Hello,
Post by Mathieu Othacehe
Post by Martin Castillo
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
(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.
Post by Mathieu Othacehe
* Allow for target field to be #f and do not call the installer when
this happends.
Sounds reasonable.
+1
Post by Ludovic Courtès
Post by Mathieu Othacehe
* Precise the --no-bootloader parameter of guix system to deal with
--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
Ludovic Courtès
2017-12-15 14:53:59 UTC
Permalink
Raw Message
Hello,
Post by Martin Castillo
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’.
Oleg Pykhalov
2017-12-17 12:29:28 UTC
Permalink
Raw Message
Post by Ludovic Courtès
Note that if all you want is dual-boot, this should already be possible
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.
Ludovic Courtès
2017-12-18 09:21:37 UTC
Permalink
Raw Message
Post by Oleg Pykhalov
Post by Ludovic Courtès
Note that if all you want is dual-boot, this should already be possible
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.
Post by Oleg Pykhalov
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’.
Oleg Pykhalov
2018-02-01 06:14:54 UTC
Permalink
Raw Message
Hello Ludovic,
[...]
Post by Ludovic Courtès
Post by Oleg Pykhalov
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.
Post by Ludovic Courtès
Post by Oleg Pykhalov
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.
Félicien Pillot
2018-02-01 08:06:48 UTC
Permalink
Raw Message
Hi Oleg,

Le Thu, 01 Feb 2018 09:14:54 +0300,
Post by Oleg Pykhalov
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
***@gnu.org - ***@riseup.net
Oleg Pykhalov
2018-02-02 22:34:24 UTC
Permalink
Raw Message
Hello Félicien,

Thank you for the report!
Le Thu, 01 Feb 2018 09:14:54 +0300, Oleg Pykhalov
Post by Oleg Pykhalov
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
/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.
Ludovic Courtès
2018-02-05 13:15:57 UTC
Permalink
Raw Message
Hi,
Post by Oleg Pykhalov
[...]
Post by Ludovic Courtès
Post by Oleg Pykhalov
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.
Post by Ludovic Courtès
Post by Oleg Pykhalov
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
Date: Thu, 1 Feb 2018 08:59:30 +0300
Subject: [PATCH] bootloader: Add additional-options to menu-entry.
* gnu/bootloader.scm (<menu-entry>)[additional-options]: New field.
* gnu/bootloader/grub.scm (grub-configuration-file): Handle this.
[...]
Post by Oleg Pykhalov
(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
<menu-entry>, that could default to 'auto to obtain the current
behavior?

Ludo’.
Oleg Pykhalov
2018-02-06 12:25:34 UTC
Permalink
Raw Message
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.

Loading...