1

I'm moving my system to a new SSD. And I would like to take this opportunity to convert from BIOS to EFI. Mainboard is about 1 year old, so firmware should be current enough to avoid the UEFI issues the early versions had.

I'm using two complete system partitions (for production and test) and the selection is done via GRUB menu. I would like to keep that.

The new SSD is GPT-partitioned, and I have created an "EFI System" partition with type EF00, VFat formatted, and mounted at /boot/efi.

However, now I'm caught in a vicious circle: As long I haven't installed an EFI-enabled GRUB on the new SSD, I need to keep the CSM module enabled in UEFI setup and boot from the old HDD in BIOS mode. But as long as I boot in BIOS mode, I can't do a grub-install --target=x86_64-efi because it says EFI variables are not supported on this system.

I've found some instructions for Ubuntu referring to boot-repair, but that's not available for Arch Linux and there is some dispute if it's a good idea to use it at all.

1

There are a few options:

  • You can produce a grubx64.efi file with the appropriate GRUB modules included using grub-mkimage -O x86_64-efi, place it into /boot/efi/EFI/BOOT/BOOTX64.EFI and place the GRUB configuration file in the same directory. This is similar to what you would generally do to make a removable media UEFI-bootable. Then you can disable the CSM and the firmware should detect the SSD as a valid UEFI boot disk.

  • Alternatively, you could disable the CSM and boot Linux from an UEFI-bootable removable media (or the Super Grub2 Disk suggested by Freddy), then chroot to your Arch installation if necessary.

Either way, your system will now be booted in UEFI mode, so the EFI variables will be accessible, and you can now use the grub-install --target=x86_64-efi to install a proper bootloader for a permanently installed OS, the way UEFI specifications expect it to be done.

0

The easiest solution is probably to boot from Super Grub2 Disk.

  1. Download and install a Super Grub2 Disk ISO to a USB stick. Choose the hybrid ISO and dd or cat the image to the stick, i.e.

    dd if=/path/to/super_grub2_disk_hybrid_2.04s1.iso of=/dev/sdX bs=16M
    

    where /dev/sdX is the path to your USB stick, e.g. /dev/sdd.

  2. Change your BIOS boot mode to "UEFI only" (without CSM).

  3. Boot Super Grub2 Disk from the stick and choose "Detect and show boot methods" from the menu. If it works as expected you should be presented a list of kernels to boot from found in your /boot directories.
  4. Select a kernel, boot into your Arch installation and install GRUB.
  5. Keep the USB stick for emergencies.
0

It worked with the Super Grub2 Disk as suggested by @Freddy. Just in case somebody else stumbles upon this question, I'm going to describe the whole procedure a bit more detailed below (contains Freddy's steps).

However, the current stable iso image of the Super Grub2 Disk is not able to boot from an USB stick. I needed to go for the beta and use the multiarch-USB image.

So this is the complete procedure:

  • Create the Super Grub 2 Disk USB stick and test it :-)
  • Boot from the old HDD or SSD one last time
  • Create a "gpt" partition table and some partitions on the new SSD:
    1. "EFI System" partition with type EF00, VFat formatted, and mounted at /boot/efi
    2. A small Linux partition, mounted at /boot
    3. Depending on the use of encryption, LVM, ... one or more partitions for system, data, ...
  • If applicble, set up encryption and/or LVM
  • Copy all data from the old HDD or SSD to the new one
  • Adapt the fstab on the new to-be-root filesystem to new UUID's, labels, or whatever you're using
  • Adapt the grub.cfg on the new to-be-/boot filesystem accordingly
  • Shutdown
  • Disconnect the old BIOS-based HDD or SSD
  • Start the computer and enter UEFI setup
  • Disable the CSM
  • Boot from the Super Grub2 Disk USB (maybe you need to open the UEFI's boot menu)
  • Go to "Detect and show boot methods" (can take some time) and if you adapted your grub.cfg correctly before, you only need to select the correct menu entry without editing anything manually.
  • Do a grub-install on the new SSD
  • You may want to go to UEFI setup again and select the new SSD as default bot device

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.