This not really an "answer". The content would be a better match to a comment, but is too long-winded to fit in one. Apologies :-(
Some questions just to make sure I am reading your question correctly. (Please update/edit your question if you any further info to add.)
- You say "I installed grub manually onto the hard disk (/dev/sda)."
So you have already booted into the 12.04 installed on partition sda5
and successfully run
sudo grub-install /dev/sda
?
- You say that "... after booting into Windows 7, grub doesn't load on
the next boot. The computer simply reboots again and again."
Does it make any difference which of the two entries for Windows in your GRUB menu you use to boot into Windows?
There is one for /dev/sda1
(label "OSDisk") and another for /dev/sda3
(label "BDEDrive").
- Is there any error or status information at all displayed prior to or during this infinite boot loop? Can you tell if it is Linux/GRUB or Windows that is looping?
I am wondering if there is some conflict between your two Windows boot configurations. Only one of them would seem to be needed. (Probably the one on the first partition, OSBoot?)
Perhaps you might learn something by installing a Windows boot utility such as EasyBCD and making sure your Windows boot settings are correct?
Another alternative might be to bring up the Windows 7 Advanced startup options boot menu by pressing F8 immediately after starting a Windows boot from the GRUB menu. If the option to Repair your computer
is available in the advanced options boot menu, you could run Startup repair
to check for and (maybe) correct problems in your Windows boot setup.
Note: You have to be quick pressing F8 or Windows will just boot as usual.
I'm not sure exactly what is going wrong, but could there be some corruption in either your Windows or Linux file systems?
The excerpt below is from your boot-repair log from lines 616 to 641. The repeated failures of getcwd()
(get current working directory) and the GRUB warning about ZISD (ZENworks Image Safe Data ?) might mean something. Do you use ZENworks?
REPAIROK:
Copied Win boot files from sda3 to sda1
Reinstall the GRUB of sda5 into all MBRs of disks with OS or not-USB
Reinstall the GRUB of sda5 into the MBR of sda
dpkg --configure -a sda5
sh: 0: getcwd() failed: No such file or directory
grub-install (GRUB) 1.99-21ubuntu3
grub-setup: warn: Sector 5 is already in use by ZISD; avoiding it. This software may cause boot or other problems in future. Please ask its authors not to store data in the boot track.
SETUPOUTPUT: SETUPEXIT:0
sh: 0: getcwd() failed: No such file or directory
/usr/sbin/grub-setup: warn: Sector 5 is already in use by ZISD; avoiding it. This software may cause boot or other problems in future. Please ask its authors not to store data in the boot track.
INSTALLOUTPUT: Installation finished. No error reported.
INSTALLEXIT:0
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
Generating grub.cfg ...
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
Found linux image: /boot/vmlinuz-3.2.0-23-generic-pae
Found initrd image: /boot/initrd.img-3.2.0-23-generic-pae
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
Found memtest86+ image: /boot/memtest86+.bin
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
I have done a trail with my dummy practical computer with one hdd and one ssd.
I assume, you have installed windows in UEFI boot mode with gpt partitioning type on your hdd. sda.
Since mine is a dummy practical computer, I don't need to worry about backup. I do recommend you to take backup.
I have not considered sdc for separate home partition as I don't have other drive free.
Procedure:
Log on with live session of Ubuntu.
Here are my sda-1tb hdd and sdb-120gb ssd.
I have windows10 on sda and Ubuntu18.04.1 on sdb. Grub is on sda.
You can see windows10 is installed in device sda with EFI partition on sda2. This is what controlling the grub now.
Important: this partition sda2 has UUID matched with the text in the file /etc/fstab on device sdb.
As we are going to format sda. We need to create EFI System Partition on sdb. sdb has only one partition sdb1. We have to create a EFI partition at start of the disk.
Now we got unallocated space of 100mb at start of disk sdb.
In order to install grub on this we need it in FAT32 format with boot and esp flags.
Here if you observe, we have created 100mb EFI partition at the start of the disk. which should be named as sdb1. but gparted still shows it as sdb2. to sort out this
run sudo sgdisk -s /dev/sdb
Now delete the EFI partition (sda2) on sda or you can format entire device sda.
Now we need to install grub on /dev/sdb.
Procedure:
sudo mount /dev/sdb2 /mnt
# mounting root partition. (sdb2 is the ext4 /)
for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
(binding the required folders).
sudo mount /dev/sdb1 /mnt/boot/efi
# sdb1 is the EFI partition on sdb.
sudo chroot /mnt
update-grub
grub-install /dev/sdb
update-grub
exit
Now we need to know the UUID of freshly created EFI Partition (sdb1) on device sdb.
Open "Disks" app.
Copy the UUID of sdb1.
Open the fstab file.
sudo nano /mnt/etc/fstab
. (note: i have used gedit, attached pics are gedit in the below).
paste the UUID at the rite place.
Save and Close.
Now reboot.
Best Answer
I'm not sure what it uses to detect the OS. I'd try a quick reformat of the partitions.
If nothing else works, here is a patch that can be made to
/etc/grub.d/30_os-prober
that will allow you to specify any partitions you want to skip:/etc/grub.d/30_os-prober modification
These lines can be added to the file (just past the middle) to skip any partitions that you don't want to show up in the menu. Leaving the string empty will skip nothing.
Add the lines starting with
############## Patch to prevent some partitions being autodetected
through
############## End of patch
:After changing this file, you will, of course, need to run
sudo update-grub
to regenerate the menu. You should be able to see the results from the terminal's output when it says "Found ..." for each entry; you can run it first before the mods, then compare the output to after the mods. You should not see the removed entries.