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 05-01-2020, 08:43 AM   #1
Seppi
LQ Newbie
 
Registered: May 2020
Posts: 3

Rep: Reputation: Disabled
Grub lost Win7 entry


Hello,

im having trouble booting my Win7 partition lately. I haven't used it for a while and i didnt notice that grub lost the Windows entry during the last couple of months.
What i tried so far:
Code:
sudo os-prober
sudo update-grub
This does not bring up the Win partition.

Ive also installed boot-repair, which detects the Win7 partition but does not fix the problem. I tried just to fix the Win boot files, reinstall grub and place the boot flag on the linux partition.
I also purged grub once but it didn't help.

BootInfo gives me the following output:
Quote:
=> Grub2 (v2.00) is installed in the MBR of /dev/sdc and looks at sector 1 of
the same hard drive for core.img. core.img is at this location and looks
for (,msdos5)/boot/grub. It also embeds following components:

modules
---------------------------------------------------------------------------
fshelp ext2 part_msdos biosdisk
---------------------------------------------------------------------------

[...]

sdc1: __________________________________________________________________________

File system: ntfs
Boot sector type: Windows 7/2008: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows 7
Boot files: /bootmgr /Windows/System32/winload.exe

sdc2: __________________________________________________________________________

File system: Extended Partition
Boot sector type: -
Boot sector info:

sdc5: __________________________________________________________________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Linux Mint 19.1
Boot files: /boot/grub/grub.cfg /etc/fstab /etc/default/grub
/boot/grub/i386-pc/core.img

sdc6: __________________________________________________________________________

File system: swap
Boot sector type: -
Boot sector info:

[...]

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sdc1 2,048 149,838,876 149,836,829 7 NTFS / exFAT / HPFS
/dev/sdc2 149,839,870 247,461,887 97,622,018 5 Extended
/dev/sdc5 * 149,839,872 230,688,767 80,848,896 83 Linux
/dev/sdc6 230,690,816 247,461,887 16,771,072 82 Linux swap / Solaris


blkid (filtered): ______________________________________________________________

Device UUID TYPE LABEL

/dev/sdc1 4C3EFDC5xxxxxxxx ntfs SSD
/dev/sdc5 f68f5cde-d2a5-4d7a-990a-xxxxxxxxxxxx ext4
/dev/sdc6 94e63dc9-c827-4b8a-b024-xxxxxxxxxxxx swap

[...]

====================== sdc5/boot/grub/grub.cfg (filtered) ======================

Linux Mint 19.1 Cinnamon
Linux Mint 19.1 Cinnamon, with Linux 4.15.0-99-generic

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

[...]

================================ 2 OS detected =================================

OS#1: The OS now in use - Linux Mint 19.1 Tessa CurrentSession on sdc5
OS#2: Windows on sdc1

[...]

=============================== UEFI/Legacy mode ===============================

This installed-session is not in EFI-mode.
Any idea why os_prober isn't picking up my win7 installation any more? Let me know if you need further information.
Thank you for your help.
 
Old 05-01-2020, 02:56 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
Hope others know, just wanted to post thoughts....

sdc5 has *. Doesn't that mean bootable? Modern linux may not need but Windows does???

https://en.wikipedia.org/wiki/GNU_GRUB#Version_2_(GRUB) has pretty good info but the machine you are on may make access to /boot too high up on disk. May need to know that.
 
Old 05-01-2020, 04:03 PM   #3
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,353

Rep: Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590
please the post the whole boot-info file, not just the parts you think are important.
 
Old 05-03-2020, 02:07 PM   #4
Seppi
LQ Newbie
 
Registered: May 2020
Posts: 3

Original Poster
Rep: Reputation: Disabled
Sorry, i wanted to keep the post as short as possible. Ive uploaded the full Boot-Info to hastebin
https://hastebin.com/ihicosugiy.sql

@jefro: Thanks for the Info. I will have a look if i can find a hint an wikipedia. I think that the * shows where the boot flag is though. But thats just a guess of mine ...
 
Old 05-03-2020, 07:34 PM   #5
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,353

Rep: Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590
Try changing the boot flag to /dev/sdc1
 
Old 05-05-2020, 02:25 PM   #6
IlyaK
Member
 
Registered: Jun 2017
Location: The Netherlands
Distribution: Debian
Posts: 118

Rep: Reputation: 72
Do you know which drive your windows is installed on?
If you are using MBR (not UEFI) then you can add Windows entry explicitly.

Here is how I added windows to debian grub:

First, I checked that I have "ntfs" partition on on the second drive (/dev/sdb)
Code:
$ sudo parted  /dev/sdb print
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdb: 26.8GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  26.8GB  26.8GB  primary  ntfs         boot
It seems that I have.

Then, I added appropriate entry
Code:
$ cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# 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=hd1
        chainloader +1
}
This entry tells grub "take second disk and chainload it (it must have MBR installed by Windows)"
I then called
Code:
$ sudo update-grub
After reboot, I got "Windows" entry ready to use.

Even without of this entry, you can click "c" on Grub menu, and type
Code:
set root=hd1
chainloader +1
boot
"hd1" means "second hard drive" (from the BIOS point of view).

If you have Windows installed on the same harddrive, but different partition, you should use something like
"hd0(1)"
That means "disk 0, partition 1".

So, in my case I can use ``hd1(0)`` which also works
 
Old 05-24-2020, 04:20 PM   #7
Seppi
LQ Newbie
 
Registered: May 2020
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hey,
sorry for my late reply. Thank you for your suggestions.
@ colorpurple21859 ive tried setting the boot flag on sdc1 but with no luck
@ IlyaK the created custom entry seems not to be detected by grup-update.
Code:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50_linuxmint.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-99-generic
Found initrd image: /boot/initrd.img-4.15.0-99-generic
Found linux image: /boot/vmlinuz-4.15.0-96-generic
Found initrd image: /boot/initrd.img-4.15.0-96-generic
Found linux image: /boot/vmlinuz-4.15.0-91-generic
Found initrd image: /boot/initrd.img-4.15.0-91-generic
Found linux image: /boot/vmlinuz-4.15.0-88-generic
Found initrd image: /boot/initrd.img-4.15.0-88-generic
Found linux image: /boot/vmlinuz-4.15.0-20-generic
Found initrd image: /boot/initrd.img-4.15.0-20-generic
done
I also set the file to be executable
Code:
-rwxr-xr-x 1 root root   285 May 24 23:01 40_custom
Ive copied your suggestion so the file itself looks like this
Code:
#!/bin/sh
exec tail -n +3 $0
# 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(1) 
        chainloader +1
}
Its really strange because i didn't change anything on purpose. Did the last official update for Win7 change the boot type to UEFI? Or is it possible that a grup update early this year messed up the entries. But this wouldn't explain why Win is not detected now.
 
Old 05-24-2020, 07:59 PM   #8
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,353

Rep: Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590Reputation: 1590
this
Quote:
set root=hd0(1)
syntax is wrong.
Syntax errors in the 40_custom file will prevent a menu entry from being generated. If windows bootloader is on the first partition of the first drive, this is the correct syntax
Code:
set root=(hd0,1)
or on the mbr of the first drive
Code:
set root=(hd0)
but if windows is on /dev/sdc1, the first partition of the third drive it will be
Code:
set root=(hd2,1)
This is assuming the windows bootloader is installed to the beginning of the partition. For windows boot loader installed to mbr of sdc it would be
Code:
set root=(hd2)
for windows 7 you could try this entry also
Code:
menuentry "Windows 7" {
     insmod part_msdos
     insmod ntldr
     insmod ntfs
     ntldr (hd2,msdos1)/bootmgr
}

Last edited by colorpurple21859; 05-24-2020 at 08:32 PM.
 
  


Reply



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
UEIF Dual Boot Win7 & CentOS only boots Win7 wigglytoes Linux - General 3 12-30-2013 05:53 AM
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM
[SOLVED] Grub Error with Mint Debian over Ubuntu 12.04 with Win7 Dual Boot Grub Error Gad Linux - Newbie 8 07-01-2013 08:31 PM
[SOLVED] After Upgrading from Win7-32 to WIN7-64 can't mount cifs shares pobrika Linux - Networking 2 07-21-2010 08:15 PM
Booting my new ubuntu install = "GRUB GRUB GRUB GRUB GRUB" etc. dissolved soul Ubuntu 2 01-13-2007 12:55 PM

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

All times are GMT -5. The time now is 10:49 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