<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Containers on RESEARCHUT</title><link>https://researchut.com/tags/containers/</link><description>Recent content in Containers on RESEARCHUT</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>rrs@researchut.com (Ritesh Raj Sarraf)</managingEditor><webMaster>rrs@researchut.com (Ritesh Raj Sarraf)</webMaster><lastBuildDate>Sat, 20 Dec 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://researchut.com/tags/containers/index.xml" rel="self" type="application/rss+xml"/><item><title>Immutable Debian</title><link>https://researchut.com/blog/Immutable_Atomic_Debian/</link><pubDate>Sat, 20 Dec 2025 00:00:00 +0000</pubDate><author>rrs@researchut.com (Ritesh Raj Sarraf)</author><guid>https://researchut.com/blog/Immutable_Atomic_Debian/</guid><description>&lt;h2 id="immutable-atomic-linux-distirbutions"&gt;Immutable Atomic Linux Distirbutions&lt;/h2&gt;
&lt;p&gt;Of late, I&amp;rsquo;ve been hearing a lot of (good) things about Immutable Linux
Distributions, from friends, colleagues and mentors. It has been
something on my plate for some time, to explore. But given the nature of
the subject, it has been delayed for a while. Reasons are simple; I can
only really judge this product if I use it for some time; and it has to
be on my primary daily driver machine.&lt;/p&gt;</description><content:encoded><![CDATA[<h2 id="immutable-atomic-linux-distirbutions">Immutable Atomic Linux Distirbutions</h2>
<p>Of late, I&rsquo;ve been hearing a lot of (good) things about Immutable Linux
Distributions, from friends, colleagues and mentors. It has been
something on my plate for some time, to explore. But given the nature of
the subject, it has been delayed for a while. Reasons are simple; I can
only really judge this product if I use it for some time; and it has to
be on my primary daily driver machine.</p>
<p>Personal life, this year, has been quite challenging as well. Thus it got pushed to until now.</p>
<h3 id="chrome-os">Chrome OS</h3>
<p>I&rsquo;ve realized that I&rsquo;ve been quite late to a lot of Linux parties.
Containers, Docker, Kubernetes, Golang, Rust, Immutable Linux and many
many more.</p>
<p>Late to the extent that I&rsquo;ve had a Chrome Book lying at home for many
months but never got to tinker with it at all.</p>
<p>Having used it for just around 2 weeks now, I can see what a great
product Google built with it. In short, this is exactly how a Linux
desktop integration should be. The GUI integration is just top notch.
There&rsquo;s consistency across all applications rendered on the Chrome OS</p>
<p>The integration of [X]Wayland and friends is equally good. Maybe Google
should consider opensourcing all those components. IIRC, exo,
sommelier, xwayland, ash and many more.</p>
<p>I was equally happy to see their <code>Linux Development Environment</code>
offering on supported hardware. While tightly integrated, it still
allows power users to tinker things around. I was quite impressed to see
nested containers in <code>crostini</code>. Job well done.</p>
<p>All of this explains why there&rsquo;s much buzz about <code>Immutable Atomic Linux Distributions</code> these days.</p>
<p>Then, there&rsquo;s the Android integration, which is just awesome in case you
care of it. Both <code>libndk</code> and <code>libhoudini</code> are well integrated and
nicely usable.</p>
<h3 id="immutable-linux-distributions">Immutable Linux Distributions</h3>
<p>This holiday season I wanted to find and spend some time catching up on
stuff I had been prolonging.</p>
<p>I chose to explore this subject while trying to remain in familiar
Debian land. So my first look was to see if there was any product
derived out of the Debian base.</p>
<p>That brought me to <code>Vanilla OS Orchid</code>. This is a fresh out of oven
project, recently switched to being based on Debian Sid. Previous
iteration used Ubuntu as the base.</p>
<p>Vanilla OS turned out to be quite good an experience. The stock
offering is created well enough to serve the general audience. And the
framework is such wonderfully structured that seasoned users can tinker
around with it, without much fuss.</p>
<p>Vanilla OS uses an A/B Partition model for how system updates are
rolled. At any point, when a new OTA update is pushed, it gets applied
to the inactive A/B partition. And it gets activated at next boot. If things
break, user has the option to switch to the previous state. Just the
usual set of expectations one would have with an immutable distribution.</p>
<p>What they&rsquo;ve done beautifully is:</p>
<ul>
<li>Integration Device Mapper LVM for A/B Partition</li>
<li>Linux Container OCI images to provison/flash A/B Paritions</li>
<li>Developed <code>abroot</code> utility for A/B Partition management</li>
<li>APX (Distrobox) integration for container workflows, with multiple Linux flavors</li>
<li>No <code>sudo</code>. Everything done via <code>pkexec</code></li>
</ul>
<p>But the most awesome thing I liked in Vanilla OS is <a href="https://github.com/rickysarraf/custom-image">custom images</a>. This allows power users to easily tinker with the developer workflow and generate new images, tailored for their specific use cases. All of this done levraging the GitHub/GitLab CI/CD workflows, which I think is just plain awesome. Given that payload is of the OCI format, the CICD workflow just generates new OCI images and publishes to a registry. And then the same is pulled to the client as an OTA.</p>
<p>Hats off to this small team/community for doing such nice integration
work, ultimately producing a superb Immutable Atomic Linux Distribution
based on the Debian base.</p>
<h3 id="immutable-linux">Immutable Linux</h3>
<p>My primary work machine has grown over the years, being on the rolling
Debian Testing/Unstable channel. And I don&rsquo;t much feel the itch ever to
format my (primary) machine so quick, no matter how great the counter
offer is.</p>
<p>So that got me wondering how to have some of bling of the immutable
world that I&rsquo;ve tasted (Thanks Chrome OS and Vanilla OS). With a fair
idea of what they offer in features, I drew a line to what I&rsquo;d want on
my primary machine.</p>
<ul>
<li>read-only rootfs</li>
<li>read-only /etc/</li>
</ul>
<p>This also kinda hardens my systems to an extent that I can&rsquo;t
accidentally cause catastrophic damage to it.</p>
<p>The feature I&rsquo;m letting go of is the A/B Partition (rpm-ostree for Fedora
land). While a good feature, having to integrate it into my current
machine is going to be very very challenging.</p>
<p>I actually feel that, the core assumption the Immutable Distros make,
that all hardware is going to <code>Just Work</code>, is flawed. While Linux has
substantially improved over the past years, there&rsquo;s still a hit/miss
when introducing very recent hardware.</p>
<p>Immutable Linux is targeted for the novice user, who won&rsquo;t accidentally
mess with the system. But what would the novice user do in case they
have issues with their recently purchased hardware, that they are
attempting to run (Immutable) Linux on.</p>
<h3 id="riteshs-immutable-debian">Ritesh&rsquo;s Immutable Debian</h3>
<p>With the premise set, on to sailing in immutable land.</p>
<p>There&rsquo;s another ground breaking innovation that has been happening;
which I think everyone is aware of. And may be using it as well, direct
or indirect.</p>
<p><em>Artificial Intelligence</em></p>
<p>While I&rsquo;ve only been a user for a couple of months as I draft this post,
I&rsquo;m now very much impressed with all this innovation. Being at the
consumer end has me appreciating it for what it has offered thus far.
And I haven&rsquo;t even scratched the surface. I&rsquo;m making attempts at
developing understanding of <em>Machine Learning</em> and <em>Artificial
Intelligence</em> but there&rsquo;s a looonnngg way to go still.</p>
<p>What I&rsquo;m appreciating the most is the availability of the AI Technology.
It has helped me be more efficient. And thus I get to use the gain
(time) with family.</p>
<p>To wrap, what I tailored my primary OS to, wouldn&rsquo;t have been possible
without assistance from AI.</p>
<p>With that, I disclaim that the rest of this article is primarily drafted
by my AI Companion. This is going to serve me as a reference for future,
when I forget about how all of this was structured.</p>
<h1 id="-system-architecture-immutable-debian-btrfs--mergerfs">🏗️ System Architecture: Immutable Debian (Btrfs + MergerFS)</h1>
<p>This system is a custom-hardened <strong>Immutable Workstation</strong> based on Debian Testing/Unstable. It utilizes native Btrfs properties and surgical VFS mounting to isolate the Operating System from persistent data.</p>
<h2 id="1-storage-strategy-subvolume-isolation">1. Storage Strategy: Subvolume Isolation</h2>
<p>The system resides on a LUKS-encrypted NVMe partition, using a flattened subvolume layout to separate the &ldquo;Gold Master&rdquo; OS from volatile and persistent data.</p>
<table>
	<thead>
			<tr>
					<th style="text-align: left">Mount Point</th>
					<th style="text-align: left">Subvolume Path</th>
					<th style="text-align: left">State</th>
					<th style="text-align: left">Purpose</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: left"><code>/</code></td>
					<td style="text-align: left"><code>/ROOTVOL</code></td>
					<td style="text-align: left"><strong>RO</strong></td>
					<td style="text-align: left">The core OS image.</td>
			</tr>
			<tr>
					<td style="text-align: left"><code>/etc</code></td>
					<td style="text-align: left"><code>/ROOTVOL/etc</code></td>
					<td style="text-align: left"><strong>RO</strong></td>
					<td style="text-align: left">System configuration (Snapshot-capable).</td>
			</tr>
			<tr>
					<td style="text-align: left"><code>/home/rrs</code></td>
					<td style="text-align: left"><code>/ROOTVOL/home/rrs</code></td>
					<td style="text-align: left"><strong>RW</strong></td>
					<td style="text-align: left">User data and Kitty terminal configs.</td>
			</tr>
			<tr>
					<td style="text-align: left"><code>/var/lib</code></td>
					<td style="text-align: left"><code>/ROOTVOL/var/lib</code></td>
					<td style="text-align: left"><strong>RW</strong></td>
					<td style="text-align: left">Docker, Apt state, and system DBs.</td>
			</tr>
			<tr>
					<td style="text-align: left"><code>/var/spool</code></td>
					<td style="text-align: left"><code>/ROOTVOL/var/spool</code></td>
					<td style="text-align: left"><strong>RW</strong></td>
					<td style="text-align: left">Mail queues and service state.</td>
			</tr>
			<tr>
					<td style="text-align: left"><code>/swap</code></td>
					<td style="text-align: left"><code>/ROOTVOL/swap</code></td>
					<td style="text-align: left"><strong>RW</strong></td>
					<td style="text-align: left">Isolated path for No_COW Swapfile.</td>
			</tr>
			<tr>
					<td style="text-align: left"><code>/disk-tmp</code></td>
					<td style="text-align: left"><code>/ROOTVOL/disk-tmp</code></td>
					<td style="text-align: left"><strong>RW</strong></td>
					<td style="text-align: left">MergerFS overflow tier.</td>
			</tr>
	</tbody>
</table>
<h3 id="11-etcfstab">1.1 /etc/fstab</h3>
<pre tabindex="0"><code>❯ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use &#39;blkid&#39; to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# &lt;file system&gt; &lt;mount point&gt;   &lt;type&gt;  &lt;options&gt;       &lt;dump&gt;  &lt;pass&gt;

# --- ROOT &amp; BOOT ---
/dev/mapper/nvme0n1p3_crypt  /  btrfs  autodefrag,compress=zstd,discard=async,noatime,defaults,ro  0  0
/dev/nvme0n1p2               /boot      ext4    defaults        0  2
/dev/nvme0n1p1               /boot/efi  vfat    umask=0077      0  1

# --- SWAP ---
# Mount the &#34;Portal&#34; to the swap subvolume using UUID (Robust)
UUID=4473b40b-bb46-43d6-b69c-ef17bfcac41c  /swap  btrfs  subvol=/ROOTVOL/swap,defaults,noatime  0  0

# Activate the swap file by path (Correct for files)
/swap/swapfile  none  swap  defaults  0  0

# --- DATA / MEDIA ---
UUID=439e297a-96a5-4f81-8b3a-24559839539d  /media/rrs/TOSHIBA  btrfs  noauto,compress=zstd,space_cache=v2,subvolid=5,subvol=/,user

# --- MERGERFS ---
# --- DISK-TMP (MergerFS Overflow Tier) ---
# Ensure this ID matches your actual disk-tmp subvolume
UUID=4473b40b-bb46-43d6-b69c-ef17bfcac41c  /disk-tmp  btrfs  subvolid=417,discard=async,defaults,noatime,compress=zstd  0  0
tmpfs               /ram-tmp   tmpfs          defaults  0  0
/ram-tmp:/disk-tmp  /tmp       fuse.mergerfs  x-systemd.requires=/ram-tmp,x-systemd.requires=/disk-tmp,defaults,allow_other,use_ino,nonempty,minfreespace=1G,category.create=all,moveonenospc=true  0  0

# --- IMMUTABILITY PERSISTENCE LAYERS ---
# We explicitly mount these subvolumes so they remain Writable later.
# UUID is the same as your /var/lib entry (your main Btrfs volume).

# 1. /var/lib (Docker, Apt state) - ID 50659
UUID=4473b40b-bb46-43d6-b69c-ef17bfcac41c  /var/lib    btrfs   subvolid=50659,discard=async,defaults,noatime,compress=zstd  0  0

# 2. /home/rrs (User Data) - ID 13032
UUID=4473b40b-bb46-43d6-b69c-ef17bfcac41c  /home/rrs   btrfs   subvolid=13032,discard=async,defaults,noatime,compress=zstd  0  0

# 3. /etc (System Config) - ID 13030
UUID=4473b40b-bb46-43d6-b69c-ef17bfcac41c  /etc        btrfs   subvolid=13030,discard=async,defaults,noatime,compress=zstd,ro  0  0

# 4. /var/log (Logs) - ID 406
UUID=4473b40b-bb46-43d6-b69c-ef17bfcac41c  /var/log    btrfs   subvolid=406,discard=async,defaults,noatime,compress=zstd    0  0

# 5. /var/cache (Apt Cache) - ID 409
UUID=4473b40b-bb46-43d6-b69c-ef17bfcac41c  /var/cache  btrfs   subvolid=409,discard=async,defaults,noatime,compress=zstd    0  0

# 6. /var/tmp (Temp files) - ID 401
UUID=4473b40b-bb46-43d6-b69c-ef17bfcac41c  /var/tmp    btrfs   subvolid=401,discard=async,defaults,noatime,compress=zstd    0  0

# /var/spool
UUID=4473b40b-bb46-43d6-b69c-ef17bfcac41c  /var/spool  btrfs  subvolid=50689,discard=async,defaults,noatime,compress=zstd  0  0
</code></pre><h2 id="2-tiered-memory-model-tmp">2. Tiered Memory Model (/tmp)</h2>
<p>To balance performance and capacity, <code>/tmp</code> is managed via <strong>MergerFS</strong>:</p>
<ul>
<li><strong>Tier 1 (RAM):</strong> <code>tmpfs</code> mounted at <code>/ram-tmp</code>.</li>
<li><strong>Tier 2 (Disk):</strong> Btrfs subvolume mounted at <code>/disk-tmp</code>.</li>
<li><strong>Logic:</strong> Files are written to RAM first. If RAM falls below 1GB available, files spill over to the Btrfs disk tier.</li>
</ul>
<h2 id="3-hibernation--swap-logic">3. Hibernation &amp; Swap Logic</h2>
<ul>
<li><strong>Size:</strong> 33 GiB (Configured for Suspend-to-Disk with 24GB RAM).</li>
<li><strong>Attribute:</strong> The <code>/swap</code> subvolume is marked <strong>No_COW (+C)</strong>.</li>
<li><strong>Kernel Integration:</strong>
<ul>
<li><code>resume=UUID=...</code> (Points to the unlocked LUKS container).</li>
<li><code>resume_offset=...</code> (Physical extent mapping for Btrfs).</li>
</ul>
</li>
</ul>
<h3 id="31-systemd-sleephibernation">3.1 systemd sleep/Hibernation</h3>
<pre tabindex="0"><code>❯ cat /etc/systemd/sleep.conf.d/sleep.conf
[Sleep]
HibernateDelaySec=12min
</code></pre><p>and</p>
<pre tabindex="0"><code>❯ cat /etc/systemd/logind.conf.d/logind.conf
[Login]
HandleLidSwitch=suspend-then-hibernate
HandlePowerKey=suspend-then-hibernate
HandleSuspendKey=suspend-then-hibernate
SleepOperation==suspend-then-hibernate
</code></pre><h2 id="4-immutability--safety-mechanisms">4. Immutability &amp; Safety Mechanisms</h2>
<p>The system state is governed by two key components:</p>
<h3 id="a-the-control-script-immutectl">A. The Control Script (<code>immutectl</code>)</h3>
<p>Handles the state transition by flipping Btrfs properties and VFS mount flags in the correct order.</p>
<ul>
<li><code>sudo immutectl unlock</code>: Sets <code>ro=false</code> and remounts <code>rw</code>.</li>
<li><code>sudo immutectl lock</code>: Sets <code>ro=true</code> and remounts <code>ro</code>.</li>
</ul>
<pre tabindex="0"><code>❯ cat /usr/local/bin/immutectl
#!/bin/bash

# Ensure script is run as root
if [[ $EUID -ne 0 ]]; then
   echo &#34;This script must be run as root (sudo).&#34;
   exit 1
fi

ACTION=$1

case $ACTION in
    unlock)
        echo &#34;🔓 Unlocking / and /etc for maintenance...&#34;

        # 1. First, tell the Kernel to allow writes to the mount point
        mount -o remount,rw /
        mount -o remount,rw /etc
        
        # 2. Now that the VFS is RW, Btrfs will allow you to change the property
        btrfs property set / ro false
        btrfs property set /etc ro false

        echo &#34;Status: System is now READ-WRITE.&#34;
        ;;
    lock)
        echo &#34;🔒 Locking / and /etc (Immutable Mode)...&#34;
        sync

        btrfs property set / ro true
        btrfs property set /etc ro true

        # We still attempt remount, but we ignore failure since Property is the Hard Lock
        mount -o remount,ro / 2&gt;/dev/null
        mount -o remount,ro /etc 2&gt;/dev/null

        echo &#34;Status: System is now READ-ONLY (Btrfs Property Set).&#34;
        ;;
    status)
        echo &#34;--- System Immutability Status ---&#34;
        
        for dir in &#34;/&#34; &#34;/etc&#34;; do
            # Get VFS state
            VFS_STATE=$(grep &#34; $dir &#34; /proc/mounts | awk &#39;{print $4}&#39; | cut -d, -f1)
            
            # Get Btrfs Property state
            BTRFS_PROP=$(btrfs property get &#34;$dir&#34; ro | cut -d= -f2)
            
            # Determine overall health
            if [[ &#34;$BTRFS_PROP&#34; == &#34;true&#34; ]]; then
                FINAL_STATUS=&#34;LOCKED (RO)&#34;
            else
                FINAL_STATUS=&#34;UNLOCKED (RW)&#34;
            fi

            echo &#34;Path: $dir&#34;
            echo &#34;  - VFS Layer (Mount): $VFS_STATE&#34;
            echo &#34;  - Btrfs Property:    ro=$BTRFS_PROP&#34;
            echo &#34;  - Effective State:   $FINAL_STATUS&#34;
            
            # Check for mismatch (The &#34;Busy&#34; scenario)
            if [[ &#34;$VFS_STATE&#34; == &#34;rw&#34; &amp;&amp; &#34;$BTRFS_PROP&#34; == &#34;true&#34; ]]; then
                echo &#34;  ⚠️  NOTICE: VFS is RW but Btrfs is RO. System is effectively Immutable.&#34;
            fi
            echo &#34;&#34;
        done
        ;;
    *)
        echo &#34;Usage: $0 {lock|unlock|status}&#34;
        exit 1
        ;;
esac
</code></pre><h3 id="b-the-smart-seal-immutability-sealservice">B. The Smart Seal (<code>immutability-seal.service</code>)</h3>
<p>A systemd one-shot service that ensures the system is locked on boot.</p>
<ul>
<li><strong>Fail-safe:</strong> The service checks <code>/proc/cmdline</code> for the standalone word <code>rw</code>. If found (via GRUB manual override), the seal is aborted to allow emergency maintenance.</li>
</ul>
<pre tabindex="0"><code>❯ cat /etc/systemd/system/immutability-seal.service 
[Unit]
Description=Ensure Btrfs Immutable Properties are set on Boot (unless rw requested)
DefaultDependencies=no
After=systemd-remount-fs.service
Before=local-fs.target
# Don&#39;t run in emergency/rescue modes
#ConditionPathExists=!/run/systemd/seats/seat0

[Service]
Type=oneshot
# The robust check: exit if &#39;rw&#39; exists as a standalone word
ExecStartPre=/bin/sh -c &#39;! grep -qE &#34;\brw\b&#34; /proc/cmdline&#39;
ExecStartPre=mount -o remount,rw /
ExecStart=/usr/bin/btrfs property set / ro true
ExecStart=/usr/bin/btrfs property set /etc ro true
ExecStartPost=mount -o remount,ro /
RemainAfterExit=yes

[Install]
WantedBy=local-fs.target
</code></pre><h2 id="5-monitoring--maintenance">5. Monitoring &amp; Maintenance</h2>
<ul>
<li><strong>Nagging:</strong> A systemd user-timer runs <code>immutability-nag</code> every 15 minutes to notify the desktop session if the system is currently in an &ldquo;Unlocked&rdquo; state.</li>
<li><strong>Verification:</strong> Use <code>sudo immutectl status</code> to verify that both the VFS Layer and Btrfs Properties are in sync.</li>
</ul>
<h3 id="51-nagging">5.1 Nagging</h3>
<pre tabindex="0"><code>❯ cat ~/bin/immutability-nag 
#!/bin/bash
# Check Btrfs property
BTRFS_STATUS=$(btrfs property get / ro | cut -d= -f2)

if [[ &#34;$BTRFS_STATUS&#34; == &#34;false&#34; ]]; then
    # Use notify-send (Standard, fast, non-intrusive)
    notify-send -u critical -i security-low \
    &#34;🔓 System Unlocked&#34; \
    &#34;Root is currently WRITABLE. Run &#39;immutectl lock&#39; when finished.&#34;
fi
</code></pre><p>and</p>
<pre tabindex="0"><code>❯ usystemctl cat immutability-nag.service 
# /home/rrs/.config/systemd/user/immutability-nag.service
[Unit]
Description=Check Btrfs immutability and notify user
# Ensure it doesn&#39;t run before the graphical session is ready
After=graphical-session.target

[Service]
Type=oneshot
ExecStart=%h/bin/immutability-nag
# Standard environment for notify-send to find the DBus session
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%U/bus

[Install]
WantedBy=default.target

    ~                                                                                                                                                                   20:35:15 
❯ usystemctl cat immutability-nag.timer 
# /home/rrs/.config/systemd/user/immutability-nag.timer
[Unit]
Description=Check immutability every 15 mins

[Timer]
OnStartupSec=5min
OnUnitActiveSec=15min

[Install]
WantedBy=timers.target
</code></pre><p>And the resultant nag in action.


<div class="box" >
  <figure  itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
    <div class="img" style="background-image: url('/images/immutable-seal.jpeg');" >
      <img itemprop="thumbnail" src="/images/immutable-seal.jpeg" alt="Immutable Debian Nag"/>
    </div>
    <a href="/images/immutable-seal.jpeg" itemprop="contentUrl"></a>
      <figcaption><h4>Immutable Debian Nag</h4>
      </figcaption>
  </figure>
</div>
</p>
<h3 id="52-verification">5.2 Verification</h3>
<pre tabindex="0"><code>❯ sudo immutectl status
[sudo] password for rrs: 
--- System Immutability Status ---
Path: /
  - VFS Layer (Mount): rw
  - Btrfs Property:    ro=false
  - Effective State:   UNLOCKED (RW)

Path: /etc
  - VFS Layer (Mount): rw
  - Btrfs Property:    ro=false
  - Effective State:   UNLOCKED (RW)



    ~                                                                                                                                                                   21:14:08 
❯ sudo immutectl lock
🔒 Locking / and /etc (Immutable Mode)...
Status: System is now READ-ONLY (Btrfs Property Set).


    ~                                                                                                                                                                   21:14:15 
❯ sudo immutectl status
--- System Immutability Status ---
Path: /
  - VFS Layer (Mount): rw
  - Btrfs Property:    ro=true
  - Effective State:   LOCKED (RO)
  ⚠️  NOTICE: VFS is RW but Btrfs is RO. System is effectively Immutable.

Path: /etc
  - VFS Layer (Mount): rw
  - Btrfs Property:    ro=true
  - Effective State:   LOCKED (RO)
  ⚠️  NOTICE: VFS is RW but Btrfs is RO. System is effectively Immutable.
</code></pre><hr>
<p><strong>Date Configured:</strong> December 2025<br>
<strong>Philosophy:</strong> The OS is a diagnostic tool. If an application fails to write to a locked path, the application is the variable, not the system.</p>
<h2 id="wrap">Wrap</h2>
<p>Overall, I&rsquo;m very very happy with, the result of a day of working
together with AI. I wouldn&rsquo;t have gotten things done so quick in such
time if it wasn&rsquo;t around. Such great is this age of AI.</p>
]]></content:encoded></item><item><title>Systemd Service Hang</title><link>https://researchut.com/blog/Systemd_Service_Hang/</link><pubDate>Fri, 22 Apr 2022 00:00:00 +0000</pubDate><author>rrs@researchut.com (Ritesh Raj Sarraf)</author><guid>https://researchut.com/blog/Systemd_Service_Hang/</guid><description>&lt;p&gt;Finally, TIL, what can all be the reason for systemd services to hang indefinitely. The internet is flooded with numerous reports on this topic but no clear answers. So no more uselessly marked workarounds like: &lt;code&gt;systemctl daemon-reload&lt;/code&gt; and &lt;code&gt;systemctl-daemon-reexec&lt;/code&gt; for this scenario.&lt;/p&gt;
&lt;p&gt;The scene would be something along the lines of:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rrs &lt;span style="color:#ae81ff"&gt;6467&lt;/span&gt; 0.0 0.0 &lt;span style="color:#ae81ff"&gt;23088&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;15852&lt;/span&gt; pts/1 Ss 12:53 0:00 | | &lt;span style="color:#ae81ff"&gt;\_&lt;/span&gt; /bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rrs &lt;span style="color:#ae81ff"&gt;11512&lt;/span&gt; 0.0 0.0 &lt;span style="color:#ae81ff"&gt;14876&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;4608&lt;/span&gt; pts/1 S+ 13:18 0:00 | | | &lt;span style="color:#ae81ff"&gt;\_&lt;/span&gt; systemctl restart snapper-timeline.timer
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rrs &lt;span style="color:#ae81ff"&gt;11513&lt;/span&gt; 0.0 0.0 &lt;span style="color:#ae81ff"&gt;14984&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;3076&lt;/span&gt; pts/1 S+ 13:18 0:00 | | | &lt;span style="color:#ae81ff"&gt;\_&lt;/span&gt; /bin/systemd-tty-ask-password-agent --watch
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rrs &lt;span style="color:#ae81ff"&gt;11514&lt;/span&gt; 0.0 0.0 &lt;span style="color:#ae81ff"&gt;234756&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;6752&lt;/span&gt; pts/1 Sl+ 13:18 0:00 | | | &lt;span style="color:#ae81ff"&gt;\_&lt;/span&gt; /usr/bin/pkttyagent --notify-fd &lt;span style="color:#ae81ff"&gt;5&lt;/span&gt; --fallback
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;snapper-timeline&lt;/code&gt; service is important to me and it not running for months is a complete failure. Disappointingly, commands like &lt;code&gt;systemctl --failed&lt;/code&gt; do not report of this oddity. The overall system status is reported to be fine, which is completely incorrect.&lt;/p&gt;</description><content:encoded><![CDATA[<p>Finally, TIL, what can all be the reason for systemd services to hang indefinitely. The internet is flooded with numerous reports on this topic but no clear answers. So no more uselessly marked workarounds like: <code>systemctl daemon-reload</code> and <code>systemctl-daemon-reexec</code> for this scenario.</p>
<p>The scene would be something along the lines of:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>rrs         <span style="color:#ae81ff">6467</span>  0.0  0.0  <span style="color:#ae81ff">23088</span> <span style="color:#ae81ff">15852</span> pts/1    Ss   12:53   0:00  |   |   <span style="color:#ae81ff">\_</span> /bin/bash
</span></span><span style="display:flex;"><span>rrs        <span style="color:#ae81ff">11512</span>  0.0  0.0  <span style="color:#ae81ff">14876</span>  <span style="color:#ae81ff">4608</span> pts/1    S+   13:18   0:00  |   |   |   <span style="color:#ae81ff">\_</span> systemctl restart snapper-timeline.timer
</span></span><span style="display:flex;"><span>rrs        <span style="color:#ae81ff">11513</span>  0.0  0.0  <span style="color:#ae81ff">14984</span>  <span style="color:#ae81ff">3076</span> pts/1    S+   13:18   0:00  |   |   |       <span style="color:#ae81ff">\_</span> /bin/systemd-tty-ask-password-agent --watch
</span></span><span style="display:flex;"><span>rrs        <span style="color:#ae81ff">11514</span>  0.0  0.0 <span style="color:#ae81ff">234756</span>  <span style="color:#ae81ff">6752</span> pts/1    Sl+  13:18   0:00  |   |   |       <span style="color:#ae81ff">\_</span> /usr/bin/pkttyagent --notify-fd <span style="color:#ae81ff">5</span> --fallback
</span></span></code></pre></div><p>The <code>snapper-timeline</code> service is important to me and it not running for months is a complete failure. Disappointingly, commands like <code>systemctl --failed</code> do not report of this oddity. The overall system status is reported to be fine, which is completely incorrect.</p>
<p>Thankfully, a kind soul&rsquo;s <a href="https://github.com/NixOS/nixpkgs/issues/2584#issuecomment-42616675">comment</a> gave the hint. The problem is that you could be having certain services in <code>Activating</code> status, which thus blocks all other services; quietly. So much for the unnecessary fun.</p>
<p>Looking further, in my case, it was:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>rrs@priyasi:~$ systemctl list-jobs 
</span></span><span style="display:flex;"><span>JOB  UNIT                           TYPE  STATE  
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">81</span>   timers.target                  start waiting
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">85</span>   man-db.timer                   start waiting
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">88</span>   fstrim.timer                   start waiting
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">3832</span> snapper-timeline.service       start waiting
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">83</span>   snapper-timeline.timer         start waiting
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">39</span>   systemd-time-wait-sync.service start running
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">87</span>   logrotate.timer                start waiting
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">84</span>   debspawn-clear-caches.timer    start waiting
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">89</span>   plocate-updatedb.timer         start waiting
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">91</span>   dpkg-db-backup.timer           start waiting
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">93</span>   e2scrub_all.timer              start waiting
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">40</span>   time-sync.target               start waiting
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">86</span>   apt-listbugs.timer             start waiting
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#ae81ff">13</span> jobs listed.
</span></span><span style="display:flex;"><span>13:12 ♒ ॐ ♅ ♄ ⛢     ☺ 😄    
</span></span></code></pre></div><p>That was it. I knew the <code>systemd-timesyncd</code> service, in the past, had given me enough headaches. And so was it this time, just quietly doing it all again.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>rrs@priyasi:~$ systemctl status systemd-time-wait-sync.service
</span></span><span style="display:flex;"><span>● systemd-time-wait-sync.service - Wait Until Kernel Time Synchronized
</span></span><span style="display:flex;"><span>     Loaded: loaded <span style="color:#f92672">(</span>/lib/systemd/system/systemd-time-wait-sync.service; enabled; vendor preset&gt;
</span></span><span style="display:flex;"><span>     Active: activating <span style="color:#f92672">(</span>start<span style="color:#f92672">)</span> since Fri 2022-04-22 13:14:25 IST; 1min 38s ago
</span></span><span style="display:flex;"><span>       Docs: man:systemd-time-wait-sync.service<span style="color:#f92672">(</span>8<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>   Main PID: <span style="color:#ae81ff">11090</span> <span style="color:#f92672">(</span>systemd-time-wa<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>      Tasks: <span style="color:#ae81ff">1</span> <span style="color:#f92672">(</span>limit: 37051<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>     Memory: 836.0K
</span></span><span style="display:flex;"><span>        CPU: 7ms
</span></span><span style="display:flex;"><span>     CGroup: /system.slice/systemd-time-wait-sync.service
</span></span><span style="display:flex;"><span>             └─11090 /lib/systemd/systemd-time-wait-sync
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Apr <span style="color:#ae81ff">22</span> 13:14:25 priyasi systemd<span style="color:#f92672">[</span>1<span style="color:#f92672">]</span>: Starting Wait Until Kernel Time Synchronized...
</span></span><span style="display:flex;"><span>Apr <span style="color:#ae81ff">22</span> 13:14:25 priyasi systemd-time-wait-sync<span style="color:#f92672">[</span>11090<span style="color:#f92672">]</span>: adjtime state <span style="color:#ae81ff">5</span> status <span style="color:#ae81ff">40</span> time Fri 2022-&gt;
</span></span><span style="display:flex;"><span>13:16 ♒ ॐ ♅ ♄ ⛢      ☹ 😟<span style="color:#f92672">=</span>&gt; <span style="color:#ae81ff">3</span>  
</span></span></code></pre></div><p>Dear LazyWeb, anybody knows of why the <code>systemd-time-wait-sync</code> service would hang indefinitely? I&rsquo;ve had identical setups on many machines, in the same network, where others don&rsquo;t exhibit this problem.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>rrs@priyasi:~$ systemctl cat systemd-time-wait-sync.service
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>...snipped...
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>Service<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>Type<span style="color:#f92672">=</span>oneshot
</span></span><span style="display:flex;"><span>ExecStart<span style="color:#f92672">=</span>/lib/systemd/systemd-time-wait-sync
</span></span><span style="display:flex;"><span>TimeoutStartSec<span style="color:#f92672">=</span>infinity
</span></span><span style="display:flex;"><span>RemainAfterExit<span style="color:#f92672">=</span>yes
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">[</span>Install<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>WantedBy<span style="color:#f92672">=</span>sysinit.target
</span></span></code></pre></div><p>The <code>TimeoutStartSec=infinity</code> is definitely an attribute that shouldn&rsquo;t be shipped in any system services. There are use cases for it but that should be left for local admins to explicitly decide. Hanging for <code>infinity</code> is not a desired behavior for a system service.</p>
<p>In figuring all this out, today I learnt the handy <code>systemctl list-jobs</code> command, which will give the list of active <code>running/blocked/waiting</code> jobs.</p>
<h2 id="update-2024-08-15">Update: 2024-08-15</h2>
<p>This week I finally found the cause of the issue. I have a bunch of bridge interfaces defined on my machine. And all of them, most of their time, would be <code>DOWN</code></p>
<pre tabindex="0"><code>
@ ip a
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: withnet: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether XXXXXXXXXXXXXXXXX brd ff:ff:ff:ff:ff:ff
3: nonet: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether XXXXXXXXXXXXXXXXX brd ff:ff:ff:ff:ff:ff
4: tap0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether XXXXXXXXXXXXXXXXX brd ff:ff:ff:ff:ff:ff
6: wlan0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether XXXXXXXXXXXXXXXXX brd ff:ff:ff:ff:ff:ff
    inet 10.42.1.66/24 brd 10.42.1.255 scope global dynamic noprefixroute wlan0
       valid_lft 5325sec preferred_lft 5325sec
    inet6 fe80::9bc0:e362:7c9d:be7c/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
7: email-laptop: &lt;POINTOPOINT,NOARP,UP,LOWER_UP&gt; mtu 1280 qdisc noqueue state UNKNOWN group default qlen 1000
    link/none 
    inet XXXXXXXXXXXXXXXXX scope global noprefixroute email-laptop
       valid_lft forever preferred_lft forever
    inet6 XXXXXXXXXXXXXXXXX scope global noprefixroute 
       valid_lft forever preferred_lft forever
    inet6 XXXXXXXXXXXXXXXXXXXXXXXX/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
⛢ 13:55:21 rrs@priyasi ~/pu/researchut-hugo   researchut|+1…2
</code></pre><p>And as it stands, that is the cause of the problem.</p>
<p><code>systemd-timesyncd</code> would invoke an attempt to sync time for all the interfaces defined under <code>systemd-networkd</code>. And given the setup, that is bound to <del>fail</del> timeout; which is why I had added the  override against:</p>
<pre tabindex="0"><code>TimeoutStartSec=infinity
</code></pre><p>So, apparently, for every interface in <code>networkd</code>, it&rsquo;d attempt the ntp sync. It reports along the lines of:</p>
<pre tabindex="0"><code>Aug 15 13:24:06 priyasi systemd-timesyncd[1987]: Network configuration changed, trying to establish connection.
</code></pre><p>So I learnt this week, of the attribute to handle this:</p>
<pre tabindex="0"><code>@ cat sysbr0.network
[Match]
Name=withnet

[Network]
DHCPServer=yes
IPv4Forwarding=yes
IPv6Forwarding=yes
IPMasquerade=both
Address=192.168.1.1/24
LLMNR=yes

[Link]
RequiredForOnline=no

#[DHCPServer]
#DNS=192.168.1.1
</code></pre><p>With that, NTP time synchronization is back to what it should be. Precision synchronization of the system time.</p>
<pre tabindex="0"><code>ॐ 14:11:35 rrs@priyasi /etc/systemd/network  
@ timedatectl show
LocalRTC=no
CanNTP=yes
NTP=yes
NTPSynchronized=yes
TimeUSec=Thu 2024-08-15 14:12:45 IST
RTCTimeUSec=Thu 2024-08-15 14:12:45 IST
</code></pre>]]></content:encoded></item><item><title>Btrfs Subvol Fix</title><link>https://researchut.com/blog/BTRFS_Subvol_Fix/</link><pubDate>Wed, 20 Apr 2022 22:41:53 +0530</pubDate><author>rrs@researchut.com (Ritesh Raj Sarraf)</author><guid>https://researchut.com/blog/BTRFS_Subvol_Fix/</guid><description>&lt;p&gt;There surely is need for better tooling on the BTRFS File System side.&lt;/p&gt;
&lt;p&gt;While &lt;a href="https://researchut.com/blog/Thinkpad_AMD_Debian/"&gt;migrating&lt;/a&gt; my setup from one machine to another, this is one issue I came to be aware of, only today, when my backup tool (&lt;code&gt;btrbk&lt;/code&gt;) complained about it. Following the pointers, I see the below snippet in &lt;code&gt;btrfs-subvolume&lt;/code&gt; manual page.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; A snapshot that was created by send/receive will be read-only, with different last change generation, read-only and with set received_uuid which identifies the subvolume on the
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; filesystem that produced the stream. The usecase relies on matching data on both sides. Changing the subvolume to read-write after it has been received requires to reset the
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; received_uuid. As this is a notable change and could potentially break the incremental send use &lt;span style="color:#66d9ef"&gt;case&lt;/span&gt;, performing it by btrfs property set requires force &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; that is really desired by
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; user.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Note
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; The safety checks have been implemented in 5.14.2, any subvolumes previously received &lt;span style="color:#f92672"&gt;(&lt;/span&gt;with a valid received_uuid&lt;span style="color:#f92672"&gt;)&lt;/span&gt; and read-write status may exist and could still lead to
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; problems with send/receive. You can use btrfs subvolume show to identify them. Flipping the flags to read-only and back to read-write will reset the received_uuid manually. There
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; may exist a convenience tool in the future.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Fixing the &lt;code&gt;Received UUID: &lt;/code&gt; flag meant running the below:&lt;/p&gt;</description><content:encoded><![CDATA[<p>There surely is need for better tooling on the BTRFS File System side.</p>
<p>While <a href="/blog/Thinkpad_AMD_Debian/">migrating</a> my setup from one machine to another, this is one issue I came to be aware of, only today, when my backup tool (<code>btrbk</code>) complained about it. Following the pointers, I see the below snippet in <code>btrfs-subvolume</code> manual page.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>       A snapshot that was created by send/receive will be read-only, with different last change generation, read-only and with set received_uuid which identifies the subvolume on the
</span></span><span style="display:flex;"><span>       filesystem that produced the stream. The usecase relies on matching data on both sides. Changing the subvolume to read-write after it has been received requires to reset the
</span></span><span style="display:flex;"><span>       received_uuid. As this is a notable change and could potentially break the incremental send use <span style="color:#66d9ef">case</span>, performing it by btrfs property set requires force <span style="color:#66d9ef">if</span> that is really desired by
</span></span><span style="display:flex;"><span>       user.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>           Note
</span></span><span style="display:flex;"><span>           The safety checks have been implemented in 5.14.2, any subvolumes previously received <span style="color:#f92672">(</span>with a valid received_uuid<span style="color:#f92672">)</span> and read-write status may exist and could still lead to
</span></span><span style="display:flex;"><span>           problems with send/receive. You can use btrfs subvolume show to identify them. Flipping the flags to read-only and back to read-write will reset the received_uuid manually. There
</span></span><span style="display:flex;"><span>           may exist a convenience tool in the future.
</span></span></code></pre></div><p>Fixing the <code>Received UUID: </code> flag meant running the below:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>rrs@priyasi:.../spool$ sudo btrfs sub show /
</span></span><span style="display:flex;"><span>WARNING: the subvolume is read-write and has received_uuid set,
</span></span><span style="display:flex;"><span>         don&#39;t use it for incremental send. Please see section
</span></span><span style="display:flex;"><span>         &#39;SUBVOLUME FLAGS&#39; in manual page btrfs-subvolume for
</span></span><span style="display:flex;"><span>         further information.
</span></span><span style="display:flex;"><span>ROOTVOL
</span></span><span style="display:flex;"><span>        Name:                   ROOTVOL
</span></span><span style="display:flex;"><span>        UUID:                   122b0de1-e6f2-6845-aba0-6bf766c16526
</span></span><span style="display:flex;"><span>        Parent UUID:            -
</span></span><span style="display:flex;"><span>        Received UUID:          34772967-c709-5146-bf20-898f7dbc2c1f
</span></span><span style="display:flex;"><span>        Creation time:          2021-12-02 19:59:29 +0530
</span></span><span style="display:flex;"><span>        Subvolume ID:           256
</span></span><span style="display:flex;"><span>        Generation:             138473
</span></span><span style="display:flex;"><span>        Gen at creation:        7
</span></span><span style="display:flex;"><span>        Parent ID:              5
</span></span><span style="display:flex;"><span>        Top level ID:           5
</span></span><span style="display:flex;"><span>        Flags:                  -
</span></span><span style="display:flex;"><span>        Send transid:           35245
</span></span><span style="display:flex;"><span>        Send time:              2021-12-02 19:59:29 +0530
</span></span><span style="display:flex;"><span>        Receive transid:        34
</span></span><span style="display:flex;"><span>        Receive time:           2021-12-02 20:13:11 +0530
</span></span><span style="display:flex;"><span>        Snapshot(s):
</span></span><span style="display:flex;"><span>                                ROOTVOL/.snapshots/1/snapshot
</span></span><span style="display:flex;"><span>                                ROOTVOL/.snapshots/2/snapshot
</span></span><span style="display:flex;"><span>22:40 ♒ ॐ ♅ ♄ ⛢     ☺ 😄    
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>rrs@priyasi:.../spool$ sudo btrfs property set / ro true
</span></span><span style="display:flex;"><span>WARNING: read-write subvolume with received_uuid, this is bad
</span></span><span style="display:flex;"><span>22:40 ♒ ॐ ♅ ♄ ⛢     ☺ 😄    
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>rrs@priyasi:.../spool$ sudo btrfs property set -f / ro false
</span></span><span style="display:flex;"><span>22:40 ♒ ॐ ♅ ♄ ⛢     ☺ 😄    
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>rrs@priyasi:.../spool$ sudo btrfs sub show /
</span></span><span style="display:flex;"><span>ROOTVOL
</span></span><span style="display:flex;"><span>        Name:                   ROOTVOL
</span></span><span style="display:flex;"><span>        UUID:                   122b0de1-e6f2-6845-aba0-6bf766c16526
</span></span><span style="display:flex;"><span>        Parent UUID:            -
</span></span><span style="display:flex;"><span>        Received UUID:          -
</span></span><span style="display:flex;"><span>        Creation time:          2021-12-02 19:59:29 +0530
</span></span><span style="display:flex;"><span>        Subvolume ID:           256
</span></span><span style="display:flex;"><span>        Generation:             138473
</span></span><span style="display:flex;"><span>        Gen at creation:        7
</span></span><span style="display:flex;"><span>        Parent ID:              5
</span></span><span style="display:flex;"><span>        Top level ID:           5
</span></span><span style="display:flex;"><span>        Flags:                  -
</span></span><span style="display:flex;"><span>        Send transid:           0
</span></span><span style="display:flex;"><span>        Send time:              2021-12-02 19:59:29 +0530
</span></span><span style="display:flex;"><span>        Receive transid:        138480
</span></span><span style="display:flex;"><span>        Receive time:           2022-04-20 22:40:43 +0530
</span></span><span style="display:flex;"><span>        Snapshot(s):
</span></span><span style="display:flex;"><span>                                ROOTVOL/.snapshots/1/snapshot
</span></span><span style="display:flex;"><span>                                ROOTVOL/.snapshots/2/snapshot
</span></span><span style="display:flex;"><span>22:40 ♒ ॐ ♅ ♄ ⛢     ☺ 😄    
</span></span></code></pre></div><p>Hoping there won&rsquo;t be surprises in the coming months. 🤞</p>
]]></content:encoded></item><item><title>Setting Up a Secure Webapp</title><link>https://researchut.com/blog/Setting_Up_a_Secure_Webapp/</link><pubDate>Sat, 22 May 2021 15:44:48 +0530</pubDate><author>rrs@researchut.com (Ritesh Raj Sarraf)</author><guid>https://researchut.com/blog/Setting_Up_a_Secure_Webapp/</guid><description>&lt;p&gt;As a person who prefers full access to data in the simplest format, while at the same time having it useful with latest technologies, my quest for trying things out is an ongoing activity.&lt;/p&gt;
&lt;p&gt;Earlier, I &lt;a href="https://researchut.com/blog/Catching_Up_Your_Sources/"&gt;blogged&lt;/a&gt; about my needs of collating news feeds in a simple format, readily accessible offline, while still being useful and aligned with the modern paradigm.&lt;/p&gt;
&lt;p&gt;In today&amp;rsquo;s age, the other common aspect of our life, is digitization of moments. With the advent of great technology and affordable economics, the world now has access to great devices to capture moments in digital form. Most people, these days, are equipped with smart devices, like mobile phones, that come with pretty good image capturing devices. Our lives, our societies, how we interact; a lot of it is now built around the assumption of smart devices and digital services.&lt;/p&gt;</description><content:encoded><![CDATA[<p>As a person who prefers full access to data in the simplest format, while at the same time having it useful with latest technologies, my quest for trying things out is an ongoing activity.</p>
<p>Earlier, I <a href="/blog/Catching_Up_Your_Sources/">blogged</a> about my needs of collating news feeds in a simple format, readily accessible offline, while still being useful and aligned with the modern paradigm.</p>
<p>In today&rsquo;s age, the other common aspect of our life, is digitization of moments. With the advent of great technology and affordable economics, the world now has access to great devices to capture moments in digital form. Most people, these days, are equipped with smart devices, like mobile phones, that come with pretty good image capturing devices. Our lives, our societies, how we interact; a lot of it is now built around the assumption of smart devices and digital services.</p>
<p>A lot of good things have happened of it. We are now able to send messages to people, securely, in a matter of seconds. We are now able to capture moments, which otherwise we&rsquo;d often miss; all thanks to devices like smart mobile phones that most of all carry almost all along with us.</p>
<p>In this regard, we are quite indebted to the technology revolution that has improved life styles all over. Of course, like every coin has a flip side, thus too, too much of obsession with digital life, also has its drawbacks. A simple reminder to self should always be about what a human life is designed for and try to live by its rules.</p>
<h3 id="moments">Moments</h3>
<p>Given the tools general availability, we are all more used to capturing moments. Once upon a time, taking a photo meant going to a photo studio.</p>
<p>Then came a generation where we&rsquo;d have personal devices with roll films, to which we captured the moments. And then get it processed from a photo developing service provider. And that is when we&rsquo;d know which all moments came out correct and which ones were spoilt. In such cases, there&rsquo;s always the <em>wish I could have that moment again</em>.</p>
<p>Thankfully, now, in our current generation, we have the liberty to take pictures and validate them almost immediately. We also have the flexibility to take multiple shots of the moment and do the filtering later. There&rsquo;s also many intelligent and invasive services, all mostly provided free, to help you organize these moments; at a small cost of keeping an eye on your life activity.</p>
<p>In a summary, mankind, now, generates lots and lots of data. So much lot that now even mammoths like Google are forced to make a call whether it is more profitable to sniff user activity while providing them a service for free, or ask people to pay otherwise too.</p>
<h3 id="privacy">Privacy</h3>
<p>Many of us are wary of the amount of personal data we generate, which is our asset; and how the big tech giants want a piece of it in the name of free services. And in such quest, free aside, there&rsquo;s always a lookout for privacy savvy tools that can help us draw a bold line in between <em>Public</em> and <em>Private</em></p>
<h3 id="google-photos">Google Photos</h3>
<p>Google Photos has been a great tool. The way it organizes, siphons and present your data is simply amazing. No good would have been the photos taken, if they weren&rsquo;t easily searchable, organized, annotated, and presented.</p>
<p>But Google Photos is proprietary and invasive. The amount of information they have access to should be a concern to all people. For services that invade so much, the world needs <strong>Free Services</strong>.</p>
<h3 id="photoprism">PhotoPrism</h3>
<p>I only came across this project around a month ago, while the project has been around since 2019. So far, in my exploration, this is one of the best Free Software tools to manage and organize my digital photos. The other favorite tool that I regularly depend on is <strong>Digikam</strong> and it still is a gem.</p>
<p>In a gist, PhotoPrism aims to be the equivalent of Google Photos, for the privacy savvy people.</p>
<p>As of date, it has a decent list of features available. And for some of the missing ones, I&rsquo;ve come up with a fairly okay workflow with other tools, which is one of the reasons of this blog post.</p>
<p>PhotoPrism is a web app, written in the Go Programming Language. Its layout and workflow as a Photo Management application is similar to Google Photos. It is very performant compared to other applications. Since it is a Progressive Web App, access through a Laptop, Tablet or Mobile is almost the same. It uses <em>Google TensorFlow</em> for some of its features and thus you feel like using Google Photos in some regard.</p>
<p>Some shortcomings and workarounds</p>
<ul>
<li>
<p>Facial Recognition: To date, facial recognition is a planned feature. But this was easy to tackle given that Digikam has pretty solid facial recognition. So I use Digikam to detect, recognize and annotate faces. And then PhotoPrism is happy enough to use those annotations and present relevant data.</p>
</li>
<li>
<p>HTTP Web App: The upstream project has done a good job of making use of Docker container technology in presenting this web app solution. A software solution, the equivalent of a Google Photos, does need a heavyweight config. In free software, it is all about reusing available tools. PhotoPrism makes use of tools like <em>MySQL, Vue.js, TensorFlow, GoLang, GoLibs</em> and strives to provide a single package solution, all thanks to Docker containers.</p>
</li>
</ul>
<p>In its current offering, PhotoPrism is run as a HTTP Web App. I wanted to have an added layer of security on top of it. And thus run an nginx reverse proxy on top of it. Along with it, I run the proxy service on HTTPS, thus making all traffic from clients to the proxy encrypted. I also wanted an added layer of HTTP AUTH on top, so I explored some options and finally settled down with <a href="https://github.com/atomx/nginx-http-auth-digest">http-auth-digest</a></p>
<p>Also, in the current implementation, PhotoPrism doesn&rsquo;t have a strong notion of normal and private photos in its data organization. I wanted normal photos available under a standard auth realm and private photos under a different realm. And along with a different realm, I also wanted some added security directives for it. So far, it looks like I&rsquo;ve put together a decent solution with the help of <em>nginx</em>.</p>
<ul>
<li>
<p>First of all, since the port from the host is forwarded to the docker instance, that needed to be controlled. Instead of the default of listening on all interfaces, I changed it to loopback only. Because my primary and only interface is going to be the <em>nginx reverse proxy</em></p>
</li>
<li>
<p>Setup nginx with a self-signed certificate to have all communication encrypted.</p>
</li>
<li>
<p>Setup nginx as a reverse proxy to talk to PhotoPrism.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>server <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>   listen 80;
</span></span><span style="display:flex;"><span>   listen <span style="color:#f92672">[</span>::<span style="color:#f92672">]</span>:80;
</span></span><span style="display:flex;"><span>   server_name lenovo;
</span></span><span style="display:flex;"><span>   <span style="color:#66d9ef">return</span> <span style="color:#ae81ff">302</span> https://$host$request_uri;
</span></span><span style="display:flex;"><span>   rewrite ^ https://$http_host$request_uri? permanent;    <span style="color:#75715e"># force redirect http to https</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    server_tokens off;
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>server <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>listen <span style="color:#ae81ff">443</span> ssl http2 default_server;
</span></span><span style="display:flex;"><span>listen <span style="color:#f92672">[</span>::<span style="color:#f92672">]</span>:443 ssl http2 default_server;
</span></span><span style="display:flex;"><span>ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
</span></span><span style="display:flex;"><span>ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
</span></span><span style="display:flex;"><span>server_tokens off;
</span></span><span style="display:flex;"><span>server_name lenovo;
</span></span><span style="display:flex;"><span>client_max_body_size 500M;
</span></span><span style="display:flex;"><span>    auth_digest_expires 900s;
</span></span><span style="display:flex;"><span>    auth_digest_evasion_time 5s;
</span></span><span style="display:flex;"><span>    auth_digest_replays 500;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>location /private <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    auth_digest <span style="color:#e6db74">&#39;abc&#39;</span>;
</span></span><span style="display:flex;"><span>    auth_digest_user_file /etc/nginx/htdigest;
</span></span><span style="display:flex;"><span>    auth_digest_expires 900s;
</span></span><span style="display:flex;"><span>    auth_digest_evasion_time 5s;
</span></span><span style="display:flex;"><span>    auth_digest_replays 500;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    proxy_pass http://localhost:2342/private;
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>location /discover <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    auth_digest <span style="color:#e6db74">&#39;abc&#39;</span>;
</span></span><span style="display:flex;"><span>    auth_digest_user_file /etc/nginx/htdigest;
</span></span><span style="display:flex;"><span>    auth_digest_expires 900s;
</span></span><span style="display:flex;"><span>    auth_digest_evasion_time 5s;
</span></span><span style="display:flex;"><span>    auth_digest_replays 500;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    proxy_pass http://localhost:2342/discover;
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>location / <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
</span></span><span style="display:flex;"><span>    proxy_set_header Host $host;
</span></span><span style="display:flex;"><span>    proxy_buffering off;
</span></span><span style="display:flex;"><span>    proxy_http_version 1.1;
</span></span><span style="display:flex;"><span>    proxy_set_header Upgrade $http_upgrade;
</span></span><span style="display:flex;"><span>    proxy_set_header Connection <span style="color:#e6db74">&#34;upgrade&#34;</span>;
</span></span><span style="display:flex;"><span>    proxy_pass http://localhost:2342;
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>    auth_basic <span style="color:#e6db74">&#34;Priv&#34;</span>;
</span></span><span style="display:flex;"><span>    auth_basic_user_file /etc/nginx/htpasswd;
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span></code></pre></div></li>
<li>
<p>nginx packaging: I was so happy to see the simplicity of the nginx packaging in Debian. Becuase <code>http-auth-digest</code> is not upstream, it needs to be pulled in separately and compiled. I was happy to see how simple the packaging structure of nginx in Debian is. It was just a matter of putting in the module in the right modules location, which as structured such in the packaging falls under the debian/ packaging sub-folder, that any future upgrades will be quite easy to manage.</p>
</li>
<li>
<p>http-auth-digest: I&rsquo;d love to see <code>http-auth-digest</code> module be part of the upstream package. While I&rsquo;m a web n00b, I felt this module perfect for my use case. From what I&rsquo;ve understood, set up and tested so far, this module fills in all my requirements; which is more of like a session management.</p>
</li>
</ul>
<p>With the combined setup in place, <code>https://host</code> is authenticated with a different set of credentials. On the other hand, <code>https://host/discover and /private</code> get covered with a different set of credentials and policies. While, this will continue to be an ongoing effort and audit of the services that I build, so far now, I feel this is in decent shape that I can use it as my daily driver.</p>
<p>The end result is:
<link rel="stylesheet" href="/css/hugo-easy-gallery.css" />

<div class="box" >
  <figure  itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
    <div class="img" style="background-image: url('/images/PhotoPrism_auth.jpg');" >
      <img itemprop="thumbnail" src="/images/PhotoPrism_auth.jpg" alt="nginx auth prompt"/>
    </div>
    <a href="/images/PhotoPrism_auth.jpg" itemprop="contentUrl"></a>
      <figcaption><h4>nginx auth prompt</h4>
      </figcaption>
  </figure>
</div>



<div class="box" >
  <figure  itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
    <div class="img" style="background-image: url('/images/PhotoPrism_list.jpg');" >
      <img itemprop="thumbnail" src="/images/PhotoPrism_list.jpg" alt="PhotoPrism Photo List"/>
    </div>
    <a href="/images/PhotoPrism_list.jpg" itemprop="contentUrl"></a>
      <figcaption><h4>PhotoPrism Photo List</h4>
      </figcaption>
  </figure>
</div>



<div class="box" >
  <figure  itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
    <div class="img" style="background-image: url('/images/PhotoPrism_Menu.jpg');" >
      <img itemprop="thumbnail" src="/images/PhotoPrism_Menu.jpg" alt="PhotoPrism Menu"/>
    </div>
    <a href="/images/PhotoPrism_Menu.jpg" itemprop="contentUrl"></a>
      <figcaption><h4>PhotoPrism Menu</h4>
      </figcaption>
  </figure>
</div>
</p>
<h2 id="updates">Updates</h2>
<ul>
<li>Things can really get frustrating at times. These days, it is Google that contributes to it. <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=544244">https://bugs.chromium.org/p/chromium/issues/detail?id=544244</a>
<ul>
<li>It is is now fair to say that Google is big enough to rewrite all the standards. Or at least break them. Or best, their arrogance of it. This bug report is a fine example of what other ways it could have been dealt.</li>
</ul>
</li>
</ul>
]]></content:encoded></item><item><title>Wayland KDE X11</title><link>https://researchut.com/blog/Wayland_KDE_X11/</link><pubDate>Fri, 26 Feb 2021 17:08:26 +0530</pubDate><author>rrs@researchut.com (Ritesh Raj Sarraf)</author><guid>https://researchut.com/blog/Wayland_KDE_X11/</guid><description>&lt;h2 id="kde-impressions"&gt;KDE Impressions&lt;/h2&gt;
&lt;p&gt;These days, I often hear a lot about Wayland. And how much of effort is being put into it; not just by the Embedded world but also the usual Desktop systems, namely KDE and GNOME.&lt;/p&gt;
&lt;p&gt;In recent past, I switched back to KDE and have been (very) happy about the switch. Even though the KDE 4 (and initial KDE 5) debacle had burnt many, coming back to a usable KDE desktop is always a delight. It makes me feel home with the elegance, while at the same time the flexibility, it provides. It feels so nice to draft this blog article from Kwrite + VI Input Mode&lt;/p&gt;</description><content:encoded><![CDATA[<h2 id="kde-impressions">KDE Impressions</h2>
<p>These days, I often hear a lot about Wayland. And how much of effort is being put into it; not just by the Embedded world but also the usual Desktop systems, namely KDE and GNOME.</p>
<p>In recent past, I switched back to KDE and have been (very) happy about the switch. Even though the KDE 4 (and initial KDE 5) debacle had burnt many, coming back to a usable KDE desktop is always a delight. It makes me feel home with the elegance, while at the same time the flexibility, it provides. It feels so nice to draft this blog article from Kwrite + VI Input Mode</p>
<p>Thanks to the great work of the <em>Debian KDE Team</em>, but <a href="https://www.preining.info/">Norbert Preining</a> in particular, who has helped bring very up-to-date KDE packages into Debian. Right now, I&rsquo;m on a <strong>Plamsa 5.21.1</strong> desktop, which is recent by all standards.</p>
<h2 id="wayland">Wayland</h2>
<p>Almost all the places in the Linux world these days are busy with integrating Wayland as the primary display service. Not sure what the current status on the GNOME side is but I definitely keep trying <strong>KDE + Wayland</strong> with every release.</p>
<p>I keep <em>trying</em> with <em>every release</em> because it still is not prime for daily use. And it makes me get back to X11, no matter how dated some may call. Fact is, X11 still shines to me as an end-user.</p>
<p>Glitches with Wayland still are (Based on this week&rsquo;s test on Plasma 5.21.1):</p>
<ul>
<li>Horrible performance compared to X11</li>
<li>Very crashy, especially when hotplugging secondary display. Plasma would just crash. X11 is very resilient to such things, part of the reason I can think is the age of the codebase.</li>
<li>Many many applications still need to be fixed for Wayland. Or Wayland needs to accomodate them in some way. XWayland does not really feel like the answer.</li>
</ul>
<p>And while KDE keeps insisting users to switch to <strong>Wayland</strong>, as that&rsquo;s where all the <a href="https://bugs.kde.org/show_bug.cgi?id=422552">new enhancements and fixes</a> are put in, someone like me still needs to stick to X11 for the time being. So to get my shiny new <code>LG 27&quot; 4K Monitor (3840x2160     60.00*+)</code> to work without too much glitch, I had to live with an alias:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ alias | grep xrandr
</span></span><span style="display:flex;"><span>alias rrs_xrandr_lg<span style="color:#f92672">=</span><span style="color:#e6db74">&#39;xrandr --output DP-1 --mode 3840x2160 --scale .75x.75&#39;</span>
</span></span><span style="display:flex;"><span>18:31 ♒ ॐ ♅ ♄ ⛢     ☺ 😄  
</span></span></code></pre></div><h2 id="plasma-521">Plasma 5.21</h2>
<p>On the brighter side, the Plasma 5.21.1 release brings some nice enhancements in other areas.</p>
<ul>
<li>I&rsquo;m now able to make use of <a href="https://blog.davidedmundson.co.uk/blog/plasma-and-the-systemd-startup/">tighter integration with systemd/cgroups</a>, with better organization and management of processes overall.</li>
<li>The new Plasma theme, <strong>Breeze Twilight</strong>, is a good blend of Light + Dark.</li>
</ul>
<p>I also appreciate the work put in by <a href="https://github.com/psifidotos/">Michail Vourlakos</a>. The KDE project is lucky to have a developer/designer like him. His vision and work into the KDE desktop is well beyond a writing by me.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ usystemctl status plasma-plasmashell.service 
</span></span><span style="display:flex;"><span>● plasma-plasmashell.service - KDE Plasma Workspace
</span></span><span style="display:flex;"><span>     Loaded: loaded <span style="color:#f92672">(</span>/usr/lib/systemd/user/plasma-plasmashell.service; enabled; vendor preset: enabled<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>     Active: active <span style="color:#f92672">(</span>running<span style="color:#f92672">)</span> since Fri 2021-02-26 18:34:23 IST; 13s ago
</span></span><span style="display:flex;"><span>   Main PID: <span style="color:#ae81ff">501806</span> <span style="color:#f92672">(</span>plasmashell<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>      Tasks: <span style="color:#ae81ff">21</span> <span style="color:#f92672">(</span>limit: 18821<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>     Memory: 759.8M
</span></span><span style="display:flex;"><span>        CPU: 13.706s
</span></span><span style="display:flex;"><span>     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/plasma-plasmashell.service
</span></span><span style="display:flex;"><span>             └─501806 /usr/bin/plasmashell --no-respawn
</span></span><span style="display:flex;"><span>             
</span></span><span style="display:flex;"><span>Feb <span style="color:#ae81ff">26</span> 18:35:00 priyasi plasmashell<span style="color:#f92672">[</span>501806<span style="color:#f92672">]</span>: qml: recreating buttons
</span></span><span style="display:flex;"><span>Feb <span style="color:#ae81ff">26</span> 18:35:21 priyasi plasmashell<span style="color:#f92672">[</span>501806<span style="color:#f92672">]</span>: qml: recreating buttons
</span></span><span style="display:flex;"><span>Feb <span style="color:#ae81ff">26</span> 18:35:49 priyasi plasmashell<span style="color:#f92672">[</span>501806<span style="color:#f92672">]</span>: qml: recreating buttons
</span></span><span style="display:flex;"><span>Feb <span style="color:#ae81ff">26</span> 18:35:57 priyasi plasmashell<span style="color:#f92672">[</span>501806<span style="color:#f92672">]</span>: qml: recreating buttons
</span></span><span style="display:flex;"><span>18:36 ♒ ॐ ♅ ♄ ⛢     ☺ 😄
</span></span></code></pre></div><h2 id="obs---open-build-service">OBS - Open Build Service</h2>
<p>I should also thank the OpenSUSE folks for the <a href="https://github.com/openSUSE/open-build-service">OBS work</a>. It has enabled the close equivalent (or better, in my experience) of <em>PPAs for Debian</em>. And that is what has enabled developers like Norbert to easily and quickly be able to deliver the entire KDE suite.</p>
<h3 id="obs---some-detail">OBS - Some detail</h3>
<p>Christian asked for some more details on the OBS side of things, of my view. I&rsquo;m updating this article with it because the comment system may not always be reliable and I hate losing content.</p>
<p>Having been using OBS myself, and also others in the Debian community who are making use of it, I surely think we as project should consider making use of OBS.</p>
<p>Given that OBS is <strong>Free Software</strong>, it is a perfect fit for Debian. Gitlab is another example of what we&rsquo;ve made available in Debian.</p>
<p>OBS is divided into multiple parts</p>
<ul>
<li>OBS Server</li>
<li>OBS DoD service</li>
<li>OBS Publisher</li>
<li>OBS Workers</li>
<li>OBS Warden</li>
<li>OBS Rep Server</li>
</ul>
<p>For every Debian release I care about,  I add an OBS project per release. So I have OBS projects for: Sid, Bullseye, Buster, Jessie.</p>
<p>Now, say you have a package, <code>foo</code> . You prep your package and enable all the releases that you want to build the package for. So the same package gets built, in separate clean environments, for every release I mentioned as an example above. You don&rsquo;t have to manually trigger the build for every release/every architcture. You should add the release (as projects) in OBS, set their supported architectures, and then add those <em>enabled release projets</em> as bits to your package.</p>
<p>Every build involves:</p>
<ul>
<li>Creating a new chroot for each build</li>
<li>Building the package</li>
</ul>
<p>Builds can be scattered across multiple hosts, known as <strong>workers</strong> in OBS terminology. Your workers are independent machine entities, supporting different architectures. The machines can be Bare-Metal ones, VMs, even containers. So this allows for very nice scale-in and scale-out. There may be auto-scaling too but that is something worth investigating.</p>
<p>Think of things like cross architecture builds. Let&rsquo;s assume the cloud vendors decide to donate resources to the Debian project. We could enable OBS worker instances on the respective clouds (different architectures) and plug them into the master OBS instance that Debian hosts. Fully distributed. Similarly, big hardware vendors willing to donate compute resources could house them in their premises and Debian could just easily establish a connection to them. All of this just a TCP connection away.</p>
<p>So when I look at the features of OBS, from the point of view of Debian, I like it more. Extensibility won&rsquo;t be an issue. Supporting a new Debian release would just be a matter of bootstrapping the Debian release as a project in OBS, and then all done. The single effort of setting of the target release project is a one time job, and then all can leverage it.</p>
<p>The PPA was a long craved feature missing in Debian, in my opinion. OBS allows to not just fulfil that gap but also extend it in a very easy way.</p>
<p>Andrew Lee had put in a <a href="https://debconf20.debconf.org/talks/62-open-build-service-and-debian-packaging/">nice video presentation</a> about the same @ Debconf 20</p>


<video width=100% controls>
    <source src="https://meetings-archive.debian.net/pub/debian-meetings/2020/DebConf20/62-open-build-service-and-debian-packaging.webm" type="video/webm">
    Your browser does not support the video tag.
</video>


]]></content:encoded></item><item><title>Cross Architecture Linux Containers</title><link>https://researchut.com/blog/Cross_Architecture_Linux_Containers/</link><pubDate>Fri, 19 Jul 2019 21:34:02 +0530</pubDate><author>rrs@researchut.com (Ritesh Raj Sarraf)</author><guid>https://researchut.com/blog/Cross_Architecture_Linux_Containers/</guid><description>&lt;h2 id="linux-and-arm"&gt;Linux and ARM&lt;/h2&gt;
&lt;p&gt;With more ARM based devices in the market, and with them getting more powerful every day,
it is more common to see more of ARM images for your favorite Linux distribution. Of them,
&lt;strong&gt;Debian&lt;/strong&gt; has become the default choice for individuals and companies to base their work on.
It must have to do with Debian&amp;rsquo;s long history of trying to support many more architectures than
the rest of the distributions. Debian also tends to have a much wider user/developer mindshare
even though it does not have a direct backing from any of the big Linux distribution companies.&lt;/p&gt;</description><content:encoded><![CDATA[<h2 id="linux-and-arm">Linux and ARM</h2>
<p>With more ARM based devices in the market, and with them getting more powerful every day,
it is more common to see more of ARM images for your favorite Linux distribution. Of them,
<strong>Debian</strong> has become the default choice for individuals and companies to base their work on.
It must have to do with Debian&rsquo;s long history of trying to support many more architectures than
the rest of the distributions. Debian also tends to have a much wider user/developer mindshare
even though it does not have a direct backing from any of the big Linux distribution companies.</p>
<p>Some of my work involves doing packaging and integration work which reflects on all architectures
and image types; ARM included. So having the respective environment readily available is really
important to get work done quicker.</p>
<p>I still recollect back in 2004, when I was much newer to <em>Linux Enterprise</em> while working at a big Computer Hardware Company, I had heard about the <em>Itanium 64</em> architecture. Back then, trying out anything other than <em>x86</em> would mean you need access to physical
hardware. Or be a DD and have shell access the Debian Machines.</p>
<p>With Linux Virtualization, a lot seems to have improved over time.</p>
<h2 id="linux-virtualization">Linux Virtualization</h2>
<p>With a decently powered processor with virtualization support, you can emulate a lot of architectures that Linux supports.</p>
<p>Linux has many virtualization options but the main dominant ones are <strong>KVM/Qemu, Xen and VirtualBox</strong>.
<em>Qemu</em> is the most feature-rich virtualization choice on Linux with a wide range of architectures that
it can emulate.</p>
<p>In case of ARM, things are still a bit tricky as hardware definition is tightly coupled. Emulating device type
on a virtualized Qemu is not straightforward as x86 architecture. Thankfully, in <code>libvirt</code>, you can be provided
with a generic machine type called <strong>virt</strong>. For basic cross architecture tasks, this should be enough.</p>
<link rel="stylesheet" href="/css/hugo-easy-gallery.css" />

<div class="box" >
  <figure  itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
    <div class="img" style="background-image: url('/images/virt-profile-libvirt.png');" >
      <img itemprop="thumbnail" src="/images/virt-profile-libvirt.png" alt="virt board profile under libvirt"/>
    </div>
    <a href="/images/virt-profile-libvirt.png" itemprop="contentUrl"></a>
      <figcaption><h4>virt board profile under libvirt</h4>
      </figcaption>
  </figure>
</div>

<p>But, while, virtualization is a nice progression, it is not always an optimal one. For one, it needs good device virtualization
support, which can be tricky in the ARM context. Second, it can be (very) slow at times.</p>
<p>And unless you are doing low-level hardware specific work, you can look for an alternative in <strong>Linux Containers</strong></p>
<h2 id="linux-containers">Linux Containers</h2>
<p>So this is nothing new now. Lots and lots of buzz around containers already. There&rsquo;s many different implementations
across platforms supporting similar concept. From good old <em>chroot (with limited functionality), jails (on BSD)</em>, to
well marketed products like: <em>Docker, LXC, systemd-nspawn</em>. There&rsquo;s also some like <em>firejail</em> targeting specific use cases.</p>
<p>As long as you do not have tight dependency on the hardware <strong>or</strong> a dependency on the specific parts of the Linux kernel (like once I
explored the possibility of running <em>open-iscsi</em> in a containerized environment instead), <em>containers</em> are a quick way to get
an equal environment. Especially, things like <strong>Process, Namespace and Network separation</strong> are awesome helping me concentrate on the work
rather than putting the focus on <strong>Host &lt;=&gt; Guest</strong> issues.</p>
<p>Given how fast work can be accomplished with containers, I have been wanting to explore the possibility of building container images
for ARM and other architectures that I care about.</p>
<p>The good thing is that architecture virtualization is offered through <strong>Qemu</strong> and the same tool also provides similar architecture
emulation. So features and fixes have a higher chance of parity as they are being served from the same tool.</p>
<h2 id="systemd-nspawn">systemd-nspawn</h2>
<p>I haven&rsquo;t explored all the container implementations that Linux has to offer. Initially, I used <strong>LXC</strong> for a while. But these days,
for my work it is <strong>docker</strong>, while my personal preference lies with <strong>systemd-nspawn</strong>.</p>
<p>Part of the reason is simply because I have grown
more familiar with <strong>systemd</strong> given it is the house keeper for my operating system now. And also, so far, I like most of what <em>systemd</em> offers.</p>
<h2 id="getting-cross-architecture-containers-under-debian-gnulinux">Getting Cross Architecture Containers under Debian GNU/Linux</h2>
<ul>
<li>Use <code>qemu-user-static</code> for emulation</li>
<li>Generate cross architecture chroot images with <code>qemu-debootstrap</code></li>
<li>Import those as sub-volumes under <code>systemd-nspawn</code></li>
<li>Set a template for your containers and other misc stuff</li>
</ul>
<h3 id="glitches">Glitches</h3>
<p>Not everything works perfect but most of it does work.</p>
<p>Here&rsquo;s my container list. Subvolumed containers do help de-duplicate and save some space. They are also very very quick when creating a clone for the container</p>
<pre tabindex="0"><code class="language-linux" data-lang="linux">rrs@priyasi:~$ machinectl list-images
NAME                 TYPE      RO USAGE CREATED                     MODIFIED
2019                 subvolume no   n/a Mon 2019-06-10 09:18:26 IST n/a     
SDK1812              subvolume no   n/a Mon 2018-10-15 12:45:39 IST n/a     
BusterArm64          subvolume no   n/a Mon 2019-06-03 14:49:40 IST n/a     
DebSidArm64          subvolume no   n/a Mon 2019-06-03 14:56:42 IST n/a     
DebSidArmhf          subvolume no   n/a Mon 2018-07-23 21:18:42 IST n/a     
DebSidMips           subvolume no   n/a Sat 2019-06-01 08:31:34 IST n/a     
DebianJessieTemplate subvolume no   n/a Mon 2018-07-23 21:18:54 IST n/a     
DebianSidTemplate    subvolume no   n/a Mon 2018-07-23 21:18:05 IST n/a     
aptVerifySigsDebSid  subvolume no   n/a Mon 2018-07-23 21:19:04 IST n/a     
jenkins-builder      subvolume no   n/a Tue 2018-11-27 20:11:42 IST n/a     
jenkins-builder-new  subvolume no   n/a Tue 2019-04-16 10:13:43 IST n/a     
opensuse             subvolume no   n/a Mon 2018-07-23 21:18:34 IST n/a     

12 images listed.
21:08 ♒♒♒   ☺ 😄    </code></pre>
<h3 id="problems-with-networking-on-foreign-architectures">Problems with networking on foreign architectures</h3>
<p>So this must mostly have to do with Qemu&rsquo;s emulation. When making networking work, I did see many reports and fixes upstream about networking and other subsystems having issues with emulation. Luckily for the architectures listed above, I have been able to make use of them with some workarounds.</p>
<p>Here&rsquo;s a running <strong>Debian Sid ARM64</strong> container image under <code>systemd-nsapwn</code> with <code>qemu emulation</code></p>
<pre tabindex="0"><code class="language-linux" data-lang="linux">DebSidArm64(fba63648a4c4451ebf56eb758463b37d)
           Since: Fri 2019-07-19 21:13:51 IST; 1min 16s ago
          Leader: 12061 (systemd)
         Service: systemd-nspawn; class container
            Root: /var/lib/machines/DebSidArm64
           Iface: sysbr0
              OS: Debian GNU/Linux 10 (buster)
       UID Shift: 445841408
            Unit: systemd-nspawn@DebSidArm64.service
                  ├─payload
                  │ ├─init.scope
                  │ │ └─12061 /usr/bin/qemu-aarch64-static /usr/lib/systemd/systemd
                  │ └─system.slice
                  │   ├─console-getty.service
                  │   │ └─12245 /usr/bin/qemu-aarch64-static /sbin/agetty -o -p -- \u --noclear --keep-baud console 115200,38400,9600 vt220
                  │   ├─cron.service
                  │   │ └─12200 /usr/bin/qemu-aarch64-static /usr/sbin/cron -f
                  │   ├─dbus.service
                  │   │ └─12197 /usr/bin/qemu-aarch64-static /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
                  │   ├─rsyslog.service
                  │   │ └─12202 /usr/bin/qemu-aarch64-static /usr/sbin/rsyslogd -n -iNONE
                  │   ├─systemd-journald.service
                  │   │ └─12123 /usr/bin/qemu-aarch64-static /lib/systemd/systemd-journald
                  │   └─systemd-logind.service
                  │     └─12203 /usr/bin/qemu-aarch64-static /lib/systemd/systemd-logind
                  └─supervisor
                    └─12059 /usr/bin/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --network-bridge=sysbr0 --bind /var/tmp/Debian-Build/containers/ --bind-ro /var/tmp/:/var/tmp/vartmp -U --settings=override --machine=DebSidArm64

Jul 19 21:13:53 priyasi systemd-nspawn[12059]: [  OK  ] Reached target Multi-User System.
Jul 19 21:13:53 priyasi systemd-nspawn[12059]: [  OK  ] Reached target Graphical Interface.
Jul 19 21:13:53 priyasi systemd-nspawn[12059]:          Starting Update UTMP about System Runlevel Changes...
Jul 19 21:13:53 priyasi systemd-nspawn[12059]: [  OK  ] Started Update UTMP about System Runlevel Changes.
Jul 19 21:13:53 priyasi systemd-nspawn[12059]: [  OK  ] Started Rotate log files.
Jul 19 21:13:57 priyasi systemd-nspawn[12059]: [  OK  ] Started Daily apt download activities.
Jul 19 21:13:57 priyasi systemd-nspawn[12059]:          Starting Daily apt upgrade and clean activities...
Jul 19 21:13:59 priyasi systemd-nspawn[12059]: [2B blob data]
Jul 19 21:13:59 priyasi systemd-nspawn[12059]: Debian GNU/Linux 10 SidArm64 console
Jul 19 21:13:59 priyasi systemd-nspawn[12059]: [1B blob data]
21:15 ♒♒♒   ☺ 😄    </code></pre>
<p>And the login</p>
<pre tabindex="0"><code class="language-linux" data-lang="linux">rrs@priyasi:~$ machinectl login DebSidArm64 
Connected to machine DebSidArm64. Press ^] three times within 1s to exit session.

Debian GNU/Linux 10 SidArm64 pts/0

SidArm64 login: root
Password: 
Last login: Thu Jun 20 10:57:30 IST 2019 on pts/0
Linux SidArm64 4.19.0-5-amd64 #1 SMP Debian 4.19.37-5 (2019-06-19) aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@SidArm64:~# 
root@SidArm64:~# 
root@SidArm64:~# uname -a
Linux SidArm64 4.19.0-5-amd64 #1 SMP Debian 4.19.37-5 (2019-06-19) aarch64 GNU/Linux
root@SidArm64:~# </code></pre>
<p>The problematic networking part. Notice the <code>qemu</code> emulation error messages. Basically, at this stage networking is dead.</p>
<pre tabindex="0"><code class="language-linux" data-lang="linux">root@SidArm64:~# ip a
Unsupported setsockopt level=270 optname=11
Unknown host QEMU_IFLA type: 50
Unknown host QEMU_IFLA type: 51
Unknown host QEMU_IFLA type: 50
Unknown host QEMU_IFLA type: 51
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: host0@if10: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc noop state DOWN group default qlen 1000
request send failed: Operation not supported
    link/ether f6:9d:cc:d6:ad:32 brd ff:ff:ff:ff:ff:ffroot@SidArm64:~# 
root@SidArm64:~# 


root@SidArm64:~# ping www.google.com
ping: www.google.com: Temporary failure in name resolution
root@SidArm64:~# 

root@SidArm64:~# cat /etc/resolv.conf 
nameserver 172.16.20.1</code></pre>
<p>Because I prefer <code>systemd</code> for containers, I chose to make use of systemd&rsquo;s network management tools too. Maybe that is causing the problem but in my opinion, is highly unlikely to be the cause.</p>
<p>Anyways&hellip;.simply invoking <code>dhclient</code> at this stage does assign the container an ip address. But more than that the core networking stack gets back in action, even though the reporting tools still report errors.</p>
<pre tabindex="0"><code class="language-linux" data-lang="linux">root@SidArm64:~# dhclient host0
Unknown host QEMU_IFLA type: 50
Unknown host QEMU_IFLA type: 51
Unknown host QEMU_IFLA type: 50
Unknown host QEMU_IFLA type: 51
Unsupported setsockopt level=270 optname=11
Unknown host QEMU_IFLA type: 50
Unknown host QEMU_IFLA type: 51
Unknown host QEMU_IFLA type: 50
Unknown host QEMU_IFLA type: 51
Unsupported setsockopt level=263 optname=8
Unsupported setsockopt level=270 optname=11
Unknown target IFA type: 4
Unknown target IFA type: 3
Unknown target IFA type: 6
root@SidArm64:~# 


root@SidArm64:~# ip a
Unsupported setsockopt level=270 optname=11
Unknown host QEMU_IFLA type: 50
Unknown host QEMU_IFLA type: 51
Unknown host QEMU_IFLA type: 50
Unknown host QEMU_IFLA type: 51
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: host0@if10: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UP group default qlen 1000
request send failed: Operation not supported
    link/ether f6:9d:cc:d6:ad:32 brd ff:ff:ff:ff:ff:ffroot@SidArm64:~# 
root@SidArm64:~# 


root@SidArm64:~# ping 172.16.20.1
PING 172.16.20.1 (172.16.20.1) 56(84) bytes of data.
64 bytes from 172.16.20.1: icmp_seq=1 ttl=64 time=0.091 ms
64 bytes from 172.16.20.1: icmp_seq=2 ttl=64 time=0.061 ms
64 bytes from 172.16.20.1: icmp_seq=3 ttl=64 time=0.138 ms
64 bytes from 172.16.20.1: icmp_seq=4 ttl=64 time=0.136 ms
64 bytes from 172.16.20.1: icmp_seq=5 ttl=64 time=0.152 ms
64 bytes from 172.16.20.1: icmp_seq=6 ttl=64 time=0.143 ms
64 bytes from 172.16.20.1: icmp_seq=7 ttl=64 time=0.137 ms
64 bytes from 172.16.20.1: icmp_seq=8 ttl=64 time=0.144 ms
^C
--- 172.16.20.1 ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 158ms
rtt min/avg/max/mdev = 0.061/0.125/0.152/0.030 ms


root@SidArm64:~# ping www.google.com
PING www.google.com (216.58.197.68) 56(84) bytes of data.
64 bytes from maa03s21-in-f4.1e100.net (216.58.197.68): icmp_seq=1 ttl=50 time=45.2 ms
64 bytes from maa03s21-in-f4.1e100.net (216.58.197.68): icmp_seq=2 ttl=50 time=63.7 ms
64 bytes from maa03s21-in-f4.1e100.net (216.58.197.68): icmp_seq=3 ttl=50 time=63.2 ms
64 bytes from maa03s21-in-f4.1e100.net (216.58.197.68): icmp_seq=4 ttl=50 time=80.7 ms
64 bytes from maa03s21-in-f4.1e100.net (216.58.197.68): icmp_seq=5 ttl=50 time=65.4 ms
64 bytes from maa03s21-in-f4.1e100.net (216.58.197.68): icmp_seq=6 ttl=50 time=70.4 ms
^C
--- www.google.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 12ms
rtt min/avg/max/mdev = 45.190/64.758/80.717/10.597 ms</code></pre>
<h2 id="conclusion">Conclusion</h2>
<p>With some minor annoyances but otherwise this has been my fastest way to get work done, especially cross architecture stuff. When I compare it back to how I&rsquo;d have thought such a use case back in the early days, I can&rsquo;t imagine the speed and simplicity I have at hand today. <strong>Free and Opensource Software</strong> has been a great choice, while it started just as a curiosity of young boy.</p>
]]></content:encoded></item></channel></rss>