{"id":616,"date":"2026-01-06T01:08:19","date_gmt":"2026-01-05T19:38:19","guid":{"rendered":"https:\/\/www.bhuvankrishna.in\/blog\/?p=616"},"modified":"2026-01-06T01:10:24","modified_gmt":"2026-01-05T19:40:24","slug":"grub-command-to-login-to-temp-shell","status":"publish","type":"post","link":"https:\/\/www.bhuvankrishna.in\/blog\/2026\/01\/06\/grub-command-to-login-to-temp-shell\/","title":{"rendered":"How to boot system with grub prompt alone"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When you see Grub command prompt at the boot time instead of <em>grub<\/em> <em>menu<\/em> I think that is when these commands will come handy to boot into the underlying OS. I tested it with ubuntu and pretty sure it should work with any linux distro.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Identify your boot partition: <\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use the ls command to list all disks and partitions GRUB can see. Partitions are typically named like (hd0,msdos1) for MBR or (hd0,gpt1) for GPT.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>grub> ls<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Locate the kernel files:<\/strong><br>Once you see a list of partitions, use\u00a0<code>ls<\/code>\u00a0on potential candidates to find the one containing your Linux filesystem, which will have\u00a0<code>\/vmlinuz<\/code>\u00a0and\u00a0<code>\/initrd.img<\/code>\u00a0(or similar) files. You can use tab completion to help.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grub&gt; ls (hd0,gpt1)\/\n# Look for files like vmlinuz-*-generic and initrd.img-*-generic or vmlinuz and initrd.img at the root or inside a \/boot directory.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Set the root partition:<\/strong><br>Once you identify the correct partition (e.g.,\u00a0<code>(hd0,gpt1)<\/code>), set it as the root for subsequent commands.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grub&gt; set root=(hd0,gpt1)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Load the Linux kernel:<\/strong><br>Use the&nbsp;<code>linux<\/code>&nbsp;command to load the kernel, specifying the full path you found (use Tab for completion).&nbsp;<strong>Crucially<\/strong>, append the&nbsp;<code>root=<\/code>&nbsp;parameter (using the Linux device name, e.g.,&nbsp;<code>\/dev\/sda1<\/code>&nbsp;for&nbsp;<code>(hd0,gpt1)<\/code>) and your desired&nbsp;<code>rw init=\/bin\/bash<\/code>&nbsp;parameters to this line.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>Note: GRUB uses a different naming convention than Linux.\u00a0<code>(hd0,gpt1)<\/code>\u00a0generally maps to\u00a0<code>\/dev\/sda1<\/code>\u00a0in Linux,\u00a0<code>(hd0,gpt2)<\/code>\u00a0to\u00a0<code>\/dev\/sda2<\/code>,\u00a0<code>(hd1,gpt1)<\/code>\u00a0to\u00a0<code>\/dev\/sdb1<\/code>, etc.<\/em>.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>grub&gt; linux \/boot\/vmlinuz-*-generic root=\/dev\/sda1 rw init=\/bin\/bash\n# (Replace '*' with your specific kernel version, found with the 'ls' command in step 2)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Load the initial RAM disk (initrd):<\/strong><br>Use the\u00a0<code>initrd<\/code>\u00a0command to load the initial RAM disk image, ensuring the version matches the kernel version you selected.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grub&gt; initrd \/boot\/initrd.img-*-generic\n# (Replace '*' with the same specific kernel version as above)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Boot the system:<\/strong><br>Execute the&nbsp;<code>boot<\/code>&nbsp;command to start the system with your specified parameters.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grub&gt; boot<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ensure changes are written to disk with&nbsp;<code>sync<\/code><\/strong>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;<code>sync<\/code>&nbsp;command forces all buffered data and metadata (including the updated password hash) to be written to the disk drive immediately. This prevents data loss during an abrupt reboot.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># After you have successfully run 'passwd &#91;username]'<\/em>\nsync<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;Remount the filesystem cleanly (Optional but Recommended)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the filesystem was mounted in a weird state during the recovery boot, sometimes a clean remount helps.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mount -o remount,rw \/\nsync <em># Run sync again after remount if you wish<\/em><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;Reboot the system properly<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once the changes are synced, do not just yank the power cord. Use a proper reboot command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># Exit the temporary shell cleanly<\/em>\nexit\n\n<em># The system might automatically try to shut down, or you can force a reboot:<\/em>\nreboot -f\n<em># OR<\/em>\nexec \/sbin\/init <em># Tries to start the normal init process<\/em><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When you see Grub command prompt at the boot time instead of grub menu I think that is when these commands will come handy to boot into the underlying OS. I tested it with ubuntu and pretty sure it should work with any linux distro. Identify your boot partition: Use the ls command to list\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.bhuvankrishna.in\/blog\/2026\/01\/06\/grub-command-to-login-to-temp-shell\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-616","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.bhuvankrishna.in\/blog\/wp-json\/wp\/v2\/posts\/616","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bhuvankrishna.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bhuvankrishna.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bhuvankrishna.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bhuvankrishna.in\/blog\/wp-json\/wp\/v2\/comments?post=616"}],"version-history":[{"count":2,"href":"https:\/\/www.bhuvankrishna.in\/blog\/wp-json\/wp\/v2\/posts\/616\/revisions"}],"predecessor-version":[{"id":619,"href":"https:\/\/www.bhuvankrishna.in\/blog\/wp-json\/wp\/v2\/posts\/616\/revisions\/619"}],"wp:attachment":[{"href":"https:\/\/www.bhuvankrishna.in\/blog\/wp-json\/wp\/v2\/media?parent=616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bhuvankrishna.in\/blog\/wp-json\/wp\/v2\/categories?post=616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bhuvankrishna.in\/blog\/wp-json\/wp\/v2\/tags?post=616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}