LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 07-19-2020, 10:14 AM   #1
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
Question SOLVED: grub detecting 2 windows10, only one really works


Hi there.

I had an issue in windows 10 and I had to re-install it. Not a big deal.
After reinstalling it, I boot into a live usb and follow the proper procedure to reinstall grub back to /dev/sda. Everything is fine here too.
Now grub menu properly boots on 'opensuse tumbleweed' (sda4) and on 'Windows 10 (on /dev/sda2)', as expected.

What bothers me is there is now 2 entries for windows 10, and this another one didn't work, really. If selected it brings a windows fix mode or something.
This extra wrong menu entry is related to the boot windows auxiliary partition (/dev/sda1) which is needed to windows to boot, but it shouldn't be in the grub menu.

Before windows re-install, grub used to have only one windows 10 menu entry (/dev/sda2).

How can I rid of this extra menu entry ?
I guess (just a guess) some left over file from previous installation is confusing os_prober somehow. But I have no idea what it is or how to fix.

Code:
kimera:/home/miguel # grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/vmlinuz-5.7.7-1-default
Found initrd image: /boot/initrd-5.7.7-1-default
Found linux image: /boot/vmlinuz-5.7.5-1-default
Found initrd image: /boot/initrd-5.7.5-1-default
Found Windows 10 on /dev/sda1
Found Windows 10 on /dev/sda2
done
kimera:/home/miguel #
section of /boot/grub/grub.cfg created above only showing the os_prober_section

Code:
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 10 (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-CEFE7B31FE7B1147' {
        savedefault
        insmod part_msdos
        insmod ntfs
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  CEFE7B31FE7B1147
        else
          search --no-floppy --fs-uuid --set=root CEFE7B31FE7B1147
        fi
        parttool ${root} hidden-
        drivemap -s (hd0) ${root}
        chainloader +1
}
menuentry 'Windows 10 (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-chain-0A1CA2CC1CA2B1DD' {
        savedefault
        insmod part_msdos
        insmod ntfs
        set root='hd0,msdos2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 --hint='hd0,msdos2'  0A1CA2CC1CA2B1DD
        else
          search --no-floppy --fs-uuid --set=root 0A1CA2CC1CA2B1DD
        fi
        parttool ${root} hidden-
        drivemap -s (hd0) ${root}
        chainloader +1
}
### END /etc/grub.d/30_os-prober ###
PS: I've added
Code:
GRUB_OS_PROBER_SKIP_LIST="CEFE7B31FE7B1147@/dev/sda1"
to /etc/default/grub and it works. grub2-mkconfig now ignores /dev/sda1.

Last edited by marozsas; 07-20-2020 at 07:41 AM. Reason: correct string in GRUB_OS_PROBER_SKIP_LIST
 
Old 07-19-2020, 12:06 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,526

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
What is the partition in question? sda1. Is that or was that a boot partition for an earlier version of windows? Can you mount it and take a look at the folders/files there and possibly post that info here? Fix mode or something is a bit vague, you might reboot again and get the actual error as there are a number of members here very familiar with windows who might be able to help.
 
Old 07-19-2020, 12:40 PM   #3
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499

Original Poster
Blog Entries: 2

Rep: Reputation: 68
Quote:
Originally Posted by yancek View Post
What is the partition in question? sda1.
Yes, sda1 is the extra menu entry.

Quote:
Originally Posted by yancek View Post
Is that or was that a boot partition for an earlier version of windows?
Yes. It is. This partition always be there. It was created by windows installer back in the original install in a empty disk. I didn't touch on it.

Quote:
Originally Posted by yancek View Post
Can you mount it and take a look at the folders/files there and possibly post that info here?
Sure. Here it is:
Code:
kimera:/home/miguel # mount -o ro /dev/sda1 /mnt/sda1
kimera:/home/miguel # ls /mnt/sda1
$RECYCLE.BIN  BOOTNXT  BOOTSECT.BAK  Boot  Recovery  Recovery.txt  System Volume Information  bootmgr
kimera:/home/miguel # umount /dev/sda1
Quote:
Originally Posted by yancek View Post
Fix mode or something is a bit vague, you might reboot again and get the actual error as there are a number of members here very familiar with windows who might be able to help.
Because it is not important. The presence of /dev/sda1 is normal. Nothing wrong with that.
What is wrong is grub creating a entry for it that does not works, nor intended to work at all.
The correct windows boot partition is /dev/sda2.

Editing the file /boot/grub2/grub.cfg and removing the /dev/sda1 entry it is fine, but I have to do that every time a new kernel is installed.

Last edited by marozsas; 07-19-2020 at 12:43 PM.
 
Old 07-20-2020, 07:40 AM   #4
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499

Original Poster
Blog Entries: 2

Rep: Reputation: 68
I think I understand now what happened.
The presence of folder /Boot in a ntfs partition triggers the detection of a bootable windows partition by the script /etc/grub.d/30_os-prober.
Usually you have /Boot only on the auxiliary partition (mine was /dev/sda1, the one that I've listed the content in a previous post in this thread).
This was my initial situation. /boot on /dev/sda1 only.

When I had to reinstall windows it did differently on the second time. The windows installer created another /boot folder on /dev/sda2 and completely ignored the /dev/sda1 partition that it have created before.
As result my system ended with 2 /boot folders, one of then (the one on /dev/sda1) useless to boot the new install, as the new install relies entirely on /dev/sda2.

To avoid the detection of /dev/sda1 as a windows system in grub, I've renamed the /Boot on /dev/sda1 to /old.Boot. Now grub does not add /dev/sda1 to the grub boot list.
Of course the Windows is booting fine, since it is not depends on files on /dev/sda1 to boot.
 
  


Reply

Tags
grub2, windows10, wrong-menu-entry



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Kali & Windows10 Dual-booting shayno90 Linux - Distributions 10 03-09-2021 05:02 PM
Trying to install linux mint dual boot on windows10 elizabethjq88 Linux - Newbie 11 08-21-2017 07:18 AM
dual booting windows10 and arc linux abhishek021 Arch 3 09-26-2015 05:03 PM
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 06:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration