VirtualBox

From ReactOS
Jump to: navigation, search

VirtualBox is a virtual machine for x86 architecture developed by Innotek and maintained by Oracle. There are two versions: the full VirtualBox package with a proprietary license and the VirtualBox Open Source Edition (GPL).

It's easier to configure than QEMU and slightly slower than VMware.

Note: If you have any trouble 'capturing' your mouse/cursor within the Ros-VM-window with Virtualbox, first go to the "machine" tab and then select "Disable mouse integration", then click again on the VM-session you're running to 'capture', and this time it should work.

Running the ReactOS Live CD

The following instructions will guide you through the process of creating a ReactOS compatible virtual machine in Virtualbox and mounting the Live CD. The process is demonstrated using Virtualbox 4.2.14 r86644 on Windows 7 x64, but it should similar on other operating systems and versions.

  • Download the latest LiveCD release from http://www.reactos.org/download
  • Start VirtualBox.
  • Click the 'New' button.
  • Enter a name and set the type to Microsoft Windows. The version should be set to Windows XP. Click next.
  • Choose the amount of RAM you wish to allocate to the Virtual Machine. At least 64 MB is required, but 256 MB or more is recommended.
  • Add a Virtual Hard Drive, even if you wish to run from CD. A hard drive is required for booting the system. You can either make a new one, or choose an existing one. Click Create to create your new VM.
  • Select your new VM and click Settings.
  • Go to the 'Storage' tab and select the empty disk IDE controller.
  • Under Attributes, select your Live CD image and tick the 'Live CD/DVD' checkbox.
  • Press OK. You are now ready to boot ReactOS.

If you are unable to choose the correct screen resolution in ReactOS, then follow these instructions. They explain the steps for Windows 8, but it should work for ReactOS as well.

Getting debug output

Windows

Rosdebug1.png

Steps to be taken:

  • Set up a serial port in VirtualBox.
There are other VM's possible, but they all work more or less the same, and they can all send a debug output to a COM port.
  • Download VirtualBox, if you haven't done so yet.
  • Obviously, to debug/log ReactOS, you also need a ReactOS Debug build. ( You MUST use a Debug build. You will also need 7-Zip to get the ReactOS ISO out of the .7z file.
  • When the VirtualBox-window opens, click on the tab Settings. Click on Serial Ports.
Choose Port Mode: Host Pipe, tick the Create Pipe option, Port Path: \\.\pipe\ros_pipe
IMPORTANT: Don't change the "COM1" port that appears in the Dropdown listbox. Keep it as COM1.


Rosdebug2.png
  • Download and start PuTTY or your own favourite serial terminal (e.g. HyperTerminal,... )
This is the program that creates the debug logs. PuTTY can listen to a COM port and write it to file. If you don't know what you're looking for, get the
"For Windows on Intel x86" putty.exe file. It doesn't need to be installed; you just have to know where you downloaded it to. On Windows Vista and later
it must be run as Admin, as anything that is to use named pipes.
  • Make sure Session is selected on the TreeView on the left. In the main part of the window, under Connection Type, choose the radiobutton Serial. Under Serial Line type \\.\pipe\ros_pipe. Under speed, type "115200". Depending on your wish how to log, one can go to the TreeView on the left and click on Logging under Session. Under Session Logging, choose All session output.
  • Log file name indicates where the debug log will be and what it will be called. Use the Browse button to change the location if you like, but make sure you know where it's being saved!
  • Go back to the TreeView on the left and click on Serial (under Connection). Set Flow Control to None. PuTTY is now configured. Note that on the main page of PuTTY you can Save/Load configurations which makes it even easier.
  • Thus, after you elect the serial as connection type, set speed to 115200 baud and put the named pipe path as serial line (\\.\pipe\ros_pipe), you are ready to go. Of course, instead of ros_pipe, you can use any unique name, only mind to follow the \\.\pipe\[pipe_name] scheme.
  • Click on "Open" at the bottom of the PuTTY-window. This activates PuTTY's debug-log-creating abilities, which is a black window with a flashing green
cursor. If you can see your PuTTY window in the background, you'll see lots of text flying past as PuTTY does its thing. When you've finished with
exploring ReactOS, you'll have your debug log there. When you shut down the virtual machine, PuTTY will change to inactive state and display error
message, but when you restart the virtual machine, you can easily reconnect that session by pressing right mouse button on window top bar and selecting
Restart session.


  • First start ReactOS in DEBUG MODE in VirtualBox, then open PuTTY and watch the log.


It has been suggested that there might be some slight data loss with pipes under very heavy output. If one notices this as being the case, and one intends to be a heavy tester/logger, there is still another way of getting a debug-log to work:


Com0com : This is the VirtualBox/PuTTY bridge. It gives you the option to have multiple COM port pairs, but you really only need 1 COM port pair. (Virtual Port Pair 0, for instance). Download and install com0com virtual comport redirector. See the com0com tutorial for more info. At the setup window, you'll see the names of the virtual serial ports (default: "CNCA0" and "CNCB0"). Be sure to check that the driver for com0com is installed correctly (with Device Manager, for instance). Then start your VM. In VirtualBox, go to "Settings", "Serial Ports" and set "Port Mode" to "Host Device" in the drop-down box (NOT "Host pipe"). Then, set Port/File Path to "\\.\CNCA0". Next, start Putty; check "Serial" and at the Serial line now type "CNCB0", and click on "open". As said earlier, a black box should appear, and when you run ReactOS in debug mode, the box will fill with text, aka, your log.

IMPORTANT: Make sure to use the digitally signed version of the com0com driver on 64-bit versions of Windows Vista and later.

Using VMwareGateway

You need to download the VMwareGateway application. Start it with /r option to make it run as a service (in Windows Vista you have to use an elevated CMD for this). You can download a x86/x64 build here that does not require VirtualBox to run elevated on Vista/Win7. Next you need to start the service, using SC command:

sc start vmwaregateway

Sort out any firewall pop-up if applicable. Finally, use your favorite telnet client to connect to localhost on port 567.

To configure your virtual machine, set it to Host Pipe with the following pipe address:

\\.\pipe\vmwaredebug

Make sure you do not mark the Create Pipe box. VMwareGateway has already created it. Debug output should appear in your telnet client PuttyTel.

Linux

  • Install VirtualBox package, how to do so will depends on your distribution

On Debian or Ubuntu: sudo apt-get install virtualbox

  • Obviously, to debug/log ReactOS, you also need a ReactOS Debug build. ( You MUST use a Debug build. You will also need 7-Zip to get the ReactOS ISO out of the .7z file.
  • Set up a serial port in VirtualBox.

Setup a serial port in VirtualBox as shown in the picture to the right and below.

  • When the VirtualBox-window opens, click on the tab Settings. Click on Serial Ports.
Choose Port Mode: Host Pipe, tick the Create Pipe option, Port Path: /tmp/ReactOS-Debug.pipe
IMPORTANT: Don't change the "COM1" port that appears in the Dropdown listbox. Keep it as COM1.
VirtualBox-4.0.8.Setup serial port for socat pipe.png

Using minicom

This guide is based on the terminal application minicom. First install it by typing:

sudo apt-get install minicom
Configuring the serial port in minicom
  • "sudo minicom -s" will allow you to set your port and save the configuration file (dfl = default)
  • Choose "Configure serial ports". Name the device unix#pipe_path where "pipe_path" is a file like /tmp/ReactOS-Debug.pipe which will be used as pipe between the virtual machine and minicom.

Make sure that pipe_path is exactly the same on both minicom and VirtualBox.

  • Save config (dfl) will save your configure
  • Exit
  • now after starting the VM, execute "minicom" without sudo, to run it as a normal user
Redirect to file (Linux host)

When running minicom, type Ctrl-A then L. Type the name of the capture file.

Using socat

For viewing only
socat unix-client:pipe_path stdout

You could also do this:

socat unix-client:pipe_path stdio

Substitute "pipe_path" with the path of the pipe you created using VirtualBox (e.g. "/tmp/ReactOS-Debug.pipe").

In case you want to redirect the socat output to a file you can use the following command:

socat -u unix-client:pipe_path stdio OPEN:log_file_name,creat,trunc

Where log_file_name is the file you want to send VirtualBox serial output to.

If ReactOS crashes, you should still be able to type in the VirtualBox window - e.g. within a debug session. You'll see the input and output on the console window which socat is running in.

For an interactive window (e.g. to get a backtrace)

In one terminal tab/window do: $socat UNIX-CONNECT:/tmp/ReactOS-Debug.pipe PTY,link=/tmp/vbox_term

In an other terminal tab/window do: $screen /tmp/vbox_term

Serial port output using com0com

Install and configure com0com according to the com0com guide.

Enable the first serial port for your ReactOS machine. Use port number "COM1", mode "host device" and port path "COM4" or whatever virtual port you created first with com0com.

Connect your terminal application to your second virtual port and start up VirtualBox.

Installing Guest Additions

Mount the CD in the CD-Drive and open the file VBoxWindowsAdditions.exe and follow the setup instructions.

Setting up audio

ReactOS has had limited support for sound since the 0.3.9 release, but it is recommended to test sound with a trunk build.

In VirtualBox Machine Settings, enable audio and set the following:

  • Host Audio Driver: Windows DirectSound
  • Audio Controller: ICH AC97

After installing ReactOS:

  1. Download the Intel AC 97 driver from ReactOS Application Manager
  2. Extract the files to C:\ReactOS\
  3. Restart the virtual machine
  4. Install and start your favorite audio playback or multimedia application (e.g. Winamp, VLC, MPlayer)
  5. Open an audio file and play

Known Issues

  • The AC97 Driver only supports PCM Wave Audio in the range 8000-44.100Khz, 16Bit Samples and 2 Channels
  • Sample rate conversion is not yet supported
  • The driver has issues when changing the sample rate of the audio stream

Built-in VirtualBox (low-level) debugger

Not only the QEMU has built-in debugger, its own has also the VirtualBox. Detailed description see in the chapter "12.1.3. The built-in VM debugger" of VirtualBox User Manual help file.

Activating debugger

The VM debugger is available in all regular production versions of VirtualBox, but it is disabled by default because the average user will have little use for it. There are two ways to access the debugger:

  • A debugger console window displayed alongside the VM
  • Via the telnet protocol at port 5000

The debugger can be enabled in three ways:

  • Start the VM directly using VirtualBox --startvm, with an additional --dbg,--debug, or --debug-command-line argument. See the VirtualBox usage help for details.
  • Set the VBOX_GUI_DBG_ENABLED or VBOX_GUI_DBG_AUTO_SHOW environment variable to true before launching the VirtualBox process. Setting these variables (only their presence is checked) is effective even when the first VirtualBox process is the VM selector window. VMs subsequently launched from the selector will have the debugger enabled.
  • Set the GUI/Dbg/Enabled extra data item in config file to true before launching the VM. This can be set globally or on a per VM basis. Per VM basis - change corresponding .vbox file, is an XML-formatted settings of virtual machine.

The paths are:

  • X:\Users\%username%\.VirtualBox\VirtualBox.xml - for global

XML-node: VirtualBox/Global/ExtraData

  • ...\%VM_NAME%.vbox - for local

XML-node: VirtualBox/Machine/ExtraData

And under the mentioned XML-node add the next element: <ExtraDataItem name="GUI/Dbg/Enabled" value="true"/>

As result, a new 'Debug' menu entry will be added to the VirtualBox application. This menu allows the user to open the debugger console.

NB.: sometimes this debugger activation requires Windows restart.

Using the debugger

The VM debugger command syntax is loosely modeled on Microsoft and IBM debuggers used on DOS, OS/2 and Windows. Users familiar with symdeb, CodeView, or the OS/2 kernel debugger will find the VirtualBox VM debugger familiar. The most important command is 'help'.

See more at: VirtualBox debugger manual

See also

Personal tools
Namespaces

Variants
Actions
Navigation
Tools