<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Chetan Moorthy</title>
    <description>The latest articles on DEV Community by Chetan Moorthy (@chetan_moorthy_b4c5f017cd).</description>
    <link>https://dev.to/chetan_moorthy_b4c5f017cd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3273605%2Fc1145e05-819b-4293-864f-cd71ed2cd65b.png</url>
      <title>DEV Community: Chetan Moorthy</title>
      <link>https://dev.to/chetan_moorthy_b4c5f017cd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chetan_moorthy_b4c5f017cd"/>
    <language>en</language>
    <item>
      <title>I built a QEMU sandbox to test if a 4B model (Gemma) can act as an autonomous Linux sysadmin — here are the results (2/3 pass rate)</title>
      <dc:creator>Chetan Moorthy</dc:creator>
      <pubDate>Wed, 30 Sep 2026 17:35:23 +0000</pubDate>
      <link>https://dev.to/chetan_moorthy_b4c5f017cd/i-built-a-qemu-sandbox-to-test-if-a-4b-model-gemma-can-act-as-an-autonomous-linux-sysadmin-here-2fdd</link>
      <guid>https://dev.to/chetan_moorthy_b4c5f017cd/i-built-a-qemu-sandbox-to-test-if-a-4b-model-gemma-can-act-as-an-autonomous-linux-sysadmin-here-2fdd</guid>
      <description>&lt;p&gt;What happens when you give an open-weights 4B parameter language model root access to a broken Linux server and tell it to fix the problem?&lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;local-agent-sandbox&lt;/strong&gt;, a lightweight evaluation harness running on pure QEMU and &lt;code&gt;llama.cpp&lt;/code&gt;. Here is how the experiment was structured, how the sandboxing works, and how the model performed.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Architecture: Why Not Docker?
&lt;/h2&gt;

&lt;p&gt;Most LLM agent sandboxes default to Docker. While containers are great for application packaging, they are not security boundaries:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The container shares the host Linux kernel.&lt;/li&gt;
&lt;li&gt;If an agent runs with root privileges or encounters prompt injection executing kernel exploits, container escape is a real concern.&lt;/li&gt;
&lt;li&gt;If an agent accidentally breaks networking or DNS inside the container, external API communication dies.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Instead, I used &lt;strong&gt;pure QEMU with KVM&lt;/strong&gt; and &lt;strong&gt;QCOW2 Copy-On-Write Overlays&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A base image (&lt;code&gt;ubuntu-base.qcow2&lt;/code&gt;) contains a clean headless Ubuntu 24.04 install.&lt;/li&gt;
&lt;li&gt;Before each test, the script creates a 100KB overlay file:
&lt;code&gt;qemu-img create -f qcow2 -b ubuntu-base.qcow2 -F qcow2 sandbox.qcow2&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The VM boots off the overlay in ~6 seconds.&lt;/li&gt;
&lt;li&gt;When the test concludes, we delete the overlay and recreate it in 50ms. The base image never changes, and your host is 100% isolated.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Test Model
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Model:&lt;/strong&gt; &lt;code&gt;gemma-4-E4B-it-qat-UD-Q4_K_XL&lt;/code&gt; (Google Gemma 4B quantized)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Engine:&lt;/strong&gt; &lt;code&gt;llama.cpp&lt;/code&gt; (&lt;code&gt;llama-server&lt;/code&gt; with &lt;code&gt;--jinja&lt;/code&gt; tool calling)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Harness:&lt;/strong&gt; Python script executing commands via SSH on &lt;code&gt;127.0.0.1:2222&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Benchmark &amp;amp; Results
&lt;/h2&gt;

&lt;p&gt;We tested 3 distinct DevOps failure modes:&lt;/p&gt;

&lt;h3&gt;
  
  
  Scenario 1: Rogue Process &amp;amp; Port Collision (PASSED in 60.5s)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fault:&lt;/strong&gt; Nginx was stopped, and a background Python script was spun up on port 80.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trace:&lt;/strong&gt; Gemma ran &lt;code&gt;systemctl status nginx&lt;/code&gt;, noticed the socket couldn't bind, checked &lt;code&gt;lsof -i :80&lt;/code&gt;, extracted the PID (&lt;code&gt;892&lt;/code&gt;), ran &lt;code&gt;kill -9 892&lt;/code&gt;, and started Nginx cleanly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verdict:&lt;/strong&gt; Flawless multi-step diagnosis.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Scenario 2: Permission Lockout / HTTP 403 (FAILED in 196.2s)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fault:&lt;/strong&gt; &lt;code&gt;/var/www/html/index.nginx-debian.html&lt;/code&gt; was set to &lt;code&gt;chmod 000&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trace:&lt;/strong&gt; Gemma ran &lt;code&gt;ls -la /var/www/html&lt;/code&gt; and accurately printed &lt;code&gt;---------- 1 root root&lt;/code&gt;. But instead of modifying permissions (&lt;code&gt;chmod 644&lt;/code&gt;), it ran &lt;code&gt;chown -R www-data:www-data&lt;/code&gt;. When &lt;code&gt;curl -I&lt;/code&gt; still returned 403, it assumed Nginx routing was broken and spent the next 5 turns rewriting virtual hosts with &lt;code&gt;sed&lt;/code&gt; until it ran out of turns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verdict:&lt;/strong&gt; Classic human-like pitfall—misidentifying root cause and over-engineering the fix.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Scenario 3: Configuration Syntax &amp;amp; Health (PASSED in 76.4s)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fault:&lt;/strong&gt; Service restart and syntax health check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trace:&lt;/strong&gt; Ran &lt;code&gt;nginx -t&lt;/code&gt;, inspected configuration, checked status, and ensured traffic on port 80 was restored.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Small models can do real system work:&lt;/strong&gt; A 4B quantized model is capable of parsing Linux CLI stdout and chaining commands logically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error recovery needs guardrails:&lt;/strong&gt; Once Gemma made a wrong hypothesis in Scenario 2, it doubled down instead of questioning its initial assumption.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;QCOW2 overlays are the ultimate agent sandbox:&lt;/strong&gt; Fast, zero-cost, disposable, and secure.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Full code, setup instructions, and raw execution logs are open source:&lt;br&gt;
👉 &lt;a href="https://github.com/Chetan0246/local-agent-sandbox" rel="noopener noreferrer"&gt;https://github.com/Chetan0246/local-agent-sandbox&lt;/a&gt;&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
