{"id":1043,"date":"2025-09-09T10:27:17","date_gmt":"2025-09-09T07:27:17","guid":{"rendered":"https:\/\/itgen.itbumper.com\/?page_id=1043"},"modified":"2025-09-09T10:27:17","modified_gmt":"2025-09-09T07:27:17","slug":"0040_linux_grub","status":"publish","type":"page","link":"https:\/\/itgen.itbumper.com\/?page_id=1043","title":{"rendered":"0040_Linux_GRUB"},"content":{"rendered":"<p><strong><span style=\"text-decoration: underline;\">grub rescue<\/span>&gt; shows if GRUB can`t find its configuration (grub.cfg) or its modules.<\/strong><\/p>\n<p>It happens if:<\/p>\n<ul>\n<li data-tadv-p=\"keep\">Move or delete the \/boot partition<\/li>\n<li data-tadv-p=\"keep\">Disk`s UUID changed<\/li>\n<li data-tadv-p=\"keep\">Trouble with MBR or UFI<\/li>\n<\/ul>\n<p>Common commands grub rescue&gt;:<\/p>\n<ul>\n<li>ls &#8211; shows disks and partitions (hd0) (hd0,msdos1)<\/li>\n<li>set &#8211; shows or changes (prefix, root)<\/li>\n<li>set root=(hd0,msdos1) &#8211; there are must be folders \/var, \/opt, \/etc, \/proc &#8230;.<\/li>\n<li>set prefix=(hd0,msdos1)\/boot\/grub &#8211; grub config and modules<\/li>\n<li>insmod normal &#8211; load a module normal<\/li>\n<li>normal &#8211; go to the grub menu<\/li>\n<\/ul>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n#Example\nls\nset root=(hd0,msdos1)\nset prefix=(hd0,msdos1)\/boot\/grub\ninsmod normal\nnormal\n<\/pre><\/div>\n\n<p>If it&#8217;s correct, then the grub menu shows up.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">grub&gt;<\/span> it is a CLI GRUB and it shows:<\/strong><\/p>\n<ul>\n<li data-tadv-p=\"keep\">Then &#8220;c&#8221; was pressed<\/li>\n<li data-tadv-p=\"keep\">The grub menu can`t be found, but modules were loaded<\/li>\n<\/ul>\n<p>Here are more commands than in the grub rescue mode. You can manually load a kernel.\u00a0<\/p>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#Example\nls\nset root=(hd0,msdos1)\nlinux \/boot\/vmlinuz-6.8.0 root=\/dev\/sda1 ro\ninitrd \/boot\/initrd.img-6.8.0\nboot\n<\/pre><\/div>\n\n<p><strong>GRUB: BIOS and UEFI recovery<\/strong><\/p>\n<p>General algorithm:<\/p>\n<ol>\n<li data-tadv-p=\"keep\">Boot from LiveCD\/LiveUSB Linux (Ubuntu, Debian, etc.).<\/li>\n<li data-tadv-p=\"keep\">Determine where the system root and EFI partition are (for UEFI): lsblk,fdisk -l<\/li>\n<li data-tadv-p=\"keep\">Mount the system.<\/li>\n<li data-tadv-p=\"keep\">Make a chroot into the installed system.<\/li>\n<li data-tadv-p=\"keep\">Reinstall GRUB and update the configuration.<\/li>\n<li data-tadv-p=\"keep\">Reboot.<\/li>\n<\/ol>\n<p>\u00a0<\/p>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n#Example for BIOS (Legacy)\n# Use LiveCD\/LiveUSB Linux\u00a0\n# Find the &quot;\/&quot; \nlsblk\nfdisk -l\nsudo mount \/dev\/sdXY \/mnt\nsudo mount --bind \/dev \/mnt\/dev\nsudo mount --bind \/proc \/mnt\/proc\nsudo mount --bind \/sys \/mnt\/sys\n\n#\nsudo chroot \/mnt\n\n#\ngrub-install \/dev\/sdX\nupdate-grub\n\n#\nexit\n#\nsudo umount \/mnt\/dev \/mnt\/proc \/mnt\/sys\nsudo umount \/mnt\nreboot\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n#Example for UEFI\n# Use LiveCD\/LiveUSB Linux\u00a0\n# Find the &quot;\/&quot; \nlsblk\nfdisk -l\nsudo mount \/dev\/sdXY \/mnt\n\n# 100\u2013500 MB, type EFI System Partition\nsudo mount \/dev\/sdXZ \/mnt\/boot\/efi\n\n#\nsudo mount --bind \/dev \/mnt\/dev\nsudo mount --bind \/proc \/mnt\/proc\nsudo mount --bind \/sys \/mnt\/sys\n\n#\nsudo chroot \/mnt\n\n#\ngrub-install --target=x86_64-efi --efi-directory=\/boot\/efi --bootloader-id=GRUB\nupdate-grub\n\n#\nexit\n\n#\nsudo umount \/mnt\/dev \/mnt\/proc \/mnt\/sys\nsudo umount \/mnt\/boot\/efi\nsudo umount \/mnt\nreboot\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#Auto-repair (boot-repair)\n\nsudo add-apt-repository ppa:yannubuntu\/boot-repair\nsudo apt update\nsudo apt install -y boot-repair\nboot-repair\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>grub rescue&gt; shows if GRUB can`t find its configuration (grub.cfg) or its modules. It happens if: Move or delete the \/boot partition Disk`s UUID changed Trouble with MBR or UFI Common commands grub rescue&gt;: ls &#8211; shows disks and partitions (hd0) (hd0,msdos1) set &#8211; shows or changes (prefix, root) set root=(hd0,msdos1) &#8211; there are must &hellip; <a href=\"https:\/\/itgen.itbumper.com\/?page_id=1043\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;0040_Linux_GRUB&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[21],"tags":[],"_links":{"self":[{"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=\/wp\/v2\/pages\/1043"}],"collection":[{"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1043"}],"version-history":[{"count":2,"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=\/wp\/v2\/pages\/1043\/revisions"}],"predecessor-version":[{"id":1045,"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=\/wp\/v2\/pages\/1043\/revisions\/1045"}],"wp:attachment":[{"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itgen.itbumper.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}