Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What did grub-install do to my nvram?
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
Screenager
n00b
n00b


Joined: 26 Nov 2023
Posts: 37

PostPosted: Mon Nov 27, 2023 12:15 am    Post subject: What did grub-install do to my nvram? Reply with quote

I just ran through linux from scratch on my old ThinkPad T500 with a bios and MBR setup without any problems (aside from insane compile times).

I want to really understand what is happening here.
So I went on to my old X220t for a gentoo EFI and GPT install and did it according to the handbook. There is still a SSD with an old win7 inside which I didn't touch and installed on an USB-Stick. So far everything works great got KDE-Plasma running on Wayland - didn't expect this old laptop to feel this ... fast... :D

So now I want to do a more 'fancy' install with LUKS and LVM on a different SSD. But I want to understand one thing first:
My BIOS Bootmenu had an entry 'WIN7_OS' on top before listing physical devices. This got replaced by 'gentoo' after I was done with grub-install. I probably should have run --no-nvram. I suggest the handbook puts one of this red danger messages here.
While I can boot into the old Win7 just fine by selecting the physical drive instead of the old 'WIN7_OS' top entry I can't do the same for my gentoo USB stick. I can only boot into gentoo by using that 'gentoo' entry that probably comes from the NVRAM.

I am scared from continuing, if I mess up the initramfs with my fulldiskencryption while at the same time losing the ability to boot in my host I am doomed to start over from an ordinary livestick without persistence. And I still won't know why this behaves so strange.

Usually the UEFI boot manager should just look for a flagged partition and read the EFI folder there, right? That is why whe use fat32 and the standardized folder structure, or am I wrong?
Then why won't my stick boot if i just point it to the physical stick without that NVRAM entry?

EDIT: The entry 'gentoo' is even there after a cold boot without the gentoo stick plugged in so it has to be some weird manufactor-firmware thing, right?
Back to top
View user's profile Send private message
soparla
n00b
n00b


Joined: 21 Aug 2018
Posts: 72
Location: Florida

PostPosted: Mon Nov 27, 2023 4:07 am    Post subject: Why are you afraid? Reply with quote

You should not be afraid. You can always edit the grub config and bring back in Win or whatever and then run grub-install again.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Mon Nov 27, 2023 12:25 pm    Post subject: Reply with quote

Screenager,

Welcome to Gentoo.

Are you using the same kernel command line in both USB stick boot cases?

Root on USB can be a problem because the kernel tries to mount root before USB gets started.
That's a bad thing for root on USB.

To test add rootdelay=30 to the kernel command line. That's far too long but at the end of 30 seconds the kernel will try to mount root and panic if root is not there.
When it works, swap that for rootwait. That will wait forever for root, so only use that once it works.
_________________
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
Screenager
n00b
n00b


Joined: 26 Nov 2023
Posts: 37

PostPosted: Mon Nov 27, 2023 10:39 pm    Post subject: Re: Why are you afraid? Reply with quote

soparla wrote:
You should not be afraid. You can always edit the grub config and bring back in Win or whatever and then run grub-install again.


You are right I can always grub-install from chroot again.


@NeddySeagoon

So I need to put this in /etc/default/grub like:
Code:
GRUB_CMDLINE_LINUX="rootdelay=30"

and then run
Code:
grub-mkconfig -o /boot/grub/grub.conf

right?

I got an error by grub-probe that it found an unkown filesystem after finding my initramfs. After a reboot and not noticing a delay I did run it again, this time without an error. Still no delay though.
Sometimes during a cold boot I get sent to grub rescue shell which is then unable to see any filesystems. It can see the GPT partitons on the internal SSD and the USB stick but it throws 'Unkown Filesystem' for any partitions.
I fix this by booting in a completly unrelated debian live stick, taking a look at my gentoo stick in Gparted and be like "yep all partitions are still here and readable" do a reboot into my 'gentoo' entry and surprise - it boots.
I also found some more complaints about weird EFI/linux/X220t interactions. So I guess I have a faulty stick and a weird EFI implementation. I currently don't have the ability to verify if a different EFI system behaves the same way.
My /efi folder only has a 136kb executable /efi/EFI/BOOT/grubx64.efi - not even the default /efi/BOOT/BOOTX64.EFI got created there is just an empty folder.
I rememer I was getting confused by the handbook in the beginning and was preparing for systemd-boot but later changed back to follow the grub route - maybe I did something there that I forgot to clean up.

I already replaced the old win7 SSD with a new one. I made a backup with ntfsclone and intend to restore this partitions later on and try to get it booted in QUEMU with KVM.

So I guess I just move on with installing gentoo on the internal SSD then. I am doing a kind of inbetween between the full-disk-encryption and rootfs-enryption guide: Everything on the internal SSD but a detached header inside my unencrypted extended boot partition. I am still not convinced Dracut will be able to build a good init script with that, after peeking into their source they seem to use /etc/crypttab for their setup which does not exist on an OpenRC system - maybe another thing to add to the guides. I will just extract the image before I try to boot into it and take a look at the script inside. I should notice if the commands are not right, I mean I just did everything manually by hand and the initramfs just needs to do the same steps to create a proper rootfs.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4167
Location: Bavaria

PostPosted: Mon Nov 27, 2023 11:11 pm    Post subject: Re: Why are you afraid? Reply with quote

Screenager wrote:
[...] not even the default /efi/BOOT/BOOTX64.EFI got created there is just an empty folder.

This is not a default, this is an emergency nail in case you have a buggy UEFI BIOS. :lol:

A correct UEFI BIOS reads its entries you (or an install routine) has given to it (e.g. with efibootmgr) from its NVRAM. You can always list these entries with "efibootmgr". Some BIOS have a problem when creating these entries (and refuse to accept new entries). THEN ... ONLY THEN - THE program which shall be be booted (e.g. grub or a stub kernel) can be renamed to BOOTX64.EFI AND it must be copied to the directory \efi\boot. This is a hard-coded name that a UEFI BIOS must ALWAYS accept/find/boot.

The primary purpose of this name is to be able to boot from a removable media (USB stick) WITHOUT having to create an entry (which would be pretty pointless). Yes, on a USB stick you will ALWAYS find this hardcoded name (there is no other method). Ask yourself why the parameter in grub-install is called "removable". ;-)

Just have a read:
https://wiki.gentoo.org/wiki/UEFI
https://wiki.gentoo.org/wiki/EFI_System_Partition
https://wiki.gentoo.org/wiki/Efibootmgr
https://wiki.gentoo.org/wiki/EFI_stub

I have described all the requirements for a UEFI boot in this chapter:
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Boot_kernel_via_UEFI#Prerequisites_for_an_UEFI_boot

If you are tired of grub, you can easily boot a DIST kernel (which is already a STUB kernel) directly with UEFI. You can find the instructions for this in: https://wiki.gentoo.org/wiki/EFI_stub

Please read before:
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Confusion_with_root%3DPARTUUID%3D_and_root%3DUUID%3D
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Kernel_Commandline_Parameter
_________________
https://wiki.gentoo.org/wiki/User:Pietinger


Last edited by pietinger on Mon Nov 27, 2023 11:45 pm; edited 1 time in total
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4167
Location: Bavaria

PostPosted: Mon Nov 27, 2023 11:21 pm    Post subject: Reply with quote

NeddySeagoon wrote:
To test add rootdelay=30 to the kernel command line. [...]

I suggest to use the kernel command line paramter "rootwait" instead.
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4167
Location: Bavaria

PostPosted: Mon Nov 27, 2023 11:42 pm    Post subject: Re: Why are you afraid? Reply with quote

Screenager wrote:
[...] My /efi folder only has a 136kb executable /efi/EFI/BOOT/grubx64.efi - not even the default [...]

I just have seen this. This is not from a gentoo Installation because Gentoo installs the grub into \EFI\gentoo\grubx64.efi of the ESP (when not using parameter "removable").
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
zah21
n00b
n00b


Joined: 15 Jan 2021
Posts: 27

PostPosted: Tue Nov 28, 2023 12:27 am    Post subject: Reply with quote

If you don't mind may I ask why you felt the need to use Linux from scratch when there's such a nice distro such as Gentoo? Also why post in Gentoo forums, when there's a dedicated Linux from scratch forum out there.

I sense you're some kind of troll.

Anyway, what have you learned after starting on your journey? I was thinking of trying it myself until I started to realize that I'd have to manage packages compilation issues myself, as well as deal with bugs, updates and other stuff down the line, so that wasn't a good motivator unfortunately :/
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21644

PostPosted: Tue Nov 28, 2023 1:35 am    Post subject: Reply with quote

Please do not call people "troll" without more evidence. The Gentoo forums tend to attract this type of person because we have many power users, so advanced questions are likely to get a good answer. If OP is trolling, he is putting a lot of effort into it, so that explanation seems unlikely.
Back to top
View user's profile Send private message
Screenager
n00b
n00b


Joined: 26 Nov 2023
Posts: 37

PostPosted: Tue Nov 28, 2023 6:26 am    Post subject: Reply with quote

Listen, I am a former Flash developer and now I am a former Unity developer too, some people need to be fooled twice but I am done with corporate shenanigans. I am currently a solo game dev and I consider myself more of an artist. I am a huge gearhead/technerd, the sort of who selects special potentiometers for his guitar and rewires/resolders the whole electronics himself. So it is only natural I came to gentoo. I have used Windows until now and I won't upgrade to Win 11...

So as I am back to my own engine development right now, might as well switch everything to gentoo while I am in the process. I did LFS for educational purposes. There was a nice amount of history inside so I can see why some stuff grew the way it is. I already run infrastructure in form of a debian server with NGINX, node.js, postfix, dovecot, gitea, nextcloud and other stuff which I plan to move to a hardened gentoo install. So I know my way around C/C++, Blender, GLTF and Vulkan but have no basic understanding of how GNU/Linux works. Typicallly, I just copied tutorial commands to get stuff setup and running, admining the bad way, well at least I got fail2ban setup for every public facing login :lol:

I also started the gentoo install on this laptop for educational purposes. I actually wanted to move my workstation first and it is gonna be a long and stressfull process so I wanted to be prepared. Until I have a new DAW (Ardour or Reaper) with all my VSTs running I am a little edgy. Sorry for appearing trollish, you can imgine live is a little stressfull right now. I was about to rework my website and was 75% done with it and was thinking about first trailers and composing a soundtrack and now I am back to thinking about scene graphs, implementing A* again and filling polys while looking at librarys...

Which probably made me copy some command from somewhere else and now I am stuck with this strange install. I definitely ran some grub-install variance that I found somewhere on google. Just FYI I have around 900 tabs open right now, it's been a few chaotic months :oops:

Thank you all for your help.

I will take a look at it with efibootmanager, maybe check the Bios settings again but I guess I just abandon this weird install and move on. No way to debug this if I myself don't know what exact command I ran. I was thinking I could save time by fixing it and moving it with dd from stick to SSD so I won't have to compile anew. Could it be other os probing saw the Win7 SSD that was still inside at that time, grub refused to do anything because the EFI would not allow to add entries and I --forced the install with a strange folder structure and overwrote my NVRAM completly?

BTW I really like gentoo so far, that's why I am going all in. Gotta use these honymoon feelings and dive in as deep as I can, enjoy it while it lasts.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21644

PostPosted: Tue Nov 28, 2023 3:17 pm    Post subject: Reply with quote

As a quick tip, do not use dd to copy to an SSD. Ideally, never use dd unless you need (usually for forensic or compliance reasons) a bit-for-bit exact copy. In almost all cases, making a filesystem on the target and copying the source data as files will be better for you.
Back to top
View user's profile Send private message
Screenager
n00b
n00b


Joined: 26 Nov 2023
Posts: 37

PostPosted: Wed Nov 29, 2023 12:28 am    Post subject: Reply with quote

The plot thickens:

Code:
BootCurrent: 0019
Timeout: 0 seconds
BootOrder: 0019,000A,0006,0007,0008,0009,000B,000C,000D,000E,000F,0010,0011,0012,0013
Boot0000  Setup   FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9)
Boot0001  Boot Menu   FvFile(126a762d-5758-4fca-8531-201a7f57f850)
Boot0002  Diagnostic Splash Screen   FvFile(a7d8d9a6-6ab0-4aeb-ad9d-163e59a7a380)
Boot0003  Startup Interrupt Menu   FvFile(f46ee6f4-4785-43a3-923d-7f786c3c8479)
Boot0004  ME Configuration Menu   FvFile(82988420-7467-4490-9059-feb448dd1963)
Boot0005  Rescue and Recovery   FvFile(665d3f60-ad3e-4cad-8e26-db46eee9f1b5)
Boot0006* USB CD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,86701296aa5a7848b66cd49dd3ba6a55)
Boot0007* USB FDD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,6ff015a28830b543a8b8641009461e49)
Boot0008* ATAPI CD0   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a35401)
Boot0009* ATA HDD2   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f602)
Boot000A* ATA HDD0   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f600)
Boot000B* ATA HDD1   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f601)
Boot000C* USB HDD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,33e821aaaf33bc4789bd419f88c50803)
Boot000D* PCI LAN   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803)
Boot000E* ATAPI CD1   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a35403)
Boot000F* ATAPI CD2   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a35404)
Boot0010  Other CD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a35406)
Boot0011* ATA HDD3   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f603)
Boot0012* ATA HDD4   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f604)
Boot0013  Other HDD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f606)
Boot0014* IDER BOOT CDROM   PciRoot(0x0)/Pci(0x16,0x2)/Ata(0,1,0)
Boot0015* IDER BOOT Floppy   PciRoot(0x0)/Pci(0x16,0x2)/Ata(0,0,0)
Boot0016* ATA HDD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f6)
Boot0017* ATAPI CD:   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a354)
Boot0018* PCI LAN   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803)
Boot0019* gentoo   HD(1,GPT,e58da84e-4b3f-407d-a26f-7d6fc4bcb271,0x1000,0x100000)/File(\EFI\gentoo\grubx64.efi)


besides that, the BIOS was still set to UEFI/Bios Legacy compatility mode.
I guess it should be save to remove everything after Boot0005 except Boot0018 which should be the PXE boot thing, right? Some weird vendor stuff there. So there will be messing with coreboot somewhere in the future...

EDIT: Important Information: Turns out that it is very dangerous to remove any of those entries on thinkpads - it might brick them! I will not be messing with any of this, I will just continue with my install to SSD now.

Thank you all for your help! In the end I was just to ignorant about the inner workings of UEFI and hurt myself further by being inpatient. In the future I will just ask, instead of trying out various commands :oops:
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4167
Location: Bavaria

PostPosted: Wed Nov 29, 2023 3:13 pm    Post subject: Reply with quote

First of all: I am sorry that you, as a new user, had an unpleasant contact with another user. This happens very rarely in our forum!

Screenager wrote:
Thank you all for your help! [...]

You are very Welcome ! :D

Screenager wrote:
[...] In the future I will just ask, instead of trying out various commands :oops:

Maybe you know the saying: You can't know everything, you just have to know where it is written. So don't be afraid to ask in the future.

I have seen that you have also registered in our wiki. That gives me the impression that you will be active for gentoo and I am very pleased. :D

I wish you a lot of fun with Gentoo. 8)
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Screenager
n00b
n00b


Joined: 26 Nov 2023
Posts: 37

PostPosted: Thu Nov 30, 2023 2:53 am    Post subject: Reply with quote

No worries. My writing was a little all over the place after I've been doing Linux/Gentoo full-time(and 'overtime') the past few weeks :lol:

Yeah, I read a little bit more around and saw how the wiki is organized and the idea is just excellent. There is a lot of stuff I need to do, might as well write it down step by step. This will slow me down and stop me from breaking stuff out of inpatience and might create a guide or two. Besides, I need to setup my own wiki at some point so I see many synergies in doing this.
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