Ticket #11526: EmulatingHaikuInVirtualBox_with_guest_additons.txt

File EmulatingHaikuInVirtualBox_with_guest_additons.txt, 18.1 KB (added by LkpPo, 5 years ago)

Fixed version

Line 
1<p>Virtual instances of operating systems are perfect for all kinds of testing
2purposes that need to be done in a safe and isolated environment. Installing
3Haiku in a virtual machine is a solution for people who do not want to install
4it on their physical computers, but wish to become familiar with it.</p>
5
6<p>This How-To guide will describe the process of running Haiku on virtual
7machine (VM) using <strong>VirtualBox 3.2</strong>. We also recommend
8installing the <em>Virtualbox Guest Additions</em> that much improved
9integration of the virtual machine to the host system. They are designed to be
10installed inside a virtual machine after the guest operating system has been
11installed and consist of device drivers and system applications that optimize
12the guest operating system for better performance and usability (including
13graphical interface).</p>
14
15<p>There are two ways it can be done– one is installing and running Haiku from
16CD-ROM image, same way it would be done on a physical instance. Another way is
17using the already prepared VM hard disk image, for convenience and time-saving
18purposes. The choice in this decision is left up to the user, although many
19people prefer VM image as it is easier to manage.</p>
20
21<p>For this tutorial we will be using an ISO image and VM image (vmdk) file -
22both can be obtained <a href="http://www.haiku-os.org/get-haiku">here</a>. The
23VirtualBox virtualization software and installation manual can be downloaded
24from <a href="http://www.virtualbox.org/wiki/Downloads">here</a>.</p>
25
26<p>Go to section:</p>
27
28<ul>
29        <li><a href="#part_iso">Installing and running Haiku from an ISO image</a></li>
30        <li><a href="#part_vmimage">Running Haiku from a VM image</a></li>
31        <li><a href="#part_additional">Additional Steps</a></li>
32        <li><a href="#part_trouble">Troubleshooting</a></li>       
33</ul>
34             
35            <h3 id="part_iso">Installing and running Haiku from an ISO image.</h3>
36             
37            The following guide will describe installation of Haiku on VirtualBox, using a ISO image.
38             
39            <h5 id="part_creatingv">Step 1. Creating a virtual machine.</h5>
40            After installing VirtualBox and downloading an iso image, we can begin the installation process. Installing operating systems in VirtualBox consists of two parts - first step is to create a virtual machine itself and then configure it to run the desired guest system installation.<br />
41             
42            We begin, by clicking the icon <span class="button">New</span> (or pressing <span class="key">Ctrl</span> + <span class="key">N</span>):
43             
44            <br /><img style="padding:12px" alt="virtualBox's main window" src="https://www.haiku-os.org/files/image1.png"/><br />
45             
46            We need to specify what kind of guest operating system we are going to install. This is helpful in pre-configuration of virtual machines – it applies default settings for supported OS’s. For Haiku, we are going to choose "<em>Other</em>" for operating system field and "<em>Other/Unknown</em>" for version:
47             
48            <br /><img style="padding:12px" alt="VM Name" src="https://www.haiku-os.org/files/image3.png"/><br />
49             
50            The next step is to define how much of the host’s physical memory we want to allocate for our virtual machine. This decision should be based on the amount of RAM the host has, but it is recommended to spend a minimum of 256mb of RAM to make it run smoothly. More memory can have an effect on the performance of the VM, but too much can slow down the host, so there needs to be a balance between the VM and host machine resources:
51             
52            <br /><img style="padding:12px" alt="Memory" src="https://www.haiku-os.org/files/image4.png"/><br />
53             
54            After we have done that, we need to create a hard disk image, that is going to be stored on the physical drive, under specified location. We click Create new hard disk (if it is not selected already) and click <span class="button">Create</span>:
55             
56            <br /><img style="padding:12px" alt="virtual hard disk" src="https://www.haiku-os.org/files/image5.png"/><br />
57                   
58                    Choose VDI and click <span class="button">Next</span>.
59                    <br /><img style="padding:12px" alt="Location and size" src="https://www.haiku-os.org/files/image7_1.png"><br />
60                                   
61            Here we can define how big the virtual hard disk should be. In most cases it is sufficient to use the default option, which is <em>Dynamically expanding storage</em>. This will allow the image file to grow as more content is saved in it, with no lack in functionality:
62             
63            <br /><img style="padding:12px" alt="Hard disk storage type" src="https://www.haiku-os.org/files/image6.png"/><br />
64             
65            The next slide will ask us for the location of the hard disk image file and maximum size of the dynamically expanding file. Input the values and click <span class="button">Create</span>:
66           
67           <br /><img style="padding:12px" alt="Location and size" src="https://www.haiku-os.org/files/image7_2.png"/><br />
68             
69            <!--break-->
70            <h5>Step 2. Configuring the virtual machine.</h5>
71             
72            Now we need to configure a few settings, to get things to work.<br />
73             
74            We click on the Settings icon that appeared for our virtual machine:
75             
76            <br /><img style="padding:12px" alt="Settings on main menu" src="https://www.haiku-os.org/files/image8.png"/><br />
77             
78            The settings window allows the user to configure the hardware aspects of the virtual machine guest OS will be using.  First of all we need to attach our ISO image with haiku installation to the virtual machine, in a form of emulated CD-ROM drive. To do that, we click <em>Storage </em>from the left panel, and then clicking on <em>Empty </em>in the <em>Storage Tree</em>. Then we click on the CD icon next to the CD/DVD Device drop-down list:
79             
80            <br /><img style="padding:12px" alt="CD/DVD Device" src="https://www.haiku-os.org/files/image9.png"/><br />
81             
82            Now we click on <em>Choose a virtual CD/DVD disk file...</em>. In the new window we point to the location where we stored our Haiku ISO installation and then Click <span class="button">Open</span> to confirm. Here is what we will see after that:
83             
84            <br /><img style="padding:12px" alt="Media manager" src="https://www.haiku-os.org/files/image10.png"/><br />
85             
86            After you are done with configuration, click <span class="button">OK</span> to move back to the main window.
87            <!--break-->
88            <h5>Step 3. Running Haiku installation.</h5>
89             
90            Hopefully, at this point everything is properly configured and we can run Haiku installation. To do so, click the Start Icon (or Machine -&gt; Start) to run the virtual machine. After a few seconds the right GUI should appear and begin the installation of Haiku in virtual environment.<br />
91             
92            The installation itself is quite simple and does not differ really from a physical one  (follow the guides <a href="http://www.haiku-os.org/get-haiku/installation-guide">on this page</a> if you are not familiar with installing haiku) although it can appear slower, depending on the performance of the host  (takes about 30 to 60 minutes to complete installation). Installing on virtual machine will also require partitioning changes which can be made directly in installation manager. The DriveSetup window should detect two mediums, one is our cd-rom (iso) file and another is a “hard drive” we created earlier. All we need to do is select that drive, go to <em>Partitions -&gt; Initialize</em>, click on <em>Be File System</em> and continue the installation.
93             
94            <br /><img style="padding:12px" alt="Haiku's DriveSetup" src="https://www.haiku-os.org/files/image11.png"/><br />
95             
96            And that’s it! After the installation is complete, the virtual machine window will redraw, to simulate rebooting of VM.  Unmount the CD image to prevent the ISO loading at each reboot by going to <em>Devices -&gt; CD/DVD Devices -&gt; Unmount CD/DVD Device</em>.
97            <!--break-->
98                    <hr />
99            <h3 id="part_vmimage">Running Haiku from a VM image</h3>
100            The following guide will describe installation of Haiku on Virtual Machine, using a VM hard disk image.<br />
101             
102            Begin by clicking the icon <span class="button">New</span> (or pressing <span class="key">Ctrl</span> + <span class="key">N</span>).
103             
104            <br /><img style="padding:12px" alt="Main menu" src="https://www.haiku-os.org/files/image8.png"/><br />
105             
106            We need to specify what kind of guest operating system we are going to install. This is helpful in pre-configuration of virtual machines – it applies default settings for supported OS’s. For Haiku,
107            we are going to choose <em>Other</em>for operating system field and <em>Other/Unknown</em> for version:
108             
109            <br /><img style="padding:12px" alt="Name and type" src="https://www.haiku-os.org/files/image3.png"/><br />
110             
111            The next step is to define how much of host’s physical memory we want to allocate for our virtual machine. This decision should be based on the amount of RAM the host has, but it is recommended to spend a minimum of 256mb of RAM to make it run smoothly. More memory can have effect on the performance of the virtual machine, but too much can slow down the host, so there needs to be a balance between the  virtual machine and host machine resources:
112             
113            <br /><img style="padding:12px" alt="Memory" src="https://www.haiku-os.org/files/image4.png"/><br />
114             
115            Now, choose "<em>Use an existing virtual hard drive file</em>" and then browse and select the file you had downloaded:
116            <br /><img style="padding:12px" alt="Add" src="https://www.haiku-os.org/files/image12.png"><br />
117                   
118            After the image appears, click <span class="button">Create</span> to confirm and move back to the main window.
119            <br /><img style="padding:12px" alt="Now with Image" src="https://www.haiku-os.org/files/image13.png"><br />
120           
121            No further steps nor configuration is required to make Haiku work, so we can move straight to executing the virtual machine. Click on the Start icon to boot VM.
122            <!--break-->
123             
124             
125            <!--break-->
126            <hr />
127                    <h3 id="part_additional">Additional steps</h3>
128            <!--break-->
129            <h5>Additional Step 1. Configuring the virtual machine.</h5>
130            There are a few settings that could be changed, for example to improve performance of Haiku. Remember that you need to divide resources responsibly, depending on your host specification.<br />
131             
132            We begin by clicking on the Settings icon.
133             
134            <br /><img style="padding:12px" alt="Settings on main menu" src="https://www.haiku-os.org/files/image8.png"/><br />
135             
136            The settings window allows the user to configure the hardware aspects of the virtual machine guest OS will be using.<br />
137             
138            One of the ways to increase performance if changing the video memory assigned to the virtual machine. On the left panel click Display tab, and move the first slider to the right, to increase the amount of memory assigned. This should allow the GUI to run more smoothly and be more responsive. 
139             
140            <br /><img style="padding:12px" alt="Display tab" src="https://www.haiku-os.org/files/image15.png"/><br />
141
142            <p>If you have previously installed Virtualbox Guest Additions,
143you can benefit from better management of the mouse between the host and the
144VM especially if it is USB or you have more than one.</p>
145
146            <p>Go to settings of your VM. On the <em>System</em> page and
147<em>Motherboard</em> tab, choose pointing device: <em>USB Tablet</em> (That
148should fix the problem).</p>
149
150            <p>Another hint is to enable the hardware virtualization, which
151by default is disabled. On the System page, click the Processor tab and mark
152Enable PAE/NX to enable CPU address extension. Before enabling this option,
153make sure your CPU supports it by visiting the manufacturer's information
154page. If you're running Linux, you can see the output of the command:<p>
155
156<pre class="terminal">grep ^flags /proc/cpuinfo</pre>
157
158            <p>This list must contain flags pae and/or nx.</p>
159             
160            <br /><img style="padding:12px" alt="Settings tab" src="https://www.haiku-os.org/files/image16.png"/><br />
161             
162            After you are done with configuration, click <span class="button">OK</span> to move back to the main window.
163            <!--break-->
164            <h5>Additional Step 2. Adjusting window settings.</h5>
165            <p>One of the inconveniences users experience while using virtual
166machines are screen resolutions. By default, guest OS’s apply a big screen
167resolution, causing the windows to have scrolling bars on both sides to
168navigate in x-axis and y-axis. There are two solutions for that problem.</p>
169
170            <p>First solution is simply adjusting the screen resolution using
171tools built into system. In Haiku we can use the Screen preflet, which can be
172found under the Preferences menu. By changing the resolution the user will
173then notice that size of the VM window has now changed.</p>
174             
175            <br /><img style="padding:12px" alt="Haiku's Screen Preflet" src="https://www.haiku-os.org/files/image17.png"/><br />
176
177            <p>You can optionally add a custom VESA resolution to the VM to get the
178full screen mode:</p>
179
180            <pre class="terminal">VBoxManage setextradata "NameOfYourVM" "CustomVideoMode1" "1400x1050x16"</pre>
181
182            </p>Another way, is to install <em>VirtualBox Guest
183Additions</em>. You can then enter and exit the full screen mode with the
184<span class="key">Host</span> + <span class="key">F</span> toggle.</p>
185
186
187            <!--break-->
188            <h5>Additional Step 3. Expanding the size of the VM hard disk image.</h5>
189            Often users find the size of original VM Haiku image not big enough to fulfil their needs. By default that size is about 600mb and in this step we are going to expand it. There is a way to do it, but it’s not as easy as it sounds. Just like a regular hard drive, once created, its physical boundaries cannot be expanded any more (the size of the disk, not partitions). The solution could be reinstalling, or cloning  the content of smaller hard drive into bigger one. That is exactly what we can do in this situation.<br />
190             
191            First we need to create a new hard disk of fixed size. Open <em>Virtual Media Manager</em> (<span class="key">Ctrl</span> + <span class="key">D</span>) and click New icon (or <em>Actions -&gt; New</em>). Then click <span class="button">Next</span>.
192             
193            <br /><img style="padding:12px" alt="Fixed-size storage" src="https://www.haiku-os.org/files/image18.png"/><br />
194             
195            Choose the <em>Fixed-size storage</em> option and click <span class="button">Next</span>. On the next slide choose a name, location and size for a <span class="path">.vdi</span> image and click <span class="button">Next</span>.
196             
197            <br /><img style="padding:12px" alt="Size" src="https://www.haiku-os.org/files/image19.png"/><br />
198             
199            Click <span class="button">Finish</span> to confirm action.<br />
200             
201            <p>For the next step we will need to switch to the command-line
202environment, to perform the cloning process. These steps need to be done on
203the host OS. Depending on OS installed instructions may vary (see <a
204href="http://www.virtualbox.org/manual/ch08.html">here</a> to get more
205information). Open the terminal/console and navigate to the location where
206VirtualBox was installed and run the following command:</p>
207             
208            <pre class="terminal">VBoxManage clonehd [location of .vdmk VM hard drive image] [location of hard drive we created earlier] –-existing</pre>
209
210            <p>F or example: (Windows host platform)</p>
211
212            <pre class="terminal">“C:\Program Files\Oracle\VirtualBox\VBoxManage.exe” clonehd C:\haiku-r1alpha2.vmdk C:\new.vdi --existing</pre>
213            <p>After executing this instruction the progress calculator will
214appear and return the uuid when finished.</p>
215             
216            <br /><img style="padding:12px" alt="CMD output" src="https://www.haiku-os.org/files/image20.png"/><br />
217             
218            Now all we need to do is to re-create the virtual machine using steps described <a href="http://www.haiku-os.org/guides/virtualizing/virtualbox#part_creatingv">here</a>, only changing the hard drive to the one we just created (<span class="path">new.vdi</span>).
219             
220            <br /><img style="padding:12px" alt="With the new image" src="https://www.haiku-os.org/files/image21.png"/><br />
221             
222            After the process if completed, we can delete the old, smaller hard drive VM image, and boot the new one we have just created.
223
224            <!--break-->
225            <hr />
226            <h3 id="part_trouble">Troubleshooting</h3>
227            <!--break-->
228
229            <h5> 1. Haiku cannot connect to the internet</h5>
230            There are some known issues with the network cards on VirtualBox virtual machines. The symptom is simply the inability to connect to other computers over the Internet. A solution to this problem is as follows:<br />
231             
232            Go to the settings of Haiku virtual machine (it needs to be shutdown first) and click <em>Network -> Advanced-> Adapter type -> Intel PRO/100 MT</em>.  Accept changes by clicking <span class="button">OK</span>.
233             
234            <br /><img style="padding:12px" alt="Intel PRO/100 MT" src="https://www.haiku-os.org/files/image22.png"/><br />
235             
236            Now the network services should be working properly.