Как добавить windows в grub debian

Windows 10 was installed first on a non-formated disk using a non-UEFI BIOS.

Windows 10 was installed first on a non-formated disk using a non-UEFI BIOS.

A partition table (type msdos) and a partition for Windows were created manually during the installation of Windows. Windows automatically created a «System Reserved» partition (/dev/sda1) used for booting. Windows was installed into the second partition (/dev/sda2). Debian was installed into the third partition (/dev/sda3).

Problem: After running package upgrades, a GRUB entry for Windows was not added by the os-prober.
Solution: Re-enable os-prober to create a custom GRUB menu entry for Windows.

To re-enable os-prober uncomment the following line in /etc/default/grub:

#GRUB_DISABLE_OS_PROBER=false

NOTE: You will likely have to retrieve and enter your Windows volume Bitlocker key to get Win10 to continue booting after each time GRUB updates take place.

Problem: The GRUB entry created for Windows by the os-prober is wrong (e.g., has the wrong name).
Solution: Disable os-prober create a custom GRUB menu entry for Windows.

To disable os-prober add the following line to /etc/default/grub:

GRUB_DISABLE_OS_PROBER=true

Discover the UUID of the partition containing the Windows boot loader by executing the following command in terminal as root:

blkid /dev/sda1

The output will be something like this:

/dev/sda1: LABEL="System Reserved" UUID="1D584C40586B2873" TYPE="ntfs" PARTUUID="adc19fb9-33"

Use the UUID value to create a custom menu entry at the end of the /etc/grub.d/40_custom file:

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

Update grub by executing the following command in terminal as root:

update-grub

Info on menuentry syntax:

  • —class is used to group menu entries into classes. Menu themes may display different classes using different styles.

  • —no-floppy option prevents searching floppy devices, which can be slow.

  • ntldr is a new method to chainload Windows boot loader (the old one is chainload +1).

  • —hint. You may have seen other menu entries using —hint* options with the search command. In case when two or more partitions have identical IDs, this hints help to find the right one. In our case, we use UUID and it is very unlikely that several partitions on one system get identical UUIDs.

  • drivemap and parttool commands. You may have seen other menu entries using these commands. They are needed if you have more than one Windows/DOS installation on one disk.

References:

http://www.gnu.org/software/grub/manual/grub.html
http://unix.stackexchange.com/questions/115555/what-does-the-hint-option-in-grub2s-search-command-do
http://www.linuxcommand.org/man_pages/blkid8.html
https://wiki.gentoo.org/wiki/GRUB2/Chainloading#Probing

Установил Debian 6.0.5 поверх Windows XP. Не появилось меню выбора Windows в grub. Я понимаю, что здесь не форум экстрасенсов, но другой информации нет… Спрашивайте, я постараюсь ответить в краткие сроки.

Всем спасибо,после небольших танцев с бубном я сделал:
добавил Windows в /etc/grub.d/40_custom и на выходе получил:

### 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.
menuentry "Windows" {
    set root=(hd0,2)
    chainloader +1
}

Еще крупная ошибка, это забывал прописать update-grub и ставить символ «}«

задан 9 июл 2012 в 18:55

Женя Коцарев's user avatar

Женя КоцаревЖеня Коцарев

331 золотой знак1 серебряный знак8 бронзовых знаков

2

Хотя править в ручную конфиги grub не рекомендуется, все же советую это сделать, ибо меня спасло только это.

 # nano /boot/grub/grub.cfg

Далее после записей дебиан прописать что-то вроде следующего:

### BEGIN /etc/grub.d/30_os-prober ###
 menuentry "Microsoft Windows XP Professional RU (on /dev/sda1)" {
        insmod part_msdos
        insmod ntfs
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set f6209cff209cc84f
        drivemap -s (hd0) ${root}
        chainloader +1
}

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

Значение «/dev/sda1» — раздел с Windows, «f6209cff209cc84f» — это UUID этого раздела.

ответ дан 10 июл 2012 в 7:49

ave6990's user avatar

1

А вообще попробуй перегенерировать список, командой

update-grub

или

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

cheops's user avatar

cheops

19.3k29 золотых знаков42 серебряных знака137 бронзовых знаков

ответ дан 9 июл 2012 в 20:20

X-NicON's user avatar

X-NicONX-NicON

8475 серебряных знаков12 бронзовых знаков

1

Windows 10 will, for the most part, be added to grub boot menu by the os-prober automajically.

For my specific setup I wanted to completely hide grub menu and automatically boot windows unless a hotkey was pressed to boot Ubuntu. So in my specific case os-prober isn’t an option because the most important step in hiding the grub menu, which most answers I found neglect to mention, is to set the disable os-prober flag or the menu WILL be shown until os-prober completes.

It took considerably longer than I had anticipated to get right because there are so many partial answers out there but most are version dependant and can lead you astray. I spent a lot of time trying write my own grub menu entry trying use grub commands that didn’t exist like ntdlr. Another caveat is that the chainloader functions on my grub try to boot bios not efi and will not work.(Im sure I was doing something wrong?)

In the end the solution was actually simple as the scripts that make your /boot/grub/grub.cfg do most of the work for you in finding UUIDS for your boot partitions. So you can skip the fdisk and blkid steps most people mention.

So step 1 is to make sure /boot/grub/grub.cfg is current using update-grub to make .cfg file. In terminal

sudo update-grub

Step 2 is to add custom menu entries in /etc/grub.d/40_custom. Don’t waste time trying to write your own simply open /boot/grub/grub.cfg search «menuentry» and copy the automatically generated entries.

The first in the list will be ubuntu mine looks like

menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-9e66eed6-e672-49ff-a07c-afdc00809148' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root  9e66eed6-e672-49ff-a07c-afdc00809148
else
  search --no-floppy --fs-uuid --set=root 9e66eed6-e672-49ff-a07c-afdc00809148
fi
linux   /boot/vmlinuz-5.4.0-39-generic root=UUID=9e66eed6-e672-49ff-a07c-afdc00809148 ro  quiet splash $vt_handoff
initrd  /boot/initrd.img-5.4.0-39-generic

}

Windows will be similar. Copy both to /etc/grub.d/40_custom. The only change I made for Ubuntu is to add the —hotkey=key flag which will make grub boot the os associated with that hotkey.

menuentry 'Ubuntu2' --class ubuntu --class gnu-linux --class gnu --class os --hotkey=u $menuentry_id_option 'gnulinux-simple-9e66eed6-e672-49ff-a07c-afdc00809148' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root  9e66eed6-e672-49ff-a07c-afdc00809148
else
  search --no-floppy --fs-uuid --set=root 9e66eed6-e672-49ff-a07c-afdc00809148
fi
linux   /boot/vmlinuz-5.4.0-39-generic root=UUID=9e66eed6-e672-49ff-a07c-afdc00809148 ro  quiet splash $vt_handoff
initrd  /boot/initrd.img-5.4.0-39-generic

}

I use —hotkey=u here to set Ubuntu boot hotkey to u.

Then I tweaked the Windows entry, replacing $menuentry_id_option withe the grub —id flag.

menuentry "Windows 10" --class windows --class os --id windows-custom {
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root  0EAE-C882
else
  search --no-floppy --fs-uuid --set=root 0EAE-C882
fi
chainloader /EFI/Microsoft/Boot/bootmgfw.efi

}

I used —id windows-custom. Save chages to /etc/grub.d/40_custom.

Finally open /etc/default/grub and add

GRUB_DISABLE_OS_PROBER=true

change GRUB_DEFAULT=0 to GRUB_DEFAULT=windows-custom
and change GRUB_TIMEOUT=10 to your choice of timings I use 0.5 just to give myself a little extra time to hit u to boot Ubuntu after POST.

Hopefully this saves someone a bit of headache, cheers!

Для выбора и запуска операционной системы во время загрузки компьютера используется специализированная программа — загрузчик. Самый популярный загрузчик — Grub. При установке нескольких операционных систем, например, Linux поверх Windows, в меню загрузчика первой будет последняя установленная ОС.

Это не вызовет проблем у пользователей, которые пользуются Linux как основной системой, для них это даже более предпочтительный вариант. Но если вы еще новичок, и хотите использовать Linux второй системой, а Windows пока еще основной, до тех пор, пока не освоитесь, то наверное захотите чтобы первой была Windows. В этой статье мы рассмотрим как сделать загрузку Windows первой в Grub. Рассмотрим два способа: с помощью программы Grub Customizer и вручную, через файлы конфигурации загрузчика Grub.

Grub Customizer

Grub Customizer — это программа, позволяющая настраивать различные параметры загрузчика Grub. В том числе и положение и очередность пунктов загрузки. Установить программу можно из официальных репозиториев. Например, в Ubuntu нужно использовать ppa:

 sudo add-apt-repository ppa:danielrichter2007/grub-customizer
 sudo apt-get update
 sudo apt-get install grub-customizer

Для запуска программы откройте терминал (Ctrl + Alt + T) и наберите grub-customizer:

grub-customizer

Для работы программы необходимы права root, в некоторых системах возможно придется использовать такую команду:

gksu grub-customizer

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

grub

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

grub2

В меню выберите пункт Переместить вверх. Это действие нужно будет повторить несколько раз, пока Windows не будет первой в списке. Теперь будет выполняться загрузка windows по умолчанию grub.

Если потом вы захотите опустить Windows обратно вниз, есть обратное действие — Переместить вниз.

Для сохранения настроек просто нажмите кнопку Сохранить. Готово. Можете перезагружать компьютер и смотреть что получилось.

grub4

Но я хочу затронуть еще пару настроек, которые могут быть полезны. Вместо того чтобы делать загрузку Windows первой в Grub, можно изменить пункт запускаемый по умолчанию. Перейдите на вкладку Основные настройки:

grub6

Здесь для выбора пункта по умолчанию используемого по умолчанию есть список Задействовать:

grub5

Кроме того, можно загружать по умолчанию последнюю загруженную ОС, для этого есть галочка:

grub7

Не забудьте снова нажать кнопку сохранить.

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

sudo gedit /boot/grub/grub.cfg

Как правило, строки меню выглядят вот так:

menuentry имя_пункта --опции {
...
}

Например пункт Windows:

menuentry 'Windows 8 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprob
er-chain-FC324E26324DE66C' {
....
}

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

Аналогично тому как мы настраивали пункт, загружаемый по умолчанию в Grub Customizer, это можно сделать и в терминале. Откройте файл /etc/default/grub.

gksu gedit /etc/default/grub

Здесь нас интересует строчка:

GRUB_DEFAULT=0

Замените 0, на нужный пункт для загрузки, также вместо цифры можно указать имя пункта, например:

GRUB_DEFAULT="Windows 8 (loader) (on /dev/sda1)"

Посмотреть доступные пункты загрузки не открывая файл конфигурации можно командой:

sudo grep menuentry /boot/grub/grub.cfg

Еще можно настроить загрузку последней загруженной системы, для этого добавьте строчку

GRUB_SAVEDEFAULT=true

А в GRUB_DEFAULT укажите saved:

GRUB_DEFAULT=saved

Очевидным плюсом этого способа есть то, что настройки во время обновления конфигурации Grub не собьются, так как во время обновления информация берется из этого файла. Теперь давайте обновим конфигурацию и сохраним настройки командой:

grub-update

Не во всех системах работает такой вариант, поэтому можно использовать другую команду:

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

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

Creative Commons License

Статья распространяется под лицензией Creative Commons ShareAlike 4.0 при копировании материала ссылка на источник обязательна .

It looks like you’ve followed an old guide that expects Windows to use MBR partitioning.

The «invalid signature» error suggests Secure Boot is enabled. When Secure Boot is enabled, all bootloaders must be signed with a private key, and a matching public key must be included in the Secure Boot variables in the firmware NVRAM. GRUB is dutifully reading the first sector of the partition you’ve specified, but since it does not contain the appropriate Secure Boot signature, the firmware refuses to execute it.

Secure Boot requires native UEFI-style boot as a prerequisite. You may be able to disable Secure Boot on your system, but since GRUB already starts for you, there is probably no need to do that.

Your insmod part_gpt suggest you expect the disk to have a GPT-style partitioning which usually goes together with UEFI boot style, but on the other hand, set root=(hd0,msdos2) expects a MBR partition.

On my Debian system with GPT partitioning, the set root line reads: set root='hd0,gpt1'. If your system uses GPT partitioning, use the gptN partition identifiers instead of msdosN.

Also chainloader +1 tells GRUB to read the boot block from the first block of the partition; in UEFI native boot, there is no such thing. To boot Windows in UEFI mode, the set root line should point to the EFI System Partition that contains the Windows bootloader, and the chainloader line should be chainloader /EFI/Microsoft/Boot/bootmgfw.efi.

It looks like you’ve followed an old guide that expects Windows to use MBR partitioning.

The «invalid signature» error suggests Secure Boot is enabled. When Secure Boot is enabled, all bootloaders must be signed with a private key, and a matching public key must be included in the Secure Boot variables in the firmware NVRAM. GRUB is dutifully reading the first sector of the partition you’ve specified, but since it does not contain the appropriate Secure Boot signature, the firmware refuses to execute it.

Secure Boot requires native UEFI-style boot as a prerequisite. You may be able to disable Secure Boot on your system, but since GRUB already starts for you, there is probably no need to do that.

Your insmod part_gpt suggest you expect the disk to have a GPT-style partitioning which usually goes together with UEFI boot style, but on the other hand, set root=(hd0,msdos2) expects a MBR partition.

On my Debian system with GPT partitioning, the set root line reads: set root='hd0,gpt1'. If your system uses GPT partitioning, use the gptN partition identifiers instead of msdosN.

Also chainloader +1 tells GRUB to read the boot block from the first block of the partition; in UEFI native boot, there is no such thing. To boot Windows in UEFI mode, the set root line should point to the EFI System Partition that contains the Windows bootloader, and the chainloader line should be chainloader /EFI/Microsoft/Boot/bootmgfw.efi.

  1. I have installed Windows 10
  2. I have installed Linux Mint Silvia and I have chosen a device for boot loader installation — sda.
  3. There is not Windows 10 in grub menu when the system starts
  4. I have booted via Linux Mint live USB.
  5. I Do step by step https://howtoubuntu.org/how-to-repair-restore-reinstall-grub-2-with-a-ubuntu-live-cd
  6. But it still no Windows 10 in grub menu
  7. I have booted via live windows 10 USB.
  8. With restoration tools, I have chosen the command line
  9. I have fixed Mbr by console command bootrec /FixMbr
  10. Ok, windows 10 is loading by there is no Grub.
  11. I have repeated steps 4 and 5
  12. There is no result

Also, I have tried to change grub config with this answer
https://askubuntu.com/questions/661947/add-windows-10-to-grub-os-list#answer-977251 — But in this case, There is Windows 10 — but when I chose — I will recursively going to grub

And with this answer
https://askubuntu.com/questions/661947/add-windows-10-to-grub-os-list#answer-890562
I have an error message when chose Windows 10 — There is no bootmgr directory

Thanks @Kinnectus for help

Also, I have tried

sudo os-prober

And getting

/dev/sda1:FreeDOS:FreeDOS:chain
/dev/sda2:FreeDOS:FreeDOS1:chain

And then I have tried

sudo update-grub

And getting

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.10.0-38-generic
Found initrd image: /boot/initrd.img-4.10.0-38-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found FreeDOS on /dev/sda1
Found FreeDOS on /dev/sda2
done

Unfortunately — there is not Windows 10 in grub menu

Also, I have fdisk output.

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1            2048  16779263  16777216     8G  c W95 FAT32 (LBA)
/dev/sda2  *     16779264  33556479  16777216     8G  c W95 FAT32 (LBA)
/dev/sda3        33556480 770219115 736662636 351,3G  7 HPFS/NTFS/exFAT
/dev/sda4       770220030 976771071 206551042  98,5G  5 Extended
/dev/sda5       770220032 976771071 206551040  98,5G 83 Linux

Partition 4 does not start on physical sector boundary.

There is an issue.
Maybe the problem is with this issue?

Please, help me, I am stucking with this a whole day.
I completely have no idea, what am I doing wrong.

Понравилась статья? Поделить с друзьями:
  • Как добавить hyper v в windows 10 хоум
  • Как добавить беспроводную сеть на windows 10 на ноутбуке
  • Как добавить windows media center в windows 10
  • Как добавить беспроводной принтер в windows 10
  • Как добавить windows forms c visual studio 2019