This is theoretical part. For working implementation, see 'vbox-unattended' here:
viewtopic.php?f=10&t=46798&p=211187#p211187
Background:
OS vendors support automation, so big corporations can deploy many physical OSes quickly.
Every major operating system supports / requires it's own format of automatic scripts.
But with some trickery it can be done in virtual hardware, too...
The operating system installers knows how-to read such 'unattended scripts'
We will generate the necessary scripts on the fly, and feed to the OS installers.
research paper:
Copyright (c) 2011 Alexey Eromenko "Technologov"
I have analyzed VMware Workstation 7 product.
Found several backends:
Red Hat Anaconda kickstart,
Windows NT 5.x and
Windows NT 6.x scripts.
Debian preseed (found on the net)
The scripts for each backend is generated on the fly, based on template.
-----------------------------------------------------------
Part A: Windows unattended scripts:
-----------------------------------------------------------
Windows NT 5.x unattended scripts: (family includes Windows 2000/XP/2003)
is just single file 'winnt.sif' on floppy, that has INI-like syntax.
Windows NT 6.x unattended scripts: (family includes Windows Vista/7/2008)
is just single file 'autounattend.xml' on floppy, that has XML-like syntax.
Docs about both formats can be found on Google.
For VBox deployment, I recommend to use 2 CDs + floppy.
(1st CD = Windows, 2nd CD = Guest Additions.iso, floppy = has the config file)
We'll boot from the Windows CD.
We must:
1. generate the Windows-unattended scripts (winnt.sif and autounattend.xml),
2. create a FAT12-formatted 1.44 MB standard empty floppy image.
3. copy the Windows-unattended scripts into the floppy image.
Steps:
Linux hosts:
stage 1. is done by python strings parser.
stage 2a. dd if=/dev/zero of=/tmp/myfloppy.img count=1440 bs=1024 (create floppy image)
stage 2b. mkfs.msdos /tmp/myfloppy.img (format floppy image)
stage 3. mcopy -i /tmp/myfloppy.img winnt.sif autounattend.xml :: (copy file 1+2 into floppy image)
note: syntax of 'mcopy' is DOS-like [from] [from] ... [to], while "::" means to floppy image. Image must be specified using '-i [image]' parameter.
Problems:
stage 2 and stage 3 are impossible on Windows hosts without C coding.
(on Linux I use 'dd' and 'mkfs.msdos' for stage 2; 'mtools' for stage 3)
Possible Solutions: (hack)
stage 2: ship empty pre-formatted floppy image inside "vbox-unattended" for Windows hosts. (if zipped, it takes only few kilobytes)
stage 3: compile 'mtools' on Cygwin ? (very ugly hack, but no I see better solution for now)
Allternative: (ugly hack)
stage 2+3: Use "dir2floppy.jar" (pulls Java dependency). Advantage: Should work on Windows, without porting.
https://github.com/jedi4ever/veewee/tre ... r/lib/java
Best Solution: (good)
stage 2+3: Qemu has MIT-licensed FAT12 code built-in. (this avoids 'dd', 'mkfs.msdos' and 'mtools' hacks)
Possibly in this file:
http://svn.kju-app.org/trunk/qemu/qemu/block-vvfat.c
Porting such code to VirtualBox will pretty much solve the issue.
----------------------------------------------------------
Part B: Red Hat Anaconda kickstart:
----------------------------------------------------------
(family includes RHEL3/4/5/6, CentOS, Scientific Linux and Oracle Enterprise Linux,
that claims to be 'Unbreakble')
(a bit harder to support, but also possible is: Fedora)
Those are much more complex. Anaconda does not read kickstart config files
from floppy, unlike Windows.
The end result, is that there is a need to generate cusom-made bootable ISO,
that includes linux kernel, initrd, and kickstart config file.
In addition, I also recommend putting VBoxLinuxAdditions.run on the 2nd CD,
so they could be automatically deployed.
For VBox deployment, I recommend to use 2 CDs.
(1st CD = custom-made.iso (bootable), 2nd CD = Red Hat Enterprise Linux)
We must:
1. generate Linux-kickstart scripts
2. extract Linux-kernel, initrd, bootloader from original Red-Hat-like DVD.
3. extract VBoxLinuxAdditions.run from GuestAdditions.iso.
4. generate bootable custom-made iso (ISO9660 filesystem), that uses components from steps #1, #2, #3.
Steps:
Linux hosts:
stage 1. is done by python strings parser.
stages 2+3: 7z e /path/Red-Hat-like.iso isolinux/ && rm -Rvf isolinux/
(Alternative: can be done via 'mount -o loop')
stage 4: $ genisoimage -o /tmp/boot-ks.iso -r -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T .
(Alternative: can be done via 'mkisofs')
(VMware WS 7 uses 'mkisofs' on Windows hosts for stage 4)
Problems:
Is including and invoking LGPLed utility (7-zip) acceptable for VirtualBox team, if this code to be upstreamed ?
Extra steps: (required for full remastering of Red Hat)
stage A. copy .discinfo (hidden file; else your Red Hat won't detect DVD)
stage B. implantisomd5 redhat_custom.iso (so that media test will succeed)
More read:
Red Hat kickstart configurator GUI:
http://docs.redhat.com/docs/en-US/Red_H ... start.html
-----------------------------------------------------
Part C: Debian installer preseed:
-----------------------------------------------------
Debian actually provides not one, but two (!) methods of unattended installation:
- FAI (Fully Automatic Installation) and Debian Preseed.
In this material I cover the later, because the former doesn't suit our needs.
About FAI: from my very quick review, it seems to require very complex host-side
scripting, that are part of Debian.
It will likely work only on Debian hosts, or from Debian servers. Doesn't suit our needs.
Unlike FAI, preseed hides most of it's complex logic inside guest.
Preseed is in some ways similar to Red Hat kickstart, but more picky at some places, and requires more work;
Scripts are easy-to-read plain text.
It allows for both for semi-automatic and fully-automatic installs, by pre-seeding ready results.
For example it doesn't allows to boot from CD-A and load preseed script from same CD-A,
but install from CD-B.
So here we boot from CD-A, read script from floppy, then install from CD-B.
Moreover, preseed requires more parameters to be passed to the kernel.
The reason to use floppy, is that I was unable to load the script from CD.
isolinux.cfg:
kernel /install.386/vmlinuz
append initrd=/install.386/initrd.gz debian-installer/locale=en_US console-setup/layoutcode=us netcfg/choose_interface=auto priority=critical preseed/file=/floppy/preseed.cfg --
If you forget to specify "locale" or "layoutcode", the d-i (debian installer)
will ask the user about those interactively, converting our install to semi-automatic.
priority=critical is related to the amount of questions that various "deb"
packages usually ask (such as which Display Manager to use: XDM or KDM).
We must:
1. generate Debian-preseed scripts and isolinux.cfg
2. extract Linux-kernel, initrd, bootloader from original Debian media. (install.{arch}/ and isolinux/)
3. extract VBoxLinuxAdditions.run from GuestAdditions.iso.
4. generate bootable custom-made iso, that uses components from steps #1, #2, #3.
5. create a FAT12-formatted 1.44 MB standard empty floppy image.
6. put the Debian-preseed scripts into the floppy image.
For VBox deployment, I recommend to use 2 CDs+1 floppy.
(1st CD = custom-made.iso (bootable), 2nd CD = Debian, custom-made-floppy.img (w/preseed))
Steps:
Similar to RedHat + Windows combined.
More reading about preseed:
http://www.debian.org/releases/stable/i ... 02.html.en
-and-
http://www.debian-administration.org/ar ... ding/print
--------------------------------------
Part D: SUSE AutoYast:
--------------------------------------
(family includes SUSE Linux Enterprise and openSUSE)
SUSE's AutoYast automatic installer in it's logic and concept is similar to Red Hat's kickstart.
Both depend on 2 CD-ROMs being loaded, and both don't need any floppy.
Major difference is the actual format, that uses XML format.
================
Sister projects:
1. Oz
http://clalance.blogspot.com/2011/02/oz ... n-010.html
http://aeolusproject.org/oz-download.html
Chris Lalancette <clalance@redhat.com>
2. passion engine
https://github.com/hh/veewee/tree/master/templates
https://github.com/passionengine/ii
done by <hippiehacker> on #vbox
-Technologov