Page 1 sur 15 12311 ... DernièreDernière
Affichage des résultats 1 à 10 sur 145

Discussion: Qemu in rescue system, e.g. Windows installation

  1. #1
    Date d'inscription
    January 2014
    3 295

    Cool Qemu in rescue system, e.g. Windows installation

    [UPDATE 16.9.2014]KS-1 uses different ethernet card or KS-3 or KS-4. See here steps on how to get Windows on KS-1 [/UPDATE]

    [Partial rewrite 10.6.2014] --> follow here for Linux installation
    I think this introduction may clarify a little bit the idea:

    [UPDATE]Install for KS-1 and KS-2: [/UPDATE]

    Qemu-kvm is a great thing, because it lets you access very easily (at least easier than VirtualBox or VMWare Player) /dev/sda and /dev/sdb. So you can run the installation of an OS in Qemu and instead of installing the OS on a virtual HDD (which is just a file of format vdi, vmdk, qcow2 or so) you are installing your OS on the real thing, namely /dev/sda or /dev/md1 (if you setup Raid during OS installation). Qemu outputs VGA output through vnc, so you can see the content of your screen and can make the proper selections, without sitting in front of the server. Now a Qemu-kvm environment is not the same thing as your server, e.g. MAC of the ethernet card is different. So you will need to make some manual changes, e.g. set DHCP, set HDD controller, etc. or install missing drivers so that, when you restart your server, those changes between a Qemu-kvm environment and your real server don't affect the boot process and connectivity to the internet, etc.

    Qemu-kvm is also great for debugging (some) boot errors, since you see the screen output right from the beginning.

    Understandably, you could just install your OS, e.g. Windows on your home computer or in a VM, set generic settings for ethernet, HDD controller, etc. and install missing drivers and make an image of your OS installation and copy that image onto your server. This works AND is faster (sometimes)! I have good experience with Easeus ToDoBackup 3.5 (last freeware) for Windows XP to 7 but simple clone programs like clonezilla or Ghost or even plain "dd" should get the job done. When installing at home, one would choose a small HDD partition (20-25 GB for Win7/8 should be fine) and expand it later with a partition manager or the Windows disk manager. Keeps the data transfer small.

    Qemu and Windows 7/8 don't work on KS-1 and KS-2 due to a (still??) unfixed software bug. So on such a machine, I would go and clone a home installation of Windows back.

    It's actually pretty easy, once you know where the caveats lie.

    Prepare Qemu

    [NOTE] I recommend "Alternative installation at home" for Windows 2008 R2 Server installation. Qemu failed with HDD driver problems.[/NOTE]

    Turn off monitoring in the Kimsufi Manager.

    Partially optional: Get hadwareinfo (lshw), ip and mac info (ifconfig), routing info (route), pci info (lspci), usb info (lsusb), etc. On Kimsufi i3, i5 server you have the problem, that they use intel 82578V network card and driver don't exist for Windows Server edition. So it is partially optional, since you have to know your hardware and that your Windows has the proper drivers installed.

    Booting the rescue systems gives you a complete linux system that is running on your server without using your hard disk. This means you can do all manipulations to the harddisk without the kernel interfering. Some directories lie on a network drive and are read-only. So you cannot install anything, without moving that data to tmpfs first. So let's do that first.

    Please bear in mind, that Linux Rescue system uses 200 MB RAM.
    The following copying of the network drives into tmpfs uses 1000 MB RAM.
    Qemu uses 200 MB RAM.

    #to see if Raid devices are present and stop them
    cat /proc/mdstat
    mdadm --stop /dev/md0
    mdadm --stop /dev/md1

    #Second step is to get rid of the network drives, because they are read-only
    mount -t tmpfs -o size=6000m tmpfs /mnt # use 6GB of memory as temp - adjust as needed
    mkdir /mnt/var
    mkdir /mnt/var/cache
    mkdir /mnt/var/lib
    mkdir /mnt/var/run
    mkdir /mnt/usr
    mkdir /mnt/lib
    rsync -a /var/cache/ /mnt/var/cache/
    rsync -a /var/lib/ /mnt/var/lib/
    rsync -a /var/run/ /mnt/var/run/
    rsync -a /usr/ /mnt/usr/
    rsync -a /lib/ /mnt/lib/
    mount -B /mnt/var/cache /var/cache
    mount -B /mnt/var/lib /var/lib
    mount -B /mnt/var/run /var/run
    mount -B /mnt/usr /usr

    #Update your system
    apt-get -y update
    apt-get -y --force-yes upgrade

    #Install qemu + kvm
    apt-get -y install qemu kvm

    #download windows iso into /mnt
    cd /mnt
    #wget http://domain.tld/yourwindows.iso #adjust as necessary

    #CAREFULL Wipe hard disks, so that you can start your OS installation, remove "#" to execute
    #dd if=/dev/zero of=/dev/sda bs=1M count=1
    #dd if=/dev/zero of=/dev/sdb bs=1M count=1

    #Now start qemu. "qemu" is 32-bit, "qemu-system-x86_64" is 64 bit. Qemu packages are 32-bit compiled, so we can only use 2047MB. As mentioned, Qemu is having a bug and doesn't run on Windows 7, 2k8, etc without kvm. Here the commands:

    qemu-system-x86_64 -net nic -net user,hostfwd=tcp::3389-:3389 -m 2047M -alt-grab -localtime -enable-kvm -cpu core2duo,+nx -smp 2 -usbdevice tablet -k en-us -cdrom /mnt/yourwindows.iso -hda /dev/sda -hdb /dev/sdb -drive file=/mnt/cdrom2.iso,index=4,media=cdrom -vnc :0

    -net # network card, e.g. -net nic,model=virtio -net user
    -hostfwd=tcp::3389-:3389# forwards 3389 from host to 3389 from guest
    -cpu (CPU Type) # see options with "qemu -cpu ?"
    -enable-kvm # if kvm installed, use kvm
    -smp 2# number of processors
    -vnc :0 # means use vncdisplay 0 -> ":0" = 5900 port, ":1" = 5901 port, etc)
    -m 1.8G# amount of memory, 2048M and more can cause problems with 32-bit complied qemu
    -usbdevice # useful with VNC
    -k # keyboard format needs to be used, if you use keyboard other than en-us
    -cdrom # image file
    -hda # first hdd -> using physical HDD
    -hdb # second hdd -> using physical HDD
    -drive # for second CD-ROM or file, e.g. "-drive file=/mnt/cdrom2.iso,index=2,media=cdrom" or "-drive file=WIN2K.qcow2,if=ide"
    -boot d# if you need to boot from another drive e.g. /cdrom
    -boot once=d # boot once from different drive.
    -nographics # use kvm headless
    -daemonize # run as daemon

    #With this commands you can see the screen of your qemu from your home running linux
    vncviewer -via root@yourip localhost:0 #secure
    vnc yourip:0 #insecure

    -via (login to your server through ssh, using user root and standard ssh port)
    -localhost:0 (ssh makes remote server be localhost for you, :0 means connecting to port 5900 on remote server, :1 would mean connecting through port 5901, etc)

    #Windows users can use tiger-vnc and putty for secure access or just tiger-vnc for unsecure access.
    For secure access to your server, create a ssh tunnel with putty and use tiger-vnc to access "localhost:0". Unsecure you can access your server with tiger-vnc at "serverIP:0".

    # commands to create ssh tunnel with putty, still missing.

    Now you can finish your Windows installation as if you were sitting in front of your computer. If you like to setup Raid 1, just finish the installation on the first HDD. Later you can activate Raid 1 from within Windows.

    Alternative installation at home

    Especially if you need to install many servers, it is faster to make an image of your Windows installation and copy that image over the internet. I used this for an installation of Windows 2008 on a Core i5. Setup a VirtualBox server with
    System-Motherboard: 4 GB RAM, Chipset ICH9, USB Tablet, enable I/O APIC, Hardware Clock in UTC
    System-Processor: 2 CPU, PAE off
    Storage: Sata, use host I/O, 25 GB HDD, CD-Rom Windows 2008 original iso (no sp1)
    USB: disable USB 2.0
    Rest standard

    Finish the installation of Windows. Install VirtualBox Guest extensions.

    Customize Windows to start on your server

    1. Insert your Windows key

    2. Make sure your Windows installation has driver for your hardware.
    a) General command to add drivers to Windows Driverstore
    • You need to have all drivers in one directory. E.g. when you run the self-extracting file for Intel 82578V driver, the program will extract all files in a subdirectory of your temp directory. Open a command prompt ("cmd") and change to AppData directory (cd AppData) and run "explorer ." . You can then use the explorer to open Local, Temp, 2, RarSFX0, PRO1000, WinX64, NDIS62.

      Copy the directory NDIS62 to c:\NDIS62.
      The command to add a driver to the driver store is "pnputil.exe -a <PathToDriver>/<Driver>.inf" or "pnputil.exe -a <PathToDriver>/*.inf", e.g.
      pnputil.exe -a c:\NDIS62\e1c62x64.inf
      but don't do that yet. See for details.

    b) Instead of adding the driver to the installed Windows, you can also add the driver to the Windows ISO. This explains it nicly:
    Another link:

    c) HDD Controller

    • Windows 7/Windows 2008 R2 and other Windows versions missing SATA-Driver and some hints here

      To resolve this issue yourself, enable the AHCI driver in the registry before you 
      change the SATA mode of the boot drive. To do this, follow these steps:
      1. Exit all Windows-based programs.
      2. Click Start, type regedit in the Start Search box, and then press ENTER.
      3. If you receive the User Account Control dialog box, click Continue.
      4. Locate and then click one of the following registry subkeys:
      5. HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Msahci
      6. HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\IastorV
      7. In the pane on the right side, right-click Start in the Name column, and then click Modify.
      8. In the Value data box, type 0, and then click OK.
      9. On the File menu, click Exit to close Registry Editor.

    • If you need special storage drivers (e.g. SCSI, etc.) , you can add them as described in a).

    d) Network Controller
    Kimsufi uses Intel Desktop boards with 82579V network cards. Intel does not provide signed Drivers for any Windows Server edititon. You can download the latest or a not so late as suggested here.

    For Windows 2008 R2 you will need to modify the e1c62x64.inf that you will find in c:\NDIS62 after you followed step a) to look like this (Reference: ):

    ; DisplayName                   Section              DeviceID
    ; -----------                   -------              --------
    %E1502NC.DeviceDesc%            = E1502.6.1.1,       PCI\VEN_8086&DEV_1502
    %E1502NC.DeviceDesc%            = E1502.6.1.1,       PCI\VEN_8086&DEV_1502&SUBSYS_00008086
    %E1502NC.DeviceDesc%            = E1502.6.1.1,       PCI\VEN_8086&DEV_1502&SUBSYS_00011179
    %E1502NC.DeviceDesc%            = E1502.6.1.1,       PCI\VEN_8086&DEV_1502&SUBSYS_00021179
    %E1503NC.DeviceDesc%            = E1503.6.1.1,       PCI\VEN_8086&DEV_1503
    %E1503NC.DeviceDesc%            = E1503.6.1.1,       PCI\VEN_8086&DEV_1503&SUBSYS_00008086
    %E1503NC.DeviceDesc%            = E1503.6.1.1,       PCI\VEN_8086&DEV_1503&SUBSYS_00011179
    %E1503NC.DeviceDesc%            = E1503.6.1.1,       PCI\VEN_8086&DEV_1503&SUBSYS_00021179
    ; DisplayName                   Section        DeviceID
    ; -----------                   -------        --------
    %E1502NC.DeviceDesc%            = E1502,       PCI\VEN_8086&DEV_1502
    %E1502NC.DeviceDesc%            = E1502,       PCI\VEN_8086&DEV_1502&SUBSYS_00008086
    %E1502NC.DeviceDesc%            = E1502,       PCI\VEN_8086&DEV_1502&SUBSYS_00011179
    %E1502NC.DeviceDesc%            = E1502,       PCI\VEN_8086&DEV_1502&SUBSYS_00021179
    %E1503NC.DeviceDesc%            = E1503,       PCI\VEN_8086&DEV_1503
    %E1503NC.DeviceDesc%            = E1503,       PCI\VEN_8086&DEV_1503&SUBSYS_00008086
    %E1503NC.DeviceDesc%            = E1503,       PCI\VEN_8086&DEV_1503&SUBSYS_00011179
    %E1503NC.DeviceDesc%            = E1503,       PCI\VEN_8086&DEV_1503&SUBSYS_00021179
    After you modified the inf-file you can add it to the driver store with
    pnputil.exe -a c:\NDIS62\e1c62x64.inf
    For Windows 2012 R2 the driver is in NDIS64 from step a) see: . Direct adding in Windows 2012R2 didn't work, but it did after turning on testsigning of 3.b) below and rebooting. But this does not do the job, as in Windows 2008 R2. You have to boot into rescue mode from the Windows DVD in Qemu / VirtualBox / etc. and add the driver with
    Dism /Image:D:\ /Add-Driver /Driver:e1c64x64.inf
    to Windows. Thanks to

    3. Prepare Windows for reboot on new hardware

    [UPDATE 1.8.14] An installation of Windows 7 went smooth with these steps on KS-3. Install Windows 7 under Qemu. Download Intel driver and execute driver. Under "c:\user\username\Appdata\Local\Temp\Rar_something " you will find the extracted Intel network driver. Go to the proper subdirectory in Pro1000 with NDIS62. Use pnputil.exe from above to import driver to Windows. Then use fixit from to ensure you can boot from SATA. Enable Remote Desktop. That's it. Don't update the system but reboot from HDD. You should be able to login. Now follow to Step 4 and customize Windows. [/UPDATE]

    a) Do nothing special. It was reported that it would work, e.g. Windows 2012 R2 and Windows 8 and maybe also earlier versions. You should turn on remote desktop.

    b) Turn on testsigning mode, so that Windows does not complain about not digitally signed drivers.
    Turn on testsigning mode:
    bcdedit -set loadoptions DISABLE_INTEGRITY_CHECKS
    bcdedit -set TESTSIGNING ON
    Set GroupPolicy (ignored on Windows 7 and higher)
    1. Type GPEdit.MSC in Run dialog box and start Group Policy Edit.
    2. Locate "Local Computer Policy\User Configuration\Administrative Templates\System\Driver Installation"
    3. Change Device Drivers policy to enabled and choose Ignore for "installs unsigned drivers without asking"

    c) Driver Signature Enforcement Overrider 1.3b

    d) Enable Remote Desktop

    e) Turn off Firewall, so be able to ping your server

    f) Turn on debug mode with
    bcdedit -debug on
    This should turn off driver signature checking in Windows 2012 R2 and seemed to do the trick to get Intel 82579V driver installed.

    [Note: I used b), d) on my Windows 2008 R2 installation I prepared in VirtualBox]

    f) Run Sysprep on installation to let Windows scan for hardware changes
    [UPDATE] unattend.xml files are language specific. You cannot just use a English version on a Spanish Windows.[/UPDATE]
    1. Copy corresponding unattend.xml to c:\windows\panther and c:\windows\system32\sysprep
    Note, you will need an unattend.xml that fits to your Windows DVD. Read further on how to create your own unattend.xml

    2. start cmd as Administrator
    3. cd \windows\system32\sysprep
    4. sysprep /generalize /OOBE /shutdown /unattend:unattend.xml

    Windows will shut down after sysprep

    Backup and restore Windows installations

    a) Qemu installation
    You need to do nothing, since you installed Windows on your original server HDD

    b) Home installation
    Take a Linux LiveCD and boot the Windows virtual machine from the LiveCD (e.g. ScientificLinux 6.5). IMPORTANT: Don't boot up Windows after sysprep shut down your installation. The LiveCD won't mount your HDD. You can use any Linux System and add the VirtualBox HDD to it to get the same result. Just notice that you may need to change /dev/sda accordingly.

    Backup Windows installation for later use onto server
    dd if=/dev/sda bs=16M | xz | ssh -p 22 root@ "dd of=/root/windows.dd.xz bs=16M"
    Restore Windows from onto server with linux rescue mode
    dd if=/root/windows.dd.xz bs=16M | ssh -p 22 root@ "xz -d | dd of=/dev/sda bs=16M"
    -p # ssh port
    -root@ # user to ssh into

    Copy Windows to directly to server in rescue mode
    dd if=/dev/sda bs=16M | gzip -3 | ssh -p 22 root@ "gzip -d | dd of=/dev/sda bs=16M"
    -gzip -3 # so that you can compress datastream in realtime, on fast CPU you may use higher number

    You are now ready to reboot your server from HDD.

    Links I used:


    Add Driver to Windows

    HDD Drivers

    Unsigned Drivers

    Intel 82578V

    Access hidden drivers in Windows


    Autounattend.xml don't confuse with unattend.xml
    Dernière modification par heise 13/01/2015 à 21h41 Motif: Successfull Windows 2012 R2 installation

  2. #2
    Date d'inscription
    January 2014
    3 295

    Re : Qemu in rescue system, e.g. Windows installation

    Part II - Things to do after first time boot

    Your server will boot up in Windows and load the proper drivers. Since Windows is preconfigured to get the IP via DHCP, you should have no problems getting the correct IP address. You should be able to log into your server via RDP with the credentials you choose while installing the server. RDP client for linux that I use i xfreerdp as

    xfreerdp -g 1280x800 -u user -p password -a 8 -x b -z
    -g geometry
    -u user
    -p password
    -a color depths 8, 15, 16, 24 or 32, e.g. 8 for 8 bit
    -x connection type, m modem, b broadband, l lan
    -z IP:Port

    The following steps are optional and depend on what you did during installation. You may need to reboot in between.

    a) Change your Administrator password

    b) Remove product key, so you can enter new product key
    slmgr -upk
    c) Enter new product key and activate Windows

    d) Turn on firewall. Use set public network and never home or work network.

    e) Right-click on Computer and choose "Manage". Under Storage choose Disk management. Right-click on partition C: and choose extend.

    Right-click on DISK 0 and DISK 1 to convert them to dynamic disks if you want to connect them them to a RAID1
    See both disks resyncing:

    If you should run into problems booting due to problems in your Raid, boot from Windows DVD into rescue mode and start "diskpart"
    Select DISK 0
    Detail DISK
    HELP to show commands, I think you will need the command "Recover". Keep "Online" "Offline", "Break" and "Add" in mind.

    f) Turn off testsigning with
    bcdedit /deletevalue loadoptions
    bcdedit -set TESTSIGNING OFF
    g) Turn off debug mode with
     bcdedit -debug off
    h) Change computername

    i) Delete unattend.xml in C:\Windows\Panther and C:\Windows\System32\Sysprep

    j) Uninstall WAIK or WADK and VirtualBox Guest Addons.

    k) Create one account with administrator rights and one standard user account. Use the user account for your everyday work and the one with administrator rights, when you need to install something.

    l) Disable the Administrator account.

    m) Change standard RPD port. . You may need to update your firewall FIRST, so you don't lock yourself out.

    n) Turn on Automatic updates

    o) Update drivers

    p) Turn on monitoring in the Kimsufi Manager, if you adjusted you firewall, e.g. permit ping.

    Part III - Create your own unattend.xml

    You need to download Windows Assessment and Deployment Kit (WADK) for Windows® 8
    or old version

    Follow the steps from here to install WAIK or WADK.

    Now you can open the "install.img" file in the source directory of your DVD or the corresponding ".clg" file, like "install_Windows 7 PROFESSIONAL.clg". Then import an already created unattend.xml or create a new one.

    a) If you import an already created just make sure it fits to your installation, check the settings (like passwords) and save it again.

    b) To create a new unattend.xml these are the settings to look for:
    1. Microsoft-Windows-Security-SPP, generalize with SkipRearm = 1
    2. Microsoft-Windows-Security-SPP-UX, specialize with SkipAutoActivation = true
    3. Microsoft-Windows-International-Core, oobeSystem with InputLocale = en-US, SystemLocale = en-US, UILanguage = en-US
      UserLocale = en-US or as needed
    4. Microsoft-Windows-Shell-Setup, oobeSystem with HideEULAPage = true
      Expand UserAccounts
      Select AdministratorPassword and type in a password in the answer pane
    5. Microsoft-Windows-TerminalServices-LocalSessionManager, specialize with fDenyTSConnections = false
    6. Networking-MPSSVC-Svc, specialize with DomainProfile_EnableFirewall = false, PrivateProfile_EnableFirewall = false, PublicProfile_EnableFirewall = false and add
      Active = true
      Group = @FirewallAPI.dll,-28752
      Key = RemoteDesktop
      Profile = all
      to FirewallGroups/FirewallGroup
    7. Microsoft-Windows-Setup, windowsPE with AcceptEula = true under UserData, optional add product key and WillShowUI = Never

    See and

    I liked but please notice, that this is for creating an autounattend.xml, which is not the same as an unattend.xml.

    Part IV - Alternative installations

    Backup programs that do restore to dissimilar hardware, e.g. ToDo Backup. Freeware ToDo Backup 3.5 (later versions are not freeware for commercial use) lets you create a WinPE iso to restore. If you put the ".pbd" backup file in a qemu HDD file, then you can boot qemu with your HDD as hda, the qemu HDD file as second HDD and the iso to boot from. Restore works with no problems, other than you don't have much free space on tmpfs.

    You can overcome this by creating a small partition in the back of you HDD that will not be overwritten while restoring Windows. Delete with
    #dd if=/dev/zero of=/dev/sda bs=1M count=1
    the beginning of your HDD. Linux will not notice, that your HDD does not have any partition table anymore, but qemu will see a completely empty HDD. It would be a good idea, to remount the partition read-only before starting qemu.

    Same did work with ToDo Backup Server Trial 5.0. Other Backup programs should work as well.

    You should also be able to use V2P programs to restore Windows.

    If you have virtualization, you can run Windows virtualized in
    - Hyper-V , small hints on configuring fail-over IPs for guests

    - proxmox (tutorial in french // tutorial in English, ip forward: )

    - Vmware ESXi (tutorial )

    People that do Windows installations:
    Dernière modification par heise 31/12/2014 à 16h12 Motif: successful installation of windows

  3. #3
    Date d'inscription
    December 2013

    Re: Qemu in rescue system, e.g. Windows installation

    Thanks! will have to try that.. beats paying $35

  4. #4

    Re: Qemu in rescue system, e.g. Windows installation

    Do i understand right? We use QUEMU to install Windows to HDD?

  5. #5

    Re: Qemu in rescue system, e.g. Windows installation

    mount -t tmpfs -o size=12000m tmpfs /mnt # use 12GB of memory as temp - reduce as needed
    Ah, this is not usable for cheap servers that have 2-4GB of RAM.
    Dernière modification par immobilizer 12/02/2014 à 12h08

  6. #6
    Date d'inscription
    January 2014
    3 295

    Re : Qemu in rescue system, e.g. Windows installation

    Well understanding of what happens, I used RAM to store temporary files. You can use what ever you want, e.g. /dev/sdb1 or even make a partition /dev/sda4 and avoid writing to it while setting up windows. Once Windows is running, you can recover /dev/sda4 with a partition resizing program. Also note, that Qemu is slow on 2GB Ram machines, at least on my Atom D2550.

    So, you have to get creative and please report back.

  7. #7

    Re : Qemu in rescue system, e.g. Windows installation

    I will try this out, and if it is succesful you have my gratitude, if im not succesful its most likely im just bad a linux.

  8. #8

    Re : Qemu in rescue system, e.g. Windows installation

    this is my result after two attempts. ->
    i might give it 1 more attempt only because it would allow me to use windows server 2012 r2 datacenter edition

  9. #9

    Re: Qemu in rescue system, e.g. Windows installation

    huh, it is quite brain-fucking... i prefer to pay 35$ then waste hole day on it...

  10. #10
    Date d'inscription
    January 2014
    3 295

    Re : Qemu in rescue system, e.g. Windows installation

    Did you try to use qemu-system-x86_64 instead of qemu? Further your problem should not arise, if you get KVM installed without a reboot. I couldn't try, because my CPU has no virtualization.

    Further, you may get into trouble with the hdd-controler. See (try to read with if you don't know German) which recommends Mergeide.reg from for Windows XP.

    After installation you can easily "upgrade" the installation on one HDD to RAID1 in Windows. Change both harddisk partitons and change disk type to dynamic. Then you can set them up as RAID1. Google for details.

Page 1 sur 15 12311 ... DernièreDernière

Tags for this Thread

Règles de messages

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts