RE: [Xen-users] Importing Windows XP installation

Dustin Henning
Wed, 25 Jun 2008 14:54:33 -0000

For the WindowsXenPV driver to work, you must edit your boot.ini.
For instance, if the this is your WindowsXP line:
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP
Professional" /noexecute=optin /fastdetect
you need to add one like this (whichever line is on top will be default):
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP
Professional GPLPV" /gplpv /noexecute=optin /fastdetect
you then need to boot to it to use the HVM drivers/xen hardware and boot to
the other to boot with standard PV hardware/drivers.  These changes can also
be made with the cli editor if your WinXP is new enough, but the boot.ini
will then be converted to binary (default on Vista and 2008).
	The reason I mention the steps above is because I am pretty certain
they aren''t automated yet, and you didn''t mention taking them.
Also, once
you install the drivers, two sets of hardware show up in the device manager,
the set with yellow exclamation points is the set that isn''t being
used.  I
think the unused set may actually be hidden in the latest drivers (only when
you boot with gplpv), but I haven''t tried them out yet to verify.
Also, as
a fair warning, the WindowsXenPV drivers aren''t "stable" per
se (though I
haven''t had much trouble with them), and I''m not sure
upgrading works right
yet, so trying to get to a new version could take your virtual system out of
commission if you aren''t fairly good at recovery operations.
	As for the disk line, that space before ioemu may or may not be
problematic, but it seems unlikely that it would be.  Also, I don''t use
ioemu:hda, I just use hda, but I don''t know for sure that one way is
better
than the other.
	Regarding the vif line, I don''t use type= or model= in my vif line
either, so those might be problematic.  Considering that you are messing
with the GPLPV drivers at this point anyway, I think you have installed a
separate network driver that will work when booted in gplpv mode anyway, and
I don''t know whether those settings affect it, but removing them
won''t hurt
where it isn''t working anyway.  Good luck,
	Dustin

-----Original Message-----
From: flinco@libero.it [mailto:flinco@libero.it]
Sent: Wednesday, June 25, 2008 04:49
To: Dustin.Henning
Cc: xen-users
Subject: RE: [Xen-users] Importing Windows XP installation

Few days ago I followed a two step procedure:
- first (on Windows) I created a VMWare image of WinXp partition using
"VMWare converter"
- then (on Linux) I converted the VMWare image into a qemu image with the
following commands:
vmware-vdiskmanager -r win_xp.vmdk -t 0 win-xp-flattened.vmdk
qemu-img convert win_xp-flattened.vmdk win_xp.img

Then I transferred the image on /dev/sda4:
dd if=win_xp.img of=/dev/sda4

It works and I can boot properly.
But now I must face other problems:
- I know I must reactivate WinXP; to reactivate I need it recognize a NIC
but it doesn''t.
In win_xp.vhm I set:
vif = [ ''type=ioemu, mac=00:XX:XX:XX:XX:XX, bridge=xenbr0,
model=rtl8139'' ]
This because (in Safe Mode I discovered that a RTL8139 NIC driver is already
installed even if the actual installed NIC is a RTL8111/8168B.
I discovered some warnings in xend.log. I don''t know if they are
related
with NIC problem but googling around I found no posted solution. My xend.log
is the following:

[2008-06-25 09:25:09 4472] INFO (SrvDaemon:338) Xend Daemon started
[2008-06-25 09:25:09 4472] INFO (SrvDaemon:342) Xend changeset: unavailable.
[2008-06-25 09:25:09 4472] INFO (SrvDaemon:349) Xend version: Unknown.
[2008-06-25 09:25:09 4472] DEBUG (XendDomainInfo:132)
XendDomainInfo.recreate({''max_vcpu_id'': 3,
''cpu_time'': 237303954195L,
''ssidref'': 0, ''hvm'': 0,
''shutdown_reason'': 0, ''dying'': 0,
''online_vcpus'': 4,
''domid'': 0, ''paused'': 0,
''crashed'': 0, ''running'': 1,
''maxmem_kb'':
4294967292L, ''shutdown'': 0, ''mem_kb'':
1940044L, ''handle'': [0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ''blocked'': 0,
''name'': ''Domain-0''})
[2008-06-25 09:25:09 4472] INFO (XendDomainInfo:149) Recreating domain 0,
UUID 00000000-0000-0000-0000-000000000000. at /local/domain/0
[2008-06-25 09:25:09 4472] DEBUG (XendDomain:443) Adding Domain: 0
[2008-06-25 09:25:09 4472] DEBUG (XendDomain:379) number of vcpus to use is
0
[2008-06-25 09:25:09 4472] INFO (SrvServer:180) unix
path=/var/lib/xend/xend-socket
[2008-06-25 09:25:09 4472] DEBUG (XendDomainInfo:1040)
XendDomainInfo.handleShutdownWatch
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call: VBD.set_device
not found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call: VBD.set_type not
found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call:
VM.get_auto_power_on not found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call:
VM.set_auto_power_on not found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call: debug.get_all not
found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call:
console.get_other_config not found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call:
console.set_other_config not found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call: VIF.get_network
not found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call: VIF.set_device
not found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call: VIF.set_MAC not
found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call: VIF.set_MTU not
found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call:
session.get_all_records not found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call: event.get_record
not found
[2008-06-25 09:25:09 4472] WARNING (XendAPI:672) API call: event.get_all not
found
[2008-06-25 09:25:09 4472] INFO (XMLRPCServer:149) Opening Unix domain
socket XML-RPC server on /var/run/xend/xen-api.sock; authentication has been
disabled for this server.
[2008-06-25 09:25:09 4472] INFO (XMLRPCServer:149) Opening Unix domain
socket XML-RPC server on /var/run/xend/xmlrpc.sock.

I don''t understand why xend executable doesn''t find VBD.xxx,
VIF.xxx and
some other functions. I would also remark that this log is printed after
"/etc/init.d/xend start" but BEFORE starting any guest domain.
I would like, if possible, to achieve a set up which avoids these warnings.

For the record I''m using all original Fedora 8 stuff (xen-3.1.2 with
kernel
2.6.21.7) with no change to any config script.

Other problem:
I get last stable WindowsXenPV driver from http://www.meadowcourt.org
I booted HVM win_xp and I installed them in Safe Mode. Then XP recognized
some new hw but it also shows two SCSI "Xen Block Device Driver" with
yellow
exclamation marks. I thing there''s some misconfiguration in the storage
emulation section of win_xp.hvm:


disk = [ ''phy:/dev/sda4,
ioemu:hda,w'',''phy:/dev/sr0,ioemu:hdc:cdrom,r'' ]

Thanks to all the people who gave me some help and to all of them which
will help me in the future!

Lorenzo

>         I think there is also a fixmbr command from the recovery console.
> That might be necessary in your virtual machine as well.  However, I think
> your problem may be that there is no partitioning on the virtual disk you
> are trying to boot Windows from.  In that case, "CHKDSK C:" will
probably
> fail (does not check RAW drives or something), and fixmbr won''t do
you any
> good (beyond possibly getting you a new error about cannot find ntldr).
>         In PV, whatever you attach (/dev/VG_Guests/win_xp_sp3 in this
case)
> is passed on to Windows as a drive, so your dd command would in real life
be
> the equivalent of doing this: (dd if=/dev/sda1 of=/dev/sdb) and then
moving
> the drive identified as sdb to another computer to boot it.  I
don''t think
> fixmbr and fixboot will make such a drive bootable since it isn''t
partitioned.
>         What you should probably do is create /dev/sda4 and the fdisk
> /dev/sda4 to create a partition table on it where there is a new partition
> identical in size to sda1 (if you need to use LVM for this particular
setup,
> and I don''t believe you do, you would fdisk
/dev/VG_Guests/win_xp_sp3, and
I
> don''t know if that is directly possible or not).
>         Once that is done (and this is an assumption based on several
> messages I have seen from the past week), I guess you can use kpartx or
> something to make the partitions on the /dev/sda4 partition show up in
> /dev/mapper, then you can use your dd command to copy your windows
partition
> onto the partition you created on your new Windows virtual drive (dd
> if=/dev/sda1 of=/dev/mapper/????).  You would then use kpartx again to
> remove the partition(s) on /dev/sda4 from /dev/mapper.  Assuming you
pulled
> this paragraph off, you would then have Windows in an NTFS partition on
your
> virtual drive, but it still wouldn''t be bootable.
>         At this point, fixmbr and fixboot in the virtual machine might
work,
> but I would skip that and try this (assuming you are NOT using LVM):
> dd if=/dev/sda of=/dev/sda4 bs=446 count=1
> That will copy the boot sector of your real machine to the boot sector of
> your virtual drive without overwriting the partition table you created on
> said virtual drive.  In this case, that probably means booting with
> grub/lilo and loading the Windows boot information from wherever it is
> stored on the new virtual sda1 (that is identical to your existing sda1,
so
> wherever installing linux moved it to on the original sda1), but
regardless,
> it would (hopefully) be identical to what your system is currently doing,
> and I assume your system currently boots to Windows when you tell it to.
>         All of this is probably an exercise in futility, though, because
you
> are probably still going to have to reactivate, and that is assuming that
> you can even get Windows to boot and get all of the necessary drivers to
> install.  You may be able to take care of the driver business with some
> Physical to Virtual conversion tool (or all of the drivers may even
> automatically install if the i386 folder is stored on the partition, and
> since they didn''t send you a cd, it might be), and you may not be
concerned
> about activation, but know you aren''t out of the water just
because you
see
> the WindowsXP splash screen.  Good luck to you,
>         Dustin
>
>
> -----Original Message-----
> From: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
> [mailto:xen-users-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of
flinco@xxxxxxxxx
> Sent: Thursday, June 19, 2008 03:48
> To: tical.net
> Cc: xen-users
> Subject: Re: [Xen-users] Importing Windows XP installation
>
> I wrote "same size of sda1" for brevity but that''s not
exactly true:
> sda1 37.19 GiB
> sda4 40.94 GiB
> I think that more than 3 GiB are enough to cover the LVM overhead.
> Anyway waiting for further hints I will try to pass "CHKDSK C:"
on the
> Recovery Console (booting from CD).
>
> Thanks
>
> Lorenzo
>
>> If /dev/sda1 and /dev/sda4 are exactly the same size, surely the
overhead
of
>> LVM makes the logical volume a little smaller than /dev/sda1.  Can you
>> remake /dev/sda4 as something slightly bigger than /dev/sda1 and retry
the
>> whole operation?  Without knowing any more than I do about the
underlying
>> tech used to boot HVM, I''m imagining that something (windows
bootloader,
>> qemu?) thinks your partition is invalid because it can''t see
the end of
it
>> (because the partition is truncated).
>>
>> -Ray
>>
>>
>>
>> On Thu, Jun 19, 2008 at 3:08 AM, flinco@xxxxxxxxx
<flinco@xxxxxxxxx>
wrote:
>>
>> > Hi,
>> >
>> > I''m using a little workstation with the following
configuration:
>> > - CPU Intel Q6600
>> > - 2 GB DDR3 SDRAM
>> > - 250GB SATA2 HD
>> >
>> > - Win XP SP3 32bit on /dev/sda1 (NTFS)
>> > - Fedora 8 32bit on /dev/sda2 (ETX3)
>> > - Extended /dev/sda3 with:
>> >  + a shared /dev/sda5 (NTFS)
>> >  + 2 GB linux swap /dev/sda6
>> >
>> > I would like to know if it is possible to take the pre-installed
WinXP
>> > installation (sda1) and to run "as it is" on a xen
paravirtual domain.
I
>> > would like to do this way because I cannot make a new installation
of
>> > Windows (I''m doing this on my office machine that runs a
XP downgraded
from
>> > Vista, and there''s no XP recover/install CD).
>> >
>> > It''s my first time with xen and (para)virtualization.
>> > I followed Xen User Manual and "How to Install Windows on Xen
3.0".
>> > To be able to experiment without damaging the original XP
installation
I
>> > made a primary unformatted /dev/sda4 (same size of sda1) where I
created
a
>> > Volume Group called VG_Guests. Then I filled VG_Guests with a
Logical
Volume
>> > I called win_xp_sp3.
>> > I tried to copy the physical partition sda1 into the logical
volume
>> > win_xp_sp3 (dd if=/dev/sda1 of=/dev/VG_Guests/win_xp_sp3).
>> >
>> > I use the following win_xp_sp3.hvm:
>> >
>> > #===================================================>> >
import os, re
>> > arch = os.uname()[4]
>> > if re.search(''64'', arch):
>> >    arch_libdir = ''lib64''
>> > else:
>> >    arch_libdir = ''lib''
>> >
>> > kernel = "/usr/lib/xen/boot/hvmloader"
>> > builder=''hvm''
>> > memory = 768
>> > name = "win_xp_sp3"
>> > #vcpus=1
>> > #acpi=1
>> > #apic=1
>> > pae=1
>> > cpus = "2,3"
>> > vif = [ ''type=ioemu, mac=00:1A:4D:5C:69:7B,
bridge=xenbr0'' ]
>> > disk = [
>> >
''phy:/dev/VG_Guests/win_xp_sp3,ioemu:hda,w'',''phy:/dev/sr0,ioemu:hdc:cdrom,r''
>> > ]
>> > device_model = ''/usr/'' + arch_libdir +
''/xen/bin/qemu-dm''
>> > cdrom="/dev/sr0"
>> > boot="dc"
>> > #snapshot=1
>> > #sdl=1
>> > vnc=1
>> > vncviewer=1
>> > #vncviewer=0
>> > #nographic=0
>> > #serial=''pty''
>> > ne2000=0
>> > #usb=1
>> > #usbdevice=''tablet''
>> > audio=1
>> > #localtime=1
>> > #full-screen=1
>> > #stdvga=0
>> >
>> > I can boot from cdrom, but I cannot boot the copied XP, because
paravirtual
>> > system hangs after showing "Booting From Hard Disk".
>> > Then I tried booting a "non genuine" XP CD to access the
Recovery
Console;
>> > i run FIXBOOT C: but the system still doesn''t boot.
>> >
>> > There''s something else I can try?
>> >
>> > Thanks
>> >
>> > L.B.
>> >
>> >
>> >
>> > _______________________________________________
>> > Xen-users mailing list
>> > Xen-users@xxxxxxxxxxxxxxxxxxx
>> > http://lists.xensource.com/xen-users
>> >
>>