Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Boot manager with serial console for UEFI AMD64.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 182
Location: Ancient Rome

PostPosted: Wed Aug 10, 2022 2:16 pm    Post subject: Boot manager with serial console for UEFI AMD64. Reply with quote

Hi, I’m looking for boot manager for my headless machine. Currently I have tried rEfind, but serial console didn’t worked for me [1], and grub, but it also failed because of mdraid [2]. I’m looking for something that allow me to choose kernel and edit command line. What are my options?

[1] https://forums.gentoo.org/viewtopic-t-1155637.html
[2] https://bugs.gentoo.org/568956
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9714
Location: almost Mile High in the USA

PostPosted: Wed Aug 10, 2022 3:57 pm    Post subject: Reply with quote

I'd imagine refind would also puke on mdraid because EFI wants an ESP marked partition, and not sure if you mdraid it, what would EFI think? Might be able to just run as-is however. As stated in the bug report, there were problems found during the installation that's outside the scope of the tools - efivars partition does not appear to be enabled for the user. Note that the bug reports are over 6 years old and should have propagated up.

In any case, I believe on one EFI machine I just manually kept two ESPs on the two disks synced and ran the rest of the disks MDRAID1. However this is an IA64 box and I was running elilo on it...

My hw is too old, though technically my current server should support EFI boot, alas I'm using CSM on it...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 182
Location: Ancient Rome

PostPosted: Wed Aug 10, 2022 4:50 pm    Post subject: Reply with quote

Refind is okayish with mdraid, I have already two machines with rEFInd on mirror with metadata=1.0, which stores metadata at the end of partition and for systems that are not aware of it they look like regular partitions. Only bugs I found are I have doubled entries for memtest, and it complained about unable to find device for /dev/mdXXX, but it worked anyway.
I also thought about syncing two partition, but mdraid feels like more elegant solution
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9714
Location: almost Mile High in the USA

PostPosted: Wed Aug 10, 2022 11:03 pm    Post subject: Reply with quote

well, I guess if it worked for refind, then it should work fine for grub2.

What is the exact invocation that you used? It should find the right drive based on efivars.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 182
Location: Ancient Rome

PostPosted: Thu Aug 11, 2022 2:08 pm    Post subject: Reply with quote

Code:
livecd ~ # grub-install --target=x86_64-efi --efi-directory=/boot
Installing for x86_64-efi platform.
efibootmgr: option requires an argument -- 'd'
efibootmgr version 17
usage: efibootmgr [options]
        -a | --active         sets bootnum active
        -A | --inactive       sets bootnum inactive
        -b | --bootnum XXXX   modify BootXXXX (hex)
        -B | --delete-bootnum delete bootnum
        -c | --create         create new variable bootnum and add to bootorder
        -C | --create-only      create new variable bootnum and do not add to bootorder
        -D | --remove-dups      remove duplicate values from BootOrder
        -d | --disk disk       (defaults to /dev/sda) containing loader
        -r | --driver         Operate on Driver variables, not Boot Variables.
        -e | --edd [1|3|-1]   force EDD 1.0 or 3.0 creation variables, or guess
        -E | --device num      EDD 1.0 device number (defaults to 0x80)
        -g | --gpt            force disk with invalid PMBR to be treated as GPT
        -i | --iface name     create a netboot entry for the named interface
        -l | --loader name     (defaults to "\EFI\Gentoo\grub.efi")
        -L | --label label     Boot manager display label (defaults to "Linux")
        -m | --mirror-below-4G t|f mirror memory below 4GB
        -M | --mirror-above-4G X percentage memory to mirror above 4GB
        -n | --bootnext XXXX   set BootNext to XXXX (hex)
        -N | --delete-bootnext delete BootNext
        -o | --bootorder XXXX,YYYY,ZZZZ,...     explicitly set BootOrder (hex)
        -O | --delete-bootorder delete BootOrder
        -p | --part part        partition containing loader (defaults to 1 on partitioned devices)
        -q | --quiet            be quiet
        -t | --timeout seconds  set boot manager timeout waiting for user input.
        -T | --delete-timeout   delete Timeout.
        -u | --unicode | --UCS-2  handle extra args as UCS-2 (default is ASCII)
        -v | --verbose          print additional information
        -V | --version          return version and exit
        -w | --write-signature  write unique sig to MBR if needed
        -y | --sysprep          Operate on SysPrep variables, not Boot Variables.
        -@ | --append-binary-args file  append extra args from file (use "-" for stdin)
        -h | --help             show help/usage
grub-install: error: efibootmgr failed to register the boot entry: Operation not permitted.
livecd ~ # grub-mkconfig -o /boot/grub/grub.cfg
/usr/sbin/grub-probe: error: failed to get canonical path of `/dev/ata-Kingchuxing_128GB_2022062800115-part2'.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9714
Location: almost Mile High in the USA

PostPosted: Thu Aug 11, 2022 2:20 pm    Post subject: Reply with quote

Try adding --removable to your grub-install as a workaround?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 182
Location: Ancient Rome

PostPosted: Thu Aug 11, 2022 2:46 pm    Post subject: Reply with quote

Code:
livecd ~ # grub-install --target=x86_64-efi --efi-directory=/boot --removable
Installing for x86_64-efi platform.
Installation finished. No error reported.
ivecd ~ # grub-mkconfig -o /boot/grub/grub.cfg
/usr/sbin/grub-probe: error: failed to get canonical path of `/dev/ata-Kingchuxing_128GB_2022062800115-part2'.

It is installed, but grub-mkconfig failed and it boots into minimal GRUB console.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9714
Location: almost Mile High in the USA

PostPosted: Thu Aug 11, 2022 2:50 pm    Post subject: Reply with quote

Did grub-mkconfig generate something or did it end up creating an empty file?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 182
Location: Ancient Rome

PostPosted: Thu Aug 11, 2022 3:18 pm    Post subject: Reply with quote

It doesn't created grub.cfg, if I run it without any parameters I get only error.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9714
Location: almost Mile High in the USA

PostPosted: Thu Aug 11, 2022 4:13 pm    Post subject: Reply with quote

At this point you could simply write your own grub.cfg as the hard part is done : getting grub installed. Shouldn't be too hard if you don't want funky submenus that grub-mkconfig does.

One thing you also could do at this point to fake it if you don't want to write your own grub.cfg:

0. Make sure your bzImage, initramfs, etc. are installed on your RAID EFI boot partition
1. umount and mdadm --stop your boot/EFI RAID
2. mount one of the RAID member partitions READONLY at /boot
3. run grub-mkconfig -o /tmp/grub.cfg
4. umount the member
5. mdadm --assemble and mount the raid again
6. mv /tmp/grub.cfg to your RAID

Again this is a workaround...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 182
Location: Ancient Rome

PostPosted: Sat Aug 13, 2022 9:26 am    Post subject: Reply with quote

I finally figured it out. I wanted to make it simpler than disassembling raid. My idea was to mount ESP into /boot/esp, then install grub, kernel, initramfs and grub.cfg into /boot, then rsync them into /boot/esp, but it failed with same error. Then I noticed that grub-mkconfig was complaining about -part2, which contains my ZFS datapool, so I added libzfs flag to grub and it worked. I didn’t thought about this before, because kernel and initramfs are stored on vfat.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9714
Location: almost Mile High in the USA

PostPosted: Sat Aug 13, 2022 12:23 pm    Post subject: Reply with quote

cool, thought part2 was your ESP/boot partition. Would have been nice to know what the partition tables were (and supposedly the disassembly would have revealed that you had some issue with grub handling your root partition versus the boot partition)...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54453
Location: 56N 3W

PostPosted: Sat Aug 13, 2022 1:09 pm    Post subject: Reply with quote

lekto,

I have my EFI system partition on RAID1.

EFI Firmware is unaware of RAID, just like grub-legacy.
The EFI system partition on RAID1 must use metadata 0.90. so that the metadata is at the end of the raid set and more importantly, the filesystem starts at the start, where the EFI Firmware will look.

Its RAID1 as seen by the kernel and the raid is just ignored by the EFI firmware.

Create a EFI boot entry for each element of the mirror and add them all to the boot order.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 182
Location: Ancient Rome

PostPosted: Sat Aug 13, 2022 1:26 pm    Post subject: Reply with quote

NeddySeagoon wrote:
[…]
The EFI system partition on RAID1 must use metadata 0.90.
[…]

It can be (and should be) also 1.0.
https://raid.wiki.kernel.org/index.php/A_guide_to_mdadm#Superblocks_and_Raid_versions
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54453
Location: 56N 3W

PostPosted: Sat Aug 13, 2022 1:37 pm    Post subject: Reply with quote

lekto,

Correct. Thank you.
Quote:
... Version 1.0 is also stored at the end of the device. This means that 0.9 can be upgraded to 1.0. It also means that, now that raid assembly is no longer supported in the kernel, the only supported way to boot from raid without an initramfs is to use a v1.0 mirror. ...


My only excuse is that old habits die hard.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum