How to add an item for windows into the grub menu?  [Solved]

When you run into problems installing MX Linux XFCE
Message
Author
hako
Posts: 26
Joined: Sat Oct 15, 2022 7:19 am

Re: How to add an item for windows into the grub menu?

#21 Post by hako »

I am somehow reluctant to change the partition model of the disk, because there are lots of data to backup and restore.
If I format the boot partition again to ntfs, and re-install Windows, would that work? can I then install MX in legacy mode?

User avatar
fehlix
Developer
Posts: 12875
Joined: Wed Apr 11, 2018 5:09 pm

Re: How to add an item for windows into the grub menu?

#22 Post by fehlix »

hako wrote: Sun Oct 16, 2022 5:47 am I am somehow reluctant to change the partition model of the disk, because there are lots of data to backup and restore.
If I format the boot partition again to ntfs, and re-install Windows, would that work? can I then install MX in legacy mode?
OK, First note, the MX installer would have asked whether to use WIndows System "boot" partition as ESP and would ask to confirm you selection to reformat to FAT32 to EFI System Partition.
+++EDIT+++
Note: When running the MX Installer, you would just ignore ESP and not select or create any ESP,
and install GRUB into MBR. This can be done also when booted MX LiveUSB in UEFI mode.
+++
Now what I would do ths:
First, do create a proper MX Live USB, using the tool MX Live USB Maker, which is available within the Installed system. This would than later allow you to boot into legacy BIOS mode from Live USB.
Next when done, you need to restore/recreate window System "boot" partition on sda1
by using Windows own tools:
Something like:
* Create Win10 Boot USB (using woeUSB)
* boot into Windows provided feature to run those win-tools like fixmbr bootrec ...
lots of details on the web how to do this.
+++EDIT+++
Potentially, before booting into Windows Repair tools, do reformat ESP on sda1 to NTFS
using Gparted and also remove "esp" flag but keep the "boot" flag ,
to avoid Windows may be confused about an existing ESP.
You would, still be able to boot into MX Linux, even without any ESP using MX Boot Rescue from LiveUSB,
probably in both boot modes UEFI and BIOS, b/c you already created the GRUB efi loader (this was done
during installation) and the GRUB mbr loader (this was done when running grub-install --target=i386 /dev/sda
+++

After windows boot was restored you would now be able to recreate "bios" GRUB loader
in order to provide BIOS booting into existing MX Linux ( where you have already create the grub-install boot loader files) or just re-run from LiveUSB "MX Boot Repair" and create MBR-grub loader. + regenerate GRUB menu.
Or alternatively boot into installed MX Linux with MX LiveUSB Rescue-Boot, search for GRUB menu, and
install GRUB to mbr with "sudo grub-install --target=i386 /dev/sda"
followed by "sudo update-grub".
This would than allow you to boot into both Windows and MX Linux from GRUB.

hako
Posts: 26
Joined: Sat Oct 15, 2022 7:19 am

Re: How to add an item for windows into the grub menu?

#23 Post by hako »

Things are getting adventurous...
MX Live USB: used the MX Live USB Maker (v2.41.18) on the installed MX-21.1 Vers. 22.02.02. It stopped at 99%, another attempt lead to error. MX does not boot from this stick, Uefi: GRUB command line, legacy: black screen.

MX Updater signalled available upgrade: During upgrade Windows was found on sda2, but MX boots to grub rescue after error msg 'grub_disk_native_sectors' not_found. Probably because I only checked sda5 (the boot partition of MX), and not sda1 (the efi partition).
Which commands to use?

User avatar
fehlix
Developer
Posts: 12875
Joined: Wed Apr 11, 2018 5:09 pm

Re: How to add an item for windows into the grub menu?

#24 Post by fehlix »

hako wrote: Sun Oct 16, 2022 9:14 am Things are getting adventurous...
MX Live USB: used the MX Live USB Maker (v2.41.18) on the installed MX-21.1 Vers. 22.02.02. It stopped at 99%, another attempt lead to error. MX does not boot from this stick, Uefi: GRUB command line, legacy: black screen.

MX Updater signalled available upgrade: During upgrade Windows was found on sda2, but MX boots to grub rescue after error msg 'grub_disk_native_sectors' not_found. Probably because I only checked sda5 (the boot partition of MX), and not sda1 (the efi partition).
Which commands to use?
if you still booting in UEFI, keep the boot/esp falsg at ESP
Depends, in legacy boot mode, you should mark sda2 (windows as boot)
GRUB does not need a boot flags, that only for windows or BIOS-boot

Reboot to the Installed, or use LiveUSB chroot rescue:
and to make sure noting is hanging:

Code: Select all

sudo dpkg --configure -a
sudo apt update
sudo apt full-upgrade
and
sudo grub-install --target=i386-pc /dev/sda

hako
Posts: 26
Joined: Sat Oct 15, 2022 7:19 am

Re: How to add an item for windows into the grub menu?

#25 Post by hako »

Followed your suggestions, cleared the boot flag in sda1, set it in sda2 (Windows partition). All updates finished.
Now, it is booting in legacy mode into MX-21.2.1 version 22.08.02. I also succeeded to make a live USB stick which can boot in legacy mode.
The Boot menu has also has Windows 10, but it starts to boot (shows the Windows flag), but then stops with error (inaccessible boot device) and reboots.

User avatar
fehlix
Developer
Posts: 12875
Joined: Wed Apr 11, 2018 5:09 pm

Re: How to add an item for windows into the grub menu?

#26 Post by fehlix »

hako wrote: Sun Oct 16, 2022 3:20 pm Followed your suggestions, cleared the boot flag in sda1, set it in sda2 (Windows partition). All updates finished.
Now, it is booting in legacy mode into MX-21.2.1 version 22.08.02. I also succeeded to make a live USB stick which can boot in legacy mode.
The Boot menu has also has Windows 10, but it starts to boot (shows the Windows flag), but then stops with error (inaccessible boot device) and reboots.
OK, now, if not done already, do test first that you can boot with help MX Live
in legacy BIOS boot mode
-> Switch to GRUB
->Boot Rescue
and try both to find
-> GRUB boot loader
and
-> GRUB menus
If both do let you boot into MX Linux, fine.

Now, you need to "repair" Windows own boot loader,
which originally were located on sda1.
Simplest, do prepare a Windows 10 BootUSB / BootDVD
and repair windows boot loader with Wndows tools,
which would probably re-populate sda1 and also the MBR.

When done check it boots into WIndows.
If OK, boot again with MX LiveUSB using Boot Rescue into installed MX Linux,
and run from terminal command line again:

Code: Select all

sudo grub-install --target=i386-pc /dev/sda 
(where sda is your internal drive - check the name "sda" with lsblk -f )
and also

Code: Select all

sudo update-grub
alternatively instead from terminal command line
use MX Boot Repair to "install" GRUB and regenerate "grub config" (the grub menu)

hako
Posts: 26
Joined: Sat Oct 15, 2022 7:19 am

Re: How to add an item for windows into the grub menu?

#27 Post by hako »

Stuck in repairing the windows boot loader. I have a USB stick to install Windows. When I boot from this stick (only Uefi works), I choose repair, then advanced: Start-up Repair did not succeed. Command prompt, changing to C:
bcdboot c:\windows - failure when attempting to copy boot files
bootrec /fixmbr - runs w/o error
bootrec /fixboot - Element not found
bootrec /rebuildbcd - finds windows, but then Element not found

What can I try?

Huckleberry Finn

Re: How to add an item for windows into the grub menu?

#28 Post by Huckleberry Finn »

Code: Select all

diskpart

Code: Select all

select disk 0

Code: Select all

list volume
Note the letter of your installation usb (press Enter after each and replace D: with the letter of your usb)

Code: Select all

exit

Code: Select all

D:

Code: Select all

cd boot

Code: Select all

dir

Code: Select all

bootsect.exe /nt60 SYS /mbr /force

Huckleberry Finn

Re: How to add an item for windows into the grub menu?

#29 Post by Huckleberry Finn »

... However this will write the NT bootloader in MBR (as you could also do with dd on MX) (but the main problem is that you lost the Windows' system partition on sda1, you need to re-create that when repairing). (On Windows 7 there was no such thing, it was simpler with just one (the main) partition.. but on Win. 10 ... )

hako
Posts: 26
Joined: Sat Oct 15, 2022 7:19 am

Re: How to add an item for windows into the grub menu?

#30 Post by hako »

"bootsect.exe /nt60 SYS /mbr /force": The system partition was not found: The requested system device cannot be found.

My sda1 is ntfs with no flags.
What to do?

Post Reply

Return to “Installation”