Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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:
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
@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 ...
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
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.