Grub: Selecting windows loops back to grub

Hello,
I just installed Manjaro Cinnamon on an old computer that could not run on Windows 10 properly. Everything went well Linux-wise, and I could “increase” the speed of the computer (on Windows, even opening the start menu was a challenge).
However, the person using the computer needs to have access to Windows from time to time. And here comes my problem:
When selecting Windows from GRUB, the screen goes black, then loops back to GRUB selection, as if I never selected Windows.

After some research on the Internet, I found out that I may have messed up the Windows Bootloader when installing Manjaro:

  • The Windows bootloader is located on /dev/sda1, and as I did with my PC, I installed GRUB on the same partition (and put the /boot there).
  • I also encountered something that was not there when installing on my PC: a line below the selection of partitions (I do the partitionning myself) about where to install the boot loader. I modified the default line from /dev/sda to /dev/sda1 and I think I should not have.

Do you know in which step I messed up? How do I repair the Windows bootloader ?

Please note that the computer I installed Manjaro on seems to not have EFI/UEFI.

Hello @Diamondemon :wink:

Could you provided more information?

lsblk --fs
sudo parted -l
cat /etc/fstab
test -d /sys/firmware/efi && echo efi || echo bios
efibootmgr -v

First thoughts:

  1. Since it is not UEFI, then /dev/sda1 is not a fat32 formatted efi partition. So I assume it was some sort of system partition of Windows?
  2. On a BIOS Setup only 1 Bootloader can be targeted per drive. So Grub would overwrite the MBR and boot Windows.
  3. If windows is installed as UEFI and Manjaro as BIOS, then Grub can only find BIOS Bootloaders.

Hi @megavolt

You are right, it is a “system-reserved” partition on ntfs.

If Grub overwrote the MBR, how do I boot to Windows now? Do I have to remove grub, repair the MBR, then create a new partition for grub?

I think I have no UEFI installation on Windows, the computer is an old Windows 7 updated to Win10.

Here is what every command returns to me. I modified fstab to permanently mount the Windows partition to make acess to the files easier.

[~]$ lsblk --fs
NAME FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
fd0                                                                         
sda                                                                         
├─sda1
│    ntfs         Réservé au système
│                       3A4DD86025C7C6D8                       48,7M    92% /boot
├─sda2
│    ntfs               4340B5CFC12F85FC                       26,5G    73% /mnt/Windows
├─sda3
│    ntfs               66242B22242AF529                                    
├─sda4
│                                                                           
├─sda5
│    ext4   1.0   Linux /
│                       e9fb4db1-ff4a-40a6-8a42-8f97b0f63446   19,5G    28% /
├─sda6
│    ext4   1.0   Linux /home
│                       40d2b66d-80ac-4f84-ae67-660f6207d2dc   15,6G     6% /home
└─sda7
     swap   1           c9bd8a14-c205-4fd6-a8c9-901d2487ae89                
sdc                                                                         
sdd                                                                         
sde                                                                         
sdf                                                                         
sr0                                                                         



[~]$ sudo parted -l
Modèle : ATA ST3160811AS (scsi)
Disque /dev/sda : 160GB
Taille des secteurs (logiques/physiques) : 512B/512B
Table de partitions : msdos
Drapeaux de disque : 

Numéro  Début   Fin    Taille  Type      Système de fichiers  Drapeaux
 1      1049kB  608MB  607MB   primary   ntfs                 démarrage
 2      608MB   106GB  105GB   primary   ntfs
 4      106GB   159GB  53,7GB  extended
 5      106GB   138GB  32,2GB  logical   ext4
 6      138GB   157GB  19,3GB  logical   ext4
 7      157GB   159GB  2147MB  logical   linux-swap(v1)
 3      159GB   160GB  555MB   primary   ntfs                 msftres



[~]$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=3A4DD86025C7C6D8                     /boot          ntfs    defaults,noatime 0 2
UUID=e9fb4db1-ff4a-40a6-8a42-8f97b0f63446 /              ext4    defaults,noatime 0 1
UUID=40d2b66d-80ac-4f84-ae67-660f6207d2dc /home          ext4    defaults,noatime 0 2
UUID=4340B5CFC12F85FC                     /mnt/Windows   ntfs    defaults,noatime 0 0



[~]$ test -d /sys/firmware/efi && echo efi || echo bios
bios



[~]$ efibootmgr -v
EFI variables are not supported on this system.

Ok I see where problem is… you mixed BIOS and UEFI Setups. While its true that on UEFI Setups Windows and Linux can share one Partition, since it is Fat32, that isn’t the case for BIOS.

/boot cannot be an NTFS partition. I wonder why it works :smiley: (Nice hack xD)

So let me explain… What you need on a BIOS Setup is at least 1 partition. Thats all. And this partition have to be mounted to /. You messed this installation up by using sda1 as /boot. This partition should be only used by windows.

So ok… how to fix this…

  1. Boot into Manjaro (you said this works)
  2. then remove the line at the file /etc/fstab:
UUID=3A4DD86025C7C6D8                     /boot          ntfs    defaults,noatime 0 2

and run

sudo umount /dev/sda1
  1. Now reinstall grub:
sudo grub-install --force --target=i386-pc --recheck --boot-directory=/boot /dev/sda
  1. Recreate initramfs:
sudo mkinitcpio -P
  1. Recreate the menu
sudo grub-mkconfig -o /boot/grub/grub.cfg

Now it should boot Manjaro from sda5.

About Windows: Well you can hope that you don’t mess up its bootloader, otherwise you have recreate the bootloader and then reinstall grub again. On the web are tons of information of how to recreate the windows bootloader from the setup disk via commandline.

I don’t see any evidence for this, for me this looks like a clean BIOS setup.

Actually, as proven by OP - it can. :stuck_out_tongue_winking_eye:

@Diamondemon, when assigning sda1 as /boot partition you overwrote the Windoze boot partition. You need a Windoze recovery media to recreate the original Windoze partition. Unfortunately, afterwards Manjaro won’t work anymore as currently /boot is located there. This can be fixed by removing the fstab entry for /boot, chroot into Manjaro and restore the boot loader and all other files in /boot. All not very simple for a newbie, it’s probably easier for you to backup and start from the scratch. For a BIOS booted system no /boot partition is needed, if you would have avoided this assignement during Manjaro’s installation you would have had a working system incl. dual boot into Windoze.

I did the commands, struggled a bit because I rebooted without doing all the commands (SuperGrub2Disk saved me), and now I have a Grub on sda5, that boots Manjaro fine… and that when clicking on Windows… Goes to the old grub on /dev/sda1.

@megavolt , @Wollie can I just delete grub files on /dev/sda1? Or do I have to create a Windows recovery media in order to repair Windows’ bootloader, which I absolutely do not know how to do, I could not find something that sounded right.

I also read that I may be able to repair the Windows MBR from linux with a specific package, but the tutorial did not seem to be up to date, and that was for Ubuntu anyway.

Yes, since boot files are now on sda5. No idea if you have to recreate the boot files on sda1 for windows. If grub has overwritten files, then you have to.

First time I heard about that… how should linux create the windows bootloader? I mean not the MBR…

In a BIOS /msdos system no need to repair MBR as this is written by grub. The boot partition is what is most likely lost.

I did that, now selecting Windows goes for grub rescue mode. I think I doomed it.

It looked like someone created a tool to do so.

So how do I get it back? Do I have to install the whole Windows with an installation liveUSB?

Here: Let Me DuckDuckGo That For You - LMDDGTFY

What a beautiful tool O.O

Here is the guide I found about repairing from Linux:

Well, it fixes the mbr, but does not recreate the bootloader…

Okay thanks for the info.

The problem is, how to use bootrec since I cannot boot on Windows at all? And I did not find how to have command prompt with the Windows 10 installation media given on the official website:

https://www.microsoft.com/en-us/software-download/windows10

I tried with bootrec, I fixed the mbr but that’s not what I should have done, it seems. However, it did not repair my windows boot.
And guess what:

bootrec /fixboot

gives me “access is denied”. That’s really preposterous for a rescue tool to have denied access. I have to start from scratch to recreate the boot partition.

I could bypass this by wiping /dev/sda1 clean and reinstalling windows boot files on it. I then had to use superGrub2Disk in order to access Manjaro.
However, it seems that now I have a problem when switching to manjaro after Windows:

Manjaro gets stuck on the textual loading screen. This seems to be fixed when rebooting the PC, but the problem occurs every time I switch after Windows.

After looking up the internet, it turns out that the problem is the IDE/RAID/AHCI config in the BIOS setup. But I cannot change it so I may be in some kind of trouble here if launching Windows prevents Manjaro from booting properly on next time…
Any clue?

Have you switched of the Fast boot option in Windoze?

Just go into Settings > Power & Sleep > Choose what power button does > Shut down setting > uncheck the Turn on fast startup > save change.

I does not seem to change anything.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.