virtualbox (Blog)https://www.turnkeylinux.org/blog/term/63/0
env14.0 Optimized Builds - Part 1: OVA & VMDKhttps://www.turnkeylinux.org/blog/14.0-optimized-builds-pt1-vmdk-ova
<p>I am happy to announce the release of our OVA and VMDK VM builds. 14.0 optimized VM builds can be downloaded from their respective appliance pages (eg. <a href="https://www.turnkeylinux.org/lampstack">LAMP</a>, <a href="https://www.turnkeylinux.org/wordpress">WordPress</a> <a href="https://www.turnkeylinux.org/nodejs">Node.js</a> etc). Alternatively you can download the entire library via one of our <a href="https://www.turnkeylinux.org/mirrors">mirrors</a>.</p>
<a name="ova"></a><h2>New build format: OVA - double click installation</h2>
<p>As most TurnKey users would know, we have been providing OVF format VM builds for a while now. For those of you who didn&#39;t; OVF (<a href="https://en.wikipedia.org/wiki/Open_Virtualization_Format">Open Virtualization Format</a>) is an open standard for packaging and distributing virtual appliances. When we initially released our OVF build, it was mostly being used by VMware. However since then, support has been added (and become popular) for many other <a href="https://en.wikipedia.org/wiki/Open_Virtualization_Format#Industry_support">virtualization platforms</a>.</p>
<p>In theory this sounds grand; however as the standard is somewhat &quot;loose&quot; our previous implementation has not been without issue. Many have complained that our OVF build did not properly declare the architecture of the VM causing issues booting. This problem, some other points, as well as suggested fixes and improvements were <a href="https://www.turnkeylinux.org/forum/general/20150208/ovf-import-broken-virtualbox-64bit-fix-and-other-suggestions-easier-tklx-virt">highlighted on the forums</a> by community member <a href="http://www.turnkeylinux.org/user/51846">Dani M</a>. This resulted in a <a href="https://github.com/turnkeylinux/tracker/issues/320">feature request</a> and a related <a href="https://github.com/turnkeylinux/tracker/issues/321">bug report</a>.</p>
<p>Following on from Dani&#39;s suggestion, I set to work and did some testing. I can happily declare that the architecture bug is now squashed! :) While I was at it I also investigated Dani&#39;s suggestion to replace our OVF with an OVA. An OVA is an archive (container) for distributing OVF VMs (instead of using a zip file as we did previously). It includes a virtual disk image (usually a VMDK) and an OVF (the standards compliant VM declaration). After doing some brief testing it was a no-brainer! OVAs only require a &quot;double-click&quot; to import into both VMware Player and VirtualBox! So for v14.0 we provide an OVA (rather than a zipped OVF) and it is also the new default VM format.</p>
<p><img alt="VirtualBox import wizard" src="https://www.turnkeylinux.org/files/u/237/01-vbox-double-click_0.png" /><br />
&emsp;&emsp;&emsp;&emsp;<em>With VirtualBox installed; double-clicking the OVA file automatically opens the import wizard</em></p>
<p>If you&#39;ve never used an OVA before and you use VirtualBox or VMware (or one of the other <a href="https://en.wikipedia.org/wiki/Open_Virtualization_Format#Industry_support">virtualization platforms</a> that supports it) then why not download one; give it a test drive and report back in the comments below?!</p>
<a name="vmdk"></a><h2>Alternative VM format: VMDK</h2>
<p>Initially I was thinking that we may be able to replace the VMDK build with the OVA too. However after testing it became clear that it was not as user friendly for alternative VM platforms which support VMDK; but not OVF/OVA. As the OVA is essentially just a tar archive; opening it and extracting the VMDK virtual disk is easy enough. However within an OVA, the VMDK is read only as well as being compressed (optimized for streaming). Some platforms (e.g. KVM) do not support this type of VMDK file. So we decided that for the convenience of users on platforms such as KVM; they may appreciate the ability to simply unzip the vanilla (writeable) VMDK file and use it OOTB.</p>
<p>We decided to keep the included VMX file (VMware VM config file) as well; for any users using legacy VMware products. So the VMDK build could be considered a somewhat legacy VM build. Although as I say; it is still very useful for KVM import; as well as reported success of use with Xen HVM. It is also still usable within VMware (import via the VMX) and VirtualBox (manually configure the VM and add the VMDK file as the virtual disk) for those who like doing things the hard way! :)</p>
<h2>The value of Community</h2>
<p>So once again; together we demonstrate the value that you; our community members provide for TurnKey. Value which we can then return! So even though sometimes we may be a little slow to respond on the forums; or slow to implement great suggestions, please be assured that we always encourage users to get involved and always make a point of listening. Please do not ever hesitate to share your thoughts and ideas. Feel free to comment (below), use our <a href="https://www.turnkeylinux.org/forums">forums</a> and/or post bug reports and/or feature requests on our <a href="https://github.com/turnkeylinux/tracker/issues">GitHub Issue tracker</a>.</p>
<p>Also make sure you subscribe so you don't miss out on up and coming announcements regarding other optimized builds (coming soon).</p>https://www.turnkeylinux.org/blog/14.0-optimized-builds-pt1-vmdk-ova#commentsappliancesovaovfreleasevirtualboxvirtualizationvmdkvmwareWed, 04 Nov 2015 10:42:44 +0000Jeremy Davis17911 at https://www.turnkeylinux.orgConverting a virtual disk image: VDI or VMDK to an ISO you can distributehttps://www.turnkeylinux.org/blog/convert-vm-iso
<p>Why would anyone in their right mind want to convert a VM into an ISO?</p>
<p>Good question, the answer for Conor Fox (who was the inspiration for this post - thanks Conor!) was to distribute his customized TurnKey PostgreSQL image so others could use it.</p>
<p>Distributing an ISO as opposed to a VM image allows it to be installed on any virtualization platform, as well as on bare metal, with the added bonus of running live.</p>
<p>I suppose that's a good enough reason, so lets get to it.</p>
<!--break-->
<br/>
<h2>Convert VM disk to raw image and mount it</h2>
<p>First we need to get qemu-img, a tool bundled with <a href="http://www.qemu.org">qemu</a> (KVM's virtualization backend) to convert the VM disk to a raw image, and <a href="http://www.turnkeylinux.org/docs/tklpatch">TKLPatch</a>, the TurnKey customization mechanism to package the ISO.</p>
<p>If you are not using a TurnKey installation, see the <a href="http://www.turnkeylinux.org/docs/tklpatch/installation">TKLPatch installation notes</a>.</p>
<pre>
apt-get install qemu
apt-get install tklpatch</pre>
<p>I'll show how to convert a VMWare VMDK image into raw disk format. If you are using a different virtualization platform such as Virtualbox, see <a href="http://www.turnkeylinux.org/blog/convert-vdi-vmdk">this post</a> on converting a VDI to a raw image.</p>
<pre>
qemu-img convert -f vmdk turnkey-core.vmdk -O raw turnkey-core.raw
</pre>
<p>Next, mount the raw disk as a loopback device.</p>
<pre>
mkdir turnkey-core.mount
mount -o loop turnkey-core.raw turnkey-core.mount</pre>
<p><strong>GOTCHA 1</strong>: If your VM has partitions, it's a little tricker. You'll need to setup the loop device, partition mappings and finally mount the rootfs partition. You will need kpartx to setup the mappings.</p>
<pre>
loopdev=$(losetup -s -f turnkey-core.raw)
apt-get install kpartx
kpartx -a $loopdev
<em># p1 refers to the first partition (rootfs)</em>
mkdir turnkey-core.mount
mount /dev/mapper/$(basename $loopdev)p1 turnkey-core.mount</pre>
<h2><br />
Extract root filesystem and tweak for ISO configuration</h2>
<p>Now, make a copy of the root filesystem and unmount the loopback.</p>
<pre>
mkdir turnkey-core.rootfs
rsync -a -t -r -S -I turnkey-core.mount/ turnkey-core.rootfs
umount -d turnkey-core.mount
# If your VM had partitions (GOTCHA 1):
kpartx -d $loopdev
losetup -d $loopdev</pre>
<p>Because the VM is an installed system as opposed to the ISO, the file system table needs to be updated.</p>
<pre>
cat&gt;turnkey-core.rootfs/etc/fstab&lt;&lt;EOF
aufs / aufs rw 0 0
tmpfs /tmp tmpfs nosuid,nodev 0 0
EOF</pre>
<p><strong>GOTCHA 2:</strong> If your VM uses a kernel optimized for virtualization (like the one included in the TurnKey VM builds), you need to replace it with a generic kernel, and also remove vmware-tools if installed.</p>
<pre>
tklpatch-chroot turnkey-core.rootfs
<em># inside the chroot</em>
apt-get update
apt-get install linux-image-generic
dpkg --purge $(dpkg-query --showformat='${Package}\n' -W 'vmware-tools*')
dpkg --purge $(dpkg-query --showformat='${Package}\n' -W '*-virtual')
exit</pre>
<h2><br />
Generate the ISO</h2>
<p>Finally, prepare the cdroot and generate the ISO.</p>
<pre>
tklpatch-prepare-cdroot turnkey-core.rootfs/
tklpatch-geniso turnkey-core.cdroot/</pre>
<p>Thats it!</p>
<p>Bonus: By default the ISO will boot automatically. If you want to include the <a href="http://www.turnkeylinux.org/screenshots/boot">TurnKey bootsplash and bootmenu</a>, extract the cdroot from a TurnKey ISO and tell tklpatch-prepare-cdroot to use it as a template.</p>
<pre>
tklpatch-extractiso turnkey-core.iso
tklpatch-prepare-cdroot turnkey-core.rootfs/ turnkey-core.cdroot/
tklpatch-geniso turnkey-core.cdroot/</pre>
<p><strong>Ever needed to package a VM as a distributable ISO? <a href="#comment-form">Post a comment</a>!</strong></p></br/>https://www.turnkeylinux.org/blog/convert-vm-iso#commentsconvertvirtualboxvmwareThu, 11 Feb 2010 07:21:03 +0000Alon Swartz1019 at https://www.turnkeylinux.orgConverting a virtual disk image: VDI to VMDK to a raw loopback file you can mounthttps://www.turnkeylinux.org/blog/convert-vdi-vmdk
<p>By default, VirtualBox creates virtual disk images in a special format called VDI, which is unique to VirtualBox. Disk images are stored in $HOME/.VirtualBox/HardDisks.</p>
<p>You'll need to convert VDI into another format if you want to run a VirtualBox VM on another virtualization platform, such as VMWare or KVM.</p>
<!--break-->
<p>The VMDK virtual disk format is a good choice because even though it originated with VMWare it is supported by other virtualization platforms including VirtualBox and KVM.</p>
<p>VirtualBox enables the conversion using the low-level &quot;VBoxManage clonehd&quot; command:</p>
<pre class="literal-block">
VBoxManage list hdds # prints a list of disk image UUIDs
VBoxManage clonehd &lt;UUID&gt; -o converted.vmdk format VMDK
cd ~/.VirtualBox/HardDisks/
ls -la converted.vmdk
</pre>
<p>Once you have converted to VMDK you can use qemu-img, a tool bundled with qemu (KVM's virtualization backend) to further convert VMDK to other formats.</p>
<p>A particularly useful format to convert to is 'raw' which you can then mount as a loopback device:</p>
<pre class="literal-block">
apt-get install qemu
qemu-img convert -f vmdk converted.vmdk -O raw converted.raw
mount -o loop converted.raw /mnt<strong><br /></strong></pre>
<p><strong>Ever had to convert between disk image formats? <a href="#comment-form">Post a comment</a>!</strong></p>https://www.turnkeylinux.org/blog/convert-vdi-vmdk#commentsconvertvirtualboxvmwareTue, 09 Feb 2010 18:00:00 +0000Liraz Siri1009 at https://www.turnkeylinux.org