[Solved] How to boot Debian from a USB hard drive using UEFI from different computers

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
User avatar
s3a
Posts: 831
Joined: 2008-07-17 22:13
Has thanked: 6 times
Been thanked: 2 times

[Solved] How to boot Debian from a USB hard drive using UEFI from different computers

#1 Post by s3a »

<Edit>
For what it's worth, I changed the subject of the first post / this thread from what it used to be, "I upgraded my CPU and a UEFI Debian installation I have no longer works!", to "How to boot Debian from a USB hard drive using UEFI from different computers".
</Edit>

I upgraded my CPU (but not motherboard) and a UEFI Debian installation I have no longer works!

For future reference, is there a way that's possible to have a Debian installation that's installed to a USB hard drive be able to boot from two (x86_64 / x64 / amd64) computers?

If so, what would I need to do?

I booted a live Debian session and chrooted into the installation and did

Code: Select all

grub-install /dev/sdX --target=x86_64-efi --efi-directory=/boot/efi/
with X replaced with the letter that the live session gave.

More specifically, if I remember correctly I had done.:

Code: Select all

cryptsetup open --type luks /dev/mapper/sdX3 sdc3_crypt

Code: Select all

mount -o autodefrag,compress=zstd,subvol=@rootfs /dev/mapper/debian-vg /mnt

Code: Select all

mount --bind /dev/pts /mnt/dev/pts

Code: Select all

mount --bind /dev /mnt/dev

Code: Select all

mount /dev/sdX2 /mnt/boot

Code: Select all

mount /dev/sdX1 /mnt/boot/efi

Code: Select all

chroot /mnt

Code: Select all

grub-install /dev/sdX --target=x86_64-efi --efi-directory=/boot/efi/

Code: Select all

update-grub && update-initramfs -u && updategrub
When I reboot, it just doesn't detect anything. It's not like Debian boots but has errors; it just doesn't get detected at all.

Could someone please help me fix this?

Also, is it possible to make it so that I can boot the USB installation on two different computers? If so, what would I have to do?

I also vaguely recall having done

Code: Select all

efibootmgr add 1 /dev/sdX
in different rescue attempts of mine, one attempt outside the chroot (in the live Debian) and one inside the chroot.

Any input would be GREATLY appreciated!
Last edited by s3a on 2023-12-26 03:57, edited 1 time in total.
Use Mnemosyne to Study for School!

Aki
Global Moderator
Global Moderator
Posts: 3698
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 100 times
Been thanked: 486 times

Re: I upgraded my CPU and a UEFI Debian installation I have no longer works!

#2 Post by Aki »

Hello,

Perhaps your BIOS erased the motherboard's NVM (non-volatile memory), which holds the UEFI configuration variables, in the process of changing the CPU.
s3a wrote: 2023-12-24 12:49 [..]
is there a way that's possible to have a Debian installation that's installed to a USB hard drive be able to boot from two (x86_64 / x64 / amd64) computers? If so, what would I need to do?
[..]
If all your computers are EFI-enabled, you can install the Debian EFI grub boot loader in the "removable media path" (see [1]).

The EFI firmware in each of your computers should allow you to select the drive to boot by pressing a pre-defined key before booting (the key changes depending on the firmware).

Hope this helps.

Note: I would suggest you to change the subject of the first post from:
  • "I upgraded my CPU and a UEFI Debian installation I have no longer works!"
to
  • "How to boot Debian from a USB hard drive using UEFI from different computers"
---
[1] Debian Wiki - UEFI - Force grub-efi installation to the removable media path
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

User avatar
lewulff
Posts: 108
Joined: 2008-12-07 16:55
Location: Tagaytay Philippines
LinkedIN: www.linkedin.com/in/
Has thanked: 3 times
Been thanked: 14 times
Contact:

Re: I upgraded my CPU and a UEFI Debian installation I have no longer works!

#3 Post by lewulff »

Have you tried the efibootmgr program? I tend to run multi boot systems, and have used efibootmgr to alter boot order in NVM, and to create new NVM boot entries.
Lee Wulff

User avatar
s3a
Posts: 831
Joined: 2008-07-17 22:13
Has thanked: 6 times
Been thanked: 2 times

Re: I upgraded my CPU and a UEFI Debian installation I have no longer works!

#4 Post by s3a »

Aki wrote: 2023-12-24 15:33 Hello,

Perhaps your BIOS erased the motherboard's NVM (non-volatile memory), which holds the UEFI configuration variables, in the process of changing the CPU.
s3a wrote: 2023-12-24 12:49 [..]
is there a way that's possible to have a Debian installation that's installed to a USB hard drive be able to boot from two (x86_64 / x64 / amd64) computers? If so, what would I need to do?
[..]
If all your computers are EFI-enabled, you can install the Debian EFI grub boot loader in the "removable media path" (see [1]).

The EFI firmware in each of your computers should allow you to select the drive to boot by pressing a pre-defined key before booting (the key changes depending on the firmware).

Hope this helps.

Note: I would suggest you to change the subject of the first post from:
  • "I upgraded my CPU and a UEFI Debian installation I have no longer works!"
to
  • "How to boot Debian from a USB hard drive using UEFI from different computers"
---
[1] Debian Wiki - UEFI - Force grub-efi installation to the removable media path
Thanks a lot! Copy-pasting the data and then doing the dpkg-reconfigure command worked!
Use Mnemosyne to Study for School!

User avatar
s3a
Posts: 831
Joined: 2008-07-17 22:13
Has thanked: 6 times
Been thanked: 2 times

Re: I upgraded my CPU and a UEFI Debian installation I have no longer works!

#5 Post by s3a »

lewulff wrote: 2023-12-25 22:55 Have you tried the efibootmgr program? I tend to run multi boot systems, and have used efibootmgr to alter boot order in NVM, and to create new NVM boot entries.
Thanks for the response, and I'll keep this in mind in general for a future problem, but the removable path way would just always work regardless of which computer I boot from and with the use of efibootmgr, I'd have to keep running a command on each computer, right?

All my operating systems are on USB drives, so it's not a problem for me that only one can be detected at a time (which, if I understood correctly, is a limitation of that method) (because I can easily remove the other drives).
Use Mnemosyne to Study for School!

User avatar
LinuxOS
Posts: 53
Joined: 2022-07-31 01:46
Has thanked: 28 times
Been thanked: 3 times

Re: [Solved] How to boot Debian from a USB hard drive using UEFI from different computers

#6 Post by LinuxOS »

If your operating system is on a USB drive, you probably should add --force-extra-removable argument.

Code: Select all

grub-install /dev/sdX --target=x86_64-efi --force-extra-removable --efi-directory=/boot/efi/
It should install /boot/efi/EFI/BOOT/ directory required to boot removable USB device from any UEFI-aware machine.

Post Reply