<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[HyperForum — QEMU I tell you how I use qemu inside qemu or nested virtualization]]></title>
		<link>https://forums.hyperbola.info/viewtopic.php?id=935</link>
		<atom:link href="https://forums.hyperbola.info/extern.php?action=feed&amp;tid=935&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in QEMU I tell you how I use qemu inside qemu or nested virtualization.]]></description>
		<lastBuildDate>Wed, 29 Nov 2023 20:57:15 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[QEMU I tell you how I use qemu inside qemu or nested virtualization]]></title>
			<link>https://forums.hyperbola.info/viewtopic.php?pid=6804#p6804</link>
			<description><![CDATA[<p>First step, activate on modprobe nested were you CPU is provided, in my case: </p><p>a file `/etc/modprobe.d/kvm.conf`</p><div class="codebox"><pre><code>options kvm_intel nested=1</code></pre></div><p>next I like use a folder with folers about distros, for example:</p><div class="codebox"><pre><code>hyperbola/
trisquel/
guix/</code></pre></div><p>then inside had one folder I put a iso, example:</p><div class="codebox"><pre><code>hyperbola/iso.iso
trisquel/iso.iso
guiix/iso.iso</code></pre></div><p>then, for run a nested virtualization for example hyperbola like a host inside trisquel with inside guix you cant start your trisquel machine how the next:</p><div class="codebox"><pre><code>#!/bin/bash

cd path/to/trisquel

isoi=iso.iso
disk=img.img
vm_name=Trisquel
## CPUs
cpus=8
## RAM
ram=6 #GBs de RAM
ram=$(( $ram * 1024 ))
# o se puede comentar lo de arriba y establecer los MBs personalizados
#ram=2560
#net=(-netdev user,id=vmnic -device virtio-net,netdev=vmnic)
net=&quot;-netdev user,id=${vm_name} -device e1000,netdev=${vm_name}&quot;

qemu=&quot;qemu-system-x86_64&quot;
audio=&#039;&#039;
screen=&#039;-display sdl&#039;
if echo $1 | grep audio &amp;&gt; /dev/null || \
        echo $2 | grep audio &amp;&gt; /dev/null
then
    echo &#039;Enabling audio&#039;
    audio+=&#039;-device sb16       &#039;
    audio+=&#039;-device adlib     &#039;
    audio+=&#039;-device ES1370    &#039;
    audio+=&#039;-device cs4231a   &#039;
    audio+=&#039;-device gus       &#039;
    audio+=&#039;-device AC97      &#039;
    audio+=&#039;-device intel-hda &#039;
    audio+=&#039;-device hda-duplex&#039;
fi
if echo $1 | grep virtio &amp;&gt; /dev/null || \
        echo $2 | grep virtio &amp;&gt; /dev/null || \
        echo $1 | grep full &amp;&gt; /dev/null || \
        echo $2 | grep full &amp;&gt; /dev/null
then
    echo &#039;Enabling full screen screen&#039;
    screen+=&#039;-full-screen -vga virtio&#039;
fi
if echo $1 | grep std &amp;&gt; /dev/null || \
        echo $2 | grep std &amp;&gt; /dev/null
then
    echo &#039;Enabling std screen&#039;
    screen+=&#039;-vga std&#039;
fi

screen=&#039;&#039;

if ! [ -f img.img ]
then
    qemu-img create -f qcow2 -o size=80G img.img
fi

if du -sh img.img | grep G &amp;&gt; /dev/null || \
    du -sh img.img | grep M &amp;&gt; /dev/null &amp;&amp; \
        ! echo &quot;$1&quot; | grep boot &amp;&gt; /dev/null
then
    $qemu -k es                            \
          $audio                           \
          $screen                          \
          -accel kvm,kernel-irqchip=split  \
          -cpu host                        \
          -name $vm_name                   \
          -rtc base=utc                    \
          -smp cpus=$cpus -m $ram          \
          $net $disk
else
    $qemu -k es                            \
          $audio                           \
          $screen                          \
          -accel kvm,kernel-irqchip=split  \
          -cpu host                        \
          -name $vm_name                   \
          -rtc base=utc                    \
          -smp cpus=$cpus -m $ram          \
          $net -boot d -cdrom $isoi -hdd $disk
fi</code></pre></div><p>^ then you only need replace folder of iso.iso containe, and the last script create in automate img.img ← for your new virtual disk if not exist, for when you want delete, only delete img.img and run again for start on zero, then inside you can run again a qemu some similar or another xD!!</p>]]></description>
			<author><![CDATA[null@example.com (saravia)]]></author>
			<pubDate>Wed, 29 Nov 2023 20:57:15 +0000</pubDate>
			<guid>https://forums.hyperbola.info/viewtopic.php?pid=6804#p6804</guid>
		</item>
	</channel>
</rss>
