Grub не видит efi windows

I have finally installed Ubuntu on my second drive. When I start my computer GRUB only offers me to boot Ubuntu, not Windows 7. What needs to be done so that I can choose between Ubuntu and Windows in GRUB?

When I press F12 for boot menu at startup and I choose Windows Boot Manager it boots into Windows 7.


I ran command sudo fdisk -l and here is log (http://pastebin.com/Cgv1igHc):

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xc3ffc3ff

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1  1953525167   976762583+  ee  GPT
Partition 1 does not start on physical sector boundary.

LiveWireBT's user avatar

LiveWireBT

28.5k26 gold badges108 silver badges221 bronze badges

asked Oct 8, 2012 at 16:20

HyperX's user avatar

2

  1. Boot Ubuntu and mount your Windows partition (simply open the disk on Nautilus)

  2. Run the following on the command line (Ctrl+Alt+t):

    sudo os-prober
    
  3. If your Windows installation was found, you can run:

    sudo update-grub
    

Note that step 2 is just for your convenience. You could just mount the Windows 7 partition and then run update-grub.

Related question

  • Unable to mount Windows (NTFS) filesystem due to hibernation

Community's user avatar

answered Oct 11, 2012 at 10:36

Hermes's user avatar

HermesHermes

1,3371 gold badge7 silver badges2 bronze badges

4

If the os-prober method above doesn’t work try adding a custom grub menu entry. Documented here.

First two steps are for finding your <UUID>.

  1. Run lsblk and find the name of the row with /boot/efi

Example output (here the answer is sda2):

lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0   477G  0 disk 
├─sda1        8:1    0   450M  0 part 
├─sda2        8:2    0   100M  0 part /boot/efi
├─sda3        8:3    0    16M  0 part 
├─sda4        8:4    0    47G  0 part /windows
├─sda5        8:5    0 425,6G  0 part /
└─sda6        8:6    0   3,7G  0 part [SWAP]
mmcblk0     179:0    0  14,9G  0 disk 
└─mmcblk0p1 179:1    0  14,9G  0 part
  1. Run sudo blkid /dev/sdaX where sdaX is the answer from previous step (sda2 in my case).

Example output (here the answer is 58E4-427D):

/dev/sda2: UUID="58E4-427D" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="b81727be-ba90-5f8c-ab98-d3ec67778b7d"
  1. Add the following at the end of the file /etc/grub.d/40_custom:
menuentry "Windows 7" {  
     insmod ntfs  
     set root='(hd0,1)'  
     search --no-floppy --fs-uuid --set <UUID>
     chainloader +1  
}
  1. Run sudo update-grub and reboot.

Carolus's user avatar

Carolus

5964 silver badges18 bronze badges

answered May 29, 2015 at 9:27

Philippe Gachoud's user avatar

Philippe GachoudPhilippe Gachoud

5,8303 gold badges41 silver badges50 bronze badges

2

I had Windows 10 running and then tried dual boot. Once Ubuntu was installed, Win 10 wasn’t showing up in my GRUB loader. I tried the following —

First of all, I disabled Secure Boot in Win10. Then ran the below
commands in Ubuntu :

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair

Worked out pretty well. Was able to find both Windows and Ubuntu in GRUB after that.

αғsнιη's user avatar

αғsнιη

35.2k41 gold badges129 silver badges192 bronze badges

answered Oct 23, 2016 at 17:13

Karthik Ubaradka's user avatar

3

I solved a similar problem following steps of Boot-Repair

Install boot-repair

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair

Push «Recommended repair»
And put in a terminal some commands as it suggested.

I think my Grub doesn’t recognize windows due to a bad shutdown, and it solved the problem.

answered Apr 25, 2016 at 14:30

Rutrus's user avatar

RutrusRutrus

1,5011 gold badge9 silver badges10 bronze badges

Slightly different method as I copied from a working example on another computer, posting for my own records.

Append the following to /etc/grub.d/40_custom:

menuentry "Windows 10" {
        insmod part_gpt
        insmod fat
        search --no-floppy --fs-uuid --set <boot_efi_uuid>
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

where <boot_efi_uuid> is the UUID of your /boot/efi partition. To find this:

$ lsblk
NAME              MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT                                                  
sda                 8:0    0 119.2G  0 disk
└─md126             9:126  0 357.7G  0 raid0
  ├─md126p1       259:0    0   499M  0 md
  ├─md126p2       259:1    0   100M  0 md    /boot/efi                                                   
$ sudo blkid | grep md126p2 # Replace with your device
/dev/md126p2: UUID=<boot_efi_uuid>

Then of course, once you’re saved the file, run:

sudo update-grub

Reboot, you should now be able to successfully start up Windows.

answered Feb 16, 2019 at 23:45

Christopher Markieta's user avatar

2

If you have previously had a RAID installed that may be causing issues. In my case, I built my desktop in 2010, and I installed two 1.5 TB with a striped RAID. User gracemercy54 mentions here that this is left over metadata from the former RAID configuration.

When I originally tried the steps by Hermes I got an error specifying «wrong number of devices in a RAID set.» So, if this happens to you open a terminal and run:

   sudo dmraid -rE
   sudo os-prober
   sudo update-grub

That fixed this for me.

answered Mar 18, 2017 at 18:56

Adam Drewery's user avatar

2

I had issues like here above and the solution was just to add manual entry as below:

menuentry "WINDOWS10 (on /dev/sda1)" --class windows --class os {
    insmod part_msdos
    insmod ntfs
    set root='(/dev/sda,msdos1)'
    search --no-floppy --fs-uuid --set=root 688EB92384B85968
    drivemap -s (hd0) ${root}
    chainloader +1
}

where UUID above (688E…) was taken from boot windows disk via blkid /dev/sdb1.

ATTENTION: the additional line

set root='(/dev/sda,msdos1)'

refers to sda which is visible under Ubuntu as /dev/sdb even actually it is the first disk in sata bus while /dev/sda is in fact second drive mounted as root /.

Maybe that is why grub scripts could not work properly. I had no time to change the physical order of disks but it is quite possible it would help to resolve the issue, too.

Eliah Kagan's user avatar

Eliah Kagan

117k54 gold badges319 silver badges495 bronze badges

answered Dec 4, 2017 at 22:50

luke's user avatar

I had the same problem with Windows 10. I installed Linux Mint 18.1 Cinnamon 64-bit on my laptop for dual boot with WIN10. After the installation GRUB only offered to boot Linux but not Windows.

I found the video solution for windows 10 missing from grub menu and the forum thread Grub not recognizing Win10 after Update/Repair, but unfortunately neither worked for me so I used a combination of these two to resolve my problem.

Open your terminal and follow these commands and open the file named 40_custom:

sudo gedit /etc/grub.d/40_custom

Add these lines to the end of the file and then save and exit:

menuentry "Windows 10" {
   set root='{hd0,1}'
   chainloader + 1
}

After you save the file update your GRUB with this command:

sudo update-grub

Then restart your machine to see if it works.

Hope this will work for others too!

Eliah Kagan's user avatar

Eliah Kagan

117k54 gold badges319 silver badges495 bronze badges

answered May 30, 2017 at 13:16

Lahiru's user avatar

1

Edit: As @Guss specified, this should be configured in /etc/default/grub, not the built-in script.

Old answer:

Follow these steps if os-prober shows Windows, but GRUB does not.

  • Edit grub-mkconfig
    sudo nano /usr/bin/grub-mkconfig
    
  • Find these lines near the middle
    # Disable os-prober by default due to security reasons.
    GRUB_DISABLE_OS_PROBER="true"
    
  • Change true to false
  • Exit nano (CTRL+X, Y, Enter)
  • Update GRUB
    sudo update-grub
    

answered Mar 11, 2021 at 13:16

nathanfranke's user avatar

nathanfrankenathanfranke

1561 gold badge1 silver badge8 bronze badges

1

I had the same problem and had spent 2 days figuring it out. But today I had this sudden idea in the morning and it worked out.

You should review your bios/uefi settings. In my case I had to let Uefi boot first. Otherwise I wasn’t able to detect windows from ubuntu. What I had to set was ubuntu > Windows Boot Manager > DISK1 > DISK2 > DISK3. Insted DISK1 > ubuntu > Windows Boot Manager > DISK3.

I had 2 ubuntu installations one on hdd and one on ssd. Apparently ssd installation wasn’t showing as UEFI for some reasone but I wanted boot faster disk first.

I wasn’t expecting that order of boot can influence grub in detecting systems. So it is worth to review that.

answered Apr 29, 2017 at 7:08

Bartosz Dabrowski's user avatar

I had the same issue after I installed the updates from ubuntu. The following commands worked for me perfectly:

sudo apt-get install os-prober

First install os-prober to detect windows and then update grub:

sudo grub-mkconfig -o /boot/grub/grub.cfg

answered Oct 29, 2019 at 21:02

phoenix007's user avatar

1

In addition to the answer of Bartosz Dabrowski, which lead me to solving my problem:

Be sure that if your Linux uses UEFI Boot/GPT that your other OS (eg. Windows in my case) also uses UEFI Boot/GPT. Coming from an old Win7 to Win10 installation the hard drive still had old school boot and MBR. Somehow os-prober and boot-repair had their problems to fix this.

Ensure that in BIOS / Boot order there is your HDD with ubuntu (eg. uefi: ubuntu) and your HDD with Windows Boot Manager (eg. uefi: Windows Boot Manager) to be found.

If WBM is missing ensure that windows boot disk has GPT. You can check this in Windows using Disk Management (Win + X, then Disk Management).

There is a Windows tool: mbr2gpt which can convert your MBR to GPT. After doing so (and booting via UEFI) os-prober and finally update-grub was able to find my Windows installation and added it to the boot options of grub.

answered Oct 15, 2020 at 6:35

methical's user avatar

Okay, so I had the same problem and couldn’t find a solution for me out there for a long time, finally got it, so here is my little grain of sand to the world. Before you try, remember to check you are booting using UEFI everytime you can:

Apparently, in the process of installing Debian the Windows data inside the EFI partition was lost, so what I did is a System restore using a Windows 10 USB (I tried fixing the boot but somehow it didn’t work, I even tried it on console, anyways I lost no data). After this, now I coulnd’t boot Debian, so I run a Debian live CD, mounted everything and chrooted like this (and don’t forget to boot the USB as UEFI):

mount /dev/your_linux_partition /mnt
cd /mnt
mount -t proc /proc proc/
mount -t sysfs /sys sys/
mount --rbind /dev dev/
mount --rbind /sys/firmware/efi/efivars sys/firmware/efi/efivars/
mount /dev/your_efi_partition /boot/efi/
chroot /mnt /bin/bash

Now, here os-prober didn’t detect Windows 10, but I decided to grub-install /dev/sda and grub-update anyways and restart.

Here is the funny thing, now I couldn’t boot Windows 10 and only Debian, BUT!, I tried once again to grub-update and finally found the Windows 10 boot. This doesn’t make any sense honestly, but I don’t care. Hope it helps anyone as desperate as me :D .

answered Oct 16, 2021 at 18:56

M83OutroFeelings's user avatar

You must log in to answer this question.

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

.

Многие новички и опытные пользователи Linux держат также установленной на своем компьютере операционную систему Windows, например, последней, десятой версии. Новичкам это нужно чтобы иметь запасную операционную систему, к которой они смогут вернуться, если их Linux сломается. А для опытных пользователей важно программное обеспечение, которое не поддерживается ни в Linux, ни даже с помощью эмулятора Wine, а таких программ достаточно много.

Но временами случается такая ситуация, что загрузчик Grub не распознает установленную Windows и не отображает ее в списке систем для загрузки. В этой статье мы рассмотрим почему возникает ошибка grub не видит Windows 10 и как ее решить.

Причин такой ошибки может быть несколько, начиная от того, что система установлена на другом жестком диске, и заканчивая неизвестными глюками пакета os-prober, который и занимается определением операционных систем в Linux. Также, если у вас есть несколько версий Windows на компьютере, то программа может видеть только одну из них.

Сначала можно попытаться сделать наш с Windows раздел более видимым для программы. Для этого примонтируйте его в какую-либо папку. Например, в /mnt/:

sudo mount -t ntfs-3g -o ro /dev/sda1

Я предполагаю, что система Windows установлена на разделе, который определяется в Linux, как /dev/sda1. Дальше запустите утилиту os-prober:

sudo os-prober

Если программа обнаружит Windows, то вам останется обновить конфигурацию загрузчика Grub:

sudo update-grub

Или:

sudo grub2-mkconfig -o /boot/grub/grub.cfg

Если же этот способ не сработает, а он, скорее всего, не сработает, то вам останется только вручную добавить пункт меню для Windows. Это не самое простое, но зато эффективное решение. Сначала нам нужно узнать UUID раздела диска, на который установлена Windows, например, /dev/sda1:

blkid /dev/sda1

Затем откройте файл /etc/grub.d/40_custom и добавьте туда такой код:

menuentry "Windows 10" {
insmod ntfs
set root='(hd0,1)'
search --no-floppy --fs-uuid --set B4A6AEB7A6AE7A0E
chainloader +1
}

Если кратко, то здесь мы устанавливаем в качестве корня первый раздел первого диска, а затем указываем загрузчику, что нужно найти раздел с нужным нам UUID. Затем передаем управление загрузчику на этом разделе с помощью chainloader. Дальше осталось обновить конфигурацию Grub:

sudo update-grub

Мы использовали такой метод потому что теперь настройка не собьется после обновления ядра или другого процесса, инициализирующего обновление конфигурации. Потому что если бы мы добавили эти строки в /boot/grub/grub.cfg, то они были бы перезаписаны если не при первом, то при одном из следующих обновлений системы.

Когда конфигурация обновлена вы можете перезагрузить компьютер и загружать Windows с помощью нового пункта. Таким образом, можно добавить несколько пунктов, только для разных разделов нужно указывать их UUID.

Выводы

В этой небольшой статье мы разобрали что делать когда у вас возникнет ошибка grub не видит windows 10 и какими способами ее можно исправить. На самом деле решение очень простое, если вы не используете систему с UEFI. В варианте с EFI загрузка Windows управляется не Grub, а загрузчиком UEFI, но при использовании Linux рекомендуется отключить эту технологию.

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

Об авторе

Основатель и администратор сайта losst.ru, увлекаюсь открытым программным обеспечением и операционной системой Linux. В качестве основной ОС сейчас использую Ubuntu. Кроме Linux, интересуюсь всем, что связано с информационными технологиями и современной наукой.

I have finally installed Ubuntu on my second drive. When I start my computer GRUB only offers me to boot Ubuntu, not Windows 7. What needs to be done so that I can choose between Ubuntu and Windows in GRUB?

When I press F12 for boot menu at startup and I choose Windows Boot Manager it boots into Windows 7.


I ran command sudo fdisk -l and here is log (http://pastebin.com/Cgv1igHc):

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xc3ffc3ff

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1  1953525167   976762583+  ee  GPT
Partition 1 does not start on physical sector boundary.

LiveWireBT's user avatar

LiveWireBT

28.5k26 gold badges108 silver badges221 bronze badges

asked Oct 8, 2012 at 16:20

HyperX's user avatar

2

  1. Boot Ubuntu and mount your Windows partition (simply open the disk on Nautilus)

  2. Run the following on the command line (Ctrl+Alt+t):

    sudo os-prober
    
  3. If your Windows installation was found, you can run:

    sudo update-grub
    

Note that step 2 is just for your convenience. You could just mount the Windows 7 partition and then run update-grub.

Related question

  • Unable to mount Windows (NTFS) filesystem due to hibernation

Community's user avatar

answered Oct 11, 2012 at 10:36

Hermes's user avatar

HermesHermes

1,3371 gold badge7 silver badges2 bronze badges

4

If the os-prober method above doesn’t work try adding a custom grub menu entry. Documented here.

First two steps are for finding your <UUID>.

  1. Run lsblk and find the name of the row with /boot/efi

Example output (here the answer is sda2):

lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0   477G  0 disk 
├─sda1        8:1    0   450M  0 part 
├─sda2        8:2    0   100M  0 part /boot/efi
├─sda3        8:3    0    16M  0 part 
├─sda4        8:4    0    47G  0 part /windows
├─sda5        8:5    0 425,6G  0 part /
└─sda6        8:6    0   3,7G  0 part [SWAP]
mmcblk0     179:0    0  14,9G  0 disk 
└─mmcblk0p1 179:1    0  14,9G  0 part
  1. Run sudo blkid /dev/sdaX where sdaX is the answer from previous step (sda2 in my case).

Example output (here the answer is 58E4-427D):

/dev/sda2: UUID="58E4-427D" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="b81727be-ba90-5f8c-ab98-d3ec67778b7d"
  1. Add the following at the end of the file /etc/grub.d/40_custom:
menuentry "Windows 7" {  
     insmod ntfs  
     set root='(hd0,1)'  
     search --no-floppy --fs-uuid --set <UUID>
     chainloader +1  
}
  1. Run sudo update-grub and reboot.

Carolus's user avatar

Carolus

5964 silver badges18 bronze badges

answered May 29, 2015 at 9:27

Philippe Gachoud's user avatar

Philippe GachoudPhilippe Gachoud

5,8303 gold badges41 silver badges50 bronze badges

2

I had Windows 10 running and then tried dual boot. Once Ubuntu was installed, Win 10 wasn’t showing up in my GRUB loader. I tried the following —

First of all, I disabled Secure Boot in Win10. Then ran the below
commands in Ubuntu :

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair

Worked out pretty well. Was able to find both Windows and Ubuntu in GRUB after that.

αғsнιη's user avatar

αғsнιη

35.2k41 gold badges129 silver badges192 bronze badges

answered Oct 23, 2016 at 17:13

Karthik Ubaradka's user avatar

3

I solved a similar problem following steps of Boot-Repair

Install boot-repair

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair

Push «Recommended repair»
And put in a terminal some commands as it suggested.

I think my Grub doesn’t recognize windows due to a bad shutdown, and it solved the problem.

answered Apr 25, 2016 at 14:30

Rutrus's user avatar

RutrusRutrus

1,5011 gold badge9 silver badges10 bronze badges

Slightly different method as I copied from a working example on another computer, posting for my own records.

Append the following to /etc/grub.d/40_custom:

menuentry "Windows 10" {
        insmod part_gpt
        insmod fat
        search --no-floppy --fs-uuid --set <boot_efi_uuid>
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

where <boot_efi_uuid> is the UUID of your /boot/efi partition. To find this:

$ lsblk
NAME              MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT                                                  
sda                 8:0    0 119.2G  0 disk
└─md126             9:126  0 357.7G  0 raid0
  ├─md126p1       259:0    0   499M  0 md
  ├─md126p2       259:1    0   100M  0 md    /boot/efi                                                   
$ sudo blkid | grep md126p2 # Replace with your device
/dev/md126p2: UUID=<boot_efi_uuid>

Then of course, once you’re saved the file, run:

sudo update-grub

Reboot, you should now be able to successfully start up Windows.

answered Feb 16, 2019 at 23:45

Christopher Markieta's user avatar

2

If you have previously had a RAID installed that may be causing issues. In my case, I built my desktop in 2010, and I installed two 1.5 TB with a striped RAID. User gracemercy54 mentions here that this is left over metadata from the former RAID configuration.

When I originally tried the steps by Hermes I got an error specifying «wrong number of devices in a RAID set.» So, if this happens to you open a terminal and run:

   sudo dmraid -rE
   sudo os-prober
   sudo update-grub

That fixed this for me.

answered Mar 18, 2017 at 18:56

Adam Drewery's user avatar

2

I had issues like here above and the solution was just to add manual entry as below:

menuentry "WINDOWS10 (on /dev/sda1)" --class windows --class os {
    insmod part_msdos
    insmod ntfs
    set root='(/dev/sda,msdos1)'
    search --no-floppy --fs-uuid --set=root 688EB92384B85968
    drivemap -s (hd0) ${root}
    chainloader +1
}

where UUID above (688E…) was taken from boot windows disk via blkid /dev/sdb1.

ATTENTION: the additional line

set root='(/dev/sda,msdos1)'

refers to sda which is visible under Ubuntu as /dev/sdb even actually it is the first disk in sata bus while /dev/sda is in fact second drive mounted as root /.

Maybe that is why grub scripts could not work properly. I had no time to change the physical order of disks but it is quite possible it would help to resolve the issue, too.

Eliah Kagan's user avatar

Eliah Kagan

117k54 gold badges319 silver badges495 bronze badges

answered Dec 4, 2017 at 22:50

luke's user avatar

I had the same problem with Windows 10. I installed Linux Mint 18.1 Cinnamon 64-bit on my laptop for dual boot with WIN10. After the installation GRUB only offered to boot Linux but not Windows.

I found the video solution for windows 10 missing from grub menu and the forum thread Grub not recognizing Win10 after Update/Repair, but unfortunately neither worked for me so I used a combination of these two to resolve my problem.

Open your terminal and follow these commands and open the file named 40_custom:

sudo gedit /etc/grub.d/40_custom

Add these lines to the end of the file and then save and exit:

menuentry "Windows 10" {
   set root='{hd0,1}'
   chainloader + 1
}

After you save the file update your GRUB with this command:

sudo update-grub

Then restart your machine to see if it works.

Hope this will work for others too!

Eliah Kagan's user avatar

Eliah Kagan

117k54 gold badges319 silver badges495 bronze badges

answered May 30, 2017 at 13:16

Lahiru's user avatar

1

Edit: As @Guss specified, this should be configured in /etc/default/grub, not the built-in script.

Old answer:

Follow these steps if os-prober shows Windows, but GRUB does not.

  • Edit grub-mkconfig
    sudo nano /usr/bin/grub-mkconfig
    
  • Find these lines near the middle
    # Disable os-prober by default due to security reasons.
    GRUB_DISABLE_OS_PROBER="true"
    
  • Change true to false
  • Exit nano (CTRL+X, Y, Enter)
  • Update GRUB
    sudo update-grub
    

answered Mar 11, 2021 at 13:16

nathanfranke's user avatar

nathanfrankenathanfranke

1561 gold badge1 silver badge8 bronze badges

1

I had the same problem and had spent 2 days figuring it out. But today I had this sudden idea in the morning and it worked out.

You should review your bios/uefi settings. In my case I had to let Uefi boot first. Otherwise I wasn’t able to detect windows from ubuntu. What I had to set was ubuntu > Windows Boot Manager > DISK1 > DISK2 > DISK3. Insted DISK1 > ubuntu > Windows Boot Manager > DISK3.

I had 2 ubuntu installations one on hdd and one on ssd. Apparently ssd installation wasn’t showing as UEFI for some reasone but I wanted boot faster disk first.

I wasn’t expecting that order of boot can influence grub in detecting systems. So it is worth to review that.

answered Apr 29, 2017 at 7:08

Bartosz Dabrowski's user avatar

I had the same issue after I installed the updates from ubuntu. The following commands worked for me perfectly:

sudo apt-get install os-prober

First install os-prober to detect windows and then update grub:

sudo grub-mkconfig -o /boot/grub/grub.cfg

answered Oct 29, 2019 at 21:02

phoenix007's user avatar

1

In addition to the answer of Bartosz Dabrowski, which lead me to solving my problem:

Be sure that if your Linux uses UEFI Boot/GPT that your other OS (eg. Windows in my case) also uses UEFI Boot/GPT. Coming from an old Win7 to Win10 installation the hard drive still had old school boot and MBR. Somehow os-prober and boot-repair had their problems to fix this.

Ensure that in BIOS / Boot order there is your HDD with ubuntu (eg. uefi: ubuntu) and your HDD with Windows Boot Manager (eg. uefi: Windows Boot Manager) to be found.

If WBM is missing ensure that windows boot disk has GPT. You can check this in Windows using Disk Management (Win + X, then Disk Management).

There is a Windows tool: mbr2gpt which can convert your MBR to GPT. After doing so (and booting via UEFI) os-prober and finally update-grub was able to find my Windows installation and added it to the boot options of grub.

answered Oct 15, 2020 at 6:35

methical's user avatar

Okay, so I had the same problem and couldn’t find a solution for me out there for a long time, finally got it, so here is my little grain of sand to the world. Before you try, remember to check you are booting using UEFI everytime you can:

Apparently, in the process of installing Debian the Windows data inside the EFI partition was lost, so what I did is a System restore using a Windows 10 USB (I tried fixing the boot but somehow it didn’t work, I even tried it on console, anyways I lost no data). After this, now I coulnd’t boot Debian, so I run a Debian live CD, mounted everything and chrooted like this (and don’t forget to boot the USB as UEFI):

mount /dev/your_linux_partition /mnt
cd /mnt
mount -t proc /proc proc/
mount -t sysfs /sys sys/
mount --rbind /dev dev/
mount --rbind /sys/firmware/efi/efivars sys/firmware/efi/efivars/
mount /dev/your_efi_partition /boot/efi/
chroot /mnt /bin/bash

Now, here os-prober didn’t detect Windows 10, but I decided to grub-install /dev/sda and grub-update anyways and restart.

Here is the funny thing, now I couldn’t boot Windows 10 and only Debian, BUT!, I tried once again to grub-update and finally found the Windows 10 boot. This doesn’t make any sense honestly, but I don’t care. Hope it helps anyone as desperate as me :D .

answered Oct 16, 2021 at 18:56

M83OutroFeelings's user avatar

You must log in to answer this question.

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

.

Здравствуйте.

Переустановил Windows 10, на втором SSD (до этого стояла 10ка по учебной лицензии). После переустановки форточек, они пропали из меню GRUB2 (попасть во вторую ОС стало возможно только из Popup меню BIOS).

Обновление конфига GRUB2 и запуск os-prober’a не дали никаких результатов.

Пробовал внести диск со второй ОС, в ручном режиме, отредактировав /etc/grub.d/40_custom. К сожалению, это так-же не дало результатов. В чем может быть проблема?

Windows 10 установлен на /dev/sdd. В системе присутствует ещё два HDD-файлопомойки (/dev/sda; /dev/sdb). Manjaro установлен на /dev/sdc. Гибернация у 10ки отключена.


# blkid
/dev/sda1: LABEL="Storage-I" UUID="9a139ccf-d118-4c99-9650-10b055112eaf" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="af7f328c-13b4-ae4f-aaf4-0e900d732e13"
/dev/sdb1: LABEL="Storage-II" UUID="040dc10d-1755-4b94-8e65-3756f2d88075" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="00061c5f-01"
/dev/sdc1: UUID="82e6924b-ba33-4d3a-82ce-f4d280aa2486" BLOCK_SIZE="1024" TYPE="ext2" PTTYPE="dos" PARTUUID="2d732526-01"
/dev/sdc2: UUID="782f8374-b391-4b7b-a2fe-ab21ed86ac25" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="2d732526-02"
/dev/sdc3: UUID="45ebffb3-48ab-4dd8-a410-932569e4b68d" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="2d732526-03"
/dev/sdc4: UUID="d358f8cb-d63b-4526-87e0-79426d8a6d0a" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="2d732526-04"
/dev/sdd1: LABEL="M-PM-^RM-PM->M-QM-^AM-QM-^AM-QM-^BM-PM-0M-PM-=M-PM->M-PM-2M-PM-8M-QM-^BM-QM-^L" BLOCK_SIZE="512" UUID="54C29167C2914DDC" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="0127ac5f-c7c8-40c5-a0a9-fc172fec30a8"
/dev/sdd2: UUID="4C91-930C" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="3f6d7b1c-1ef3-490c-abb8-d84cd343e4a4"
/dev/sdd3: PARTLABEL="Microsoft reserved partition" PARTUUID="b96ef863-033a-4595-9d0b-2032fdbd4b96"
/dev/sdd4: BLOCK_SIZE="512" UUID="D8C09861C09847A0" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="bd84118f-2c15-4d80-a16a-b17120be59ba"


# fdisk -l
Диск /dev/sda: 3,65 TiB, 4000787030016 байт, 7814037168 секторов
Disk model: ST4000NE001-2MA1
Единицы: секторов по 1 * 512 = 512 байт
Размер сектора (логический/физический): 512 байт / 4096 байт
Размер I/O (минимальный/оптимальный): 4096 байт / 4096 байт
Тип метки диска: gpt
Идентификатор диска: 23D3E1CA-2035-974A-B120-89961A47C2E4

Устр-во    начало      Конец    Секторы Размер Тип
/dev/sda1    4096 7793059839 7793055744   3,6T Файловая система Linux


Диск /dev/sdb: 698,65 GiB, 750156374016 байт, 1465149168 секторов
Disk model: SAMSUNG HD753LJ 
Единицы: секторов по 1 * 512 = 512 байт
Размер сектора (логический/физический): 512 байт / 512 байт
Размер I/O (минимальный/оптимальный): 512 байт / 512 байт
Тип метки диска: dos
Идентификатор диска: 0x00061c5f

Устр-во    Загрузочный начало      Конец    Секторы Размер Идентификатор Тип
/dev/sdb1                2048 1454082047 1454080000 693,4G            83 Linux


Диск /dev/sdc: 119,25 GiB, 128035676160 байт, 250069680 секторов
Disk model: Samsung SSD 850 
Единицы: секторов по 1 * 512 = 512 байт
Размер сектора (логический/физический): 512 байт / 512 байт
Размер I/O (минимальный/оптимальный): 512 байт / 512 байт
Тип метки диска: dos
Идентификатор диска: 0x2d732526

Устр-во    Загрузочный   начало     Конец   Секторы Размер Идентификатор Тип
/dev/sdc1  *               2048    630783    628736   307M            83 Linux
/dev/sdc2                630784  63545343  62914560    30G            83 Linux
/dev/sdc3              63545344  84516863  20971520    10G            83 Linux
/dev/sdc4              84516864 241803263 157286400    75G            83 Linux


Диск /dev/sdd: 119,25 GiB, 128035676160 байт, 250069680 секторов
Disk model: Samsung SSD 850 
Единицы: секторов по 1 * 512 = 512 байт
Размер сектора (логический/физический): 512 байт / 512 байт
Размер I/O (минимальный/оптимальный): 512 байт / 512 байт
Тип метки диска: gpt
Идентификатор диска: 896AA7C4-9CDC-425E-992C-791D9F0B9FAF

Устр-во     начало     Конец   Секторы Размер Тип
/dev/sdd1     2048   1085439   1083392   529M Среда для восстановления Microsoft
/dev/sdd2  1085440   1290239    204800   100M EFI
/dev/sdd3  1290240   1323007     32768    16M Зарезервированный раздел Microsoft
/dev/sdd4  1323008 225062911 223739904 106,7G Microsoft basic data


/etc/grub.d/40_custom

#!/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.

menuentry "W10-TEST1" {
 regexp -s root '\((.+)\)' "$cmdpath"
 chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

menuentry "W10-TEST2" {
        insmod part_gpt
        insmod fat
        search --no-floppy --fs-uuid --set 4C91-930C
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

menuentry "W10-TEST3" {
   set root='{hd3,2}'
   chainloader + 1
}

menuentry "W10-TEST4" {  
     insmod ntfs  
     set root='(hd3,2)'  
     search --no-floppy --fs-uuid --set 4C91-930C
     chainloader +1  
}

Только зарегистрированные и авторизованные пользователи могут оставлять комментарии.

#1 2022-02-13 18:00:28

mohammadreza99a
Member
Registered: 2022-02-13
Posts: 10

Grub does not detect Windows UEFI but efibootmgr finds it

This problem is getting kind of repetitive but I couldn’t actually find a solution to my specific problem. I have installed Arch along side Windows and I have made a FAT32 partition which host Grub and Windows boot loader. The problem is that when I run efibootmgr, the Windows shows up but when I run os-prober, there is nothing and hence my grub can’t detect Windows boot loader. I can boot into Windows only if I put my BIOS priority to Windows. I have checked and I have Windows installed with UEFI. Does anybody know what could be the cause of this problem?

Here are some outputs.

For efibootmgr I get:

BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 2001,0001,0003,2002,2003
Boot0001* Arch_Linux	HD(1,GPT,576e6cae-b67b-584b-886d-aa127636a7cc,0x800,0x82000)/File(\EFI\Arch_Linux\grubx64.efi)
Boot0003* Windows Boot Manager	HD(1,GPT,576e6cae-b67b-584b-886d-aa127636a7cc,0x800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
Boot2001* EFI USB Device	RC
Boot2002* EFI DVD/CDROM	RC
Boot2003* EFI Network	RC 

For lsblk I get:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
nvme0n1     259:0    0 953.9G  0 disk 
├─nvme0n1p1 259:1    0   260M  0 part /boot/efi
├─nvme0n1p2 259:2    0 300.6G  0 part /run/media/mohammadreza/Windows
├─nvme0n1p3 259:3    0   251G  0 part /run/media/mohammadreza/Partition1
├─nvme0n1p4 259:4    0   151G  0 part /run/media/mohammadreza/Partition2
├─nvme0n1p5 259:5    0   150G  0 part /
├─nvme0n1p6 259:6    0    93G  0 part /home
└─nvme0n1p7 259:7    0     8G  0 part [SWAP]

#3 2022-02-13 22:50:23

mohammadreza99a
Member
Registered: 2022-02-13
Posts: 10

Re: Grub does not detect Windows UEFI but efibootmgr finds it

os-prober was enabled by default in /etc/default/grub. I have tried to add manually the Windows boot loader to grub but it does not work. Could it be related to some kind of mount issues?

#4 2022-02-15 06:37:14

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,997
Website

Re: Grub does not detect Windows UEFI but efibootmgr finds it

How exactly did you attempt to manually add the Windows menuentry? Please post the configuration file that was added or edited and also the full content of /boot/grub/grub.cfg,

Please also share the output of

#5 2022-02-17 11:35:31

mohammadreza99a
Member
Registered: 2022-02-13
Posts: 10

Re: Grub does not detect Windows UEFI but efibootmgr finds it

Here is the output of

/dev/nvme0n1p7: UUID="522fb482-ee75-40c8-9819-d0078a04c71f" TYPE="swap" PARTUUID="443d2b6c-d02d-564b-ac4c-38062f147832"
/dev/nvme0n1p5: UUID="fc20a978-2012-456d-8a38-debbddc18320" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="260fd788-e554-554d-9659-cec33efe8f16"
/dev/nvme0n1p3: LABEL="Partition1" BLOCK_SIZE="512" UUID="A4EC3CE6EC3CB500" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="87f2f298-8c1e-41b8-9d28-3d65efa000cb"
/dev/nvme0n1p1: LABEL_FATBOOT="NO_LABEL" LABEL="NO_LABEL" UUID="E23D-EDCC" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="576e6cae-b67b-584b-886d-aa127636a7cc"
/dev/nvme0n1p6: UUID="0e15e6f2-5842-4f47-a24e-b04c51f1f07e" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="8e420e0c-19e6-6048-a0f8-0d79e82fa411"
/dev/nvme0n1p4: LABEL="Partition2" BLOCK_SIZE="512" UUID="A0507F78507F53CE" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="756fa30e-9fa5-42c1-88f5-4843d5e30960"
/dev/nvme0n1p2: LABEL="Windows" BLOCK_SIZE="512" UUID="9E9044E49044C50D" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="6e3de74a-3ed0-4bcb-a711-acf4adb4f13b"

To add the entry menu for windows, I put blew code into

:

 
#!/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.
if [ "${grub_platform}" == "efi" ]; then
	menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {
		insmod part_gpt
		insmod fat
		insmod chain
		search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid
		chainloader /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
	}
fi

and after this i ran the command

and here is the content of my

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root fc20a978-2012-456d-8a38-debbddc18320
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root fc20a978-2012-456d-8a38-debbddc18320
insmod gfxmenu
loadfont ($root)/usr/share/grub/themes/Vimix/dejavu_32.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/dejavu_sans_12.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/dejavu_sans_14.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/dejavu_sans_16.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/dejavu_sans_24.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/dejavu_sans_48.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/terminus-12.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/terminus-14.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/terminus-16.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/terminus-18.pf2
insmod jpeg
insmod png
set theme=($root)/usr/share/grub/themes/Vimix/theme.txt
export theme
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-fc20a978-2012-456d-8a38-debbddc18320' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod ext2
	search --no-floppy --fs-uuid --set=root fc20a978-2012-456d-8a38-debbddc18320
	echo	'Loading Linux linux ...'
	linux	/boot/vmlinuz-linux root=UUID=fc20a978-2012-456d-8a38-debbddc18320 rw  quiet resume=UUID=522fb482-ee75-40c8-9819-d0078a04c71f loglevel=3 audit=0
	echo	'Loading initial ramdisk ...'
	initrd	/boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-fc20a978-2012-456d-8a38-debbddc18320' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-fc20a978-2012-456d-8a38-debbddc18320' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root fc20a978-2012-456d-8a38-debbddc18320
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=fc20a978-2012-456d-8a38-debbddc18320 rw  quiet resume=UUID=522fb482-ee75-40c8-9819-d0078a04c71f loglevel=3 audit=0
		echo	'Loading initial ramdisk ...'
		initrd	/boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-linux.img
	}
	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-fc20a978-2012-456d-8a38-debbddc18320' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod ext2
		search --no-floppy --fs-uuid --set=root fc20a978-2012-456d-8a38-debbddc18320
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=fc20a978-2012-456d-8a38-debbddc18320 rw  quiet resume=UUID=522fb482-ee75-40c8-9819-d0078a04c71f loglevel=3 audit=0
		echo	'Loading initial ramdisk ...'
		initrd	/boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-linux-fallback.img
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
	fwsetup
}
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# 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.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###

#6 2022-02-17 11:45:14

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 19,837

Re: Grub does not detect Windows UEFI but efibootmgr finds it

You need to actually write out the entry to standard out e.g.

echo 'menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {
		insmod part_gpt
		insmod fat
		insmod chain
		search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid
		chainloader /EFI/Microsoft/Boot/bootmgfw.efi
	}'

Note that i dropped the /boot/efi from the chainloader line because you need to write paths relative to the ESP root.

Also grub-mkconfig without the -o argument will write to stdout, make sure you properly write the correct config file as well.

#7 2022-02-17 14:54:52

mohammadreza99a
Member
Registered: 2022-02-13
Posts: 10

Re: Grub does not detect Windows UEFI but efibootmgr finds it

I did this and the problem is that when I click on the Windows entry in grub menu, it says that this path does not exist. Why this is happening? Because I can enter to Windows if I just change boot orders in my BIOS. Is this happening because the Windows boot loader is not correctly put into the correct path ?

Here is the content of my /boot/ folder:

drwx------    - root  1 Jan  1970  efi
drwxr-xr-x    - root 17 Feb 15:51  grub
.rw-r--r--  51k root 10 Feb 14:22  amd-ucode.img
.rw-------  24M root 16 Feb 22:07  initramfs-linux-fallback.img
.rw------- 6.8M root 16 Feb 22:06  initramfs-linux.img
.rw-r--r-- 4.7M root  8 Feb 22:07  intel-ucode.img
.rw-r--r--  10M root 16 Feb 22:05  vmlinuz-linux

Last edited by mohammadreza99a (2022-02-17 14:59:10)

#8 2022-02-17 15:14:22

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,997
Website

Re: Grub does not detect Windows UEFI but efibootmgr finds it

V1del wrote:

You need to actually write out the entry to standard out.

No, the stanza can be added directly, as stated on the linked ArchWiki page.

mohammadreza99a wrote:

when I click on the Windows entry in grub menu, it says that this path does not exist.

Please share the updated /boot/grub/grub.cfg that contains the Windows entry.

Did you replace $hints_string & $fs_uuid with the actual, correct string & UUID? The ArchWiki page shows how to do that.

mohammadreza99a wrote:

Is this happening because the Windows boot loader is not correctly put into the correct path ?

Check under /boot/efi and see if /EFI/Mircosoft/Boot/bootmgfw.efi is present. It should be there, the Arch & Windows NVRAM entries are both using the same PARTUUID (/dev/nvme0n1p1).

#9 2022-02-17 17:15:11

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 19,837

Re: Grub does not detect Windows UEFI but efibootmgr finds it

@HoaS if you directly edit /boot/grub.cfg sure, if you intend /etc/grub.d/40_custom to be picked up by grub-mkconfig you’ll definitely need to echo out the intended text somewhere.  But still yes, the correct replacement variables have to be replaced anyway.

#10 2022-02-17 17:23:00

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,997
Website

Re: Grub does not detect Windows UEFI but efibootmgr finds it

V1del wrote:

if you intend /etc/grub.d/40_custom to be picked up by grub-mkconfig you’ll definitely need to echo out the intended text somewhere

Nope:

archie:~$ cat /etc/grub.d/40_custom                      
#!/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.
menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {
		insmod part_gpt
		insmod fat
		insmod chain
		search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid
		chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
archie:~$ doas grub-mkconfig 2>/dev/null | grep -A6 Vista
menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {
		insmod part_gpt
		insmod fat
		insmod chain
		search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid
		chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
archie:~$

Even 40_custom disagrees with you tongue

#11 2022-02-17 18:42:38

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 19,837

Re: Grub does not detect Windows UEFI but efibootmgr finds it

I stand corrected yikes

#12 2022-02-17 19:54:06

mohammadreza99a
Member
Registered: 2022-02-13
Posts: 10

Re: Grub does not detect Windows UEFI but efibootmgr finds it

Head_on_a_Stick wrote:

Did you replace $hints_string & $fs_uuid with the actual, correct string & UUID? The ArchWiki page shows how to do that.

While running grub-probe —target=hints_string /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi in order to get$hints_string, I get this error:

grub-probe: warning: unknown device type nvme0n1.

For $fs_uuid I get a response.

I mean this is just a warning but it is weird that there is not any output.

#13 2022-02-17 20:02:39

mohammadreza99a
Member
Registered: 2022-02-13
Posts: 10

Re: Grub does not detect Windows UEFI but efibootmgr finds it

mohammadreza99a wrote:

Head_on_a_Stick wrote:

Did you replace $hints_string & $fs_uuid with the actual, correct string & UUID? The ArchWiki page shows how to do that.

While running grub-probe —target=hints_string /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi in order to get$hints_string, I get this error:

grub-probe: warning: unknown device type nvme0n1.

So I have a fix for this issus. What i did was to copy the output in the wiki and I changed hd0 to nvme0n1 and I can finally successfully load into Windows from Grub. But the main issus always remains. The fact that os-prober is not able to find Windows loader.

Here is my /etc/grub.d/40_custom for those that might have the same issus:

#!/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.
if [ "${grub_platform}" == "efi" ]; then
	menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {
		insmod part_gpt
		insmod fat
		insmod chain
		search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=nvme0n1,gpt1 --hint-baremetal=ahci0,gpt1 E23D-EDCC
		chainloader /EFI/Microsoft/Boot/bootmgfw.efi
	}
fi

Thank you both for helping me.

Last edited by mohammadreza99a (2022-02-17 20:02:58)

#14 2022-02-17 20:29:41

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 6,997
Website

Re: Grub does not detect Windows UEFI but efibootmgr finds it

The —hint options are only needed if you have multiple partitions with the same filesystem UUID.

All I have ever needed is

menuentry 'Windows' {
   search.fs_uuid $uuid
   chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

search.fs_uuid is an alias for search —fs-uuid and the root variable is the presumed default.

  • Grub 2 установка и загрузка ос windows 10
  • Gt 630 драйвер windows 10 64 bit не устанавливается
  • Group policy editor for windows 10 home
  • Gt 630 driver for windows 7
  • Grub команды для установки windows