Page 1 of 1
[SOLVED] Can't boot into windows any more
Posted: Sun Mar 16, 2008 6:01 pm
by KasperSorensen
I have a weird problem - I can't boot into windows any more. Here's what I've done
1) My computer is a brand new Lenovo T61 (7664-1FG) that comes with Windows Vista Home Edition
2) I installed Ubuntu 7.10 and grub as boot manager, and it worked fine for a week or so
3) Since I had initially only granted a couple of GBs to linux I wanted to resize the windows (NTFS) partition and add the new free space to the linux partition.
4) By mistake (UI-misenterpretation) I accidentally downsized the NTFS-partition too much, which only left a couple of megabytes left. So I never booted this partition, but instead I mounted it in linux and deleted the RRbackup folder from it.
5) Afterwards there was a couple of gigabytes free, but when I chose the windows-partition in grub it just booted to the Rescue & Recovery partition without any error messages or anything.
6) I've tried resizing the partitions again to give even more free space to the NTFS-partition but no luck.
Is it because I deleted the RRbackup folder?
Is there a way to get my windows partition working again?
Here's my grub menu.lst lines concerning windows:
Code: Select all
title Lenovo Recovery
root (hd0,0)
savedefault
makeactive
chainloader +1
title Windows Vista
root (hd0,1)
savedefault
makeactive
chainloader +1
I end up in "Rescue & Recovery" when I press either the "Lenovo Recovery" or the "Windows Vista" item in grub...
EDIT: Solved, great!

Posted: Sun Mar 16, 2008 6:18 pm
by K0LO
Can you post the output of the following command executed from an Ubuntu terminal?
Posted: Sun Mar 16, 2008 6:20 pm
by KasperSorensen
Sure, here you go:
Code: Select all
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x8e93b2b6
Device Boot Start End Blocks Id System
/dev/sda1 1 872 7003136 27 Unknown
Partition 1 does not end on cylinder boundary.
/dev/sda2 * 873 11231 83197800 7 HPFS/NTFS
Partition 2 does not end on cylinder boundary.
/dev/sda3 11231 19281 64668240 83 Linux
Partition 3 does not end on cylinder boundary.
/dev/sda4 19281 19457 1413720 5 Extended
Partition 4 does not end on cylinder boundary.
/dev/sda5 19281 19457 1413688+ 82 Linux swap / Solaris
[/code]
Posted: Sun Mar 16, 2008 6:34 pm
by K0LO
That's really strange. It's as if GRUB is unable to locate the start of partition 2. Yet you say that you can mount the Vista partition in Ubuntu and see the files?
The only thing that comes to mind is that maybe the partition boot record for the Vista partition is damaged. If you look at its first sector, is it a Vista boot record that starts bootmgr?
You could do this to find out:
Code: Select all
sudo dd if=/dev/sda2 of=/home/bootsector.bin count=1
This will copy the first sector of the Vista partition to the file /home/bootsector.bin, where you can examine it in a hex viewer to see. Or, rename it bootsector.txt and post it here and I'll have a look.
Posted: Sun Mar 16, 2008 6:41 pm
by KasperSorensen
Yes I can still mount it from linux and use the files on the partition.
Here's the result of "hexdump bootsector.bin":
Code: Select all
0000000 52eb 4e90 4654 2053 2020 0020 0802 0000
0000010 0000 0000 f800 0000 003f 00f0 def0 00d5
0000020 0000 0000 0080 0080 fec8 09ea 0000 0000
0000030 0000 000c 0000 0000 bcff 011c 0000 0000
0000040 00f6 0000 0001 0000 6eaa 3290 9082 5032
0000050 0000 0000 33fa 8ec0 bcd0 7c00 68fb 07c0
0000060 1e1f 6668 cb00 1688 000e 8166 033e 4e00
0000070 4654 7553 b415 bb41 55aa 13cd 0c72 fb81
0000080 aa55 0675 c1f7 0001 0375 d2e9 1e00 ec83
0000090 6818 001a 48b4 168a 000e f48b 1f16 13cd
00000a0 839f 18c4 589e 721f 3be1 0b06 7500 a3db
00000b0 000f 2ec1 000f 1e04 335a b9db 2000 c82b
00000c0 ff66 1106 0300 0f16 8e00 ffc2 1606 e800
00000d0 0040 c82b ef77 00b8 cdbb 661a c023 2d75
00000e0 8166 54fb 5043 7541 8124 02f9 7201 161e
00000f0 0768 16bb 7068 160e 0968 6600 6653 6653
0000100 1655 1616 b868 6601 0e61 cd07 e91a 016a
0000110 9090 6066 061e a166 0011 0366 1c06 1e00
0000120 6866 0000 0000 5066 5306 0168 6800 0010
0000130 42b4 168a 000e 1f16 f48b 13cd 5966 5a5b
0000140 5966 5966 0f1f 1682 6600 06ff 0011 1603
0000150 000f c28e 0eff 0016 bc75 1f07 6166 a0c3
0000160 01f8 08e8 a000 01fb 02e8 eb00 b4fe 8b01
0000170 acf0 003c 0974 0eb4 07bb cd00 eb10 c3f2
0000180 0a0d 2041 6964 6b73 7220 6165 2064 7265
0000190 6f72 2072 636f 7563 7272 6465 0d00 420a
00001a0 4f4f 4d54 5247 6920 2073 696d 7373 6e69
00001b0 0067 0a0d 4f42 544f 474d 2052 7369 6320
00001c0 6d6f 7270 7365 6573 0064 0a0d 7250 7365
00001d0 2073 7443 6c72 412b 746c 442b 6c65 7420
00001e0 206f 6572 7473 7261 0d74 000a 0000 0000
00001f0 0000 0000 0000 0000 9d80 cab2 0000 aa55
0000200
Oh, and thank you very much for your help so far

It's a mystery to me...
Posted: Sun Mar 16, 2008 6:55 pm
by tylerwylie
The only problem I see is that usually Windows likes to be the first drive on the hard disk, and I've never gotten it to dual boot with C:\ on anything besides the first partition on the hard drive.
Posted: Sun Mar 16, 2008 6:56 pm
by KasperSorensen
I don't think that's the problem, because it worked fine before the resizing of the partitions. And also it IS the first partition, besides the Rescue and Recovery partition, which has always been the first one.
Posted: Sun Mar 16, 2008 7:12 pm
by teetee
I also had the "Partition 1 does not end on cylinder boundary. " message in `fdisk -l` everytime after I tried to use 3rd party software to resize the partition(s). I think it has something to do with the lba32 mode and true CHS mode. Though it never was the cause of non-bootable windows partition.
Have you tried modify "root(hd0,1) to "rootnoverify(hd0,1)?
Have you tried (under linux) reinstall grub? (# grub-install /dev/sda)
teetee
Posted: Sun Mar 16, 2008 7:24 pm
by KasperSorensen
Just tried both rootnoverify and grub reinstallation but no luck
Are there perhaps any logfiles or something that I should investigate?
Posted: Sun Mar 16, 2008 7:50 pm
by K0LO
The bootsector that you posted looks fine. The boot code starts at 0054h, and from there to the end of the sector it is identical to the bootsector on my Vista partition.
Therefore,
if GRUB is properly chainloading to this partition then Vista's bootmgr file is the one that is being booted to, so if the BCD still points to the Vista partition then this ought to work.
So either GRUB does not properly point to the Vista partition or else the BCD is pointing to the wrong partition. The problem here is, to view the BCD, you need a Vista DVD. Don't suppose that you have one?
But maybe you can try the following in GRUB. Let your machine boot to the GRUB menu screen and then type a 'c' to get a command prompt. Type each of the following commands, one at a time, and see if it then boots Vista properly:
Code: Select all
rootnoverify (hd0,1)
makeactive
chainloader +1
boot
If this works then there is something wrong with your menu.lst file.
*Edit - oops! Forgot the chainloader statement
Posted: Sun Mar 16, 2008 7:53 pm
by KasperSorensen
When I do that Grub respond:
Code: Select all
Starting up...
Error 8: Kernel must be loaded before booting
Posted: Sun Mar 16, 2008 7:54 pm
by K0LO
After which statement?
Posted: Sun Mar 16, 2008 7:56 pm
by KasperSorensen
OK, this just got me into "Rescue and recovery" once again

Posted: Sun Mar 16, 2008 7:57 pm
by K0LO
At this point I would begin to suspect the Vista BCD is pointing to the wrong partition. Can you borrow a Vista DVD to check this?
Posted: Sun Mar 16, 2008 8:03 pm
by KasperSorensen
I don't know ... I have an old Windows XP cd, will that do?
Posted: Sun Mar 16, 2008 8:13 pm
by K0LO
Unfortunately, no. The commands for working with the Boot Configuration Database (BCD) are new to Vista.
Here is one alternative. You can download an iso containing the Vista repair tools from
this site. Burn it to a CD and you will have the same tools that are available on the retail Vista DVDs.
Although an automatic repair
may work, I would recommend against it. Doing it manually insures that you will get it right, so if you would like to try this then try making the bootable repair CD and then post back here the output from the command:
If the BCD pointer is the problem the fix is very simple. Of course, this may not be the problem so that's why I would not proceed with a repair until you're sure. Be glad to help if I can.
Posted: Sun Mar 16, 2008 8:18 pm
by KasperSorensen
Great, I'm downloading it now. I'll turn back when I have tried the CD out. This won't be before tomorrow though, so good night

Thank you very much for your excellent help!
Posted: Mon Mar 17, 2008 9:02 am
by KasperSorensen
OK, here's the result of running BCDEDIT:
Code: Select all
Windows Boot Manager
--------------------
identifier {bootmgr}
device unknown
description Windows Boot Manager
locale en-US
inherit {globalsettings}
default {default}
resumeobject {9f5c8777-704a-11db-9519-8441f37d8489}
displayorder {default}
toolsdisplayorder {memdiag}
timeout 0
Windows Boot Manager
--------------------
identifier {default}
device unknown
path \Windows\system32\winload.exe
description Microsoft Windows Vista
locale en-US
inherit {bootleadersettings}
recoverysequence {572bcd55-ffa7-11d9-aae0-007e994107d}
recoveryenabled Yes
osdevice unknown
systemroot \Windows
resumeobject {9f5c8777-704a-11db-9519-8441f37d8489}
nx OptIn
Thanks in advance
Posted: Mon Mar 17, 2008 9:47 am
by K0LO
Kasper:
As I suspected, you have lost your references to the devices containing the bootmgr file and the OS files. Here is an example of how the file appears on my system:
Code: Select all
C:\Windows\system32>bcdedit
Windows Boot Manager
--------------------
identifier {bootmgr}
device boot
description Windows Boot Manager
locale en-US
inherit {globalsettings}
default {current}
resumeobject {db4dc15d-b3b0-11db-a31d-cd8435bca370}
displayorder {current}
toolsdisplayorder {memdiag}
timeout 30
Windows Boot Loader
-------------------
identifier {current}
device partition=C:
path \Windows\system32\winload.exe
description Microsoft Windows Vista
locale en-US
inherit {bootloadersettings}
osdevice partition=C:
systemroot \Windows
resumeobject {db4dc15d-b3b0-11db-a31d-cd8435bca370}
nx OptIn
I need a little more information to be able to tell you how to fix this, so could you do the following?
1. Reboot to the Windows Recovery Environment (WinRE) on your CD.
2. Find out the drive letters of your Windows partition and your recovery partition by doing:
Examine each drive letter that is visible to you in the WinRE environment and determine the contents. Let me know which drive letter represents the Vista partition (as seen by WinRE; do not be concerned if the drive letter differs as seen by Vista), and which drive letter represents the recovery partition.
I'll get back to you in a couple of hours after my meeting is finished. This should be an easy fix.
Posted: Mon Mar 17, 2008 9:54 am
by KasperSorensen
Done.
C: is my Windows Vista partition
D: looks like a memory-disk (only two folders, 'boot' and 'sources')
E: looks like the Rescue & Recovery partition (among others a 'RECOVERY' folder and a 'windows' folder)
Theres also a X: drive, but this is the DVD-drive I think.
Posted: Mon Mar 17, 2008 11:30 am
by K0LO
Kasper:
OK. Here is the fix. Boot back into WinRE and type the following commands into the command prompt window. Type them one at a time. <ENTER> means to press the Enter key:
Code: Select all
bcdedit /set {bootmgr} device partition=c: <ENTER>
bcdedit /set {default} device partition=c: <ENTER>
bcdedit /set {default} osdevice partition=c: <ENTER>
These will restore the three missing pointer references so that they point to the Vista partition. Then type BCDEDIT again and look at the results to confirm that each "device" entry points to the c: partition. When done, reboot the machine to test.
I think that I now understand completely what happened and why, but first let me know if that worked and then I'll post the reasons.
Posted: Mon Mar 17, 2008 11:38 am
by KasperSorensen
It worked like a charm

Thank you so much, you've been great. Now let's hear what it was?

Posted: Mon Mar 17, 2008 11:52 am
by K0LO
Man, you're a fast worker!
The first bit of confusion was how you were booting to the recovery partition when trying to start Vista in another partition. Usually when the Vista BCD gets messed up you will get an error message (usually Winload.exe is missing or corrupt) and the machine will not boot. However, I forgot that the recovery partition would also contain its own BCD. When you tried to boot Vista and the partition reference was missing in the Vista BCD, Windows must just go on to find another BCD, which it found in the recovery partition, and it would then boot from there. Of course this BCD had all of the pointers set to boot the recovery partition, so that's what happened. I forgot that some systems can contain more than one BCD.
The root cause of the problem was when you changed the Vista partition. Depending on the partitioning tool used, the partition may have been moved. In your case, since Lenovo sets up their Vista machines with Vista's new 2048-sector offset, your partitioner must have decided to realign the partition to the older standard offset of 63 sectors. To do this the partition would have been moved a little bit to the left.
Vista's BCD identifies partitions by their GUID (Globally Unique Identifier) which is formed by some algorithm that includes the location of the starting sector of the partition. Since the partition was moved, its GUID changed and the BCD lost all of the pointers.
However, now that it has been moved and probably realigned to 63-sector boundaries, you can probably work on it with the same partitioning tool and its starting sector (and thus its GUID) should stay fixed. So you shouldn't need to repeat the BCD repairs if you re-partition again.
Make sure that the recovery partition still boots OK -- that's why I was being cautious since I didn't want to cause you to mess up its BCD and lose access to the recovery partition.
BTW - which tool did you use for partitioning?
Posted: Mon Mar 17, 2008 11:57 am
by KasperSorensen
I have two computers here, thats why it worked so fast, I had one computer for the forum and the thinkpad for doing the stuff
I used GNOME Partition Editor for partitioning, and you are right, I think it moved the partition a bit (it took way longer than I remember partitioning to usually take at least).
Posted: Mon Mar 17, 2008 12:05 pm
by K0LO
Good! Then all's well that ends well. I always learn something from these exercises, so you're welcome!
Posted: Mon Mar 17, 2008 4:00 pm
by teetee
Thanks Mark. I also learned a lot by just reading your solution.
According to
wikipedia
So BCD is just like grub but was installed in PBR at where VISTA was installed?
I always find those partition tools lack of a mechanism to check and see if the boot loader still works properly after each partition gets modified. I guess it's a much more difficult task to perform than just the partition resizing.
teetee
Posted: Mon Mar 17, 2008 4:18 pm
by K0LO
teetee:
Maybe a different description is that Vista's boot manager is somewhat like XP's boot manager (ntldr) with a twist. The older boot manager (ntldr) used a plain-text file (boot.ini) so it was easy to edit if you moved partitions around. Also, it referred to partitions by number.
Vista changed to using a binary database instead of a plain-text file. And, they changed to using GUIDs to refer to partitions. (Reminds me of Ubuntu with their recent change to UUIDs; I do not like that method because it makes human interpretation more difficult.) So you need a special tool to manage the BCD (bcdedit.exe). However, if you have a working XP or Vista system then there is a free GUI version that can manage the BCD called
VistaBootPro. However, in this case there was not a working Windows system so we had to resort to the command-line tool to fix it.