Grub add windows 10 to boot menu

Skip to content

After a recent malware attack in my Windows 10 PC, I was unable to use it for many days. So this time I decided to install both Windows 10 and Ubuntu 16.04.3 in the dual boot configuration, so that if Windows fails to boot, I can still access all my files using the Ubuntu. And of course, you can always use the powerful Ubuntu Linux on the same PC any time you want. But after installing Ubuntu 16.04.3 on the Windows 10 PC, I found no way to use Windows 10 as the Ubuntu setup somehow failed to add the Windows entry to the Grub menu.

If you are also experiencing a similar problem then you can quickly fix this problem using just two commands. Here is how:

  1. Boot into Ubuntu (well, there is no other option at the moment but to boot into Ubuntu).
  2. Press Ctrl + Alt + T to open the terminal window.
  3. In the terminal window type the following command: sudo os-prober and press Enter.
    Add Windows to Grub Menu

  4. If you see it detect Windows 10 then all you have to do is type the command sudo update-grub and press Enter. It will add new entries to the grub menu and update it. Now you can reboot your PC and you will see options to boot into Windows.

However, if you do not see the Windows 10 detected after issuing the sudo os-prober command, then you will have to use some extra steps. We have already posted about boot-repair utility that can be used from within Linux to fix most of the boot problems. You can read more about the boot-repair utility from how to restore Ubuntu Linux after re-installing Windows. This tool should be enough to fix the problems and you will never need any of the commands to be used manually or to edit the grub menu by yourself.

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.

На ssd стояла windows 10.
Разбил hdd под установку linux mint, но после его установки загружалась только windows 10. Решил это чистой установкой Linux, установщик разбил диск как ему надо. Как итог linux грузится, windows 10 — нет, и кроме того не могу войти в настройки bios: меню загрузки там пустое, bios setup не открывается.
В меню загрузки grub есть только linux.
Есть ли способ добавить windows в меню загрузчика grub, как убедиться, что она сможет запуститься, и это не убьет работающий Linux?

Grub выглядит так:

5d113880dae20436574156.jpeg

По команде lsblk результат такой:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465,8G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
└─sda2   8:2    0 465,3G  0 part /
sdb      8:16   0   118G  0 disk 
├─sdb1   8:17   0 117,2G  0 part 
└─sdb2   8:18   0   790M  0 part

Для диска, на котором лежит windows: blkid /dev/sdb1

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1  *         2048 245839254 245837207 117,2G  7 HPFS/NTFS/exFAT
/dev/sdb2       245839872 247457791   1617920   790M 27 Hidden NTFS WinRE

blkid /dev/sdb1. Странный лейбл раздела с windows 10. Критично ли это?

/dev/sdb1: LABEL="M-PM-^TM-PM-8M-QM-^AM-PM-:" UUID="2EE6EE17E6EDDF59" TYPE="ntfs" PARTUUID="d7209484-01"

upd
Добавил руками пункт загрузки в grub как написано в статье.

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

При выборе — error: invalid EFI file path.

ps. Если бы была возможность зайти в bios, с удовольствием бы снес все и накатил заново винду (или восстановил с загрузочной флешки). С проблемой столкнулся не впервые, но в прошлый раз пришлось прибегнуть к прошивке bios на программаторе. Хотелось бы обойтись без такой хирургии, тк не желательно отдавать ноут на несколько дней.

Cover image for Add Windows 10 to GRUB OS list

I usually run Ubuntu and Windows on the same computer, in order to be able to select which OS I want to boot, I use GRUB. Here we’re going to learn how to add Windows 10 to the GRUB OS list.

Using your Ubuntu OS you need to know which partition is the Windows EFI located, mine is at /dev/sda2.

Once you know it, you should run the following command adapting it to your partition.

sudo blkid /dev/sda2

Enter fullscreen mode

Exit fullscreen mode

This command will allow you to know the UUID of your Windows EFI partition.

Next, we need to edit the /etc/grub.d/40_custom file in order to add the Windows 10 entry.

sudo vi /etc/grub.d/40_custom

Enter fullscreen mode

Exit fullscreen mode

Here is the entry you should add, change WINDOWS_EFI_PARTITION_UUID with the value you obtained previously.

menuentry "Windows 10" --class windows --class os {
   insmod ntfs
   search --no-floppy --set=root --fs-uuid WINDOWS_EFI_PARTITION_UUID
   ntldr /bootmgr
}

Enter fullscreen mode

Exit fullscreen mode

Sometimes the GRUB menu is hidden by default on boot, you should enable it changing the GRUB configuration.

sudo vi /etc/default/grub

Enter fullscreen mode

Exit fullscreen mode

You should set the timeout seconds, and comment out the default style.

GRUB_TIMEOUT=5
#GRUB_TIMEOUT_STYLE=hidden

Enter fullscreen mode

Exit fullscreen mode

Once you’ve made all the changes, you should apply them by running the following command.

sudo update-grub

Enter fullscreen mode

Exit fullscreen mode

If you install Ubuntu first and Windows later, you’ll notice that it’s not possible to boot into Linux anymore. As Windows boot loader doesn’t really handle Linux, you’ll need to tell Windows to use Grub.

Once you’re in command prompt with administrative privileges, you can execute:

BCDEDIT /set {bootmgr} path \EFI\Ubuntu\grubx64.efi

After reboot Grub will show it’s ugly face and you’ll have another problem — there are no Windows entries.

To get them into Grub menu, one can simply update grub:

sudo update-grub

On most Linux distributions this will trigger OS Prober and Windows Boot Manager entry will magically appear. However, if you have OS Prober disabled or you want to disable it in future for some reason, you can add manual entry too:

cat << EOF | sudo tee /etc/grub.d/25_windows
#!/bin/sh
exec tail -n +3 \$0
menuentry 'Windows 10' {
  savedefault
  search --no-floppy --set=root --file /EFI/Microsoft/Boot/bootmgfw.efi
  chainloader (\${root})/EFI/Microsoft/Boot/bootmgfw.efi
}
EOF

sudo chmod +x /etc/grub.d/25_windows

sudo update-grub

In either case, boot menu should now offer you option to get into Windows.

Все способы:

  • Способ 1: Установка Windows на диск с Linux
  • Способ 2: Обнаружение раздела Windows
  • Способ 3: Ручное добавление загрузчика
  • Вопросы и ответы: 0

Способ 1: Установка Windows на диск с Linux

Одной из наиболее распространенных причин отсутствия Windows 10 в загрузочном меню «Grub» является установка Windows не на тот же физический диск, на который устанавливается Linux. Если нужно установить на один компьютер Windows и Linux, устанавливайте их по возможности на один физический жесткий диск, причем первой необходимо установить Windows. Если сперва будет установлена Linux, а затем Windows, то есть большая вероятность, что загрузчик Windows затрет «Grub».

Способ 2: Обнаружение раздела Windows

Если переустановка Windows 10 по какой-то причине невозможна, попробуйте обнаружить ее из среды Linux и добавить в загрузчик последней.

  1. Определите в Linux название раздела, на который установлена Windows. Получить сведения о дисках и разделах в Linux можно как из «Терминала», так и с помощью штатного приложения «Дисковая утилита». Скопируйте или запомните название устройства. Например, это будет «/dev/sda1».
  2. grub не видит Windows 10.1

  3. Откройте «Терминал» и примонтируйте раздел с Windows 10, для чего выполните команду sudo mount -t ntfs-3g -o ro /dev/sda1, где /dev/sda1 — полученный на предыдущем этапе путь к тому с Windows.
  4. Чтобы обнаружить Windows 10, выполните тут же в «Терминале» команду sudo os-prober.
  5. grub не видит Windows 10.2

  6. В случае успешного обнаружения Windows обновите конфигурацию «Grub» командой sudo update-grub либо же sudo grub2-mkconfig -o /boot/grub/grub.cfg.
  7. grub не видит Windows 10.3

Способ 3: Ручное добавление загрузчика

При использовании первого способа вероятность сходу обнаружить и прописать Windows 10 в линуксовый загрузчик довольно невелика. Более сложным, но и более эффективным способом восстановления записи Windows 10 в загрузочном меню Grub является ручное добавление. Способ универсальный, использовать его можно не только при потере Windows 10, но и других операционных систем Windows.

  1. Узнайте название раздела с Windows как было показано в первом пункте предыдущего способа.
  2. Определите UUID раздела, на котором установлена Windows 10, для чего выполните в «Терминале» команду blkid /dev/sda1, где /dev/sda1 — название раздела с Windows.
  3. grub не видит Windows 10.4

  4. Откройте любым текстовым редактором файл /etc/grub.d/40_custom и вставьте в него следующий код, где XXXXXXXXXXXXXXXX — полученный на предыдущем шаге UUID:

    menuentry "Windows 10" {
    insmod ntfs
    set root='(hd0,1)'
    search --no-floppy --fs-uuid --set XXXXXXXXXXXXXXXX
    chainloader +1
    }
    .
    Сохраните файл.

  5. grub не видит Windows 10.5

  6. Обновите конфигурацию Grub командой sudo update-grub, перезагрузите компьютер и посмотрите, появилась ли Windows в загрузочном меню Grub.

Если восстановить/добавить запись Windows 10 в загрузочное меню «Grub» не удалось, проверьте, не удален ли на диске служебный 100 МБ NTFS-раздел с загрузочными файлами. Если удален, можно будет попробовать его восстановить, но будет гораздо проще переустановить Windows и Linux. В том случае, когда используется «Grub 2» на UEFI, попробуйте включить в BIOS режим «Legacy».

Наша группа в TelegramПолезные советы и помощь

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Не удалось зарегистрировать пакет windows 11
  • Почему ноутбук не видит аирподсы windows 10
  • Silent storm как запустить на windows 10
  • Как сделать свою заставку для windows 10
  • Утилиты для тонкой настройки windows 10