Virtualizer toolbox – Honey, I Shrunk Windows 7

Virtualizer toolbox - Honey, I Shrunk Windows 7

If you are using Selenium, then you probably need the minimized version of the operating systems that are customized for a particular task – to work with browsers. Today we will talk about how we created this minimized Windows 7 image for Nerrvana, which installs on 7GB partition and works in 512MB of RAM.

All the troubles and ordeals of the process are explicitly omitted. Only their description could devote an entire post, and who will be interested in them other than the author anyway?

To customize Windows 7, I used R7 Lite. Thanks for the tip from customization gurus, as all my attempts to use vLite (for Windows XP, we used xLite) did not lead to anything good.

To start you need the original Windows 7 Home Premium image. So here are the instructions to minimize this particular version.

Why Premium? If you are using VMWare or KVM virtualization it is quite possible that Windows Home Basic will work for you. We are using Xen on 64 bit CentOS and through lots of experimentation and time I found one inexplicable phenomenon – even with the original Home Basic (it exists only in the 32 bit version) I did not manage to install Adobe Flash on IE; install just mysteriously fails. Then I took the less appealing route for us, because it has more features that we just do not need; Home Premium 64 bit, put it ‘as is’ on Xen, and Flash installed without a problem. However Flash installed just fine on Home Basic on VMWare, running on a 64 bit computer. Who knew!

From this story the practical advice follows – install the original image to the virtualization platform of your choice, and check all the details before you start minimization. In this case you will know that failure was caused by your customization process (after all, you have verified it with original image install and it all worked). It just might save you a lot of time and nerves.

Launch RT7 Lite, select Windows 7 image and specify the folder to unpack it to.

RT7 Lite - step 1

During the extraction process you will see a pop-up – select the version of Win 7 you will be working with. Why it pops up – I have no idea, as it should know what ISO we use from the ISO itself?

RT7 Lite - step 2

After loading the image you can choose and use a previously created configuration file. When you will generate the customized install image, you can, again, save changes on this page to a new file to use it in the next iteration, if it is required. Just do it before saving the customized image to an ISO file in the end.


RT7 Lite - load config

During my work I accumulated a dozen of them. Here is my latest configuration file:

[OS Name= Windows 7 HOMEPREMIUM]
[Date= 6/23/2012 8:03:53 PM]
[Microsoft .NET FrameWork= 3.5]
[Version: Release Candidate 1.7.0]
Blackviper=Default
[Update]
 
[Driver]
 
[Language]
 
[Application]
 
[Components]
Ease of Access Center=True
Action Center=True
Calculator=True
Character Map=True
Clear Type Tuner=True
Default Computer Program Access=True
Diagnostics Troubleshooting Wizard=True
Disk CleanUp=True
InboxGames=True
Chess=True
FreeCell=True
Hearts=True
Shanghai=True
Minesweeper=True
More Games=True
Internet Games=True
Internet Backgammon=True
Internet Checkers=True
Internet Spades=True
PurblePlace=True
Solitaire=True
SpiderSolitaire=True
Infrared File Transfer Application=True
Mobility Center=True
Notepad=True
On-Screen Magnifier=True
Paint=True
People Near Me=True
Projector Connectivity=True
Speech Recognition=True
Sticky Notes=True
Welcome Center=True
Windows Contacts=True
FaxServicesClientPackage=True
Windows Repair Disc=True
WindowsGadgetPlatform=True
WindowsSideShow=True
Wordpad=True
Write=True
1394 Driver=True
D_ATI Technologies=True
D_Intel Corporation=True
D_NVIDIA=True
Media Managers=True
Audio=True
High Definition Audio Driver (Default)=True
Creative Technology=True
Microsoft Audio Home Theatre Effects=True
WDM Audio Drivers=True
1394 Desktop Camera=True
M_AFA Technologies=True
M_ATI Technologies=True
M_Aver Media Technologies=True
M_Conexant=True
M_Hauppauge=True
IEEE 1394 DV Camera=True
M_IEEE 1394 Tape Subunit Devices=True
M_Luminate-Angel Devices=True
M_Microsoft Media Manager=True
M_ViXS=True
M_Windows SideShow Driver=True
Modem=True
MO_Agere Systems=True
MO_AIWA=True
MO_Anchor Datacom BV=True
MO_Archtek Telecom=True
MO_ARN=True
MO_Askey and Cardinal=True
MO_ATI Technologies=True
MO_Banksia,Meastro=True
MO_Boca Research=True
MO_Brother=True
MO_BSB Datentechnik=True
MO_Compaq=True
MO_Conexant=True
MO_Creative Labs=True
MO_Creatix Polymedia=True
MO_CPV-Stollmann Datensysteme=True
MO_Digicom=True
MO_Dynalinks and Todos=True
MO_Eiger Labs=True
MO_E-Tech=True
MO_ELSA=True
MO_Fujtisu=True
MO_Gateway 2000=True
MO_GSM Cellular=True
MO_Haeussler DK & NO=True
MO_Hayes Accura=True
MO_Hayes=True
MO_Hot Line Export AB=True
MO_I-O DATA DEVICE=True
MO_Infotel=True
MO_Intertex=True
MO_Ke Kommunikations Elektronic=True
MO_KORTEX=True
MO_LASAT COMMUNICATIONS=True
MO_Lucent=True
MO_Megasoft=True
MO_Megahertz Corporation=True
MO_Metricom=True
MO_Microcom=True
MO_MICRO Research=True
MO_Motorola=True
MO_Modular Technology=True
MO_Multitech Systems=True
MO_NEC=True
MO_Neuhaus Telekommunikation=True
MO_NISSEI=True
MO_Nokia=True
MO_Novalink Technologies=True
MO_NTT Docomo=True
MO_OLITEC=True
MO_OMRON=True
MO_OPTION International=True
MO_Ositech Communications=True
MO_Pace=True
MO_Panasonic=True
MO_Penril Datability Networks=True
MO_Practical Peripherals=True
MO_Psion Dacom=True
MO_Racal-Airtech=True
MO_Rockwell & Cirrus=True
MO_Sierra Semiconductor=True
MO_SONY=True
MO_Sony Ericsson=True
MO_Sony Ericsson and Motorola-Bluetooth Modem=True
MO_Standard Modem Drivers=True
MO_Suntac=True
MO_Supra Corporation=True
MO_TDK Corporation=True
MO_TOSHIBA=True
MO_Texas Instrument=True
MO_TKR=True
MO_TRON B.V. Datacommunicatie=True
MO_U.S. Robotics-France=True
MO_U.S. Robotics-Europe=True
MO_U.S. Robotics-Sportster=True
MO_U.S. Robotics,Telepath,IBM=True
MO_V.DOT=True
MO_Xircom=True
MO_Zoom Telephonics=True
MO_Zypcom=True
MO_ZYXEL=True
Printers=True
P_Brother=True
P_Canon=True
P_Epson=True
P_Fuji Xerox=True
P_Gestetner=True
P_Hewlett-Packard=True
P_Infotec=True
P_KONICA MINOLTA=True
P_Kyocera=True
P_Lanier=True
P_Lexmark International=True
P_Microsoft=True
P_Okidata=True
P_Ricoh=True
P_Samsung=True
P_Savin=True
P_Sharp=True
P_Sony=True
P_TOSHIBA=True
P_Xerox=True
P_XPS Document Writer=True
Scanners=True
S_Brother=True
S_Canon=True
S_Epson=True
S_Hewlett-Packard=True
S_Kyocera Mita=True
S_Lexmark=True
S_Microsoft=True
S_Ricoh=True
S_Samsung=True
S_Xerox Corporation=True
TV Tuners=True
TV_ADS Technologies=True
TV_ASUSTEK Computer=True
TV_Aver Media Technologies=True
TV_Bitland=True
TV_Creatix=True
TV_Compro Technology=True
TV_Hauppauge=True
TV_KNC ONE GMBH=True
TV_KWorld=True
TV_NXP Semiconductors=True
TV_Philips Semi-Conductors=True
TV_Pinnacle Systems=True
TV_Terratec Electronic GmbH=True
TV_VidZ Media=True
D_Bluetooth=True
Digital Media Devices=True
Diva Client=True
D_Fax=True
Floppy Drive=True
Smart Card Drivers=True
USB=True
Language Packs=True
ar-SA=True
bg-BG=True
zh-CN=True
zh-TW=True
zh-HK=True
hr-HR=True
cs-CZ=True
da-DK=True
nl-NL=True
et-EE=True
fi-FI=True
fr-FR=True
de-DE=True
el-GR=True
he-IL=True
hu-HU=True
it-IT=True
ja-JP=True
ko-KR=True
lt-LT=True
lv-LV=True
nb-NO=True
pl-PL=True
es-ES=True
pt-BR=True
pt-PT=True
ro-RO=True
ru-RU=True
sr-Latn-CS=True
sk-SK=True
sl-SI=True
sv-SE=True
th-TH=True
tr-TR=True
uk-UA=True
Autoplay=True
Sample Music and Videos=True
Sample Pictures=True
Screensavers=True
Sound Recorder=True
Windows Codec Packages=True
OpticalMediaDisc=True
Windows ISO Burn=True
MediaCenter=True
Windows Media Encoders and Decoders=True
WindowsMediaPlayer=True
Windows Photo Gallery (shimgvw)=True
Windows Photo Viewer=True
Windows Picture Acquisition Wizard=True
Windows Sounds=True
Windows wallpapers=True
IIS-WebServerRole=True
Network Explorer=True
Windows Remote Assistance=True
Remote Desktop Connection=True
TCP/IP Applications=True
TelnetClient=True
TelnetServer=True
Windows Mail=True
Windows Presentation Foundation Host=True
AxInstSV=True
SensrSvc=True
AeLookupSvc=True
ALG=True
BFE=True
BDESVC=True
wbengine=True
bthserv=True
CertPropSvc=True
KeyIso=True
Browser=True
VaultSvc=True
UxSms=True
DPS=True
WdiServiceHost=True
WdiSystemHost=True
defragsvc=True
TrkWks=True
MSDTC=True
EFS=True
EapHost=True
Fax=True
fdPHost=True
FDResPub=True
hkmsvc=True
HomeGroupListener=True
HomeGroupProvider=True
hidserv=True
IKEEXT=True
UI0Detect=True
SharedAccess=True
iphlpsvc=True
PolicyAgent=True
KtmRm=True
lltdsvc=True
Mcx2Svc=True
clr_optimization_v2.0.50727_64=True
clr_optimization_v2.0.50727_32=True
MSiSCSI=True
swprv=True
MMCSS=True
NetTcpPortSharing=True
Netlogon=True
napagent=True
NlaSvc=True
WPCSvc=True
PNRPsvc=True
p2psvc=True
p2pimsvc=True
pla=True
IPBusEnum=True
PNRPAutoReg=True
WPDBusEnum=True
Power=True
Spooler=True
wercplsupport=True
PcaSvc=True
ProtectedStorage=True
QWAVE=True
RasAuto=True
RasMan=True
SessionEnv=True
TermService=True
RpcLocator=True
RemoteRegistry=True
RemoteAccess=True
seclogon=True
SstpSvc=True
wscsvc=True
LanmanServer=True
ShellHWDetection=True
SCardSvr=True
SCPolicySvc=True
SNMPTRAP=True
sppuinotify=True
SSDPSRV=True
SysMain=True
SENS=True
TabletInputService=True
lmhosts=True
THREADORDER=True
TBS=True
upnphost=True
vds=True
VSS=True
WebClient=True
AudioSrv=True
AudioEndpointBuilder=True
SDRSVC=True
WbioSrvc=True
idsvc=True
WcsPlugInService=True
wcncsvc=True
WinDefend=True
wudfsvc=True
WerSvc=True
Wecsvc=True
MpsSvc=True
stisvc=True
ehRecvr=True
ehSched=True
WMPNetworkSvc=True
TapiSrv=True
FontCache3.0.0.0=True
WinRM=True
SearchEngine-Client-Package=True
WinHttpAutoProxySvc=True
dot3svc=True
Wlansvc=True
wmiApSrv=True
LanmanWorkstation=True
WwanSvc=True
Adapter Troubleshooter=True
Advanced UAC=True
Auto File System Converter=True
Auto File System Format Utility=True
Corrupted File Recovery=True
Device Pairing Application=True
Display Color Calibration=True
DPI Scaling=True
Eventing Command Line Utility=True
Location and Mobile PC Sensor=True
Manual windows setup=True
Microsoft Custom Dictionary=True
Microsoft Sync Center=True
Natural Language=True
Narrator=True
On-Screen Keyboard=True
Recovery=True
TabletPCOC=True
Thumbnail Cache=True
Windows Anytime Upgrade=True
Windows Cabinet Maker=True
Windows Easy Transfer=True
Windows Font Viewer=True
Windows Help=True
Windows Memory Diagnostic=True
Windows Portable Device=True
Windows PowerShell=True
Workspace Runtime=True
Xps-Foundation-Xps-Viewer=True
Zip Folder=True
 
[Features]
MediaPlayback=False
OpticalMediaDisc=False
MediaCenter=False
WindowsMediaPlayer=False
NetFx3=False
Printing-Foundation-Features=False
Printing-Foundation-InternetPrinting-Client=False
FaxServicesClientPackage=False
 
[Control Panel Remove]
 
[Control Panel Add]
 
Control panel view=Category
 
[Desktop]
 
[Desktop Taskbar]
 
[Explorer Shortcuts]
 
[Explorer Context]
 
[Explorer Views]
 
[Security]
Anti spyware=Default
UAC=Default
Windows Firewall=Default
 
[Services]
Background Intelligent Transfer Service=Manual
Network Connections=Disable
Network List Service=Disable
Windows Modules Installer=Manual
Windows Update=Manual
 
[System]
Windows Update=Disable
 
[Visual Effects]
 
[Internet Explorer]
Warn On Intranet=Disable
Welcome Page=Disable
Play Background Sound=Disable
Default Search Page=www.google.com
Script Debugger=Disable
Show URL ToolBar=Enable
Show full URL=Enable
Save Session History and Exit=Disable
No Update Checking=Enable
IE Phishing Filter=Disable
Block popups=Disable
Show URL in statusbar=Disable
Show Status Bar=Disable
Proxy=Disable
Default Start Page=Custom...
 
[Media Center]
 
CustomReg=
CustomBat=
[Un-Attended]
productkey=RHPQ2$RMFJH$74XYM$BH4JX$XM76F
 
Skip Auto Activation=True
Accept EULA=True
Select this version on install=True
Setup Language=en-US
Fullname=Nerrvana
Computername=win7template
organization=Deep Shift Labs
Logon count=1
Network location=Home
Protect your computer=Do not Install Selective Updates
Specify=True
Keyboard=United States
Currency and date format=English (United States)
UI Language=en-US
Timezone=(UTC) Coordinated Universal Time
 
[Screen Saver]
 
[Themes]
 
[WallPaper]
 
[Gadgets]
 
[Documents]
 
[Sample Musics]
 
[Sound]
Windows Ding=Default=
Windows Logoff Sound=Default=
Windows Exclamation=Default=
Windows Hardware Fail=Default=
Windows Notify=Default=
Windows Restore=Default=
Windows Recycle=Default=
Windows Battery Critical=Default=
Windows Balloon=Default=
Windows Minimize=Default=
Windows Startup=Default=
Windows Hardware Remove=Default=
Windows Critical Stop=Default=
Windows Default=Default=
Windows Feed Discovered=Default=
Windows Logon Sound=Default=
Windows Error=Default=
Windows Information Bar=Default=
Windows Hardware Insert=Default=
Windows Battery Low=Default=
Windows Shutdown=Default=
 
AppInstallationMode=0
DriverForceIntegration=False

Next, go to the tab ‘Task’ and select all of the check boxes. Here you actually tell RT7 Lite what features of it you will be using. To start, you can mark them all to have a look and then just use what you need. Today we’ll go over the features (vertical tabs on left side of RT7 Lite UI).

RT7 Lite - tab 'Task'

On the ‘Customization’ tab you can add some files to the image files that you need after installation – browsers installs, Selenium, your own scripts. You can copy files to an installed Windows too, using VNC Viewer or TeamViewer.

RT7 Lite - tab 'Customization'

Tab ‘Integration’ allows you to immediately install the necessary software updates, language packs, applications and drivers. I did not use it. This could be handy if you use Rt7 Lite to customize for big deployments – install 100 office PC’s with all standard software installed, for example.

RT7 Lite - tab 'Integration'

On the ‘Un-Attended’ tab you can answer all the questions that Windows asks during installation. Before I started using Rt7 Lite I tried using Win Toolkit where I learned the following information:

In order to not display the serial page during install you need to enter a default serial key. These are:

Windows 7:
Ultimate – D4F6K-QK3RD-TMVMJ-BBMRX-3MBMV
Professional – HYF8J-CVRMY-CM74G-RPHKF-PW487
Home Premium – RHPQ2-RMFJH-74XYM-BH4JX-XM76F
Home Basic – YGFVB-QTFXQ-3H233-PTWTJ-YRYRV
Starter – 7Q28W-FT9PC-CMMYT-WHMY2-89M6G

Windows Vista:
Ultimate – VMCB9-FDRV6-6CDQM-RV23K-RP8F7
Business – 4D2XH-PRBMM-8Q22B-K8BM3-MRW4W
Home Premium – X9HTF-MKJQQ-XK376-TJ7T4-76PKF
Home Basic – RCG7P-TX42D-HM8FM-TCFCW-3V4VD
Starter – X9PYV-YBQRV-9BXWV-TQDMK-QDWK4

NOTE: These keys are provided by Microsoft, they are only used to make the installation unattended as they keep the 30 day trial after installation.

… and use this license. After completion I passed Xen image to Dima who will finally replace this license with a real one and activate it.

RT7 Lite - tab 'Un-Attended'

It is important to visit the tab ‘Tweaks’ before ‘Features Removal’. I did not know this and spent a lot of time determining the services that can be disabled completely or disabled during normal Windows usage – Selenium testing. If you go to the ‘Services’ sub-tab (horizontal tab line in main RT7 Lite frame) on ‘Tweaks’, then at the bottom you will see a drop-down list where you can choose Black Viper’s presets.

RT7 Lite - BlackViper's presets

On this page in the left column, you can click on the Windows service description and view more details about the service and its dependencies. Profiles (most right columns) on this site are exactly the same as used by RT7 Lite. For example, selecting in RT7 Lite Black Viper’s preset ‘bare-bones’ you will get a corresponding list of services. Now you need to take a screenshot of this list, as we can remove most of the disabled services from our Windows image, when we go to the ‘Features Removal’ tab. You will need some program which can take screenshots and scroll at the same time, like FastStone Capture.

However, you do not need to remove Windows services, but just use the ‘bare-bones’ profile and leave services in the operating system in status Disabled. Installation will require more disk space, but who is very concerned about this these days? Especially if you create machines using virtual snapshot technology, when copying of the entire image is not required, and a new machine is available within seconds after receiving the command to create it. The only thing – when you decide to Windows update your master image Win 7 (the one used by virtual snapshot) – you will be updating all components and services you keep. On top of that take into account that you can have 10 or more master images if you do not install different versions of the same browsers on the same master image. You will need to Windows Update all 10 if you care to have up-to-date Windows OS for testing. For us having a very minimal Windows image is crucial as, despite the fact that we use only one browser on one virtual machine during Selenium testing (so browsers do not overlap when screenshots are taken by tests), the actual VM will have all the browsers supported on this OS installed and only one version of each browser.

To illustrate, we have:

Xen VM_A – Windows XP IE8, FF 15.0, Opera 12.02, Safari 5.1.7, Chrome 21.0.1180
Xen VM_B – Windows XP IE8, FF 11.0, Opera 11.62 Safari 5.1.5, Chrome 20.0.1132

… and Nerrvana knows which one to snapshot and launch depending on the platforms you specified.

We do not have images like

Xen VM_C – Windows XP IE8 FF 15.0, Opera 12.02, Safari 5.1.7, Chrome 21.0.1180, FF 11.0, Opera 11.62 Safari 5.1.5, Chrome 20.0.1132

Because it takes a lot of time to figure out how to install, upgrade and launch different versions of the same browser on the same OS.

Black Viper has created a wonderful site where you will find a lot of useful and structured information about Windows components and services and their dependencies. For example, COM+ System Application. Notice the tabs below where you can view information about this component on Windows 8, 7, Vista, XP Pro x64 and XP.

Below I compared my services configuration setup and the Black Viper’s ‘bare-bones’ ones. Gray color marks those services which have been removed from the image of Windows. I loaded RT7 Lite with my last configuration file where these services are removed. If you are looking at this page before visiting ‘Features Removal’ tab then all the services here will be active (black).


RT7 Lite - Services

A few words about the differences.

Background Intelligence Service – required for Windows Update. After updating, you can turn it off.

DNS client – according to the description “Only in extreme situations should you disable this service as caching DNS lookups reduces network traffic and makes internet surfing performance faster.”. It seemed important to keep it enabled.

Network Connections and Network List Service-responsible for displaying Network Connections in the Control Panel. I turned it off. If necessary, you can always turn on. I will not insist on keeping them disabled.

Themes – I left the service and keep it enabled because without it, the browser looks lame. If I am not mistaken it looks even worse than with disabled Visual Effects (more about the Visual Effects at the end of the post). Just check – switch it off on your computer and see yourself.

Windows Color System – probably agree with Black Viper – you can remove this service.

Windows Font Cache Service – “Optimizes performance of applications by caching commonly used font data. Applications will start this service if it is not already running. It can be disabled, though doing so will degrade application performance.” It seemed to me that a browser working with fonts will constantly start this service, and I left it enabled in the automatic mode. Perhaps Black Viper is right and it can be kept in Manual mode.

Windows Time – the ability to synchronize the time seemed to me as quite an important function to keep it and leave the service in Manual mode.

Windows Update – we keep it.

Startup types (Manual, Disabled, Automatic etc.) of Windows Services can be configured after OS installation. For example, after updating Windows you can disable the services responsible for updates – Windows Update, Windows Installer, Windows Modules Installer, Cryptographic Services and Background Intelligence Services. We do not want Windows checking or running updates when we run tests. It takes CPU, memory resources and fraught with unpredictable popups that may interfere with Selenium screenshots.

On the ‘Tweaks’ tab you can also change IE settings. I think it will be necessary to check if they are intact after upgrading from IE8 to IE9 – it’s not a given that they won’t be lost.

RT7 Lite - tab 'Tweaks'

Now go to the ‘Features Removal’ tab. Look at ‘Default features’ in the most right section of the main window – as I understand it, list the components that will be present (if ticked) in the resulting image. I left only IE.

Below I present the results of my work. “Language Packs” have been cut out completely. In the section ‘Features to remove’ checked boxes mark components to be removed. Ticks in expandable checkboxes mean that all the components under them are also checked. Expandable boxes that are not checked I expanded in cases where not all of the components of the lower level left (not checked). For example – see ‘Display’ section below.


RT7 Lite - tab 'Features to remove'

Finally, the last step – save customized image. If you want to save your settings and give the file a meaningful name, rather than relying on auto saving of RT7 Lite (it saves the file LastsessionX.inf adding a number in the order in the folder – C:\Program Files\Rockers Team\RT 7 Lite x64\Preset) – go back to the tab ‘Home’ and save the settings as indicated by the arrows below:

RT7 Lite - save settings

Now you can go to the ‘ISO-Bootable’ tab and save the results to the ISO file or burn it.

RT7 Lite - save ISO

Since we are not going to install multiple times with this image, the further optimization can be carried out after installation. In all virtualization platforms there is cloning functionality, which allows you to create exact copies, work with them and fall back in case of an error during the manual customization process which will follow installation.

For more information on the further optimization of Windows 7 can be found for example here:

- Windows 7 – Optimize Windows 7

- Windows 7 – Visual Effects Settings. As for the option ‘Visual effects’, it is enough to keep only the ‘Smooth edges on screen fonts’ option, if you do not care how the browser’s frame will look (on your Selenium screenshots). Otherwise, add the ‘Use visual styles on windows and buttons’, and the browser will look like we used to see it.

Good luck!

Igor

Print this post | Home

Post a comment