Score:0

Grub, get default target of the platform in use on my PC through bash shell

it flag

Eg: "x86_64-efi"
How do I know the default target of the platform in use on my PC?
Does it reside in some file or can I get it via a command?
I have not found relevant search results on the internet.

oldfred avatar
cn flag
If installing from inside your install, it is the mount of the ESP - efi system partition (FAT32) in your /etc/fstab file. If installing from a chroot, you must mount the ESP. UEFI chroot, must include ESP - efi system partition http://askubuntu.com/questions/53578/can-i-install-in-uefi-mode-with-the-alternate-installer/57380#57380 chroot with UEFI, LVM, encryption on NVMe drive https://ubuntuforums.org/showthread.php?t=2349833&p=13602088#post13602088 If just installing only grub to flash drive you can specify drive & partition in command. Where are you installing?
it flag
/etc/fstab does not contain this information "x86_64-efi". I just want to get this value from I don't know which file or command.
oldfred avatar
cn flag
Where are you installing from? Grub has multiple versions and if you have an UEFI install it will automatically reinstall the 64 bit UEFI version of grub. What model system? What version of Ubuntu?
it flag
I need to install the dual boot FAT32 / exFAT with Ubuntu 20.04 LTS on a pendrive (with "insmod exfat" I solve the problem of the exFAT partition).
oldfred avatar
cn flag
Have not installed grub by itself to flash drive for ages. Large flash drives got full installs and now I boot from SSD or second drive. Do not know if exFAT works or not. If booted in UEFI mode. mounted the USB EFI partition at /media/test and I installed grub with sudo grub-install --target=x86_64-efi --efi-directory=/media/test --bootloader-id=grub --removable --recheck --debug You then have to manually create your own grub.cfg boot stanza(s) to boot whatever you want to boot.
it flag
I have created another question regarding a problem with this thing: https://askubuntu.com/questions/1393957/stdin-invalid-argument
it flag
Instead for this topic what I intended to do was, instead of writing this: `--target=x86_64-efi`, write this: `--target=$target`, where the `$target` variable is taken somewhere, I don't know where, which is the reason for this question. This variable, I want to get it from the platform currently in use on my PC, even if the pendrive could instead be used on different platforms.
it flag
I have edited the question.
oldfred avatar
cn flag
x86_64-efi is not really a variable, just specifying 64 bit UEFI install to 64 bit PC. Unless also planning on 32 bit, or other non-PC based systems that use different software that have different descriptions. --target=i386-pc instructs grub-install to install for BIOS systems only. Generally you have to boot in same mode as you want to install.
it flag
Are you sure there is no way to get this value from some file on the system or command? `x86_64-efi` is just an example.
oldfred avatar
cn flag
Check UEFI boot mode [ -d /sys/firmware/efi ] && echo EFI || echo Legacy If UEFI then then x86_64-efi is correct. Why would you have anything else?
it flag
Ah ok, the answer is exhaustive. Thanks a lot.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.