Grub2 add windows 10

Время на прочтение9 мин

Количество просмотров128K

Наверняка почти у каждого пользователя ОС Linux и ОС Windows, а я имею в виду именно тех, у кого, в силу ряда причин, установлены обе системы, время от времени возникал вопрос: «А нельзя ли, черт возьми, придумать способ, с помощью которого можно было бы устанавливать эти системы в произвольном порядке? Без порчи настроек загрузчика?» Ведь если ставим сначала Windows а потом Linux всё хорошо — линуксовый загрузчик (например GRUB) обычно подхватывает bootmgr. Если ставить в обратном порядке то увы. Даже с использованием GPT + EFI. В случае с EFI нет опасности перезаписи MBR, зато таки есть один нюанс, который лично мне не нравится — установщик Windows в режиме EFI хоть и не перезаписывает сектора диска своим кодом, но зато переопределяет NVRAM, подсовывая туда путь к своему загрузчику. Так что функционал GBUB всё равно приходится восстанавливать. В настройках штатного установщика нет опций для кастомизации процесса установки загрузчика. А что если… не использовать стандартный установщик?! Ну, или почти не использовать…

И такой способ есть. И основан он на технологии установки Windows, которую мы имеем в её дистрибутивах начиная с «семерки». Способ работает для случая Windows версий 7/8/8.1/10, как в случае с MBR + BIOS системы, так в случае с EFI + GPT. Установить систему можно как в раздел HDD, так и на VHD. При этом функционал установщика нужен нам в общем-то для запуска программы настройки BCD-хранилища конфигурации загрузчика. Вместо установочного диска можно использовать загрузочный носитель на основе WinPE. Если бы утилитам bcdedit.exe и BootICE была *nix альтернатива, весь процесс развертывания системы можно было бы вообще выполнить в среде Linux.

Предположим у вас имеется компьютер, с установленным на HDD загрузчиком GRUB2 и свободным разделом, отформатированном в NTFS. Устанавливать будем Windows 7 Ultimate SP1. Для этого потребуются:

  1. Установочный диск с виндой
  2. Чистая флешка объемом >= 4 Gb
  3. Архиватор 7-zip соответствующей разрядности
  4. Утилита BootICE, желательна, но совершенно не обязательна, можно обойтись и bcdedit.exe, входящим в дистрибутив винды

1. Создаем загрузочную флешку

Дело в том, что семерка не хочет устанавливаться в EFI-режиме с DVD. Вот не хочет и всё. К тому же, на установочном носителе нам понадобятся дополнительные утилиты, которые туда надо поместить, а в случае с флешкой это несколько проще, чем в случае с DVD.

Монтируем установочный образ с виндой, допустим он лежит у нас в /home/$USER/install с именем win7-setup.iso

$ mkdir ~/iso
$ sudo mount -t udf ~/install/win7-setup.iso ~/iso

Вставляем флешку в USB-порт. Допустим, она получила имя устройства /dev/sdb. Выполним её разметку в формате MBR

$ sudo fdisk /dev/sdb

Создем на флешке один единственный раздел. После чего форматируем её в FAT
$ sudo mkfs.vfat /dev/sdb1

Копируем содержимое дистрибутива винды на флешку
$ mkdir /tmp/flash
$ sudo mount /dev/sdb1 /tmp/flash -o uid=1000,gid=100,fmask=113,dmask=002
$ cp -rv ~/iso/* /tmp/flash/

Скопируем конфиги EFI-загрузчика на уровень выше

$ cp -rv ~/tmp/flash/efi/microsoft/* ~/tmp/flash/efi/

Теперь нам нужен EFI-загрузчик винды. Его придется выцарапать из дистрибутива. Это легко сделать с помощью архиватора 7-zip, который имеется в репозитории extra/p7zip. Все содержимое дистрибутива винды сжато в образ wim-формата находится на установочном DVD в файле source/install.wim. Обычно этот образ имеет следующую структуру

В каталогах с именами в виде цифр 1-4 находятся разные редакции винды. Чтобы выбрать нужную надо посмотреть внутрь файла с именем [1].xml. Распакуем его в /tmp

$ cd /tmp
$ 7z e ~/iso/sources/install.wim \[1\].xml

и посмотрим с помощью какого-нибудь браузера, ибо в текстовом редакторе он выглядит ужасно, а специального редактора xml у меня в наличии не оказалось. Каждую редакцию винды описывают структурой вида

где нода EDITIONID указывает на редакцию. Параметр INDEX — как раз номер каталога, в котором валяется нужная редакция. Итак, мне нужна Ultimate, а это индекс 4. Соответсвенно выковыриваем загрузчик оттуда

$ 7z e ~/iso/sources/install.wim 4/Windows/Boot/EFI/bootmgfw.efi

Оки, теперь перенесем полученный файл на флешку

$ mv bootmgfwm.efi /tmp/flash/efi/boot/bootx64.efi

Порядок, теперь у нас в наличии загрузочная флешка для установки винды. Теперь добавим на неё необходимые для установки утилиты — виндозную версию архиватора 7-zip и утилиту BootICE. Архиватор качаем с официального сайта и распаковываем на флешку в каталог utils

$ mkdir -p /tmp/flash/utils/7-Zip/
$ cd /tmp/flash/utils/7-Zip/
$ 7z x ~/downloads/7z1602-x64.exe

Туда же помещаем и bootice

$ cp ~/install/BOOTICEx64.exe /tmp/flash/utils

Уф, всё, отмонтируем флешку
$ cd ~
$ sudo umount /tmp/flash/

Перезагружаемся. Если у вас система с EFI и съемные диски стоят в приоритете загрузки, то компьютер загрузится в установку винды автоматом. Если же появилось таки меню GRUB, ничего страшного, жмем «С» и в консоли набиваем команду exit. Вас вывалит в меню EFI, где выбираем загрузку с флешки. Если же ваша система с BIOS, то тут чуть сложнее, ибо мы не стали заморачиваться с настройкой MBR на флешке. Тогда в консоли GRUB даем команду ls — появится список всех дисков и разделов. Находим нашу флешку, она отобразится в виде (hdX, msdosY), где X, Y — номер диска и раздела соответственно. Теперь вбиваем в консоли команды

grub> set root=hdX,Y
grub> ntldr /bootmgr
grub> boot

Начнется загрузка установщика винды. Он то загрузится, но нам он и не нужен — мы всё будем делать руками. Чтобы стало понятно, что к чему, придется рассмотреть некоторую теорию

2. О развертывании Windows из WIM-образа и капризном нраве Sysprep

Начиная с семерки установка Windows заключается в следующих этапах

  1. Разметка диска в соответствии с архитектурой системы инициализации оборудования. Если BIOS — установщик размечает диск в MBR. При наличии активной EFI — разметка будет GPT.
  2. Распаковка образа install.wim в выбранный для установки раздел
  3. Установка загрузчика и перезагрузка
  4. Инициализация оборудования. Ребут
  5. Локализация, ввод ключа, окончание настройки системы

Это стандартный путь. У нас же диск уже размечен. И нам не нужна автоматическая установка загрузчика — мы поставим его вручную. Разметка диска должна удовлетворять следующим требованиям

  • Если система с EFI на диске должен присутствовать FAT-раздел с типом 0xEF. Если у нас уже установлен линукс с EFI-загрузчиком, то таковой раздел уже имеется
  • Если система с BIOS, то раздел, в котором располагается загрузчик, а это наш NTFS-раздел должен быть активным. Это очень важно! Почему, будет объяснено ниже.

Таким образом, перед распаковкой системы мы должны убедится в том, что перечисленные требования выполнены. После того, как мы распакуем все файл системы и установим загрузчик, система перезагрузиться. После перезагрузки запустится утилита Sysprep, среди прочего настраивающая оборудования и проверяющая конфигурацию системы. Так вот, если в режиме EFI Sysprep не найдет загрузчик и его конфигурацию в EFI-разделе по пути EFI/microsof/boot, а в системе с BIOS каталог \Boot и bootmgr будут лежать в неактивном разделе, то Sysprep завершится с ошибкой sysprep generalize error, а в лог, расположенный по адресу \Windows\Panther\sysperr.log выплюнет что-то похожее на

2015-03-11 16:55:42, Error [0x0e00b3] TOOL Sysprep_Specialize_Bcd: There was an error opening the system store. Status=[0xC0000098]
2015-03-11 16:55:42, Error [0x0f0082] SYSPRP LaunchDll:Failure occurred while executing 'c:\Windows\System32\spbcd.dll,Sysprep_Specialize_Bcd', returned error code 1006
2015-03-11 16:55:42, Error [0x060435] IBS Callback_Specialize: An error occurred while either deciding if we need to specialize or while specializing; dwRet = 0x3ee

и никакие танцы с бубном нам уже не помогут. Винда требует, чтобы загручик лежал в загрузочном разделе и точка. В случае с BIOS просто делаем активным раздел NTFS в котором лежит винда и туда же кладем и загрузчик. Грузится будем всё равно с помощью GRUB, а ему все равно, какой раздел будет активным. В случае с EFI загрузчик придется положить рядом с GRUB в EFI-разделе.

3. Распаковка системы

Итак, определимся, куда мы хотим ставить винду. Можно поставить в NTFS-раздел, а можно и в VHD-диск. Это уж как вам хочется. Я буду показывать процесс на примере с виртуальной машиной EFI, имеющей следующую разметку

The protective MBR's 0xEE partition is oversized! Auto-repairing.

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/loop1: 104857600 sectors, 50.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 0D217C93-6699-435A-9BBB-61DFAA6F30B7
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 104857566
Partitions will be aligned on 2048-sector boundaries
Total free space is 4029 sectors (2.0 MiB)

Number Start (sector) End (sector) Size Code Name
1 2048 206847 100.0 MiB EF00 EFI system partition
2 206848 104855551 49.9 GiB 0700 Basic data partition

На этом диске нет линукса, установлен только GRUB в раздел с EFI. Если мы ставим систему непосредственно в NTFS-раздел, то загружаемся с флешки, дожидаемся запуска программы установки и жмем Shift + F10, чтобы вызвать консоль. Запускаем утилиту diskpart и смотрим список подключенных томов

X:\sources> diskpart
DISKPART> list vol

Видим, что флешка (объемом 8 Гб) подключена как диск C:, а раздел для установки вовсе не смонтирован. Непорядок. Делаем так

DISKPART> sel vol 3
DISKPART> remove
DISKPART> assign letter=E
DISKPART> sel vol 1
DISKPART> assign letter=C
DISKPART> list vol
DISKPART> sel vol 2
DISKPART> assign letter=F

Вот теперь порядок, диск на который будем ставить винду стал диском C:, флешка — диском E:, а EFI-раздел — диском F:

Если же мы хотим поставить систему на VHD, то делаем так

DISKPART> sel vol 3
DISKPART> remove
DISKPART> assign letter=E
DISKPART> sel vol 1
DISKPART> assign letter=G
DISKPART> exit

Для порядка создаем каталог с образами
X:\sources> md G:\vhd
X:\sources> diskpart

Создаем виртуальный диск, создаем на нем разметку GPT и раздел NTFS и монтируем его к C:

DISKPART> create vdisk file="G:\vhd\win7.vhd" maximum=25600 type=fixed
DISKPART> attach vdisk
DISKPART> clean
DISKPART> convert gpt
DISKPART> create part primary
DISKPART> format fs=ntfs quick
DISKPART> assign letter=C

EFI-раздел монтируем к F:

DISKPART> sel vol 2
DISKPART> assign letter=F

Получаем такую картину

Очень важно! Убеждаемся в том, что EFI-раздел отформатирован именно в FAT, а не в FAT32. Иначе Sysprep не простит нам этой ошибки. Если на компе уже есть линукс, то настройки будут верны.

Теперь распаковываем дистрибутив на диск C:

X:\sources> E:
E:\> utils\7-Zip\7zFM.exe

Откроется GUI архиватора 7-zip. В нем открываем каталог E:\sources, находим там файл install.wim

Правой кнопкой на этом файле вызываем контектстное меню и переходим по 7-zip -> Открыть архив. Появится содержимое образа.

Лезем в папку 4 — там лежит Ultimate

Выделяем всё Ctrl + A и жмем кнопку «Извлечь». Появится окно, где нам предложат указать путь распаковки

Указываем корень диска C: и жмем ОК.

Ну и теперь, как говорится: «Откиньтесь на спинку кресла и…»

4. Установка и настройка загрузчика

Итак, после некоторого время ожидания распаковка окончена. И вот тут, вот в этом месте винда обчно делает бяку, а именно портит MBR или перенастраивает NVRAM. Но мы не дадим ей этого сделать — мы установим загрузчик вручную.

В случае с EFI, переходим на раздел EFI, смонтированный к F: и создаем необходимые пути и копируем файлы загрузчика

E:\> F:
F:\> mkdir EFI\microsoft\boot
F:\> xcopy C:\Windows\Boot\EFI\* F:\EFI\microsoft\boot /s /e
F:\> mkdir EFI\microsoft\boot\Fonts
F:\> xcopy C:\Windows\Boot\Fonts\* F:\EFI\microsoft\boot\Fonts\ /s /e
F:\> copy C:\Windows\System32\config\BCD-Template F:\EFI\microsoft\boot\BCD

Отлично, загрузчик скопирован. Теперь настроим его

F:\> E:\utils\BOOTICEx64.exe

Открываем файл F:\EFI\Microsoft\Boot\BCD. В случае установки на раздел, его параметры задаются так

Если же мы устанавливали систему на VHD, то настройки будут такими

Важно! Имя вторичного загрузчика для EFI-системы winload.efi, для BIOS-системы — winload.exe.

В случае, если мы устанавливаем BIOS-систему установка загрузчика будет выглядеть так

F:\> mkdir C:\Boot
F:\> xcopy C:\Windows\Boot\PCAT\* C:\Boot /s /e
F:\> mkdir C:\Boot\Fonts
F:\> xcopy C:\Windows\Boot\Fonts\* C:\Boot\Fonts /s /e
F:\> copy C:\Boot\bootmgr C:\bootmgr
F:\> copy C:\Windows\System32\config\BCD-Template C:\Boot\BCD

Важно! Раздел, смонтированный к C: (там где размещен загрузчик) обязан быть активным! Убедитесь в этом перед перезагрузкой!

Настройку выполняем так же точно, используя BootICE.

Ну, вроде все. Закрываем все окна и идем в ребут. Флешку можно вытащить из компа.

5. Скрестим пальцы да вознесем молитвы тебе, о Великий и Ужасный Sysprep…!

GRUB у нас еще не настроен пункта для винды в меню нет. Как только появится меню GRUB жмем «C». В консоли набираем

grub> set root=hdX,Y
grub> chainloader /EFI/Microsoft/Boot/bootmgfw.efi
grub> boot

X, Y — соответственно диск и раздел, где лежит загрузчик. Это в случае EFI. В случае с BIOS делаем так

grub> set root=hdX,Y
grub> ntldr /bootmgr
grub> boot

X, Y — диск и раздел с NTFS. Там где распакована винда и лежит её загрузчик.

В режиме EFI вместо логотипа винды я увидел черный экран, так как не нашел в дистрибутиве билиотеки bootres.dll, которую надо поместить в папку EFI\Mictosoft\Boot\Resourses. В случае с BIOS всё в порядке — знакомая эмблема «семерки». А потом в обоих случаях увидим это

Это работает Sysprep. На 57% моргнет экран — настраивается видяха. И если мы все сделали верно, то надпись «Применение параметров системы» повисит довольно долго, потом система сообщит, что установка будет продолжена после перезагрузки. Если мы где-то напортачили с установкой загрузчика — неправильный EFI раздел или неактивный NTFS, то тогда будет ошибка :( Но мы молодцы и у нас все получится, и после очередной перезагрузки мы увидим это

а потом, наконец вот это

Дальше все как при обычной, штатной установке.

6. Настраиваем GRUB

Обратили внимание на то, что каждый раз мы грузим систему из консоли GRUB руками. Это очень хорошо — значит ни MBR ни NVRAM не перезаписаны коварным майкрософтом. Настало время грузится в арч и добавить в меню GRUB новый пункт

menuentry 'Windows 7 Ultimate SP1 (EFI)' {

set root=hdX,Y
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

в случае EFI. Или

menuentry 'Windows 7 Ultimate SP1' {

set root=hdX,Y
ntldr /bootmgr
}

в случае BIOS. Применяем настройки GRUB и перезагружаемся и видем систему в пункте меню загрузки

после выбора которого получаем загруженную Windows

Заключение

Упреждая гнев профессиональных win-админов, скажу сразу — я знаю о DISM. Именно информация об этой системе и привела меня к описанному решению. Цель была одна — выяснить сколько нужно возможностей собственно Windows для установки Windows.

Оказалось вот что — для установки Windows её среда необходима только для одного — настройки BCD-хранилища. Всё. Остальное можно сделать из среды любой другой операционной системы.

Если написать аналог bcdedit.exe под Linux, то установить Windows можно будет с линуксового Live-носителя.

Все способы:

  • Способ 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Полезные советы и помощь

Recently I had installed Parrot OS to learn penetration & check out the features of Parrot OS. I was already using dual boot Windows10 with Ubuntu 19.10 & everything working fine till I installed the Parrot OS. My GRUB bootloader had been modified. This  remove my Windows 10 OS from grub boot menu entry. I searched google for the solution as I knew that my Windows10 OS was safe & I was able to boot Windows 10 from boot menu of BIOS(f12 key). But I wanted to add  Windows 10 to Grub bootloader. There are many many solutions out there & I am sure they are working for some specific conditions ( dual boot issue, corrupted grub , some malfunctioned configuration in GRUB). But in my case it was little different because I have installed
three OSesin single hard drive with different partitions on
GPT base harddrive.


So now I will show you how to add Windows 10 to GRUB bootloader but before doing that remember below points.

— Your Windows OS partition should be exist & you must be able to boot Windows from BIOS boot menu ( generally F12 key). see pic 1

— This guide is specifically for UEFI GPT based systems how ever you can try this on legacy BIOS MBR based system. You have to change some configuration accordingly.

— Try this guide after run os-prober utility which will auto detect the OS list in hard drive. If os-prober solve your problem then don’t need to try this guide.

-If you installed Linux (or multiple Linux distros) over Windows10

-UEFI secure mode should be disabled. see pic 1

Pic 1

Pic 1

If you comply above conditions then you are ready to go further. Now we are ready to add Windows 10 in GRUB bootloader.

— Open your default Linux distro using grub(probably first in the GRUB boot menu list

— Copy the UUID number of EFI partition which is mounted under /boot/efi . You can check that in /etc/fstab file.(see pic 3)

OR

-You can also use blkid /dev/sda8 to check the UUID number .This partition is approx 100MB in size & next to windows recovery partition, use sudo fdisk -l to find boot partition see pic 2

This is why GRUB not able to load Windows because GRUB try it to find in first partition rather then second.

How To Add Windows10 In GRUB2 Bootloader In Dual Boot

Pic 2

How To Add Windows10 In GRUB2 Bootloader In Dual Boot

Pic 3

Now open /etc/grub.d/40_custom file.

— Copy the below configuration in this file. Please dont delete any existing line. see pic 4


menuentry ‘windows 10’ {
search —fs-uuid —no-floppy —set=root $paste UUID number of boot partition here$
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi

pic 4

For MBR file system you can try


menuentry «Windows 10» —class windows —class os {
insmod ntfs
search —no-floppy —set=root —fs-uuid $your_uuid_here$
ntldr /bootmgr
}

After this just run update-grub command

Now restart your system

Bingo! you are now able to boot Windows 10 from GRUB bootloader boot list menu

Sharing if you like this post😀

After installing Ubuntu 22.04 & Ubuntu 23.10, you may found that dual- or multi-boot systems in your PC disappeared. That’s because of the change of Grub boot-loader. And, here’s the step by step guide shows you how to fix it.

Grub 2.06 disable os-prober by default

Ubuntu 22.04 uses Grub 2.06 to provide boot menu on startup, which disabled the os-prober feature by default.

Grub boot-loader uses the os-prober to find out other operating systems installed on the same machine. Since v2.06, it disables the feature by default. Because it’s a potential attack vector to execute os-prober and create boot entries automatically!

Which means, not only Ubuntu 22.04 but also the next Ubuntu 22.10 and higher, as well as other Linux default to Grub 2.06+ will not find other OSes installed on same PC out-of-the-box, until Grub changes the rule.

The solution is quite easy, as user may re-enable this feature either by manually editing the config file or using the Grub Customizer tool.

Method 1: Edit the Grub config file manually

Without installing anything, user may manually edit the config file and re-enable the feature by adding a new line.

1.) Firstly, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command:

sudo nano /etc/default/grub

The command will open ‘/etc/default/grub‘ config file via the nano command line text editor.

2.) Next, scroll down and add the new line below:

GRUB_DISALBE_OS_PROBER=”false”

If 'GRUB_DISALBE_OS_PROBER' line already exist, just change its value to 'false'

And, press Ctrl+X, type y and hit Enter to save change.

3.) Finally, apply change by running command:

sudo update-grub
For Fedora with UEFI, the command is grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Method 2: Re-enable os-prober via Grub Customizer

GRUB Customizer is removed from Ubuntu 22.04 repository due to its broken logic! The maintainer fixed the issue and publish the packages into PPA.

First, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run the commands below one by one to install Grub Customizer:

  • Add its official PPA by running command below. Type user password when it asks and hit Enter to continue:
    sudo add-apt-repository ppa:danielrichter2007/grub-customizer
  • Then update system package cache via:
    sudo apt update
  • Finally, install Grub-customizer via command:
    sudo apt install grub-customizer

After installing the graphical configuration tool for Grub boot-loader, search for and launch it from system start menu (or ‘Activities’ overview).

When it opens, navigate to “General Settings” tab, and click on “advanced settings” button. Finally, in pop-up dialog set GRUB_DISABLE_OS_PROBER (add if not exist) to false.

Finally, click on  ‘Save‘ button and done.

That’s all. Enjoy!

Grub Add Windows Boot Entry: A Step-by-Step Guide

If you’re dual-booting Windows and Linux, you may have found that the GRUB bootloader doesn’t always list Windows as an option when you start your computer. This can be a problem if you want to quickly and easily switch between operating systems.

Fortunately, it’s relatively easy to add a Windows boot entry to GRUB. In this guide, I’ll show you how to do just that. I’ll also provide some tips on troubleshooting common problems.

So, if you’re ready to learn how to add a Windows boot entry to GRUB, read on!

Column 1 Column 2 Column 3
Title Description Link
How to add a Windows boot entry to GRUB This guide will show you how to add a Windows boot entry to GRUB, the bootloader used by most Linux distributions. How to Add a Windows Boot Entry to GRUB
Troubleshooting GRUB boot problems This guide will help you troubleshoot GRUB boot problems, such as when GRUB is not showing up, or when you are unable to boot into Windows from GRUB. Troubleshooting GRUB Boot Problems


What is GRUB and why do you need it?


GRUB, which stands for GRand Unified Bootloader, is a bootloader that is used to load the operating system (OS) on a computer. It is a very versatile bootloader that can be used to boot multiple operating systems from the same computer, as well as to boot from a USB drive or CD-ROM.

GRUB is installed on the master boot record (MBR) of the hard drive, and it is the first thing that is loaded when the computer starts up. GRUB then scans the hard drive for operating systems and presents a menu from which the user can select which OS to boot.

GRUB is a very important part of the boot process, and it is essential for ensuring that the correct operating system is loaded. If GRUB is not working properly, it can prevent the computer from booting up correctly.

Adding a Windows boot entry to GRUB is a relatively simple process, but there are a few things that you need to know in order to do it correctly.

First, you need to know the location of the Windows installation files. This is usually located in the `/boot/efi` directory on the hard drive.

Second, you need to know the name of the Windows boot loader. This is usually called `bootmgfw.efi`.

Once you have this information, you can follow these steps to add a Windows boot entry to GRUB:

1. Open the GRUB configuration file. This file is located in the `/etc/grub.d/` directory.
2. Find the section that starts with `menuentry “Windows”`.
3. Add the following lines to the end of the section:

set root=(hd0,gpt2)
chainloader /EFI/Microsoft/Boot/bootmgfw.efi

4. Save the GRUB configuration file.
5. Regenerate the GRUB bootloader. This can be done by running the following command:

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

6. Reboot the computer.

Once the computer has rebooted, you should see the Windows boot entry in the GRUB menu. You can select this entry to boot into Windows.

GRUB is a powerful and versatile bootloader that can be used to boot multiple operating systems from the same computer. Adding a Windows boot entry to GRUB is a relatively simple process, and it can be done by following the steps in this guide.

Troubleshooting common problems

Here are some common problems that you may encounter when trying to add a Windows boot entry to GRUB:

  • The Windows boot entry is not showing up in the GRUB menu. This is usually caused by a missing or incorrect configuration file. To fix this, you can try reinstalling GRUB or manually editing the GRUB configuration file.
  • The Windows boot entry is not working. This can be caused by a number of factors, such as a corrupt Windows installation or a missing or incorrect driver. To fix this, you can try reinstalling Windows, updating your drivers, or using a third-party bootloader.
  • The Windows boot entry is taking too long to load. This can be caused by a number of factors, such as a slow hard drive or a large Windows installation. To fix this, you can try defragmenting your hard drive or reducing the size of your Windows installation.

If you are having trouble troubleshooting these problems, you can try asking for help on a Linux forum or mailing list.

Tips and tricks for using GRUB

Here are some tips and tricks for using GRUB:

  • To add a new boot entry, you can use the `grub-install` command. This command will install GRUB to the specified device and create a new boot entry for the specified operating system.
  • To edit a boot entry, you can use the `grub-editenv` command. This command will open the GRUB configuration file in a text editor, where you can make changes to the boot entry.
  • To delete a boot entry, you can use the `grub-remove-menuentry` command. This command will delete the specified boot entry from the GRUB menu.
  • To change the order of the boot entries, you can use the `grub-set-default` command. This command will set the specified boot entry as the default boot entry.
  • To change the timeout for the GRUB menu, you can use the `grub-set-timeout` command. This command will set the number of seconds that the GRUB menu will be displayed before automatically booting the default boot entry.

For more information on using GRUB, you can refer to the GRUB documentation.

In this article, we have shown you how to add a Windows boot entry to GRUB. We have also provided some tips and tricks for troubleshooting common problems and using GRUB. If you have any other questions about GRUB, please feel free to ask in the comments below.

Q: How do I add a Windows boot entry to GRUB?

A: To add a Windows boot entry to GRUB, follow these steps:

1. Boot into the GRUB bootloader.
2. Press the e key to edit the current boot configuration.
3. Find the line that starts with `menuentry` and contains the name of your Windows installation.
4. Add the following options to the end of the line:

options=quiet splash

5. Save the changes and exit the GRUB bootloader.

Your Windows installation should now be listed as a boot option in GRUB.

Q: What if I get an error when I try to add a Windows boot entry to GRUB?

A: There are a few possible reasons why you might get an error when trying to add a Windows boot entry to GRUB. Here are some common troubleshooting tips:

  • Make sure that you are using the correct version of GRUB for your operating system.
  • Make sure that you have the correct drivers for your Windows installation.
  • Make sure that you have added the correct options to the `menuentry` line.
  • Try booting into Windows from a recovery disk or a USB drive. This can help you identify any problems with your Windows installation.

If you are still having problems, you can try asking for help on a forum or mailing list dedicated to GRUB.

Q: How do I change the order of the boot entries in GRUB?

A: To change the order of the boot entries in GRUB, follow these steps:

1. Boot into the GRUB bootloader.
2. Press the e key to edit the current boot configuration.
3. Find the line that starts with `menuentry` and contains the name of the boot entry you want to move.
4. Use the arrow keys to move the line up or down in the list.
5. Save the changes and exit the GRUB bootloader.

Your Windows installation should now be listed in the desired order in GRUB.

Q: How do I delete a Windows boot entry from GRUB?

A: To delete a Windows boot entry from GRUB, follow these steps:

1. Boot into the GRUB bootloader.
2. Press the e key to edit the current boot configuration.
3. Find the line that starts with `menuentry` and contains the name of the Windows installation you want to delete.
4. Press the d key to delete the line.
5. Save the changes and exit the GRUB bootloader.

Your Windows installation should now be removed from GRUB.

In this blog post, we discussed how to add a Windows boot entry to GRUB. We covered the steps on how to do this on both a UEFI and BIOS system. We also provided some troubleshooting tips in case you run into any problems.

Here are the key takeaways from this blog post:

  • To add a Windows boot entry to GRUB on a UEFI system, you need to use the `efibootmgr` command.
  • To add a Windows boot entry to GRUB on a BIOS system, you need to edit the `grub.cfg` file.
  • If you are having trouble adding a Windows boot entry to GRUB, you can try the following troubleshooting tips:
  • Make sure that the Windows installation media is properly connected to your computer.
  • Make sure that the Windows boot files are located in the correct directory.
  • Make sure that the Windows boot entry is configured correctly in GRUB.

We hope this blog post has been helpful. If you have any other questions about adding a Windows boot entry to GRUB, please feel free to leave a comment below.

Author Profile

Hatch, established in 2011 by Marcus Greenwood, has evolved significantly over the years. Marcus, a seasoned developer, brought a rich background in developing both B2B and consumer software for a diverse range of organizations, including hedge funds and web agencies.

Originally, Hatch was designed to seamlessly merge content management with social networking. We observed that social functionalities were often an afterthought in CMS-driven websites and set out to change that. Hatch was built to be inherently social, ensuring a fully integrated experience for users.

Now, Hatch embarks on a new chapter. While our past was rooted in bridging technical gaps and fostering open-source collaboration, our present and future are focused on unraveling mysteries and answering a myriad of questions. We have expanded our horizons to cover an extensive array of topics and inquiries, delving into the unknown and the unexplored.

Latest entries

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

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Windows 10 реальные системные требования для комфортной работы
  • Прощание с windows 7
  • Подготовка hdd к установке windows 10
  • Разрешить доступ к местоположению на этом устройстве windows 10
  • Как ускорить быстродействие ноутбука windows 10