Bug 797986 - virt-resize on Windows XP in sysprep state causes "UNMOUNTABLE_BOOT_VOLUME" BSOD
virt-resize on Windows XP in sysprep state causes "UNMOUNTABLE_BOOT_VOLUME" BSOD
Status: CLOSED UPSTREAM
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Richard W.M. Jones
:
Depends On:
Blocks: 797760
  Show dependency treegraph
 
Reported: 2012-02-27 13:07 EST by Richard W.M. Jones
Modified: 2012-02-27 15:04 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 797760
Environment:
Last Closed: 2012-02-27 15:04:10 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2012-02-27 13:07:43 EST
+++ This bug was initially created as a clone of Bug #797760 +++

This bug happens both upstream (1.17.8) and in RHEL 6.3 (1.16.x)
and it seems likely that it has always been broken in virt-resize.

Description of the bug by Grant Williamson:

1 - Grab the sysprep tools from
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=11282

2 - Create a sysprep.inf file.
[Unattended]
OemSkipEula=Yes
KeepPageFile=
InstallFilesPath=c:\windows
DriverSigningPolicy=Ignore
ExtendOemPartition=1

[UserData]
ProductKey=*****-*****-*****-*****-*****
FullName="IBM_USER"
OrgName="IBM"
ComputerName=*

[GuiUnattended]
AdminPassword=PASSWORD
AutoLogon=Yes
OEMSkipRegional=1
OEMDuplicatorstring="KVM client for e-business sysprep installation"
TimeZone=85
OemSkipWelcome=1

[GuiRunOnce]
Command0="cmd /c rmdir c:\windows\$OEM$ /s/q"
;Command1="bootcfg.exe /timeout 3"

[Identification]
JoinWorkgroup=WORKGROUP

[Networking]
InstallDefaultComponents=Yes

[NetProtocols]
MS_TCPIP=params.MS_TCPIP

[params.MS_TCPIP]
DNSDomain=

DNSSuffixSearchOrder=IBM.COM

[Display]

[SysprepMassStorage]

[sysprepcleanup]

3 - Sysprep the WINDOWS XP SP3 Image
Copy the sysprep.inf to where you extracted sysprep.exe
i.e. c:\sysprep
then from this directory run.
sysprep -reseal -mini
wait till guest switches off.

4 - Resize the XP image.
truncate -s 40G NEW.raw
virt-resize --expand /dev/sda1 OLD.raw NEW.raw

5 - Boot image, chkdsk runs.
  - Machine reboots.
  - sysprep runs
  - machine reboots
  - boot hangs with BSOD message
  - shutdown/restart, same BSOD message.

6 - Workaround fix.
  - Shutdown guest
  - losetup /dev/loop0 NEW.raw
  - kpartx -a /dev/loop0
  - ntfsfix /dev/loop0
  - kpartx -d /dev/loop0
  - losetup -d /dev/loop0


Resizing on an NON SYSPREP image works.

--- Additional comment from rjones@redhat.com on 2012-02-27 10:46:49 EST ---

I can reproduce this.

--- Additional comment from rjones@redhat.com on 2012-02-27 12:36:50 EST ---

However I cannot fix it.

I added an ntfsfix binding:

https://www.redhat.com/archives/libguestfs/2012-February/msg00109.html

I tried modifying virt-resize so that it calls ntfsfix after
resizing ntfs partitions.  However that did not fix the problem.

I also tried running ntfsfix after seeing the UNMOUNTABLE_BOOT_VOLUME
error, however that just made the guest hang during boot.
Comment 1 Richard W.M. Jones 2012-02-27 14:36:42 EST
Removing
ExtendOemPartition=1
fixes the problem.  I will document it in the virt-resize
man page.
Comment 2 Richard W.M. Jones 2012-02-27 15:03:39 EST
Fixed (by documentation) upstream in 1.17.9:
https://github.com/libguestfs/libguestfs/commit/a93d4a9dc1aea6940886c85d4b09f21cbfc80969

Note You need to log in before you can comment on or make changes to this bug.