unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Unable to chain-load Debian
@ 2024-03-05 21:54 William
  2024-03-06 11:38 ` Carlo Zancanaro
  2024-03-06 15:31 ` William
  0 siblings, 2 replies; 4+ messages in thread
From: William @ 2024-03-05 21:54 UTC (permalink / raw)
  To: help-guix

Hello.

I currently have two GNU/Linux installs on this PC on two different
SSDs with their own GRUB, Guix and Debian. 
Both SSDs have an MBR partition table, no GPT/EFI.

I've been trying to add a menu entry to chain-load Debian from the Guix
GRUB menu but it doesn't seem to work as intended, upon loading the
declaration file, I check the grub configuration file at
"/boot/grub/grub.cfg" and I see the menu entry for Debian, but it
has no partition UUID defined, I don't think this entry can ever work
without UUID.

The menu-entry declaration is written as follows:

```
(menu-entries
            (list
            (menu-entry
            (label "Debian GNU/Linux")
            (device (uuid "2892086a-fc4f-4e43-8b69-46a84d80e9a4" 'ext4))
            (chain-loader "+1"))))
```

As you can see, the device UUID and filesystem type is defined, but this
string has no effect on the grub.cfg, and it looks like there's a lot of
important information missing:

```
menuentry "Debian GNU/Linux" {
  
  chainloader +1
}
```


Am I missing something? 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Unable to chain-load Debian
  2024-03-05 21:54 Unable to chain-load Debian William
@ 2024-03-06 11:38 ` Carlo Zancanaro
  2024-03-06 17:55   ` William
  2024-03-06 15:31 ` William
  1 sibling, 1 reply; 4+ messages in thread
From: Carlo Zancanaro @ 2024-03-06 11:38 UTC (permalink / raw)
  To: William; +Cc: help-guix

Hi William,

I don't know anything about Grub chainloading, but I had a quick look
and I think I have a vague idea what's going on.

The menu entry is put together by this code in gnu/bootloader/grub.scm:

--8<---------------cut here---------------start------------->8---
        #~(format port "
menuentry ~s {
  ~a
  chainloader ~a
}~%"
                  #$label
                  #$(grub-root-search device chain-loader)
                  #$chain-loader)
--8<---------------cut here---------------end--------------->8---

Where "label", "device" and "chain-loader" are bound to their values
from the provided menu-entry record.

This calls grub-root-search to emit a grub "search" command. This
function has the following:

--8<---------------cut here---------------start------------->8---
(define (grub-root-search device file)
  ...
  (if (and (string? file) (not (string-prefix? "/" file)))
      ""
      ...))
--8<---------------cut here---------------end--------------->8---

In your config, chain-loader is "+1", so when this is passed in as
"file" the conditions both pass: it is a string, and it does not start
with a "/". Thus, the root-search returns the empty string, which is
dutifully inserted into your grub.cfg file.

I think this is a bug. Unfortunately I'm not familiar enough with this
code to know how to fix it.

Carlo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Unable to chain-load Debian
  2024-03-05 21:54 Unable to chain-load Debian William
  2024-03-06 11:38 ` Carlo Zancanaro
@ 2024-03-06 15:31 ` William
  1 sibling, 0 replies; 4+ messages in thread
From: William @ 2024-03-06 15:31 UTC (permalink / raw)
  To: help-guix; +Cc: carlo

On Tue, 5 Mar 2024 22:54:24 +0100
William <willbilly@fedora.email> wrote:

> Hello.
> 
> I currently have two GNU/Linux installs on this PC on two different
> SSDs with their own GRUB, Guix and Debian. 
> Both SSDs have an MBR partition table, no GPT/EFI.
> 
> I've been trying to add a menu entry to chain-load Debian from the
> Guix GRUB menu but it doesn't seem to work as intended, upon loading
> the declaration file, I check the grub configuration file at
> "/boot/grub/grub.cfg" and I see the menu entry for Debian, but it
> has no partition UUID defined, I don't think this entry can ever work
> without UUID.
> 
> The menu-entry declaration is written as follows:
> 
> ```
> (menu-entries
>             (list
>             (menu-entry
>             (label "Debian GNU/Linux")
>             (device (uuid "2892086a-fc4f-4e43-8b69-46a84d80e9a4"
> 'ext4)) (chain-loader "+1"))))
> ```
> 
> As you can see, the device UUID and filesystem type is defined, but
> this string has no effect on the grub.cfg, and it looks like there's
> a lot of important information missing:
> 
> ```
> menuentry "Debian GNU/Linux" {
>   
>   chainloader +1
> }
> ```
> 
> 
> Am I missing something? 
> 

UPDATE:

I managed to boot Debian using Guix's GRUB directly by defining kernel,
init and root of filesystem instead of trying to chain-load,
like this:

```
(menu-entries
                    (list
                     (menu-entry
                     (label "Debian GNU/Linux")
                     (device (uuid
                     "2892086a-fc4f-4e43-8b69-46a84d80e9a4" 'ext4))
                     (linux "/boot/vmlinuz-6.1.0-18-amd64")
                     (linux-arguments
                     '("root=/dev/disk/by-uuid/2892086a-fc4f-4e43-8b69-46a84d80e9a4"))
                     (initrd "/boot/initrd.img-6.1.0-18-amd64"))
```

However, I tried now chain-loading a Windows 10 install I have on
another drive to see if it worked, defined as such:

```
(menu-entry
                     (label "Windows 10")
                     (device (uuid "80FADAC4FADAB61E" 'ntfs))
                     (chain-loader "/bootmgr"))))
```

And on grub.cfg:

```
menuentry "Windows 10" {
  search --fs-uuid --set 80FADAC4FADAB61E
  chainloader /bootmgr
}
```


It does seem as it's bootable on GRUB but refuses to boot due to
"invalid signature", I am not sure why it would complain about that
when secure boot is disabled on the BIOS firmware of this motherboard.
Windows can boot properly through Debian's GRUB and BIOS.

Did someone manage to boot Windows/ReactOS on Guix that may lend me
a hand?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Unable to chain-load Debian
  2024-03-06 11:38 ` Carlo Zancanaro
@ 2024-03-06 17:55   ` William
  0 siblings, 0 replies; 4+ messages in thread
From: William @ 2024-03-06 17:55 UTC (permalink / raw)
  To: Carlo Zancanaro; +Cc: help-guix

On Wed, 06 Mar 2024 22:38:50 +1100
Carlo Zancanaro <carlo@zancanaro.id.au> wrote:

> Hi William,
> 
> I don't know anything about Grub chainloading, but I had a quick look
> and I think I have a vague idea what's going on.
> 
> The menu entry is put together by this code in
> gnu/bootloader/grub.scm:
> 
> --8<---------------cut here---------------start------------->8---
>         #~(format port "
> menuentry ~s {
>   ~a
>   chainloader ~a
> }~%"
>                   #$label
>                   #$(grub-root-search device chain-loader)
>                   #$chain-loader)
> --8<---------------cut here---------------end--------------->8---
> 
> Where "label", "device" and "chain-loader" are bound to their values
> from the provided menu-entry record.
> 
> This calls grub-root-search to emit a grub "search" command. This
> function has the following:
> 
> --8<---------------cut here---------------start------------->8---
> (define (grub-root-search device file)
>   ...
>   (if (and (string? file) (not (string-prefix? "/" file)))
>       ""
>       ...))
> --8<---------------cut here---------------end--------------->8---
> 
> In your config, chain-loader is "+1", so when this is passed in as
> "file" the conditions both pass: it is a string, and it does not start
> with a "/". Thus, the root-search returns the empty string, which is
> dutifully inserted into your grub.cfg file.
> 
> I think this is a bug. Unfortunately I'm not familiar enough with this
> code to know how to fix it.
> 
> Carlo

Hello Carlo.

It is indeed a bug, I've already reported this
issue:

https://issues.guix.gnu.org/issue/69588

Thanks for your help.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-06 17:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-05 21:54 Unable to chain-load Debian William
2024-03-06 11:38 ` Carlo Zancanaro
2024-03-06 17:55   ` William
2024-03-06 15:31 ` William

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).