PDA

View Full Version : [SOLVED] 15.10 beta dual-boot - upgrade of the grub package damaged windows 7 installation



kloszard
October 19th, 2015, 07:51 PM
After the most recent update of the grub package that happened last week (october 12-19) my windows installation stopped working. The windows entry is present but when I click it, it sends me back to the grub boot menu instead starting windows.

I have:
1) The motherboard with BIOS (old BIOS)
2) The AHCI mode set.
3) Two primary partitions:
- 50 GB windows partition at the beginning of the disk - with boot flag
- 200GB ubuntu root(/) partition on which the grub is installed
4) Dual boot with two OSs: Windows 7 and Ubuntu 15.10 beta.


The following do not solve the issue:

1) sudo update-grub2
2) boot-repair program
3) Repairing the windows installation using the Windows 7 install disk. There is the "repair the boot program automatically" option or something like that. It did not found any problem. So there is no problem with the windows installation or it could not detect it.

Have anyone the same problem? Any ideas how bring the windows installation back to life? Is it possible that the update of the grub package could damage the the data in MBR required by windows 7? I so are there any other programs to repair it?

yancek
October 19th, 2015, 08:09 PM
If you have boot repair, run it and just select the option to Creat Bootinfo Summary and either post it here or post a link to it. It will give a lot of details and someone should be able to advise you.

kloszard
October 19th, 2015, 08:23 PM
OK, Here is the report generated by the boot-repair: http://paste.ubuntu.com/12865254/

oldfred
October 19th, 2015, 09:06 PM
Did you originally install grub to the Windows boot partition?
You now have grub installed to the Windows NTFS boot partition (PBR). That is never correct as Windows has essential boot info including partition start & size that must match partition table and which boot loader to use XP's ntldr or Vista or later bootmgr.

NTFS does keep a backup, so unusually you can restore from the backup with testdisk.
You want to get to this screen:
http://www.cgsecurity.org/wiki/TestDisk_Step_By_Step#NTFS_Boot_sector_recovery
select [Advanced] instead of [Analyse] and select [BackupBS]
[HowTo] Repair the bootsector of a Windows partition - YannBuntu
https://help.ubuntu.com/community/BootSectorFix
http://ubuntuforums.org/showthread.php?t=1926510


Also post this, as this is where grub re-installs to:
#To see what drive grub2 uses see this line - grub-pc/install_devices:
sudo debconf-show grub-pc # for BIOS with grub-pc
It will show drive model & serial number
to see drive info
sudo lshw -C Disk -short

kloszard
October 20th, 2015, 07:50 PM
Thanks for your quick response and useful links. I have no time today to use this testdisk program but I think it will help.


Did you originally install grub to the Windows boot partition?
You now have grub installed to the Windows NTFS boot partition (PBR). That is never correct as Windows has essential boot info including partition start & size that must match partition table and which boot loader to use XP's ntldr or Vista or later bootmgr.

I did not select any of my partitions: sda1(NTFS) or sda2(ex4) partitions to install the boot loader. I've selected the sda hard disk during the Ubuntu installation. It looked like the default location for the boot loader since it was the first on the list (I've selected the "Something else" option at the beginning of installation so that installer let me look at my partitions and modify them and I selected sda from the list box on the bottom of the window.)

Is the sda wrong choice? As far as I remember, I used this region in times of the grub legacy (0.97) and I never run into problems. If the sda is wrong choice for ubuntu-windows dual boot, a warning next to this option might be useful for many users.

Actually, my windows installation was damaged two times this way:

1) The first time was when I've moved my windows installation from HDD to my brand new SSD disk using the Samsung Magician software for Windows, Then I installed Ubuntu 15.10. This damaged the windows installation. I thought it was normal behaviour since installing Linux after Windows always destroyed the linux bootloader. But this times it was different, since after repairing grub, ms windows still could not start.
2) The second time was that from my first post - after updating grub package.

oldfred
October 21st, 2015, 04:41 AM
With BIOS (and UEFI) you install grub to a drive like sda, not to a partition. And never to a NTFS partition's boot sector.

Please post this:
sudo debconf-show grub-pc

kloszard
October 21st, 2015, 07:26 PM
Hi oldfred,

1) The output of the sudo debconf-show grub-pc command is as follows:


grub-pc/kopt_extracted: false
grub2/kfreebsd_cmdline:
grub-pc/chainload_from_menu.lst: true
grub-pc/install_devices_disks_changed:
grub2/force_efi_extra_removable: false
grub-pc/install_devices_failed_upgrade: true
grub2/device_map_regenerated:
grub-pc/disk_description:
grub-pc/postrm_purge_boot_grub: false
grub2/linux_cmdline_default: quiet splash
grub-pc/timeout: 10
grub2/linux_cmdline:
grub-pc/install_devices_failed: false
* grub-pc/install_devices: /dev/disk/by-id/ata-Samsung_SSD_850_EVO_250GB_S21PNSAG795716F-part1
grub2/kfreebsd_cmdline_default: quiet splash
grub-pc/mixed_legacy_and_grub2: true
grub-pc/partition_description:
grub-pc/hidden_timeout: false
grub-pc/install_devices_empty: false

This is the location you wrote about in your first post. Is it good or not?


* grub-pc/install_devices: /dev/disk/by-id/ata-Samsung_SSD_850_EVO_250GB_S21PNSAG795716F-part1


2) The output of the sudo lshw -C Disk -short command:


H/W path Device Class Description
================================================== =====
/0/2/0.0.0 /dev/sda disk 250GB Samsung SSD 850
/0/3/0.0.0 /dev/sdb disk 1TB WDC WD1002FAEX-0
/0/4/0.0.0 /dev/cdrom disk DVD RW AD-7200S




1) The first time was when I've moved my windows installation from HDD to my brand new SSD disk using the Samsung Magician software for Windows, Then I installed Ubuntu 15.10. This damaged the windows installation. I thought it was normal behaviour since installing Linux after Windows always destroyed the linux bootloader. But this times it was different, since after repairing grub, ms windows still could not start.

Here is my mistake. It's from my previous post. I should rather write something like this:

This damaged the windows installation. it was completely opposite to my previous experiences since it was always Windows which destroyed grub. Now linux and grub damaged my windows installation.

oldfred
October 21st, 2015, 11:14 PM
This was/is the problem:

* grub-pc/install_devices: /dev/disk/by-id/ata-Samsung_SSD_850_EVO_250GB_S21PNSAG795716F-part1

The part1 at the end means it will reinstall grub to partition 1 on a major update.
Grub never should choose a NTFS, or actually user should know not to ever install grub to a NTFS partition.

You can fix that with this:
#to get grub2 to remember where to reinstall on updates for BIOS
sudo dpkg-reconfigure grub-pc
#Enter thru first pages,tab to ok, spacebar to choose/unchoose drive, enter to accept, do not choose partitions
http://ubuntuforums.org/showthread.php?t=2189643

Were you able to recover backup PBR for sda1 with testdisk?

kloszard
October 22nd, 2015, 06:30 AM
Ok so the steps I have to do is :

1) Move grub do sda using "sudo dpkg-reconfigure grub-pc"
2) Fix installation with "testdisk"


Were you able to recover backup PBR for sda1 with testdisk?

Not yet.


Grub never should choose a NTFS, or actually user should know not to ever install grub to a NTFS partition.

The point is that it happened automatically using Ubuntu 15.10 beta2 amd64 installer downloaded on September 26th, 2015. I hope that today's RTM won't do it.

kloszard
October 23rd, 2015, 09:21 PM
Hi oldfred,
thanks for your help. The grub is on the proper location and the testdisk utility repaired my windows installation!

oldfred
October 23rd, 2015, 09:30 PM
Glad that worked. :)