Debian / windows 7 dual boot

From HeepyWiki
Jump to navigation Jump to search

This is a horror show.

windows is in /dev/sda2

linuxboot is on /dev/sda3

linux is in /dev/sda5

if you boot windows and run photoshop, photoshop scribbles all over the embedding area after the boot block, which is where grub's core.img lives. This causes grub to still start, but hang after showing "Starting Grub"

The alternative is installing grub into a partition instead of the raw disk and using debian's "mbr" package to boot the partition-installed grub. (MBR boots whichever partition is marked "active" so you have to set sda3 active.)

The problem is that either installing mbr, or installing grub onto sda3, i don't know which, makes windows freak out and think there's no windows partition. (it's not setting sda2 non-active.)

1. from linux,

	install-mbr /dev/sda
	grub-install --force /dev/sda3

Now mbr boots to grub, grub boots linux fine, and boots windows, but windows is unhappy. You need to "repair" it by booting windows from the install media. But this only works if the windows partition is set "active."

2. fdisk /dev/sda and set partition 2 (windows) active.

3. shutdown and boot off the windows install media. Select "repair my computer" and let it do what it wants: "repair the problem preventing windows from booting." Strangely, this doesn't just replace the MBR. It just fixes whatever is broken within the windows partition. It does however re-break the grub install on sda3. Who the fuck knows why.

4. Boot linux from a live image. Run grub-install --force /dev/sda3 again. fdisk /dev/sda3 and set partition 3 (linux boot) active and partition 2 (windows) not active. MBR is still fine, and will boot into the sda3 grub on next boot.

Now when you boot, MBR loads, starts grub from sda3 (because sda3 is active), and gives you the normal grub menu. Linux boots fine as usual, and windows starts ok now that we've "repaired" it. I have no idea what's actually going on here, but it seemed to work.