You are not logged in.

#1 2024-11-02 11:59:20

grafi
Member
Registered: 2024-06-18
Posts: 4

What is a propper way of installing grub details in a post

I have i have efi partition created by mkfs.fat -F 32 /dev/sda1
there is no legacy boot partition efi partition is mouted in /boot/EFI

Ok I understand a difference between installing grub on a partition let say /dev/sda1 and drive it self /dev/sda but...

I have no freaking clue what is a difference between those two, presented below:

    grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck
    grub-install  /dev/sda1

I just assume that if i have efi partition let say sda1 this command "grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck" will automatically install grub in to it
but, the other let me choose if i want to put my grub to sda (the drive) or sda1 (the partition).

This one grub-install  /dev/sda1 is simpler and worked on my uefi environment.

So what are a downsides if any  of using this grub-install  /dev/sda1 over this
grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck

Ps documentation on arch site is either confusing or Im compete idiot. So please explain like Im 5

Last edited by grafi (2024-11-03 13:27:13)

Offline

#2 2024-11-02 20:23:49

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,290

Re: What is a propper way of installing grub details in a post

Please adjust your title to something that actually reflects your question, instead of mentioning that you have a question, that's is generally assumed...

your first command lacks the reference to the mount point with the --efi-directory directive as documented in https://wiki.archlinux.org/title/GRUB#Installation . In fact the wiki does not refer to any variation of your first command, so where do you get that from?

The second command will work and generally do the same, but is "technically" incorrect, but grub-install is afaik helpful enough so that it infers that you meant to write to to the ESP (the mounted partition). So you can generally assume that it will have done the correct thing and that there are no functional differences.

Offline

#3 2024-11-02 21:29:16

cryptearth
Member
Registered: 2024-02-03
Posts: 1,012

Re: What is a propper way of installing grub details in a post

well - one possible option could be how grub-install is meant to behave on EFI systems: https://www.gnu.org/software/grub/manua … 02dinstall

On EFI systems for fixed disk install you have to mount EFI System Partition. If you mount it at /boot/efi then you don’t need any special arguments:

# grub-install

Otherwise you need to specify where your EFI System partition is mounted:

# grub-install --efi-directory=/mnt/efi

so - first of all: check how exactly you spelled the mountpoint
according to the grub doc, that table about gpt partition types and FHS it should be all lowercase either /boot/efi or /efi (with another popular option using /boot and by its using the ESP not just for grub but all other stuff like all the modules, the config and the kernel+initrd)
if you really have it at /boot/EFI you should fix this
it also can cause confusion because it end up in /boot/EFI/EFI/<id>/grubx64.efi which can make it hard to correctly tell what's the mountpoint and what's the folder on the ESP
this solves the first line

as for why/how it works on uefi when a device (or partition) is given - couldn't find anything in the docs so I guess someone have to dig through the source - but a wild guess: it's just ignored and install is done as if it's not given at all

why does it work without specify --target option? because arch build sets default to x86_64-efi so it doesn't have to be specified

Offline

#4 2024-11-03 13:34:40

grafi
Member
Registered: 2024-06-18
Posts: 4

Re: What is a propper way of installing grub details in a post

I changed post title to something more useful as you requested

BTW thanks for answer both of you. Your combined answers straighten things up .
Thank you very much

V1del wrote:

Please adjust your title to something that actually reflects your question, instead of mentioning that you have a question, that's is generally assumed...

your first command lacks the reference to the mount (...).

cryptearth wrote:

well - one possible option could be how grub-install is meant to behave on EFI systems: https://www.gnu.org/software/grub/manua … 02dinstall

On EFI systems for fixed disk install you have to mount EFI System Partition. If you mount it at /boot/efi then you don’t need any special arguments:

# grub-install

Otherwise you need to specify where your EFI System partition is mounted:

# grub-install --efi-directory=/mnt/efi

so - first of all: check how exactly you spelled the mountpoint
according to the grub doc, that table about gpt partition types and FHS it should be all lowercase either /boot/efi or /efi (with another popular option using /boot and by its using the ESP not just for grub but all other stuff like all the modules, the config and the kernel+initrd)
if you really have it at /boot/EFI you should fix this
it also can cause confusion because it end up in /boot/EFI/EFI/<id>/grubx64.efi which can make it hard to correctly tell what's the mountpoint and what's the folder on the ESP
this solves the first line

as for why/how it works on uefi when a device (or partition) is given - couldn't find anything in the docs so I guess someone have to dig through the source - but a wild guess: it's just ignored and install is done as if it's not given at all

why does it work without specify --target option? because arch build sets default to x86_64-efi so it doesn't have to be specified

Offline

Board footer

Powered by FluxBB