Tuesday, April 7, 2009

Windows 7, Qemu & the Internet

I decided to participate in Microsoft's testing program for Windows 7 earlier this year. I downloaded the 32- and the 64-bit installation package iso-images from Microsoft's website. I envisioned to test the next generation Windows operating system as guest in a qemu emulator (version 0.9.1) using Ubuntu's Hardy Heron 8.04 as the host operating system. Hardy Heron is installed on a MSI K8T Master 2FAR motherboard with two AMD Opteron 242 CPUs and 4Gb of RAM. Binary versions of qemu compiled as applications for for Apple's OS X are available from Q. The installation of Windows 7 should not be different. Below I describe what needed to be done to render a successful installation.

KQEMU INSTALL
To install kqemu on the host, I essentially followed instructions provided on the ubuntu community documentation site here and on alien.slackbook.org here. Microsoft recommends to provide at least 16 Gb for Windows 7. I decided to create a raw image of 20 Gb and reserve 1024 Mb for RAM, that is the maximum qemu allows, in the /home directory for the guest, running the following command in the terminal:
  • qemu-img create -f raw windows7.img 20G

WINDOWS 7 INSTALL
I used the following command to install Windows 7 on the raw image:
  • qemu-system-x86_64 -localtime -net nic,model=ne2k_pci,vlan=0  -net user -m1024 -cdrom './windows7.iso' -boot d windows7.img
I repeatedly attempted to use the 64-bit version of Windows 7 without success. Each time, the installation process halted with a blue screen below.


By contrast, I was successful with the 32-bit version. The install went smoothly. I could login and test the applications. However, I could not connect to the internet. The internet icon in the bottom panel was crossed out. The problem solver suggested that the proper driver was not found. I was asked to provide one. The reader is advised to review the experience I recount below to the end.

INTERNET
I examined numerous threads on drivers for windows and qemu over several weeks. By default, Qemu provides an ethernet interface that uses the Realtek RTL8029 driver. This is a legacy driver that Realtek no longer supports. I found an installable driver v5.08 here.

Installing, the RTL8029 driver resulted in limited connectivity with no internet access. Advice on a windows help forum suggested that this problem may be solved with disabling the firewall. It did not work.

On my continued quest for solutions, I found the following suggestions:
  • Under Properties for the Driver found in the Network and Sharing Center, click Local Area Connection, uncheck the Internet Protocol Version 6 (TCP/IPv6) option.
  • Click Start in the bottom panel,
  • type regedit in the Search programs and files box, and click on regedit in the list.
  • If you are prompted for an administrator password or for confirmation, type your password, or click Continue.
     
  • Locate and click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip4\Parameters\Interfaces\{GUID}. In this registry path, click the {GUID} subkey that corresponds to the enabled ethernet interface. 
  • On the Edit menu, point to New, and then click DWORD (32-bit) Value.
  • In the New Value #1 box, type DhcpConnEnableBcastFlagToggle, and then press ENTER.
  • Right-click DhcpConnEnableBcastFlagToggle, and then click Modify.
  • In the Value data box, type 1, and then click OK.
I added one more step:
  • Locate and click the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\Interfaces\{GUID}
  • On the Edit menu, click on New, and then on DWORD (32-bit) Value. 
  • In the New Value #1 box, type DhcpConnForceBroadcastFlag, and then press ENTER.
  • The Value data box remains set to: 0.
  • Close Registry Editor.
Note a DhcpConnForceBroadcastFlag value of 0 disables this registry entry. You can use this registry entry to prevent Windows from using the DHCP BROADCAST flag. After you set this registry entry, Windows never uses the DHCP BROADCAST flag.

Taking these steps did not render the ethernet connection with the RTL8029 driver functional either. Eventually, I disabled DHCP and entered the static IP addresses proposed on ubuntu's community documentation site manually:
  • qemu-emulated Windows 7 I.P. address: 10.0.2.15
  • Gateway address: 10.0.2.2
  • SubMask address: 255.255.255.0
  • DNS Server address: 10.0.2.3
Disabling the DHCP server did not help either. At that point, I concluded that connecting to the internet was not going to work with the legacy driver. Instead, I found here that recent versions of qemu may support the rtl8139 driver, though warning was given that this option would not provide any connectivity. Despite, restarting qemu with 
  • qemu-system-x86_64 -localtime -net nic,model=rtl8139 -net user -m1024 -cdrom './windows7.iso' -boot d windows7.img
produced a working connection to the internet, miraculously automatically. The system loaded the RTL8139C+ Fast Ethernet NIC driver from its own driver directory. The interface uses DHCP and found the correct IP addresses. I did not have to edit anything manually. The pre-installed driver can be replaced with the most recent driver from Realtek for Vista 64 and Vista bundled in the newest auto installation program (Submission ID: 1310628).

Further experimentation showed that the RTL8029 driver can be used as well. Once specified on the Qemu command line with the "-net nic,model=ne2k_pci" option, Windows 7 will load the RTL8029 driver, if it has been previously installed in the system's driver directory and configure an ethernet connection. The same will happen, when you start qemu with the default option "-net nic".

A crucial prerequisite for Windows 7 autoconfiguration to work successfully is that the RTL8029 driver must have been installed beforehand, because the driver is not included in Windows 7. By contrast, if RTL8139 is specified with the qemu command, the system loads the RTL8139C+ Fast Ethernet NIC driver pre-installed in Windows 7.


IE 8
Finally, I was ready to install the latest updates from Microsoft and test applications. I remain unimpressed with the Internet Explorer (IE) 8. This browser denies access to sites like this blog which are perfectly accessible with older versions of IE, Google Chrome, Firefox, Opera, Safari, and Seamonkey. IE 8 help does not suggest any precise actions to remedy the problem. Hence,
I opted for Google Chrome instead.

SHARED FOLDER
To access a shared folder on the host system, kqemu must be started with the following command in the terminal:
  • qemu-system-x86_64 -localtime -net nic -net user -m1024 -boot c windows7.img -smb /home/user/qemu_share
In order to access the qemu_share folder from Windows 7, the folder's permissions must be set for sharing on the host. In Windows 7, the folder can then be mounted following the sequence below:
  • Click Start in the bottom panel, choose Computer,
  • right-click Network and choose Map Network Drive...,
  • enter \\10.0.2.2\qemu_share on the folder choice line,
  • choose Reconnect at logon,
  • and click Finish.
SOUND
Qemu provides several options for sound hardware, the only option Windows 7 recognized on my setup was:
  • -soundhw es1370
Ensoniq's ES 1370 technology dates back at least ten years. I found an acceptable driver on the Ensoniq support site. The driver installer location can be accessed, using the following path:
E-MU Legacy Hardware support
Audio PCI
PC
Windows 3.1 Driver Version 3.30.06.

Alternatively, you may wish to download the driver installer directly here.

The driver's setup wizard refused to fully install the software. Intriguingly, the following Windows 7 update detected and upgraded the ES 1370 driver, I needed to set the variable QEMU_AUDIO_DRV in my environment. Which drivers are supported depends on your host operating system. The options can be reviewed with qemu -audio-help. I chose alsa. Therefore, the launch of the emulator must be preceded with the comands :
  • export QEMU_AUDIO_DRV=alsa
  • export QEMU_ALSA_DAC=dmix
  • export QEMU_ALSA_ADC=null
Though I turned up full volume in all controls, the speaker sound remained exceedingly attenuated. The problem does not reside with the host. My Windows 2000 XP system emulated with the same qemu version produces great sound. This shortcoming still remains unresolved.

RUNNING WINDOWS 7
At this point, the complete command line to boot Windows 7 on kqemu includes the following options:
  • qemu-system-x86_64 -localtime -net nic -net user -m1024 -boot c windows7.img -smb /home/user/qemu_share -soundhw es1370
I recommend to save this command line in an executable shell script. The blue screen still erratically pops up during boot. The system will boot up after a couple of tries.

Addenda
  • I applied the same procedure to successfully install the release candidate that became available for download on May 5, 2009. Reboot does not always work during installation. You may have to go through a number of lengthy repair routines that Windows suggests and be patient. Eventually, it will work (05/10/09).
  • I recently upgraded Ubuntu to Karmic Koala (9.10). This upgrade comprises a new version of qemu (0.11.0), changing the available options. With the new version, I can run the emulator with two central processing units, that is -smp 2. More types of emulated ethernet cards are available. As a consequence of the update, windows 7 uninstalled the rtl8139 ethernet driver after the next boot. I had to re-install the system-provided drivers with the Device Manager (Control Panel & System and Security & System). For sound, the es1370 option is still listed following the command qemu -soundhw ?. However starting qemu with this option now fails. I am investigating (11/28/09).
  • The sound problem is unrelated to qemu. After I removed the environmental variables for alsa from the start-up script, windows 7 recognized the virtual ensoniq sound card and installed the es 1370 driver. The loudspeaker icon on the bottom menu bar of windows 7 turned unstruck, indicating active sound. However, no sound is to be heard yet. The environmental sound variables many need to be set differently in Karmic, possibly because Karmic appears to use pulse audio instead of alsa by default. I am investigating further (12/22/09).
  • If pulse audio is used for sound, the above environmental sound variables must be replaced with: QEMU_AUDIO_DRV=pa (04/15/10).
  • The download link on www.softwarepatch.com for the RTL8029 driver provided above does not seem to work at times. I found an alternative at www.techspot.com here (08/03/10).
  • Because of recently exploited vulnerabilities, the use of the RTL8029 driver is highly discouraged. You may wish to read more here: The Stuxnet Worm, Windows & The Internet (09/29/10).
  • For those who are not obligated to use qemu as emulator, I am pleased to share that I have had great success with installing and running Microsoft Corporation's Windows 8 Consumer Preview (64 bit) on VirtualBox 4.1.10. VirtualBox is emulation freeware maintained by Oracle (formerly Sun Microsystems). The installation proceeded without impediments. I followed the suggestions for the best suited settings, and made sure that no warnings remained, before I started the installation. Red triangles alert to sub-optimally selected parameters in the settings pulldown menu. The most important choice may be to dedicate no more than half of the RAM installed in your computer to emulated base memory, even if the Windows operating system can be used with more. Since I installed the system on an old Apple MacBook (2.26 GHz Intel Core 2 Duo; OS X Snow Leopard, version 10.6.8) with only 2 GB DDR3, I limited the base memory to 1 GB. In addition, I limited the emulator video memory to 128 MB. I dedicated 20 GB to static disk storage, choosing the vmdk-format. With these settings the emulated operating system performs astonishingly well. Internet access is flawless. The virtual machine is accessible on our home network. For installation, I used the downloaded iso-image of Windows 8. Therefore, I had to make sure that the CD/DVD drive option pointed to the image for the initial boot. The image can be selected under the disk icon on the bottom bar of the virtual box or from the pulldown settings menu. Good luck (03/28/2012)!
Screenshot of VirtualBox running Windows 8 on virtual machine (Read more here).



Related Posts

Thursday, February 26, 2009

Reduced Calorie Diet & Body Mass Index

Reduced-calorie diets seem to help diminish body weight. Sacks and others (2009) report in the New England Journal of Medicine (360:859-873) that eating reduced-calorie meals with differing allotments of carbohydrates, fats, and proteins helped 645 overweight adult men and women, who stringently dieted for two years, lose on average 4 kg (roughly 9 pounds). The findings caught the attention of the national media. Tara Parker-Pope filed a report on them in her column Well for The New York Times already yesterday evening. CNN's Madison Park posted a detailed report about the study today.

The participants of the study conducted at Harvard University and Louisiana State University had body mass indexes between 25 to 40. Body mass index (BMI) was calculated dividing the weight in kilograms by the square of the height in meters (see attached converter). Diets low and high in fat and protein were personalized to provide 750 kcal less per day than the baseline expenditure determined for each person.

Statistical analysis showed that all diets tested diminished body weight noticeably, though not statistically significantly. The various types of diet did not differ significantly in the diminution of body weight. However, encouragement with counseling reinforced weight loss. More persistent encouragement, in particular the addition of physical activity regimens, could have enhanced the observed small differences in effect.

Using the converter below, you may convert your body weight [pounds] and body height [inches] into metric dimensions according to the Système International by entering the appropriate values in the blue boxes and clicking on the green boxes. If you use metric measures, just enter your data in the green boxes. Subsequently, clicking on the body mass index button calculates this value.

[in] : [cm]:
[lbs]: [kg] :
BMI_:

© You may donate for further development through PayPalhere. The converter is available for MySpace users under the App name YourBMItoday.



Addenda
  • Keith Devlin discusses ten reasons why BMI may constitute an unrealistic indicator of obesity in an segment broadcast on yesterday's Weekend Edition of National Public Radio (05/07/09).
  • According to Will Dunam's post on Reuters dated May 3, 2009, reduced-calorie diets promote longevity possibly through the expression of pha-4 related genes, the products of which are  involved in the balancing of blood sugar (07/14/09).
  • Nicholas Wade reports in his post for The New York Times, dated Jul. 9, 2008, on results of a longitudinal research study with rhesus monkeys (Coleman and others, 2009), suggesting that reduced-calorie dieting extends average lifespan  (07/16/09).
  • Alex Witchel's article for The New York Times posted Oct. 6, 2009, describes the preliminary results of the first scientifically controlled studies using restricted diets on participants of normal weight. The imposed dietary regimens may be difficult to adhere to, once we are left to our own whim. The studies have not advanced to that point yet. Perhaps, the most insightful result to date is the notion that keeping track of our food intake in a conscientious effort helps (10/09/09).
  • The discussion below gave me pause. It would be great, if this example of weight control were the result of pure self discipline (10/16/09):
  • On Mar. 4, 2010, Maggie Fox posted a report with the title "Your best diet? It might be in your genes" on a recent study uncovering variations in the genes ADRB2, FABP2, and PPARG that may play a crucial role in the efficacy of diet types. The products of these genes are proteins that influence the secretion of insulin from the pancreas (ADRB2), facilitate fatty acid metabolism, (FABP2), and regulate fatty acid storage and glucose metabolism (PPARG). The study was presented at the American Heart Association's Joint Conference - 50th Cardiovascular Disease Epidemiology and Prevention - and - Nutrition, Physical Activity and Metabolism - 2010, held in San Francisco last week (Dopler Nelson and others, 2010). The results of the study are based on the examination of 140 overweight women. Four diets were randomly assigned to the participants: Atkins (low in carbohydrates), LEARN (extremely low in fat), Ornish (low in fat), and Zone (balanced). Personal genetic profiles were analyzed in roughly 100 participants, using an assay available from Interleukin Genetics Inc. Over one year, participants with the diet matching their genetic profile lost twice the body weight (5.3 precent) than the participants on mismatched diets (2.3 percent). Note that people on restricted calorie diets lose about 10 percent in the same time span (03/07/10).
  • Our body mass index is supposed to range between 18.5 and 24.9 to keep us healthy. Kathrine Rosman provides some interesting facts for the benefits of a little more weight in her Wall Street Journal post with the title "A Case for Those Extra 10 Pounds" two days ago. A few more pounds seem okay, as long as they are not visceral. That's my snag (04/29/10)!
  • According to Gautam Naik's post entitled "Gene Curtails Alzheimer's in Mice" on The Wall Street Journal today, Guarente and others (2010) provide evidence that sirtuin 1, the product of the gene SIRT1, the expression of which is induced by reduced-calorie diets, helps prevent the formation of amyloid plaques and memory loss in a mouse model for inheritable Alzheimer's disease (AD). AD mice that had additional SIRT1 inserted into their genome showed the positive results, wheras AD mice that had SIRT1 knocked out off their genome deteriorated extraordinarily fast (07/22/10).
  • Rick Wilking provides as with a gallery of slides published online on Reuters yesterday with the title "Big U.S." documenting obesity in America. We may wish to consult the BMI table on slide #33. As long as our BMI is in the white part of the table, we are fine (10/09/10).
  • Bruce Grierson informs us in his astounding essay with the title "The Incredibly Flying Nonagenarian" published online in The New York Times today about the achievements of athletes at advanced age, the physiological and genetic basis underlying such incredible performance, and the beneficial effects of physical fitness. Persistent physical exercise routines may slow aging, because the more efficient use of calories may stem the degradation of genes involved in tissue regeneration, enhancing and preserving our physical potential. Watch Olga Kotelko at age 91 (11/25/10):
  • According to this Reuters chart with the title "Obesity" published online Dec. 9, 2010, BMI statistics suggest that Italians and French are less overweight than U.S. Americans and Germans. Must be the food (12/16/10)!
  • Remaining focused on a regimen of diet and exercise over the long haul is difficult for most. Applications like the SlimKicker may provide helpful support in a playful way (04/20/12).
  • Excess body weight has reached national proportions. According to Linda Wertheimer's interview with Dr. Ian Roberts at the London School of Hygiene and Tropical Medicine with the title "Study: Fat People Burden Earth's Resources" aired on National Public Radio's Morning Edition today, the U.S. is adding the equivalent of more than one billion people in overweight to the Earth's population (06/20/2012).
  • According to the latest results of a long-term study with rhesus monkeys conducted by the US National Institute of Aging (NIA) intramural program (Mattison and others, 2012), a reduced calorie diet did not extend life. The difference in outcome compared with the study of Colman and others (2009) may lie in study design. The control monkeys in that study were allowed to indulge in as much food as they could eat, whereas the food supply for the control monkeys in the NIA study was limited (09/29/2012). 
References

Monday, November 17, 2008

Secure Virtual Network Computing

With the ever increasing speed of internet data transfer, virtual network computing (VNC) has become a viable alternative to stand alone work stations with duplicate software installations. VNC enables users to access the desktop of a work station remotely via the internet through a slim client computer for the processing of data with heavy-weight applications. Commonly, a window server application needs to be installed on the work station and a viewer application needs to be installed on the client computer to display the work station's desktop. Once the client is connected to the server, the user can work on the server like on any other desktop. Modern VNC versions even allow drag-and-drop file transfer between client and server.

Commercial VNC software is available for Linux/Unix, Microsoft Windows, and Apple's OS X operating systems (e.g. RealVNC). Apple provides simple remote desktop connectivity for its computers in Leopard (ARD 3.2). Redstone Software offers only the Vine 3.0 server for OS X (formerly OSXvnc) free and charges for a sophisticated server/client combination with which you can drag and drop files. However, Chicken of the VNC can be used for viewing on OS X as a free complement to the Vine server.

A great advantage of VNC is that the connectivity between client and server is platform-independent. Their operating systems need not be identical. I currently use TightVNC. TightVNC is an award-winning open source project offering a highly functional package for UNIX- and Microsoft Windows-based operating systems. I installed the server on a computer running Microsoft Windows XP-64. I view the desktop on a machine running Ubuntu 8.10 or on Apple computers running OS X. TightVNC comes with a platform-independent, Java-based viewer that can be used as stand-alone application, provided the Java Runtime Environment (JRE) is installed. JRE is included with OS X and can be easily installed with the Synaptic Package Manager on Ubuntu. In addition, a viewer applet can be accessed on the server through the browser. The latter option does not require any install on the client.

VNC connections commonly use ports with numbers equal to or greater than 5900. The last digits identify the display number. The user needs to register a user account with username and password on the server. The regular login dialog is unencrypted, rendering the server vulnerable to break-ins. This hazard is perhaps tolerable on a local network protected by a firewall. However, if the server is slated to be accessible over the internet at large, unencrypted login exposes the server to excessive risk. Remote login to the server through a secure shell with RSA encryption is preferable and SSH protocols provide this option.

SSH encryption is fairly safe, particularly when passphrase encryption is employed. As additional precaution, the administrator may wish to ascertain that root login is disabled in the SSH configuration script. I once made the mistake to administer a computer with superuser privileges choosing a common English noun as password. I did not know that root was enabled by default as username on port 22 in the SSH configuration script. It took some miscreant five years to guess the password, turning my machine into a reflector for evil data transfer, until the gate keepers found out about it. To preempt complications of this nature in the future, I use sudo these days, if I need to execute commands with superuser privileges.

Remote login to a VNC server from a VNC viewer with SSH entails two steps: first the connection to the VNC server needs to be successfully established via the SSH protocol, and then the viewer has to be opened using the connection. I developed a Java-based application on the intel architecture from open sources for Apple's OS X 10.4 (Tiger) and 10.5 (Leopard) that achieves this goal in a convenient amalgamated process. This sVNC client combines jcraft's SSH login with the TightVNC viewer.

sVNCIf you like to use the sVNC client, you may wish to download the zipped folder containing the application bundle with a click on the logo on the left (trademark application #77642277, pending). Copy the application to a folder of your preference. Double-click on the application's icon to launch the SSH dialog. You are asked to enter your username @ the VNC server identified by name or IP address. Subsequently, you need to provide a listening port:host:remote port combination, specifying the local host and the ports for the displays. Commonly, you can use the default combination 5900:127.0.0.1:5900. This combination specifies the host and serves from and to displays with the number 0.  If the VNC server uses a different display number, e.g. display 1, change the first number to 5901. If you wish to use a different display on your home computer, you need to change the last number accordingly. There is no need to change the address for the local host.

After you provided this information, the SSH dialog generates RSA keys. Your consent is needed. You must enter your password for the VNC server. The connection is attempted. In case of success, you need to provide your password once more for the VNC viewer, the display of the remote desktop should pop up, and you are ready to go. The configuration options to the viewer can be found in the README file included with the application in the zipped folder.

The client works well for me. If the remote desktop seems unresponsive to clicks, hit the refresh button on the viewer's top panel. The viewer may crash when the server is accessed in a sleep state. Do not be discouraged. The viewer will work on the second attempt. I hope sVNC will be useful to you.



Build a Website in 30 minutes. Try Free, Click Here.