Page MenuHomeSolus

Grub incorrectly identify Windows 10 as Windows Vista
Closed, ResolvedPublic

Description

Running sudo update-grub

Produces this result:

Generating grub configuration file ...
Found background: /usr/share/backgrounds/splash.tga
  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
Found Windows Vista (loader) on /dev/sda1
Found Windows Vista (loader) on /dev/sda2
done

The patch below fixes the problem as it enables the -a flag for grep and and adds in the entry for Windows 10.

--- a/20microsoft
+++ b/usr/lib/os-probes/mounted/20microsoft
@@ -31,19 +31,21 @@ if item_in_dir -q bootmgr "$2"; then
 	for boot in $(item_in_dir boot "$2"); do
 		bcd=$(item_in_dir bcd "$2/$boot")
 		if [ -n "$bcd" ]; then
-			if grep -qs "W.i.n.d.o.w.s. .8" "$2/$boot/$bcd"; then
+			if grep -aqs "W.i.n.d.o.w.s. .1.0" "$2/$boot/$bcd"; then
+				long="Windows 10 (loader)"
+			elif grep -aqs "W.i.n.d.o.w.s. .8" "$2/$boot/$bcd"; then
 				long="Windows 8 (loader)"
-			elif grep -qs "W.i.n.d.o.w.s. .7" "$2/$boot/$bcd"; then
+			elif grep -aqs "W.i.n.d.o.w.s. .7" "$2/$boot/$bcd"; then
 				long="Windows 7 (loader)"
-			elif grep -qs "W.i.n.d.o.w.s. .V.i.s.t.a" "$2/$boot/$bcd"; then
+			elif grep -aqs "W.i.n.d.o.w.s. .V.i.s.t.a" "$2/$boot/$bcd"; then
 				long="Windows Vista (loader)"
-			elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8. .R.2." "$2/$boot/$bcd"; then
+			elif grep -aqs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8. .R.2." "$2/$boot/$bcd"; then
 				long="Windows Server 2008 R2 (loader)"
-			elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8." "$2/$boot/$bcd"; then
+			elif grep -aqs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8." "$2/$boot/$bcd"; then
 				long="Windows Server 2008 (loader)"
-			elif grep -qs "W.i.n.d.o.w.s. .R.e.c.o.v.e.r.y. .E.n.v.i.r.o.n.m.e.n.t" "$2/$boot/$bcd"; then
+			elif grep -aqs "W.i.n.d.o.w.s. .R.e.c.o.v.e.r.y. .E.n.v.i.r.o.n.m.e.n.t" "$2/$boot/$bcd"; then
 				long="Windows Recovery Environment (loader)"
-			elif grep -qs "W.i.n.d.o.w.s. .S.e.t.u.p" "$2/$boot/$bcd"; then
+			elif grep -aqs "W.i.n.d.o.w.s. .S.e.t.u.p" "$2/$boot/$bcd"; then
 				long="Windows Recovery Environment (loader)"
 			else
 				long="Windows Vista (loader)"

Now running sudo update-grub

Produces

Generating grub configuration file ...
Found background: /usr/share/backgrounds/splash.tga
  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
Found Windows Recovery Environment (loader) on /dev/sda1
Found Windows 10 (loader) on /dev/sda2
done

Yay, its fixed.

Event Timeline

ikey triaged this task as Unbreak Now! priority.Aug 15 2017, 12:13 PM

Happens with Windows 7 too.

STiAT added a subscriber: STiAT.Aug 15 2017, 10:45 PM

Happens with Windows 7 too.

Patched by the above patch as well.

mate-user added a subscriber: mate-user.EditedAug 20 2017, 7:26 PM

I still see Windows Vista, even though I have Windows 7.

Edit: I had to manually run "sudo update-grub" before I saw this:

Generating grub configuration file ...
Found background: /usr/share/backgrounds/splash.tga

WARNING: Failed to connect to lvmetad. Falling back to device scanning. Found Windows 7 (loader) on /dev/sda2 Found Windows 7 (loader) on /dev/sda3 done

I restarted and now I see Windows 7 :)
Thanks for the fix!