Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to repair grub bootloader after unplugging the hard drei
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
antoniovalos
n00b
n00b


Joined: 24 Mar 2023
Posts: 47

PostPosted: Sun Jun 30, 2024 2:55 am    Post subject: How to repair grub bootloader after unplugging the hard drei Reply with quote

I only unplugged my hard drive and plugged it again later, but the bootloader disappeared.
How and why does this happen?
How to repair the bootloader after unplugged the hard drive?
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1956
Location: 127.0.0.1

PostPosted: Sun Jun 30, 2024 7:22 am    Post subject: Reply with quote

If you have multiple disks, go to BIOS and select the right disk to boot to.
If you want precise answers, give more details.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54577
Location: 56N 3W

PostPosted: Sun Jun 30, 2024 10:26 am    Post subject: Reply with quote

antoniovalos,

Some EFI systems auto erase unavailable boot options.
If you booted with the HDD removed, its contents are probably OK.
You need to regenerate the efivars for the system on the drive.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5093
Location: Bavaria

PostPosted: Sun Jun 30, 2024 10:47 am    Post subject: Reply with quote

antoniovalos,

maybe read first this to understand UEFI booting better:
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Boot_kernel_via_UEFI
read up to this paragraph:
Quote:
Most (all?) UEFIs check at system startup whether the UEFI entries also point to an actually existing binary.efi ... and if not, UEFI simply deletes the entry. This means that if you make an entry for \efi\backup\bzImage.efi in the next chapter, it will be displayed, but if no \efi\backup\bzImage.efi exists, your UEFI will delete this entry the next time you start the system.

and then check WHAT you have booted before. Was it a grub ?

If yes, you must chroot (*) into your Gentoo system and install grub again (because this install routine creates also the UEFI entry for \efi\gentoo\grubx64.efi) with grub-install --efi-directory=/efi

Do this only if your ESP is mounted to /efi ... IF YOU HAVE AN OLD installation where you mount your ESP to /boot then:

1. Read this: https://forums.gentoo.org/viewtopic-t-1165115-highlight-.html
2. Use: grub-install --efi-directory=/boot

*) https://wiki.gentoo.org/wiki/User:Pietinger/New_at_Gentoo#Pause_during_Installation
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum