Fedora 29, how to simulate a grub2-install --removable command?

asked 2019-04-18 23:49:00 -0600

andreas574 gravatar image

updated 2019-04-20 06:33:54 -0600

Trying to create a portable installation of fedora 29. Using VMWare Workstation I was able to create an isolated environment that lets me install fedora on a usb drive able to boot in UEFI mode from a live image without affecting the the host computer. The generated usb drive is functional but not removable. Googling around I learned that to have the usb disk seen as removable I should install grub2 with grub2-install command and the --removable option. Grub2-install looks deprecated in fedora, so there is any workaround to make my usb disk behave as a removable drive, in order to not affect the boot process of the host computers?

Thanks in advance Andrea

** COPYNG BELOW MY COMMENTS BECAUSE i AM NOT SURE IF THEY CAN BE CONSIDERED AN ANSWER BY THE MODERATORS AND IF, LEFT AS COMMENTS, THEY HAVE THE RIGHT VISIBILITY*

Thank you for your answer, Night Romantic. My first idea was to just make a full install to an usb disk. Unfortunately this results in host system that can boot only if the usb disk is present in its slot, because the uefi grub installation process not only copies the grub files in the efi partition, but also creates or modifies the efi boot entry in the efi firmware and the grub.cfg configuration file: the anaconda installer, for and old and unresolved bug, I guess, installs and modifies the grub files only on the efi partition of sda and not on the one created on the target drive, leaving a system that can boot only if the usb drive is present and not able to launch the original Fedora installation. Moreover, the created USB drive is unable to boot because it misses the necessary EFI files. nstalling Fedora on the USB drive in a diskless protected Virtual Machine environment solves the above two problems, but, unfortunately, the VMWare created USB drive when booted creates on the host computer an additional UEFI firmware boot entry that points directly to the usb drive, making impossible to reboot the host computer if the USB drive is not present. A removable installation, like the live fedora, does not create this additional boot entry in UEFI firmware, leaving a bootable host computer When Removed. Of course a careful use of the efibootmgr command can solve the boot problem on the host computer, but this prevents a comfortable use of the fedora usb drive. As far as I could understand the --removable option in grub2-install installs a modified /EFI/BOOT/BOOTX64.EFI file that does not create the above mentioned EFI firmware boot entry. This is the reason why I am posing this question

edit retag flag offensive close merge delete

Comments

Andrea, do you want to be able to boot Fedora Live image and then be able to pull out usb disk you've booted it from?

I think you maybe overcomplicating things a bit.

1) The easiest way to create portable installation (which won't affect host computer unless you do it yourself) is to just install Fedora on a big enough usb drive. You won't be able to pull it out while Fedora is working, but aside from that you'll have your own installed Fedora copy in your pocket.

One caveat I've heard about just this week is to include additional kernel modules to initramfs to increased portability.

Night Romantic gravatar imageNight Romantic ( 2019-04-19 08:05:25 -0600 )edit

I'll give you a link, if it's the way you'll choose to go.

2) Default Fedora Live USB also don't affect host computer in any way -- unless you install Fedora from it, or mount host computer's drives and delete files from them, etc.

As as I know you can customize this image, older versions even had option to add persistent storage to it. And I think it was possible to boot this image with kernel boot parameter entirely to RAM (so that you could unplug the usb drive). Come to think about it maybe it's even default now.

Night Romantic gravatar imageNight Romantic ( 2019-04-19 08:09:19 -0600 )edit

3) Regarding grub2-install. As far as I know, it isn't deprecated or something, it's still used when you install grub in BIOS mode (i.e. for non-UEFI boot). I've seen in several different places, that it's not good for UEFI systems, and if you want to reinstall grub2 on UEFI system, you shouldn't use grub2-install, it;s done differently.

Thinking about it for a bit, it makes sense: grub2-install installs bootloader to the beginning of the HD (or partition), and for UEFI boot you just copy grub's .efi file to already-existing EFI partition.

Night Romantic gravatar imageNight Romantic ( 2019-04-19 08:14:55 -0600 )edit

Depending on what you actually want to achieve, I'd either do ordinary install but on a usb-drive (easy), or customised live image (harder/needs more time) -- each has it's own strong points and failures. And you don't need VMWare to do any of the two.

Night Romantic gravatar imageNight Romantic ( 2019-04-19 08:17:41 -0600 )edit

Thank you for your answer. 1) My first idea was to just make a full install to an usb disk. Unfortunately this results in host system that can boot only if the usb disk is present in its slot, because the uefi grub installation process non only copies the grub files in the efi partition, but also creates or modifies the efi boot entry in the efi firmware and the grub.cfg configuration file.

andreas574 gravatar imageandreas574 ( 2019-04-19 19:50:20 -0600 )edit