{"id":662,"date":"2024-12-24T16:13:27","date_gmt":"2024-12-24T21:13:27","guid":{"rendered":"https:\/\/daveking.com\/blog\/?p=662"},"modified":"2024-12-24T16:29:26","modified_gmt":"2024-12-24T21:29:26","slug":"fedora-grub2-repair-for-system-using-uefi-firmware","status":"publish","type":"post","link":"https:\/\/daveking.com\/blog\/index.php\/2024\/12\/24\/fedora-grub2-repair-for-system-using-uefi-firmware\/","title":{"rendered":"Fedora grub2 repair for system using UEFI firmware"},"content":{"rendered":"\n<p>A long-running server suddenly stopped booting successfully.  It started displaying a &#8220;grub rescue&gt;&#8221; prompt after reboot.  My searches suggested this meant grub needed to be reinstalled.  This server uses EFI firmware so all the instructions on using &#8220;grub2-install&#8221; that I found everywhere are moot.  After a couple of days of searching, this is the procedure I found that is supposed to work on a system with EFI firmware.  Unfortunately, after doing this, I continued to get <code>boot rescue&gt;<\/code> prompts after rebooting.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Boot a Fedora Live image from USB being sure to select the UEFI boot device listing for it in the BIOS boot menu.<\/li>\n\n\n\n<li>Open a terminal window and do:<br><code>sudo su -<\/code><br><code>mkdir \/mnt\/root<\/code><\/li>\n\n\n\n<li>The root filesystem is on an LVM partition on this server, so activate all the LVMs on the system:<br><code>vgchange -a y<\/code><\/li>\n\n\n\n<li><code>mount \/dev\/mapper\/fedora_fedora-root \/mnt\/root<\/code><\/li>\n\n\n\n<li>Examine <code>\/mnt\/root\/etc\/fstab<\/code> to figure out which partitions should be mounted where. The <code>lsblk -o name,size,mountpoint,uuid<\/code> command can help map physical devices to fstab entries that identify partitions by their UUID.<br><code>mount \/dev\/sda2 \/mnt\/root\/boot<br>mount \/dev\/sda1 \/mnt\/root\/boot\/efi<\/code><\/li>\n\n\n\n<li>Mount all the system partitions:<br><code>mount -o bind \/dev \/mnt\/root\/dev<br>mount -o bind \/proc \/mnt\/root\/proc<br>mount -o bind \/sys \/mnt\/root\/sys<br>mount -o bind \/run \/mnt\/root\/run<br>mount -o bind \/sys\/firmware\/efi\/efivars \/mnt\/root\/sys\/firmware\/efi\/efivars<\/code><\/li>\n\n\n\n<li><code>chroot \/mnt\/root \/bin\/bash<\/code><\/li>\n\n\n\n<li><code>dnf reinstall shim-* grub2-*<\/code><\/li>\n\n\n\n<li><code>grub2-mkconfig -o \/boot\/grub2\/grub.cfg<\/code><\/li>\n<\/ol>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A long-running server suddenly stopped booting successfully. It started displaying a &#8220;grub rescue&gt;&#8221; prompt after reboot. My searches suggested this meant grub needed to be reinstalled. This server uses EFI firmware so all the instructions on using &#8220;grub2-install&#8221; that I found everywhere are moot. After a couple of days of searching, this is the procedure [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":217,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[22,7],"tags":[],"class_list":["post-662","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howto","category-linux-administration","eq-blocks"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/daveking.com\/blog\/wp-content\/uploads\/2022\/11\/pc_rescue.jpg?fit=378%2C193&ssl=1","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=662"}],"version-history":[{"count":4,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/662\/revisions"}],"predecessor-version":[{"id":667,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/662\/revisions\/667"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/media\/217"}],"wp:attachment":[{"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daveking.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}