1

Recently, I've installed Linux (MintOS) on my ssd drive. Also I have Windows 10 on my hdd drive. Windows was installed before linux.

The problem is that grub loader don't see windows loader and I can't boot on windows.

I remember having two different OS on that ssd and there was no problem on grub menu and discovering OS on that drive. But if I wanted to boot on hdd (windows), i was using bios every time.

Now, situation is the same, except I have only 1 OS on ssd and I can't boot windows anymore. Deleting windows is not an option.

I tried repair this with boot-repair, and this software detects OS (os-prober ?) and drives and other stuff correctly. Grub is also configured with good entry for linux. Windows is detected, but not added... :(

On boot-repair I choose this flags:

  • Reinstall grub
  • Unhide boot menu
  • Place grub on sdb (ssd, where linux lives). separate /boot/efi partition is unchecked.
  • Repair windows boot files
  • sdb3 linux is os to boot by default

These are logs from boot repair:

============================= Boot Repair Summary ==============================




Default settings: ______________________________________________________________

The default repair of the Boot-Repair utility would reinstall the grub2 of
sdb3 into the MBR of sdb.
Grub-efi would not be selected by default because legacy Windows detected.
Additional repair would be performed: unhide-bootmenu-10s win-legacy-basic-fix

Final advice in case of suggested repair: ______________________________________

Please do not forget to make your BIOS boot on sdb (ATA IR-SSDPR-S25A-12) disk!

User settings: _________________________________________________________________

This will install an obsolete bootloader (GRUB Legacy). Please backup your data before this operation.
The settings chosen by the user will reinstall the grub2 of
sdb3 into the MBR of sdb.
Grub-efi will not be selected by default because legacy Windows detected.
Additional repair will be performed:  unhide-bootmenu-10s win-legacy-basic-fix


Quantity of real Windows: 1

========================= Reinstall the grub2 of sdb3 ==========================

chroot /mnt/boot-sav/sdb3 grub-install --version
grub-install (GRUB) 2.06-2ubuntu7.1

==> Reinstall the GRUB of sdb3 into the MBR of sdb

chroot /mnt/boot-sav/sdb3 grub-install /dev/sdb
Installing for i386-pc platform.
Installation finished. No error reported.

chroot /mnt/boot-sav/sdb3 update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50_linuxmint.cfg'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-56-generic
Found initrd image: /boot/initrd.img-5.15.0-56-generic
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.

Unhide GRUB boot menu in sdb3/boot/grub/grub.cfg

Boot successfully repaired.

You can now reboot your computer.
Please do not forget to make your BIOS boot on sdb (ATA IR-SSDPR-S25A-12) disk!


============================ Boot Info After Repair ============================

 => No boot loader is installed in the MBR of /dev/sda.
 => Grub2 (v2.00) is installed in the MBR of /dev/sdb and looks at sector 2048 
    of the same hard drive for core.img. core.img is at this location and 
    looks for (,gpt3)/boot/grub. It also embeds following components:
    
    modules
    ---------------------------------------------------------------------------
    fshelp ext2 part_gpt biosdisk
    ---------------------------------------------------------------------------
 => Syslinux MBR (5.00 and higher) is installed in the MBR of /dev/sdc.

sda1: __________________________________________________________________________

    File system:       
    Boot sector type:  -
    Boot sector info: 

sda2: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 8/10/11/2012: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  Windows 8 or 10
    Boot files:        /Windows/System32/winload.exe

sda3: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 2000/XP: NTFS
    Boot sector info:  According to the info in the boot sector, sda3 starts 
                       at sector 0. But according to the info from fdisk, 
                       sda3 starts at sector 519923712.
    Operating System:  
    Boot files:        

sdb1: __________________________________________________________________________

    File system:       BIOS Boot partition
    Boot sector type:  Grub2's core.img
    Boot sector info: 

sdb2: __________________________________________________________________________

    File system:       vfat
    Boot sector type:  FAT32
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /efi/BOOT/fbx64.efi /efi/BOOT/mmx64.efi 
                       /efi/ubuntu/grubx64.efi /efi/ubuntu/mmx64.efi 
                       /efi/ubuntu/shimx64.efi /efi/ubuntu/grub.cfg

sdb3: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  Linux Mint 21.1
    Boot files:        /boot/grub/grub.cfg /etc/fstab /etc/default/grub 
                       /boot/grub/i386-pc/core.img

sdc1: __________________________________________________________________________

    File system:       vfat
    Boot sector type:  SYSLINUX 6.04
    Boot sector info:  Syslinux looks at sector 32832 of /dev/sdc1 for its 
                       second stage. The integrity check of Syslinux failed. 
                       No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /boot/grub/grub.cfg /syslinux.cfg 
                       /efi/boot/bootx64.efi /efi/boot/grubx64.efi 
                       /efi/boot/mmx64.efi /ldlinux.sys


================================ 2 OS detected =================================

OS#1:   Linux Mint 21.1 Vera (21.1) on sdb3
OS#2:   Windows 8 or 10 on sda2

================================ Host/Hardware =================================

CPU architecture: 64-bit
Video: GK104 [GeForce GTX 770] from NVIDIA Corporation
Live-session OS is Linuxmint 64-bit (Linux Mint 21.1, vera, x86_64)

===================================== UEFI =====================================

BIOS/UEFI firmware: 1802(4.6) from American Megatrends Inc.
This live-session is in Legacy/BIOS/CSM mode (not in EFI mode).


c152ec201c37b6e97bbc2207e49d1271   sdb2/BOOT/fbx64.efi
fdafb5eece6caeccb788c946a28e6872   sdb2/BOOT/mmx64.efi
5ddf997e8b025bfbc2009e85b32f60dc   sdb2/ubuntu/grubx64.efi
fdafb5eece6caeccb788c946a28e6872   sdb2/ubuntu/mmx64.efi
728124f6ec8e22fbdbe7034812c81b95   sdb2/ubuntu/shimx64.efi
728124f6ec8e22fbdbe7034812c81b95   sdb2/BOOT/BOOTX64.efi

============================= Drive/Partition Info =============================

Disks info: ____________________________________________________________________

sda : is-GPT,   no-BIOSboot,    has-noESP,  not-usb,    not-mmc, has-os,    has-win,    2048 sectors * 512 bytes
sdb : is-GPT,   hasBIOSboot,    has---ESP,  not-usb,    not-mmc, has-os,    no-wind,    2048 sectors * 512 bytes

Partitions info (1/3): _________________________________________________________

sda2    : is-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   farbios
sda3    : no-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   farbios
sdb2    : no-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   not-far
sdb3    : is-os,    64, apt-get,    signed grub-pc grub-efi ,   grub2,  grub-install,   grubenv-ok, update-grub,    farbios

Partitions info (2/3): _________________________________________________________

sda2    : isnotESP, part-has-no-fstab,  no-nt,  haswinload, no-recov-nor-hid,   no-bmgr,    notwinboot
sda3    : isnotESP, part-has-no-fstab,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot
sdb2    : is---ESP, part-has-no-fstab,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot
sdb3    : isnotESP, fstab-without-efi,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot

Partitions info (3/3): _________________________________________________________

sda2    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda
sda3    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda
sdb2    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sdb
sdb3    : not--sepboot, with-boot,  fstab-without-boot, not-sep-usr,    with--usr,  fstab-without-usr,  std-grub.d, sdb

fdisk -l (filtered): ___________________________________________________________

Disk sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk identifier: 78E47EB1-EED8-44E8-85FC-7E3BE186D6CA
          Start        End    Sectors   Size Type
sda1       2048      34815      32768    16M Microsoft reserved
sda2      34816  519923711  519888896 247.9G Microsoft basic data
sda3  519923712 1953523711 1433600000 683.6G Microsoft basic data
Disk sdb: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk identifier: 2B6D4B4B-FADE-4169-AC1F-21598C19C5E1
        Start       End   Sectors   Size Type
sdb1     2048      4095      2048     1M BIOS boot
sdb2     4096   1054719   1050624   513M EFI System
sdb3  1054720 234440703 233385984 111.3G Linux filesystem
Disk sdc: 29.3 GiB, 31457280000 bytes, 61440000 sectors
Disk identifier: 0x00030679
      Boot Start      End  Sectors  Size Id Type
sdc1  *     2048 61439999 61437952 29.3G  c W95 FAT32 (LBA)

parted -lm (filtered): _________________________________________________________

sda:1000GB:scsi:512:4096:gpt:ATA WDC WD10EZEX-00B:;
1:1049kB:17.8MB:16.8MB::Microsoft reserved partition:msftres;
2:17.8MB:266GB:266GB:ntfs:Basic data partition:msftdata;
3:266GB:1000GB:734GB:ntfs:Basic data partition:msftdata;
sdb:120GB:scsi:512:512:gpt:ATA IR-SSDPR-S25A-12:;
1:1049kB:2097kB:1049kB:btrfs::bios_grub;
2:2097kB:540MB:538MB:fat32:EFI System Partition:boot, esp;
3:540MB:120GB:119GB:ext4::;
sdc:31.5GB:scsi:512:512:msdos:VendorCo ProductCode:;
1:1049kB:31.5GB:31.5GB:fat32::boot, lba;

blkid (filtered): ______________________________________________________________

NAME   FSTYPE   UUID                                 PARTUUID                             LABEL      PARTLABEL
sda                                                                                                  
├─sda1                                               8a47735e-847e-4e08-b7cf-9d242dac3f42            Microsoft reserved partition
├─sda2 ntfs     C448EE9848EE890E                     715729d9-1ab0-4a3a-a829-b2a6a909e4e6            Basic data partition
└─sda3 ntfs     01D7EC689D67D2E0                     78020014-7be6-43d1-bc08-137656e47de0 D          Basic data partition
sdb                                                                                                  
├─sdb1 btrfs    6eff9117-2be7-4fe7-8538-030938804bc3 50aa9682-8317-4601-81d8-a745a89810cc            
├─sdb2 vfat     D3A6-386D                            830148b5-746a-466b-af8d-7fb76a88f065            EFI System Partition
└─sdb3 ext4     d6be2234-9945-435c-829e-756c0e872a42 750e3efe-4797-4ff6-8be2-b19cbc280614            
sdc                                                                                                  
└─sdc1 vfat     3C77-F150                            00030679-01                          LINUX MINT 

Mount points (filtered): _______________________________________________________

            Avail Use% Mounted on
/dev/sda2   164.6G  34% /mnt/boot-sav/sda2
/dev/sda3   555.6G  19% /mnt/boot-sav/sda3
/dev/sdb2   505.9M   1% /mnt/boot-sav/sdb2
/dev/sdb3      93G  10% /mnt/boot-sav/sdb3
/dev/sdc1    26.8G   9% /cdrom

Mount options (filtered): ______________________________________________________

/dev/sda2   fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda3   fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sdb2   vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
/dev/sdb3   ext4            rw,relatime
/dev/sdc1   vfat            ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro

===================== sdb2/efi/ubuntu/grub.cfg (filtered) ======================

search.fs_uuid d6be2234-9945-435c-829e-756c0e872a42 root hd1,gpt3 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

====================== sdb3/boot/grub/grub.cfg (filtered) ======================

Ubuntu   d6be2234-9945-435c-829e-756c0e872a42
Ubuntu, with Linux 5.15.0-56-generic   d6be2234-9945-435c-829e-756c0e872a42
### END /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_uefi-firmware ###

========================== sdb3/etc/fstab (filtered) ===========================

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb3 during installation
UUID=d6be2234-9945-435c-829e-756c0e872a42 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdb2 during installation
/swapfile                                 none            swap    sw              0       0

======================= sdb3/etc/default/grub (filtered) =======================

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_DISABLE_OS_PROBER=false

==================== sdb3: Location of files loaded by Grub ====================

           GiB - GB             File                                 Fragment(s)
            ?? = ??             boot/grub/grub.cfg                             1
  13.881172180 = 14.904795136   boot/grub/i386-pc/core.img                     1
  28.841812134 = 30.968659968   boot/vmlinuz                                   1
  28.841812134 = 30.968659968   boot/vmlinuz-5.15.0-56-generic                 1
  26.887382507 = 28.870107136   boot/initrd.img                                2
  26.887382507 = 28.870107136   boot/initrd.img-5.15.0-56-generic              2
  26.887382507 = 28.870107136   boot/initrd.img.old                            2

===================== sdb3: ls -l /etc/grub.d/ (filtered) ======================

-rwxr-xr-x 1 root root 18683 Apr 15  2022 10_linux
-rwxr-xr-x 1 root root 43031 Apr 15  2022 10_linux_zfs
-rwxr-xr-x 1 root root 14180 Apr 15  2022 20_linux_xen
-rwxr-xr-x 1 root root 13369 Apr 15  2022 30_os-prober
-rwxr-xr-x 1 root root  1372 Apr 15  2022 30_uefi-firmware
-rwxr-xr-x 1 root root   700 Sep 20 03:18 35_fwupd
-rwxr-xr-x 1 root root   214 Apr 15  2022 40_custom
-rwxr-xr-x 1 root root   215 Apr 15  2022 41_custom

=========================== sdb3/etc/grub.d/35_fwupd ===========================

#! /bin/sh
# SPDX-License-Identifier: LGPL-2.1+
set -e
[ -d ${pkgdatadir:?} ]
# shellcheck source=/dev/null
. "$pkgdatadir/grub-mkconfig_lib"
if [ -f /var/lib/fwupd/uefi_capsule.conf ] &&
   ls /sys/firmware/efi/efivars/fwupd-*-0abba7dc-e516-4167-bbf5-4d9d1c739416 1>/dev/null 2>&1; then
      . /var/lib/fwupd/uefi_capsule.conf
      if [ "${EFI_PATH}" != "" ] && [ "${ESP}" != "" ]; then
      echo "Adding Linux Firmware Updater entry" >&2
cat << EOF
menuentry 'Linux Firmware Updater' \$menuentry_id_option 'fwupd' {
EOF
      ${grub_probe:?}
      prepare_grub_to_access_device '`${grub_probe} --target=device \${ESP}` | sed -e "s/^/\t/"'
cat << EOF
    chainloader ${EFI_PATH}
}
EOF
      fi
fi

====================== sdc1/boot/grub/grub.cfg (filtered) ======================

Start Linux Mint 21.1 Cinnamon 64-bit
Start Linux Mint 21.1 Cinnamon 64-bit (compatibility mode)
OEM install (for manufacturers)
Boot from next volume
UEFI Firmware Settings
Test memory

========================= sdc1/syslinux.cfg (filtered) =========================

DEFAULT loadconfig

LABEL loadconfig
  CONFIG /isolinux/isolinux.cfg
  APPEND /isolinux/

==================== sdc1: Location of files loaded by Grub ====================

           GiB - GB             File                                 Fragment(s)
            ?? = ??             boot/grub/grub.cfg                             1

================== sdc1: Location of files loaded by Syslinux ==================

           GiB - GB             File                                 Fragment(s)
            ?? = ??             syslinux.cfg                                   1
            ?? = ??             ldlinux.sys                                    1

======================== Unknown MBRs/Boot Sectors/etc =========================


/dev/sda1: unknown GPT attributes
8000000000000000

How can I add windows to grub ?

8
  • 2
    Was Windows in BIOS boot mode? You cannot mix BIOS installs with UEFI installs. And Windows only boots in UEFI mode from gpt partitioned drives. Since drive now shows as gpt, better to reinstall Windows in UEFI mode as converting to BIOS will also convert drive back to MBR(msdos) erasing it.
    – oldfred
    Commented Mar 6, 2023 at 22:07
  • I get the feeling that boot-repair only makes things worse than they already are…
    – Freddy
    Commented Mar 6, 2023 at 22:14
  • 1
    Boot-Repair runs in the mode UEFI or BIOS that you boot the USB flash drive. And if it does not see a Windows UEFI boot entry will suggest to install the BIOS version of grub. But it cannot add partition or really know when user has mixed boot modes what is really correct. That is why is suggests posting link to summary report for help.
    – oldfred
    Commented Mar 6, 2023 at 22:45
  • @oldfred Thanks for your suggestions, but none of the options worked for me. Windows is not added to grub. I tried installing with bios and uefi already (default installations with bootloader at my ssd).
    – Ruarin
    Commented Mar 7, 2023 at 14:02
  • @oldfred Actually if I install legacy grub, I can't boot anywhere except my usb
    – Ruarin
    Commented Mar 7, 2023 at 14:10

2 Answers 2

0

A possible solution is to add a Windows entry, let's say "manually", in the file /etc/grub.d/40_custom. When executing update-grub the entry will be added automatically.

The exact content can be a trial/error, depending on the Windows bootloader and/or other details.

An example (/etc/grub.d/40_custom). The lines before menuentry... are already in the file, just add the entry:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

# Add this

menuentry 'Windows' {
     insmod ntfs
     insmod ntldr
     insmod part_msdos
     insmod search_fs_uuid
     # the uuid would be of the partition where the bootloader is, I assume sda2
     search --no-floppy --fs-uuid --set=root 715729d9-1ab0-4a3a-a829-b2a6a909e4e6
     ntldr /bootmgr
}

After adding the content, you need to execute update-grub.

4
  • Thanks for your reply. I tried this option and it gives me the error "ntldr not found". Any ideas ?
    – Ruarin
    Commented Mar 7, 2023 at 14:03
  • I tried this menuentry also: menuentry 'Windows 10' { search --fs-uuid --no-floppy --set=root UUID chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi } But that is not correct entry since my windows is in legacy mode. Am I right ?
    – Ruarin
    Commented Mar 7, 2023 at 14:08
  • @Ruarin Try (${root})/Windows/Boot/EFI/bootmgfw.efi, (being root sda2, that would be C: in Windows). I really don't know if that would work, but at least I have a Windows 10 right now and the file is there. Commented Mar 7, 2023 at 16:01
  • I tried it and terminal says there's no file here) but thanks anyway, will try something else
    – Ruarin
    Commented Mar 7, 2023 at 16:52
0

Thank you every one in the comments. After some hours I found solution. So, After Linux installation windows bootloader was deleted and boot-repair was unable to restore it.

It's actually imposiible also to restore it from Linux i think.

I made a Windows 10 PE live usb. And ran bcdboot over c:\windows. I don't know how, but this util added my entrypoint to my ssd, where linux now is installed. So now I have all menuentries in grub.

See that article for explanation.

Also, I'd like to know how this worked under the hood, so please comment if u know.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .