Skip to content

Instantly share code, notes, and snippets.

@vtvh
Created June 28, 2026 05:14
Show Gist options
  • Select an option

  • Save vtvh/c5711221c66009e288968e31ae962bc4 to your computer and use it in GitHub Desktop.

Select an option

Save vtvh/c5711221c66009e288968e31ae962bc4 to your computer and use it in GitHub Desktop.
fix grub dualboot
Perfect. Looking at your terminal, we have exactly what we need.
Here is the translation of your partition table:
* **EFI System Partition:** /dev/nvme0n1p1 (This is where the bootloader lives)
* **Linux Filesystem (Root):** /dev/nvme0n1p5 (This is your Parrot OS)
Here are the exact commands you need to run in your terminal, one by one. I have plugged your specific partition numbers in for you.
### Step 1: Mount the Partitions
1. Mount your Parrot OS root partition:
```bash
sudo mount /dev/nvme0n1p5 /mnt
```
2. Ensure the EFI directory exists, then mount your EFI partition:
```bash
sudo mkdir -p /mnt/boot/efi
sudo mount /dev/nvme0n1p1 /mnt/boot/efi
```
### Step 2: Bind the System Directories
Copy and paste this entire line and press Enter. This links your live USB hardware environment to your installed system:
```bash
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
```
### Step 3: Chroot and Rebuild GRUB
1. Enter the chroot environment (your terminal prompt will change to indicate you are now "inside" your Parrot OS installation):
```bash
sudo chroot /mnt
```
2. Reinstall GRUB to the main NVMe drive (note that there is no partition number at the end of this command):
```bash
grub-install /dev/nvme0n1
```
3. Update the GRUB configuration to detect both Parrot and Windows:
```bash
update-grub
```
### Step 4: Clean Up and Reboot
If update-grub finishes without errors and lists your Linux and Windows boot managers, you are good to go!
1. Exit the chroot environment:
```bash
exit
```
2. Restart your computer safely:
```bash
reboot
```
Pull out your USB drive when the screen goes black, and your GRUB menu will be right back where it belongs.
@vtvh

vtvh commented Jun 28, 2026

Copy link
Copy Markdown
Author

Ah, I see exactly what happened! Your screenshot in "image_7.png" reveals the culprit right away.
When you ran ls /mnt/, the output was @ and @home.
This means your Parrot OS installation is using the Btrfs filesystem with subvolumes. Because of this, simply mounting /dev/nvme0n1p5 mounts the "top level" of the drive, which is essentially an empty container holding those subvolumes. Your actual Linux root files aren't sitting at the top; they are safely tucked inside that @ subvolume.
Because the system folders (/dev, /proc, etc.) weren't visible at the top level, the bind mount command couldn't find them to attach to, resulting in those "mount point does not exist" errors.
Here is how we fix it. We just need to tell the mount command to specifically target the @ subvolume.
Since you already have your terminal open as root, run these commands sequentially to clean up the old mounts and do it the Btrfs way:

Step 1: Clean Up Previous Mounts

First, we need to unmount the incorrect folders you just made.

sudo umount /mnt/boot/efi
sudo umount /mnt

Step 2: Mount with Btrfs Subvolumes

Now, we mount the exact subvolume where your OS lives. Notice the -o subvol=@ addition.

sudo mount -o subvol=@ /dev/nvme0n1p5 /mnt

(Optional: If you run ls /mnt/ now, you should see your normal Linux directories like bin, dev, etc, home, root, instead of just @!)

Step 3: Mount the EFI Partition

sudo mount /dev/nvme0n1p1 /mnt/boot/efi

Step 4: Bind System Directories

Now this command will work flawlessly because the dev, proc, sys, and run directories actually exist inside /mnt now.

for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done

Step 5: Chroot and Rebuild

Finally, step inside the system and fix the bootloader.

sudo chroot /mnt
grub-install /dev/nvme0n1
update-grub

Once update-grub finishes, just type exit, hit enter, and then run reboot. Your dual-boot menu will be fully restored.

@vtvh

vtvh commented Jun 28, 2026

Copy link
Copy Markdown
Author

Window way

This is actually the direct result of the bcdedit command we used in our very first fix attempt!
When we ran bcdedit /set {bootmgr} path \EFI\Parrot\grubx64.efi, we essentially "hijacked" the Windows Boot Manager. We told the Windows configuration: "Keep the name 'Windows Boot Manager', but point it to the GRUB file instead of the Windows file."
Since you successfully rebuilt GRUB with the chroot method, we no longer need this hijack. We can revert "Windows Boot Manager" back to normal and create a proper, clean "Parrot OS" entry for your BIOS menu.
Here is how to fix the naming and routing directly from Windows:

Step 1: Revert Windows Boot Manager

  1. Turn on the laptop and let it boot into GRUB (via that hijacked Windows entry).
  2. Select Windows from the GRUB menu to boot into your Windows OS.
  3. Open the Start menu, type cmd, right-click Command Prompt, and select Run as administrator.
  4. Run this exact command to point Windows Boot Manager back to its original Windows bootloader:
bcdedit /set {bootmgr} path \EFI\Microsoft\Boot\bootmgfw.efi

Step 2: Create a Dedicated "Parrot OS" Entry

While still in that same Command Prompt, let's create a brand-new, correctly named entry for your F12 menu that points to GRUB.

  1. Copy the current boot manager entry and name it "Parrot OS":
bcdedit /copy {bootmgr} /d "Parrot OS"

(When you press Enter, it will say something like: "The entry was successfully copied to {a-long-string-of-numbers-and-letters}." You need to copy that {...} string, including the brackets.)
2. Set the path for this new "Parrot OS" entry to your GRUB file. Replace {GUID} below with the string you just copied:

bcdedit /set {GUID} path \EFI\Parrot\grubx64.efi
  1. Finally, set this new "Parrot OS" entry to be the absolute top priority in your BIOS boot order:
bcdedit /set {fwbootmgr} displayorder {GUID} /addfirst

Restart your ThinkPad. When you press F12, you will now see a clean Parrot OS entry at the top (which loads GRUB), and the Windows Boot Manager entry will correctly load Windows if you select it!

@vtvh

vtvh commented Jun 28, 2026

Copy link
Copy Markdown
Author

Linux way

Yes, you can absolutely manage your motherboard's UEFI boot entries directly from within Parrot OS. Linux uses a powerful tool called efibootmgr to communicate directly with your motherboard's NVRAM to rename, create, and delete those F12 menu entries.
Here is how to fix your boot menu natively from Linux.

The Command Line Method (efibootmgr)

This is the standard, most reliable way to handle UEFI entries in Linux. Open your terminal and follow these steps:
1. View your current boot entries
Run this command to see exactly what your motherboard sees:

efibootmgr -v

You will see a list of entries like Boot0000, Boot0001, etc. Look for the one currently named Windows Boot Manager. Note its 4-digit number (for example, if it says Boot0002* Windows Boot Manager, your number is 0002).
2. Delete the hijacked Windows entry
Since that entry is currently pointing to GRUB instead of Windows, let's wipe it out. Replace XXXX with the 4-digit number you found in step 1:

sudo efibootmgr -b XXXX -B

3. Create a clean, correct Windows entry
Now, let's create a fresh entry that points exactly to the real Windows bootloader. Based on your previous partition layout, your EFI partition is on /dev/nvme0n1 partition 1:

sudo efibootmgr -c -d /dev/nvme0n1 -p 1 -L "Windows Boot Manager" -l "\EFI\Microsoft\Boot\bootmgfw.efi"

4. Create your new Parrot OS entry
Next, we will create a beautifully named entry just for Parrot OS that points to your GRUB file:

sudo efibootmgr -c -d /dev/nvme0n1 -p 1 -L "Parrot OS" -l "\EFI\Parrot\grubx64.efi"

5. Verify the new order
Run efibootmgr one last time without any flags. You should see "Parrot OS" and "Windows Boot Manager" cleanly listed. Whichever you want to boot first can be set using the boot order command. For example, to make Parrot OS (Boot0004) boot before Windows (Boot0003):

sudo efibootmgr -o 0004,0003

The GUI Method

Linux explicitly avoids offering a pre-installed GUI for UEFI NVRAM management because writing graphical tools that interact with every brand of motherboard firmware is incredibly risky and prone to bricking systems. Tools like grub-customizer exist, but they only edit the GRUB menu itself, not the F12 hardware menu.
However, since you are using a Lenovo ThinkPad, your motherboard actually has a built-in GUI for this exact task!
If you prefer a visual interface over the terminal, you can do this directly in your BIOS:

  1. Restart your ThinkPad and press F1 to enter the BIOS Setup.
  2. Navigate to the Startup tab, then select Boot.
  3. Here, you will see a visual list of your boot order.
  4. Lenovo's UEFI allows you to interact with these entries. You can usually highlight the incorrect "Windows Boot Manager", press Delete or Minus to remove or disable it.
  5. Some ThinkPad BIOS versions have an "Add Boot Option" button at the bottom of this screen. If yours does, you can click it, name it "Parrot OS", select your NVMe0 SSTC drive, and browse visually through the folders to select EFI -> Parrot -> grubx64.efi.
  6. Press F10 to save and exit.
    The terminal efibootmgr method is guaranteed to work in exactly 4 commands and is generally faster, but the ThinkPad BIOS provides a great graphical fallback.

@vtvh

vtvh commented Jun 28, 2026

Copy link
Copy Markdown
Author
└──╼ #efibootmgr -v
BootCurrent: 0000
Timeout: 2 seconds
BootOrder: 001C,0010,0011,0012,0013,001B,0018,0017,001A,001D,001E,0019,0000
Boot0000* Windows Boot Manager  HD(1,GPT,d22448aa-33e7-45c6-adde-0fd7e16d5c00,0x800,0x32000)/File(\EFI\Parrot\grubx64.efi)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000000000100000010000000040000007fff0400
      dp: 04 01 2a 00 01 00 00 00 00 08 00 00 00 00 00 00 00 20 03 00 00 00 00 00 aa 48 24 d2 e7 33 c6 45 ad de 0f d7 e1 6d 5c 00 02 02 / 04 04 34 00 5c 00 45 00 46 00 49 00 5c 00 50 00 61 00 72 00 72 00 6f 00 74 00 5c 00 67 00 72 00 75 00 62 00 78 00 36 00 34 00 2e 00 65 00 66 00 69 00 00 00 / 7f ff 04 00
    data: 57 49 4e 44 4f 57 53 00 01 00 00 00 88 00 00 00 78 00 00 00 42 00 43 00 44 00 4f 00 42 00 4a 00 45 00 43 00 54 00 3d 00 7b 00 39 00 64 00 65 00 61 00 38 00 36 00 32 00 63 00 2d 00 35 00 63 00 64 00 64 00 2d 00 34 00 65 00 37 00 30 00 2d 00 61 00 63 00 63 00 31 00 2d 00 66 00 33 00 32 00 62 00 33 00 34 00 34 00 64 00 34 00 37 00 39 00 35 00 7d 00 00 00 00 00 01 00 00 00 10 00 00 00 04 00 00 00 7f ff 04 00
Boot0010  Setup FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9)
      dp: 04 06 14 00 66 8b 1c 72 6c 42 86 4e 8e 99 34 57 c4 6a b0 b9 / 7f ff 04 00
Boot0011  Boot Menu     FvFile(126a762d-5758-4fca-8531-201a7f57f850)
      dp: 04 06 14 00 2d 76 6a 12 58 57 ca 4f 85 31 20 1a 7f 57 f8 50 / 7f ff 04 00
Boot0012  Diagnostic Splash Screen      FvFile(a7d8d9a6-6ab0-4aeb-ad9d-163e59a7a380)
      dp: 04 06 14 00 a6 d9 d8 a7 b0 6a eb 4a ad 9d 16 3e 59 a7 a3 80 / 7f ff 04 00
Boot0013  Lenovo Diagnostics    FvFile(3f7e615b-0d45-4f80-88dc-26b234958560)
      dp: 04 06 14 00 5b 61 7e 3f 45 0d 80 4f 88 dc 26 b2 34 95 85 60 / 7f ff 04 00
Boot0014  Startup Interrupt Menu        FvFile(f46ee6f4-4785-43a3-923d-7f786c3c8479)
      dp: 04 06 14 00 f4 e6 6e f4 85 47 a3 43 92 3d 7f 78 6c 3c 84 79 / 7f ff 04 00
Boot0015  Rescue and Recovery   FvFile(665d3f60-ad3e-4cad-8e26-db46eee9f1b5)
      dp: 04 06 14 00 60 3f 5d 66 3e ad ad 4c 8e 26 db 46 ee e9 f1 b5 / 7f ff 04 00
Boot0016  MEBx Hot Key  FvFile(ac6fd56a-3d41-4efd-a1b9-870293811a28)
      dp: 04 06 14 00 6a d5 6f ac 41 3d fd 4e a1 b9 87 02 93 81 1a 28 / 7f ff 04 00
Boot0017* USB CD        VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,86701296aa5a7848b66cd49dd3ba6a55)
      dp: 03 0a 24 00 d2 38 78 bc 82 0f 60 4d 83 16 c0 68 ee 79 d2 5b 86 70 12 96 aa 5a 78 48 b6 6c d4 9d d3 ba 6a 55 / 7f ff 04 00
Boot0018* USB FDD       VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,6ff015a28830b543a8b8641009461e49)
      dp: 03 0a 24 00 d2 38 78 bc 82 0f 60 4d 83 16 c0 68 ee 79 d2 5b 6f f0 15 a2 88 30 b5 43 a8 b8 64 10 09 46 1e 49 / 7f ff 04 00
Boot0019* NVMe0 VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,001c199932d94c4eae9aa0b6e98eb8a400)
      dp: 03 0a 25 00 d2 38 78 bc 82 0f 60 4d 83 16 c0 68 ee 79 d2 5b 00 1c 19 99 32 d9 4c 4e ae 9a a0 b6 e9 8e b8 a4 00 / 7f ff 04 00
Boot001A* ATA HDD0      VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f600)
      dp: 03 0a 25 00 d2 38 78 bc 82 0f 60 4d 83 16 c0 68 ee 79 d2 5b 91 af 62 59 56 44 9f 41 a7 b9 1f 4f 89 2a b0 f6 00 / 7f ff 04 00
Boot001B* USB HDD       VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,33e821aaaf33bc4789bd419f88c50803)
      dp: 03 0a 24 00 d2 38 78 bc 82 0f 60 4d 83 16 c0 68 ee 79 d2 5b 33 e8 21 aa af 33 bc 47 89 bd 41 9f 88 c5 08 03 / 7f ff 04 00
Boot001C* PCI LAN       VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803)
      dp: 03 0a 24 00 d2 38 78 bc 82 0f 60 4d 83 16 c0 68 ee 79 d2 5b 78 a8 4a af 2b 2a fc 4e a7 9c f5 cc 8f 3d 38 03 / 7f ff 04 00
Boot001D  Other CD      VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a35406)
      dp: 03 0a 25 00 d2 38 78 bc 82 0f 60 4d 83 16 c0 68 ee 79 d2 5b ae a2 09 0a df de 21 4e 8b 3a 5e 47 18 56 a3 54 06 / 7f ff 04 00
Boot001E  Other HDD     VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f606)
      dp: 03 0a 25 00 d2 38 78 bc 82 0f 60 4d 83 16 c0 68 ee 79 d2 5b 91 af 62 59 56 44 9f 41 a7 b9 1f 4f 89 2a b0 f6 06 / 7f ff 04 00
Boot001F* IDER BOOT CDROM       PciRoot(0x0)/Pci(0x14,0x0)/USB(11,1)
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 00 14 / 03 05 06 00 0b 01 / 7f ff 04 00
Boot0020* IDER BOOT Floppy      PciRoot(0x0)/Pci(0x14,0x0)/USB(11,0)
      dp: 02 01 0c 00 d0 41 03 0a 00 00 00 00 / 01 01 06 00 00 14 / 03 05 06 00 0b 00 / 7f ff 04 00
Boot0021* ATA HDD       VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f6)
      dp: 03 0a 24 00 d2 38 78 bc 82 0f 60 4d 83 16 c0 68 ee 79 d2 5b 91 af 62 59 56 44 9f 41 a7 b9 1f 4f 89 2a b0 f6 / 7f ff 04 00
Boot0022* ATAPI CD      VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a354)
      dp: 03 0a 24 00 d2 38 78 bc 82 0f 60 4d 83 16 c0 68 ee 79 d2 5b ae a2 09 0a df de 21 4e 8b 3a 5e 47 18 56 a3 54 / 7f ff 04 00
Boot0023* PCI LAN       VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803)
      dp: 03 0a 24 00 d2 38 78 bc 82 0f 60 4d 83 16 c0 68 ee 79 d2 5b 78 a8 4a af 2b 2a fc 4e a7 9c f5 cc 8f 3d 38 03 / 7f ff 04 00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment