<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Tech on Bastien Traverse</title>
    <link>https://bastientraverse.com/en/categories/tech/</link>
    <description>Recent content in Tech on Bastien Traverse</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Fri, 04 Oct 2024 00:00:00 +0200</lastBuildDate><atom:link href="https://bastientraverse.com/en/categories/tech/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Optimized cloud-init templates on Proxmox</title>
      <link>https://bastientraverse.com/en/posts/2024-10-04-proxmox-optimized-cloud-init-templates/</link>
      <pubDate>Fri, 04 Oct 2024 00:00:00 +0200</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2024-10-04-proxmox-optimized-cloud-init-templates/</guid>
      <description>&lt;p&gt;There are already quite a few resources out there demonstrating how to create a cloud-init enabled VM template in Proxmox. Here are the ones I mainly used to discover the topic, and which I suggest you go through because what follows depends on them:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Proxmox &lt;a href=&#34;https://pve.proxmox.com/wiki/Cloud-Init_FAQ&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;FAQ&lt;/a&gt;, &lt;a href=&#34;https://pve.proxmox.com/wiki/Cloud-Init_Support&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;wiki&lt;/a&gt; and mostly identical &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_cloud_init&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;official documentation&lt;/a&gt; on Cloud-Init support&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://youtu.be/shiIi38cJe4&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Perfect Proxmox Template with Cloud Image and Cloud Init&lt;/a&gt; (YouTube, Techno Tim 2022-03)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What those and many similar resources give are step-by-step instructions divided in as many commands to facilitate understanding. What I haven&amp;rsquo;t seen so far though, is an &lt;em&gt;all-in-one, optimized&lt;/em&gt; command to do the same thing, so here&amp;rsquo;s my contribution to the field:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;qm create &lt;span class=&#34;m&#34;&gt;1000&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --name debian12-cloud &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --description &lt;span class=&#34;s2&#34;&gt;&amp;#34;Debian 12 cloud-init template&amp;#34;&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --template &lt;span class=&#34;m&#34;&gt;1&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --ostype l26 &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --machine q35 &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --cpu host &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --cores &lt;span class=&#34;m&#34;&gt;2&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --memory &lt;span class=&#34;m&#34;&gt;4096&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --balloon &lt;span class=&#34;m&#34;&gt;512&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --scsihw virtio-scsi-single &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --scsi0 local-lvm:0,import-from&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/path/to/debian-12-generic-amd64.qcow2,discard&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;on,iothread&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;1,ssd&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;1&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --net0 virtio,bridge&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;vmbr0 &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --tablet &lt;span class=&#34;m&#34;&gt;0&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --rng0 &lt;span class=&#34;nv&#34;&gt;source&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/dev/urandom &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --boot &lt;span class=&#34;nv&#34;&gt;order&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;scsi0 &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --vga serial0 --serial0 socket &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --ide2 local-lvm:cloudinit &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --ciuser myuser &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --cipassword changeme &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --sshkey /path/to/your-public.key &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --ciupgrade &lt;span class=&#34;m&#34;&gt;0&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --ipconfig0 &lt;span class=&#34;nv&#34;&gt;ip&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;dhcp
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The same thing as a one-liner for the latest Ubuntu:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;qm create &lt;span class=&#34;m&#34;&gt;2000&lt;/span&gt; --name ubuntu-server-2404-cloud --description &lt;span class=&#34;s2&#34;&gt;&amp;#34;Ubuntu Server 24.04 cloud-init template&amp;#34;&lt;/span&gt;  --template &lt;span class=&#34;m&#34;&gt;1&lt;/span&gt; --ostype l26 --machine q35 --cpu host --cores &lt;span class=&#34;m&#34;&gt;2&lt;/span&gt; --memory &lt;span class=&#34;m&#34;&gt;4096&lt;/span&gt; --balloon &lt;span class=&#34;m&#34;&gt;512&lt;/span&gt; --scsihw virtio-scsi-single --scsi0 local-lvm:0,import-from&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/path/to/ubuntu-24.04-server-cloudimg-amd64.img,discard&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;on,iothread&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;1,ssd&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;1&lt;/span&gt; --net0 virtio,bridge&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;vmbr0 --rng0 &lt;span class=&#34;nv&#34;&gt;source&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/dev/urandom --tablet &lt;span class=&#34;m&#34;&gt;0&lt;/span&gt; --boot &lt;span class=&#34;nv&#34;&gt;order&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;scsi0 --vga serial0 --serial0 socket --ide2 local-lvm:cloudinit --ciuser myuser --cipassword changeme --sshkey /path/to/your-public.key --ciupgrade &lt;span class=&#34;m&#34;&gt;0&lt;/span&gt; --ipconfig0 &lt;span class=&#34;nv&#34;&gt;ip&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;dhcp
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note that you cannot copy-paste those blindly, you have to adjust a few parameters to your local environment (especially the VMID, disk image and SSH key paths).&lt;/p&gt;
&lt;p&gt;Follows a description of relevant options at the exclusion of self-evident ones (&lt;code&gt;name&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, &lt;code&gt;cores&lt;/code&gt;, &lt;code&gt;memory&lt;/code&gt;&amp;hellip;), as well as some possible variations you might want.&lt;/p&gt;
&lt;h3 id=&#34;generic-options&#34;&gt;&lt;a href=&#34;#generic-options&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Generic options&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;qm create 1000&lt;/code&gt;: the Proxmox CLI command to create a VM. Replace &lt;code&gt;1000&lt;/code&gt; by the VMID of your choice (must be ≥ 100)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--template 1&lt;/code&gt;: directly convert the created VM to a template&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;performance-related-options&#34;&gt;&lt;a href=&#34;#performance-related-options&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Performance related options&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--ostype l26&lt;/code&gt;: hint to optimize for a Linux 2.x-6.x-based system&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--machine q35&lt;/code&gt;: use a modern &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_machine_type&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;machine type&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--cpu host&lt;/code&gt;: pass-through the host &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#_cpu_type&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;CPU type&lt;/a&gt; to make all its features available in the VM&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--balloon 512&lt;/code&gt;: when set to a lower value than &lt;code&gt;memory&lt;/code&gt;, enables &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_memory&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;dynamic memory allocation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--scsihw virtio-scsi-single&lt;/code&gt;: the most performant &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_hard_disk&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;SCSI controller&lt;/a&gt;, especially when combined with &lt;code&gt;iothread=1&lt;/code&gt; (see next point)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--scsi0 local-lvm:0,import-from=/path/to/debian-12-generic-amd64.qcow2,iothread=1,discard=on,ssd=1&lt;/code&gt;:
&lt;ul&gt;
&lt;li&gt;import (&lt;em&gt;i.e.&lt;/em&gt; copy) the referenced cloud image as the VM disk
&lt;ul&gt;
&lt;li&gt;replace &lt;code&gt;/path/to/&lt;/code&gt; with the full path to where you downloaded the cloud image (which you should have already done by now if you have followed the resources linked above 😉)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;configure it with performance (&lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_hard_disk_iothread&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;IO Thread&lt;/a&gt;), &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_hard_disk_discard&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;thin-provisioning&lt;/a&gt; and SSD-optimized settings
&lt;ul&gt;
&lt;li&gt;remove &lt;code&gt;discard=on&lt;/code&gt; and/or &lt;code&gt;ssd=1&lt;/code&gt; if not applicable to your storage&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--tablet 0&lt;/code&gt;: one of the lesser-known performance tips but one of the most important! &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_options&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Disables the USB tablet device&lt;/a&gt; only needed when connecting via the integrated console to guests with a GUI (&lt;em&gt;e.g.&lt;/em&gt; Ubuntu Desktop). Reported to have a &lt;a href=&#34;https://reddit.com/r/homelab/comments/q1m383/a_small_but_useful_tip_for_proxmox_users/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;big performance impact&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--rng0 source=/dev/urandom&lt;/code&gt; (optional): provides a &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_virtio_rng&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;virtual hardware random number generator&lt;/a&gt; to get entropy from the host system (can speed things up during the first boot)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Up to here were performance-related options applicable to all VM templates, not only cloud-init ones. Here comes the cloud-init specific bits:&lt;/p&gt;
&lt;h3 id=&#34;cloud-init-related-options&#34;&gt;&lt;a href=&#34;#cloud-init-related-options&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Cloud-init related options&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--boot order=scsi0&lt;/code&gt;: apparently &lt;a href=&#34;https://pve.proxmox.com/wiki/Cloud-Init_Support#_preparing_cloud_init_templates&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;speeds up booting&lt;/a&gt; for cloud-init enabled images&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--vga serial0 --serial0 socket&lt;/code&gt;: creates the serial connection &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_cloud_init&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;expected by most cloud images&lt;/a&gt; in their &amp;ldquo;native&amp;rdquo; cloud environments; also useful to monitor and troubleshoot the boot process via the Proxmox console
&lt;ul&gt;
&lt;li&gt;verified to work with Debian 12 and Ubuntu 24.04 server  cloud images; remove if causing issues with the image you&amp;rsquo;re using&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--ide2 local-lvm:cloudinit&lt;/code&gt;: creates the required cloud-init &amp;ldquo;CD-ROM&amp;rdquo; drive&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--ciuser myuser&lt;/code&gt; (optional): provides a custom username for the user account provisioned by cloud-init; without it the account name will depend on the distribution&amp;rsquo;s default (&lt;code&gt;debian&lt;/code&gt; for Debian, &lt;code&gt;ubuntu&lt;/code&gt; for Ubuntu&amp;hellip; Check your cloud image docs about this)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--cipassword changeme&lt;/code&gt; (optional): generally not needed nor recommended, but useful for quickly making sure everything is all right the first few times over; afterwards use a SSH key instead&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--sshkey /path/to/your-public.key&lt;/code&gt; (&lt;strong&gt;required&lt;/strong&gt; if not setting a password): the authorized SSH public key that will be placed in the user account created by cloud-init&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--ciupgrade 0&lt;/code&gt; (optional): disable automatically upgrading packages during first boot; useful to speed things up during testing, afterwards remove it/set it to &lt;code&gt;1&lt;/code&gt; (the default) if you want &amp;ldquo;always fresh&amp;rdquo; clones (which is probably a smart choice)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--ipconfig0 ip=dhcp&lt;/code&gt;: cloud-init in Proxmox doesn&amp;rsquo;t have a network configuration by default, so use this to let DHCP handle it or use something like &lt;code&gt;--ipconfig0 ip=10.0.10.123/24,gw=10.0.10.1&lt;/code&gt; for static config. Can be done later for each VM individually, just don&amp;rsquo;t leave it empty otherwise they won&amp;rsquo;t have any network by default.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you already have &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#_custom_cloud_init_configuration&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;custom cloud-init snippets&lt;/a&gt;, specify them via &lt;code&gt;--cicustom &amp;quot;user=&amp;lt;volume&amp;gt;,network=&amp;lt;volume&amp;gt;,meta=&amp;lt;volume&amp;gt;&amp;quot;&lt;/code&gt;, &lt;em&gt;e.g.&lt;/em&gt; &lt;code&gt;--cicustom &amp;quot;user=local:snippets/user-config.yaml&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If you do, &lt;strong&gt;make sure you have the equivalents of the Proxmox cloud-init options above set in your custom config&lt;/strong&gt;, because &lt;a href=&#34;https://forum.proxmox.com/threads/proxmox-ignores-custom-cloud-init-from-cicustom-paramter-tested-with-ubuntu-centos.78070/#post-346322&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;using a custom user snippet overrides the complete user config set in the GUI or config&lt;/a&gt;! Yeah I know, it sucks and it&amp;rsquo;s not documented, boo Proxmox.&lt;/p&gt;
&lt;p&gt;Fortunately, as mentioned in the docs the GUI config can be dumped to serve as a base for custom configs:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;qm cloudinit dump &lt;span class=&#34;m&#34;&gt;1000&lt;/span&gt; user
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;qm cloudinit dump &lt;span class=&#34;m&#34;&gt;1000&lt;/span&gt; network
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;admonition info&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Note&lt;/p&gt;
  Unlike Proxmox&amp;rsquo; implementation, when using &lt;code&gt;--cicustom&lt;/code&gt; and in the absence of network configuration, the image&amp;rsquo;s &lt;code&gt;cloud-init&lt;/code&gt; process will generate a network configuration that will issue a DHCP request on a “first” network interface. So if DHCP is what you want, you don&amp;rsquo;t have to supply a &lt;code&gt;&amp;quot;network:...&amp;quot;&lt;/code&gt; snippet besides the &lt;code&gt;&amp;quot;user:...&amp;quot;&lt;/code&gt; one.
&lt;/div&gt;
&lt;h2 id=&#34;post-creation-steps&#34;&gt;&lt;a href=&#34;#post-creation-steps&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Post-creation steps&lt;/h2&gt;&lt;p&gt;The only thing that cannot be done in the same step (due to using &lt;code&gt;import-from&lt;/code&gt;) is resizing the disk image. I personally prefer doing it on the cloned VMs rather than on the template itself to reduce cloning time and adjust the size depending on the VM&amp;rsquo;s needs, but there is also a case to be made to do it on the template directly.&lt;/p&gt;
&lt;p&gt;So in my case I first clone the template to a new VM:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;qm clone &lt;span class=&#34;m&#34;&gt;1000&lt;/span&gt; &lt;span class=&#34;m&#34;&gt;150&lt;/span&gt; --full --name &lt;span class=&#34;s2&#34;&gt;&amp;#34;debian12-cloud&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;admonition note&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Note&lt;/p&gt;
  &lt;p&gt;Besides being generally recommended for VMs you will keep around, it seems we can only use a &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_copy_and_clone&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;full clone&lt;/a&gt; when using &lt;code&gt;--scsihw virtio-scsi-single&lt;/code&gt; as without the  &lt;code&gt;--full&lt;/code&gt; option I get:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Linked clone feature is not supported for drive &#39;scsi0&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;YMMV.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Then expand its disk size:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;qm resize &lt;span class=&#34;m&#34;&gt;150&lt;/span&gt; scsi0 15G
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And then we&amp;rsquo;re ready to fire up the VM!&lt;/p&gt;
&lt;div class=&#34;admonition tip&#34;&gt;
  Double-click on the VM name (or on the &amp;ldquo;Console&amp;rdquo; button at the top right) instead of going through the integrated VM-specific menu &amp;ldquo;Console&amp;rdquo; element, because the pop-up window it opens can be resized fullscreen and allows to scroll back the buffer and read the boot log if necessary.
&lt;/div&gt;
&lt;p&gt;After checking everything works, you may want to stop and destroy this test VM:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;qm stop &lt;span class=&#34;m&#34;&gt;150&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;qm destroy &lt;span class=&#34;m&#34;&gt;150&lt;/span&gt; --purge --destroy-unreferenced-disks &lt;span class=&#34;m&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now you can do the final adjustments to your template (&lt;em&gt;e.g.&lt;/em&gt; remove &lt;code&gt;--cipassword&lt;/code&gt;, &lt;code&gt;--ciupgrade 0&lt;/code&gt; etc.) and you are ready to rock the cloud-init lifestyle in Proxmox! ☁️🤘🕺&lt;/p&gt;
&lt;h2 id=&#34;uefi-variant&#34;&gt;&lt;a href=&#34;#uefi-variant&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;UEFI variant&lt;/h2&gt;&lt;p&gt;Generally I try to use as modern a stack as is reasonable, because software written in the last few years is more likely to be tested with it than a more legacy stack.&lt;/p&gt;
&lt;p&gt;But I have realized that &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_bios_and_uefi&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;UEFI&lt;/a&gt; is much less commonplace in virtualized environments than on bare metal, making it less tested and I&amp;rsquo;d say, slightly less supported overall (case in point: it&amp;rsquo;s still not the default in QEMU/Proxmox).&lt;/p&gt;
&lt;p&gt;However it is easy enough to use it in our templates by adding the following options:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;--bios ovmf --efidisk0 local-lvm:0,efitype&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;4m,size&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;4M,pre-enrolled-keys&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;m&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The only thing to note is that &lt;code&gt;pre-enrolled-keys=0&lt;/code&gt; disables Secure Boot, which trips up all the distros that don&amp;rsquo;t want to play the Microsoft game (Arch Linux being a notable one for me). Leave the parameter out or switch its value to &lt;code&gt;1&lt;/code&gt; for a Secure Boot-enabled template (confirmed working with Ubuntu for example)!&lt;/p&gt;
&lt;h2 id=&#34;the-qemu-guest-agent-conundrum&#34;&gt;&lt;a href=&#34;#the-qemu-guest-agent-conundrum&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;The QEMU Guest Agent conundrum&lt;/h2&gt;&lt;p&gt;By default, no cloud images I know of come with &lt;code&gt;qemu-guest-agent&lt;/code&gt; preinstalled, but it&amp;rsquo;s &lt;a href=&#34;https://pve.proxmox.com/wiki/Qemu-guest-agent&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;pretty&lt;/a&gt; &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_qemu_agent&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;useful&lt;/a&gt; on Proxmox.&lt;/p&gt;
&lt;p&gt;To install it in your cloud images, you basically have two options:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install and use libguestfs&amp;rsquo; &lt;a href=&#34;https://libguestfs.org/virt-customize.1.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;virt-customize&lt;/a&gt; to the cloud images themselves, as illustrated &lt;a href=&#34;https://totaldebug.uk/posts/proxmox-template-with-cloud-image-and-cloud-init/#install-packages&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;in this random blog post I found&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Let cloud-init do it during the first boot of each cloned VM using a &lt;a href=&#34;https://pve.proxmox.com/pve-docs/chapter-qm.html#_custom_cloud_init_configuration&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;custom cloud-init snippet&lt;/a&gt;: see &lt;a href=&#34;https://superuser.com/a/1787022&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this SuperUser answer&lt;/a&gt; for an example. The required lines to add to your &lt;code&gt;user-config.yaml&lt;/code&gt; are:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c&#34;&gt;#cloud-config&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nn&#34;&gt;...&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;package_update&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;kc&#34;&gt;true&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;packages&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;- &lt;span class=&#34;l&#34;&gt;qemu-guest-agent&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;runcmd&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;- &lt;span class=&#34;l&#34;&gt;systemctl enable --now qemu-guest-agent&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote&gt;
&lt;p&gt;Remember that using a custom user snippet &lt;a href=&#34;https://forum.proxmox.com/threads/proxmox-ignores-custom-cloud-init-from-cicustom-paramter-tested-with-ubuntu-centos.78070/#post-346322&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;overrides the complete user config set in the GUI or config&lt;/a&gt;, so those lines must be added to your complete user snippet!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In this case add &lt;code&gt;--cicustom &amp;quot;user=local:snippets/user-config.yaml&amp;quot;&lt;/code&gt; and&lt;code&gt;--agent 1,fstrim_cloned_disks=1&lt;/code&gt; when creating the template (see &lt;a href=&#34;https://pve.proxmox.com/pve-docs/qm.1.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;the docs&lt;/a&gt; for details).&lt;/p&gt;
&lt;h2 id=&#34;tips--tricks&#34;&gt;&lt;a href=&#34;#tips--tricks&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Tips &amp;amp; tricks&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;don&amp;rsquo;t use Debian &lt;code&gt;genericcloud&lt;/code&gt; image: its kernel is optimized for Azure &amp;amp; AWS environments and in my tests, didn&amp;rsquo;t work with Proxmox. I had started with this one (being fooled by the wording on &lt;a href=&#34;https://cdimage.debian.org/images/cloud/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;the download page&lt;/a&gt; (&amp;quot;&lt;em&gt;genericcloud: Similar to generic. Should run in any virtualised environment. Is smaller than &lt;code&gt;generic&lt;/code&gt; by excluding drivers for physical hardware&lt;/em&gt;&amp;quot;), spent quite a bit of time troubleshooting the VM booting but cloud-init not kicking in, until I eventually tried the &lt;code&gt;generic&lt;/code&gt; image where everything worked perfectly. &lt;a href=&#34;https://wiki.debian.org/Cloud/#What_is_the_difference_between_the_generic_and_genericcloud_images.3F&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;The Debian wiki&lt;/a&gt; actually sets the record straight:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The generic image uses Debian&amp;rsquo;s standard Linux kernel packages, while the genericcloud image uses the cloud kernel build. The cloud kernel disables a large number of device drivers and primarily targets the Amazon EC2 and Microsoft Azure VM device models. It may be usable in other environments, but for maximum compatibility we recommend using the generic images.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;While troubleshooting I&amp;rsquo;ve seen plenty of other reports of people having issues making the &lt;code&gt;genericcloud&lt;/code&gt; image work with Proxmox, while it worked for some others&amp;hellip; &lt;code&gt;generic&lt;/code&gt; is the reliable, consistant option. &amp;rsquo;nough said!&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;you can get Proxmox to display &lt;code&gt;.qcow2&lt;/code&gt; images alongside regular &lt;code&gt;.iso&lt;/code&gt; in its GUI, by simply suffixing/replacing their extension with &lt;code&gt;.img&lt;/code&gt; (like Ubuntu does). It&amp;rsquo;s a regex issue ¯\_(ツ)_/¯&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Using a container to sidestep a forgotten password in CasaOS</title>
      <link>https://bastientraverse.com/en/posts/2024-02-03-casa-password-recovery/</link>
      <pubDate>Sat, 03 Feb 2024 00:00:00 +0100</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2024-02-03-casa-password-recovery/</guid>
      <description>&lt;h2 id=&#34;problem-statement&#34;&gt;&lt;a href=&#34;#problem-statement&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Problem statement&lt;/h2&gt;&lt;p&gt;As part of dabbling with self-hosting again, I installed &lt;a href=&#34;https://github.com/IceWhaleTech/CasaOS&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;CasaOS&lt;/a&gt; on an Oracle Cloud free Ampere instance to try it out.&lt;/p&gt;
&lt;p&gt;After setting it aside for a few weeks, when I logged in via SSH and tried to use &lt;code&gt;sudo&lt;/code&gt; I realized I absolutely couldn&amp;rsquo;t remember my user&amp;rsquo;s password 😅&lt;/p&gt;
&lt;p&gt;The standard operating procedure in this case is to either reboot the machine on a live system and use that to chroot into the local install, or fiddle with GRUB rescue/kernel command line.&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;But since I could still install containers through CasaOS web interface, I thought I&amp;rsquo;d use this opportunity to explore ways to recover my sudo access/change my password without rebooting (which could be nice in case it is essential to avoid downtime).&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; As I was finishing this post, I realized that the third constraint listed below was incorrect, and as a result a less cumbersome resolution was possible. So read on if you are interested in the learning journey, or jump straight to &lt;a href=&#34;#the-solution-simplified&#34;&gt;the simplified solution&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;the-constraints&#34;&gt;&lt;a href=&#34;#the-constraints&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;The constraints&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;the CLI/SSH access is &amp;ldquo;useless&amp;rdquo;: my user is not setup to interact with the Docker socket without elevated privileges (which is usually a good thing)&lt;/li&gt;
&lt;li&gt;besides its App Store content, CasaOS allows to manually install containers using a Compose file or a &lt;code&gt;docker run&lt;/code&gt; command (which is then &lt;a href=&#34;https://www.composerize.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;composerized&lt;/a&gt;): see &lt;a href=&#34;https://youtu.be/ToV6vRIl3Nk?si=HH9YiQdyqy2LDsva&amp;amp;t=16&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;official video&lt;/a&gt; or &lt;a href=&#34;https://docs.zimaboard.com/docs/Self-Deploying-Applications.html#Follow-these-steps-in-order&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;screenshots&lt;/a&gt; of the process&lt;/li&gt;
&lt;li&gt;&lt;del&gt;its interface however doesn&amp;rsquo;t allow to &lt;code&gt;docker exec&lt;/code&gt; or interact with containers in any other way; the installed containers &lt;em&gt;must&lt;/em&gt; expose a web interface for us to be able to interact with them.&lt;/del&gt; As it turns out, CasaOS interface does &lt;a href=&#34;https://github.com/IceWhaleTech/CasaOS/issues/1316&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;offer access to containers&amp;rsquo; console&lt;/a&gt; (equivalent to a &lt;code&gt;docker exec -it &amp;lt;containe&amp;gt; /bin/sh&lt;/code&gt;), at least for apps installed from its official Store, via the app Settings &amp;gt; &amp;ldquo;Terminal and Logs&amp;rdquo; icon.&lt;/li&gt;
&lt;/ul&gt;
&lt;figure class=&#34;center&#34;&gt;&lt;img src=&#34;https://bastientraverse.com/en/posts/2024-02-03-casa-password-recovery/casa-app-settings-terminal.png&#34;
    alt=&#34;Access to a container shell and logs in CasaOS interface&#34;&gt;&lt;figcaption&gt;
      &lt;h4&gt;Access to a container shell and logs in CasaOS interface&lt;/h4&gt;
    &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id=&#34;hacking-around&#34;&gt;&lt;a href=&#34;#hacking-around&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Hacking around&lt;/h2&gt;&lt;p&gt;Because I&amp;rsquo;m pretty new to this, my first idea was to start a container which would give me a root shell with access to the docker socket, and then use that environment to start a second privileged container (&lt;a href=&#34;https://www.docker.com/blog/docker-can-now-run-within-docker/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Docker-in-Docker&lt;/a&gt; style) from which I would mount the host filesystem and use &lt;code&gt;{ch,}passwd&lt;/code&gt; or such&amp;hellip; Yes, I felt very smart thinking this up 😅&lt;/p&gt;
&lt;p&gt;Unaware of my mistaken approach, I looked online for a &amp;ldquo;web terminal container&amp;rdquo; and the first result on StartPage was the &lt;a href=&#34;https://github.com/raonigabriel/web-terminal&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;web terminal&lt;/a&gt; GitHub repo, which did what I needed (expose a root shell in the browser) but hadn&amp;rsquo;t been updated since August 2021 😕&lt;/p&gt;
&lt;figure class=&#34;center&#34;&gt;&lt;img src=&#34;https://bastientraverse.com/en/posts/2024-02-03-casa-password-recovery/sp-results-webterm.png&#34;
    alt=&#34;StartPage results for web terminal container&#34;&gt;
&lt;/figure&gt;
&lt;details class=&#34;admonition note&#34;&gt;&lt;summary class=&#34;admonition-title&#34;&gt;Aside&lt;/summary&gt;
  &lt;p&gt;Docker Hub search is appalling: searching for &lt;code&gt;web terminal&lt;/code&gt; gave me a bunch of &lt;a href=&#34;https://hub.docker.com/search?q=web%20terminal&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;completely unrelated results&lt;/a&gt;. I had to put a dash between the two words &lt;a href=&#34;https://hub.docker.com/search?q=web-terminal&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;to get anywhere&lt;/a&gt;, but then the two first results hadn&amp;rsquo;t been updated in 2 years either&amp;hellip;&lt;/p&gt;
&lt;p&gt;Searching for &lt;code&gt;web shell&lt;/code&gt; and &lt;code&gt;&amp;quot;web shell&amp;quot;&lt;/code&gt; didn&amp;rsquo;t give better results, while &lt;code&gt;web-shell&lt;/code&gt; and &lt;code&gt;webshell&lt;/code&gt; led to very outdated stuff without any description. I can&amp;rsquo;t believe there isn&amp;rsquo;t a reference implementation of this stuff!!&lt;/p&gt;
&lt;p&gt;I also looked up &lt;code&gt;ttyd&lt;/code&gt;, the software used by &lt;code&gt;web-terminal&lt;/code&gt;, and here the first result was fresh from a few days ago; however there was no mention of &lt;em&gt;&amp;ldquo;How to use this with Docker&amp;rdquo;&lt;/em&gt; , so I wasn&amp;rsquo;t sure a simple &lt;code&gt;docker run&lt;/code&gt; would achieve the desired result&amp;hellip; Had I checked its &lt;a href=&#34;https://hub.docker.com/layers/tsl0922/ttyd/alpine/images/sha256-92dd5758ccda91ffc1f113c4c8d8c7407cc236d02c55993dd01d5629fe3a882b?context=explore&amp;amp;tab=vulnerabilities&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Dockerfile&lt;/a&gt;, I would have seen that its &lt;code&gt;ENTRYPOINT&lt;/code&gt;/&lt;code&gt;CMD&lt;/code&gt; was, in fact, starting up the service 🙃&lt;/p&gt;
&lt;/details&gt;
&lt;p&gt;Lo and behold, I took the &amp;ldquo;risk&amp;rdquo; (after checking the image&amp;rsquo;s Dockerfile) and entered the following command in CasaOS Docker CLI interface:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;docker&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;run&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;d&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;v&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;var&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;run&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;docker&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nl&#34;&gt;sock&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;var&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;run&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;docker&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sock&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;p&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;7681&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;7681&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;raonigabriel&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;web&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;nl&#34;&gt;terminal&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;latest&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After setting up the access port in CasaOS interface and confirming everything was okay, I clicked &amp;ldquo;Install&amp;rdquo; and connected to my server&amp;rsquo;s port &lt;code&gt;7681&lt;/code&gt; in a browser&amp;hellip; Success, I was in!&lt;/p&gt;
&lt;p&gt;For the next stage of my plan I ran the following command inspired by &lt;a href=&#34;https://security.stackexchange.com/questions/218355/how-to-execute-a-command-directly-on-the-host-system-through-docker-sock-in-a-do&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this StackExchange thread&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;docker&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;run&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;ti&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;--&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;privileged&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;--&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;net&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;host&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;--&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;pid&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;host&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;--&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;ipc&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;host&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;--&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;volume&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;/:/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;host&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;busybox&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;chroot&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;host&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;bin&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;nl&#34;&gt;sh&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;nl&#34;&gt;docker&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;not&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;found&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Crap, I didn&amp;rsquo;t even check that the container had docker installed 🤦 You can tell I really don&amp;rsquo;t know what I am doing 😂&lt;/p&gt;
&lt;p&gt;Of course when I subsequently tried to install docker&amp;hellip;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-py&#34; data-lang=&#34;py&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;root&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;@&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;d0fa4b64c55&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;err&#34;&gt;$&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;apk&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;add&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;docker&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;fetch&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;https&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;//&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;dl&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;cdn&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpinelinux&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;org&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpine&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;edge&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;aarch64&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;APKINDEX&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;tar&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;gz&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;ERROR&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;https&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;//&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;dl&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;cdn&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpinelinux&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;org&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpine&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;edge&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;UNTRUSTED&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;signature&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;WARNING&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Ignoring&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;APKINDEX&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;e37b76c2&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;tar&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;gz&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;No&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;such&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;file&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;or&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;directory&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;fetch&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;https&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;//&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;dl&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;cdn&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpinelinux&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;org&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpine&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;edge&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;community&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;aarch64&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;APKINDEX&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;tar&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;gz&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;ERROR&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;https&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;//&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;dl&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;cdn&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpinelinux&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;org&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpine&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;edge&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;community&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;UNTRUSTED&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;signature&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;WARNING&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Ignoring&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;APKINDEX&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;d022dfc8&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;tar&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;gz&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;No&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;such&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;file&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;or&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;directory&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;ERROR&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;unsatisfiable&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;constraints&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;n&#34;&gt;docker&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;missing&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;required&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;by&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;world&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;docker&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;root&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;@&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;d0fa4b64c55&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;err&#34;&gt;$&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;apk&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;update&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;fetch&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;https&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;//&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;dl&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;cdn&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpinelinux&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;org&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpine&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;edge&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;aarch64&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;APKINDEX&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;tar&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;gz&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;ERROR&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;https&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;//&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;dl&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;cdn&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpinelinux&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;org&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpine&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;edge&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;UNTRUSTED&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;signature&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;WARNING&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Ignoring&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;APKINDEX&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;e37b76c2&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;tar&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;gz&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;No&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;such&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;file&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;or&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;directory&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;fetch&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;https&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;//&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;dl&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;cdn&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpinelinux&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;org&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpine&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;edge&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;community&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;aarch64&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;APKINDEX&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;tar&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;gz&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;ERROR&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;https&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;//&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;dl&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;cdn&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpinelinux&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;org&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;alpine&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;edge&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;community&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;UNTRUSTED&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;signature&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;WARNING&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Ignoring&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;APKINDEX&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;d022dfc8&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;tar&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;gz&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;No&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;such&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;file&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;or&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;directory&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;errors&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;36&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;distinct&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;packages&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;available&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A quick search seems to indicate that the image is &lt;a href=&#34;https://stackoverflow.com/questions/73374745/error-http-dl-4-alpinelinux-org-alpine-edge-testing-untrusted-signature&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;simply too old&lt;/a&gt;. Building an updated image was out of the scope I had set for this experiment, so I paused and took time to think.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;That&amp;rsquo;s when it occurred to me that this &amp;ldquo;nested container&amp;rdquo; approach was completely useless, and would most likely not work since at that point you have the first container&amp;rsquo;s virtualized filesystem namespace acting as a buffer between the host and the DinD container&amp;hellip; Complete misdirection, backing up!&lt;/p&gt;
&lt;h2 id=&#34;the-solution&#34;&gt;&lt;a href=&#34;#the-solution&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;The solution&lt;/h2&gt;&lt;p&gt;After thinking it through some more, I realized one could achieve the desired outcome by simply mounting the host &lt;code&gt;/&lt;/code&gt; read-write as an attached volume 😁&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;docker&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;run&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;d&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;v&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;/:/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;host&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;p&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;7681&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;7681&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;raonigabriel&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;web&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;nl&#34;&gt;terminal&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;latest&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;Et voilà&lt;/em&gt;, I finally had a root shell from which I could chroot into the host and update the user password and/or configure password-less sudo (which amounts to the same). Or really, do (nearly) everything to the host system 😨&lt;/p&gt;
&lt;figure class=&#34;center&#34;&gt;&lt;img src=&#34;https://bastientraverse.com/en/posts/2024-02-03-casa-password-recovery/webterm.png&#34;
    alt=&#34;Root shell provided by the web-terminal container&#34;&gt;&lt;figcaption&gt;
      &lt;h4&gt;Root shell provided by the web-terminal container&lt;/h4&gt;
    &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;blockquote&gt;
&lt;p&gt;Initially I thought it would be necessary to use a &lt;a href=&#34;https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;privileged&lt;/a&gt; container, but trying it showed that wasn&amp;rsquo;t the case. I guess it&amp;rsquo;s because I was only editing files/using regular utilites, and not trying to create new devices/nodes etc.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;the-solution-simplified&#34;&gt;&lt;a href=&#34;#the-solution-simplified&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;The solution: simplified&lt;/h2&gt;&lt;p&gt;This is what happens when you don&amp;rsquo;t know your tools enough&amp;hellip; You miss very obvious pathways that lead to simpler solutions 😁&lt;/p&gt;
&lt;p&gt;Indeed, there is no need to install a third-party container. It is enough to add the &lt;code&gt;/:/host&lt;/code&gt; volume to an existing app installed from CasaOS official App Store (&lt;em&gt;e.g.&lt;/em&gt; NextCloud), and  after making sure in its settings it runs with the root &lt;code&gt;UID&lt;/code&gt;/&lt;code&gt;GID&lt;/code&gt;, we can use the interface to connect the container&amp;rsquo;s console!&lt;/p&gt;
&lt;figure class=&#34;center&#34;&gt;&lt;img src=&#34;https://bastientraverse.com/en/posts/2024-02-03-casa-password-recovery/casa-nc-root-shell.png&#34;
    alt=&#34;Root shell inside nextcloud container&#34;&gt;&lt;figcaption&gt;
      &lt;h4&gt;Root shell inside nextcloud container&lt;/h4&gt;
    &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;And that is the Easy Way© to get a root shell on your server using containers!&lt;/p&gt;
&lt;h2 id=&#34;trying-to-refine-the-solution&#34;&gt;&lt;a href=&#34;#trying-to-refine-the-solution&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Trying to refine the solution&lt;/h2&gt;&lt;p&gt;Now that I was there, I felt like I should have been able to use a simple &lt;code&gt;busybox&lt;/code&gt; image to execute a command non-interactively directly from &lt;code&gt;docker run&lt;/code&gt;/Compose file, eliminating the need to find an image that exposes a web service or to connect to the container&amp;rsquo;s console.&lt;/p&gt;
&lt;p&gt;After a bit of fiddling, I came up with the following invocation:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;docker&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;run&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;v&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;etc&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;nl&#34;&gt;sudoers&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;host&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;etc&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sudoers&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;busybox&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;bin&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sh&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;c&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;err&#34;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;%&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sudo&lt;/span&gt;  &lt;span class=&#34;n&#34;&gt;ALL&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;ALL&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;nl&#34;&gt;NOPASSWD&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ALL&lt;/span&gt;&lt;span class=&#34;err&#34;&gt;&amp;#39;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;host&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;etc&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sudoers&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;But CasaOS interface constantly threw an error. Probably the redirection in the command, but no amount of quoting led me to a successful run.&lt;/p&gt;
&lt;p&gt;At that point I threw the towel in: I had recovered access to my sudo access and learnt quite a few things along the way. Time to wrap up.&lt;/p&gt;
&lt;h2 id=&#34;takeways&#34;&gt;&lt;a href=&#34;#takeways&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Takeways&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Docker default security story is scary: because the daemon runs as root by default, the mere ability to run containers (even without &lt;code&gt;--privileged&lt;/code&gt;) and mount any desired host path as a volume gives &lt;a href=&#34;https://stackoverflow.com/a/32192369&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;root-equivalent status&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Due to this, access to CasaOS interface is equivalent to root access on the server&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That&amp;rsquo;s all folks, thanks for reading this account I hope you enjoyed!&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;See &lt;em&gt;e.g.&lt;/em&gt; &lt;a href=&#34;https://gcore.com/learning/how-to-reset-password-in-linux/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://gcore.com/learning/how-to-reset-password-in-linux/&lt;/a&gt;&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Graphical management interfaces for Linux servers</title>
      <link>https://bastientraverse.com/en/posts/2023-12-11-server-management-gui/</link>
      <pubDate>Mon, 11 Dec 2023 00:00:00 +0100</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2023-12-11-server-management-gui/</guid>
      <description>&lt;h2 id=&#34;terminology-considerations&#34;&gt;&lt;a href=&#34;#terminology-considerations&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Terminology considerations&lt;/h2&gt;&lt;p&gt;&amp;ldquo;&lt;em&gt;Server management interface&lt;/em&gt;&amp;rdquo;, &amp;ldquo;&lt;em&gt;control panel&lt;/em&gt;&amp;rdquo;, &amp;ldquo;&lt;em&gt;dashboard&lt;/em&gt;&amp;rdquo;&amp;hellip; While investigating Free and Open Source graphical server management software, I had trouble establishing the categorical difference between the different solutions I was reading about.&lt;/p&gt;
&lt;p&gt;My use case being a &amp;ldquo;single user homelab/server&amp;rdquo; and not a multi-tenancy reseller/web hosting solution, I initially left aside the well established category of &lt;a href=&#34;https://www.linode.com/docs/guides/how-to-choose-a-control-panel/#what-is-a-control-panel&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;control panels&lt;/a&gt; (with the exception of HestiaCP).&lt;/p&gt;
&lt;p&gt;The projects that caught my interest were &lt;a href=&#34;https://cockpit-project.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Cockpit&lt;/a&gt;, &lt;a href=&#34;https://hestiacp.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HestiaCP&lt;/a&gt;, &lt;a href=&#34;https://www.portainer.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Portainer&lt;/a&gt;, &lt;a href=&#34;https://caprover.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;CapRover&lt;/a&gt;, &lt;a href=&#34;https://casaos.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;CasaOS&lt;/a&gt;, &lt;a href=&#34;https://www.cloudron.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Cloudron&lt;/a&gt;, and to a lesser extent, &lt;a href=&#34;https://github.com/SelfhostedPro/Yacht&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Yacht&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But try as I might, I just couldn&amp;rsquo;t wrap my head around what precisely distinguished them. Of course I could see that they had different focus: some were more sysadmin/general server management-oriented while others were more app- and Docker-oriented; but I lacked a general &lt;em&gt;category theory&lt;/em&gt; for them.&lt;/p&gt;
&lt;p&gt;My search-fu not yielding anything relevant, I thought I&amp;rsquo;d probe ChatGPT about it. This resulted in a most enlightening conversation, as it answered with a distinction that felt like a Eureka moment to me:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The solutions you&amp;rsquo;ve mentioned, including Portainer, HestiaCP, CapRover, CasaOS, Cloudron, and Yacht, represent a different category of software compared to the &lt;strong&gt;server management tools&lt;/strong&gt; like Cockpit, Webmin, Ajenti, and others.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It then went on to provide the following breakup:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Server Management Tools&lt;/strong&gt; (e.g. Cockpit, Webmin, Ajenti):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Primarily focused on server administration and configuration.&lt;/li&gt;
&lt;li&gt;Provide a broad range of controls over system settings, users, and services.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Complexity:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Varies from beginner-friendly to advanced, catering to users with different skill levels.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Interface Type:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Often web-based but can include desktop GUI options.&lt;/li&gt;
&lt;li&gt;Aimed at managing servers directly, not specifically for application or container orchestration.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Scalability:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Typically suitable for small to large enterprises.&lt;/li&gt;
&lt;li&gt;Designed for overall server management, including security, networking, and system configuration.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Community Support:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Active open-source communities provide support and contribute to feature development.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Integration:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Extensive third-party module or plugin support for customization.&lt;/li&gt;
&lt;li&gt;May include features for managing server-wide tasks and configurations.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Application and Container Orchestration Tools&lt;/strong&gt; (e.g. Portainer, HestiaCP, CapRover, CasaOS, Cloudron, Yacht):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Purpose:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Focused on managing and orchestrating applications, containers, and services.&lt;/li&gt;
&lt;li&gt;Streamlined for deploying and managing web applications and services in containerized environments.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Complexity:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Typically designed to be user-friendly, catering to developers and administrators with varying skill levels.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Interface Type:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Primarily web-based interfaces, emphasizing container and application management.&lt;/li&gt;
&lt;li&gt;Often include features for easy deployment, scaling, and monitoring of applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Scalability:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Suited for small to medium-scale applications and services.&lt;/li&gt;
&lt;li&gt;Designed for ease of use in deploying and managing containerized applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Community Support:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Active communities, often developer-focused, providing support and contributing to the development of container-related features.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Integration:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Strong integration with containerization technologies (e.g., Docker, Kubernetes).&lt;/li&gt;
&lt;li&gt;Emphasis on managing application stacks, updating applications, and maintaining service availability.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the content of some categories don&amp;rsquo;t really fit their header (&lt;em&gt;e.g.&lt;/em&gt; &amp;ldquo;Interface Type&amp;rdquo;)&lt;/li&gt;
&lt;li&gt;HestiaCP is lumped in the &amp;ldquo;Application and Container Orchestration Tools&amp;rdquo; category, despite its &lt;a href=&#34;https://hestiacp.com/features.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;features&lt;/a&gt; being arguably more control panel-y/towards server management.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is to just highlight the very reasonable limits of ChatGPT (3.5), in what was otherwise a super useful answer.&lt;/p&gt;
&lt;h2 id=&#34;coming-up-with-a-unified-categorization&#34;&gt;&lt;a href=&#34;#coming-up-with-a-unified-categorization&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Coming up with a unified categorization&lt;/h2&gt;&lt;p&gt;I kept poking at the prompt until I managed to formulate a General Category Theory of Server Management Graphical User Interfaces™, inclusive of control panels and &lt;em&gt;mere&lt;/em&gt; dashboards. Here&amp;rsquo;s the result:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The terms &amp;ldquo;server management tools&amp;rdquo;, &amp;ldquo;control panels&amp;rdquo;, &amp;ldquo;application and container orchestration tools&amp;rdquo; and &amp;ldquo;server dashboards&amp;rdquo; are sometimes used interchangeably, but they often refer to different aspects of managing and monitoring servers. Here&amp;rsquo;s how you can distinguish between them:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Server Management Tools:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; Server management tools are software applications designed to facilitate the configuration, administration, and monitoring of servers. They offer a range of features for tasks such as user management, service configuration, and system monitoring.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scope:&lt;/strong&gt; Server management tools encompass a broad set of functionalities related to overall server administration, configuration, and maintenance.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Examples:&lt;/strong&gt; Cockpit, Webmin, Ajenti and ISPConfig are examples of server management tools.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Control Panels:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; Control panels are specialized interfaces that provide centralized control over specific server functionalities, often in a web-based environment. They are designed to simplify the management of specific server aspects, such as web hosting, email services, or database management.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scope:&lt;/strong&gt; Control panels are more focused and may not cover all aspects of server management. They often excel in specific use cases and are user-friendly for individuals who may not have extensive server administration experience.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Examples:&lt;/strong&gt; HestiaCP, Froxlor and Virtualmin are examples of control panels.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Application and Container Orchestration Tools&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; These tools aim to streamline application deployment, scale applications automatically to handle varying workloads, provide centralized management for containers, and automate various aspects of deployment and updates, ultimately enhancing overall efficiency.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scope:&lt;/strong&gt; Their scope includes container orchestration, service discovery, load balancing, health monitoring, and automated rollbacks and updates. They focus on managing and coordinating the deployment, scaling, and operation of application containers in a containerized environment, ensuring seamless and efficient operations.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Examples&lt;/strong&gt;: Portainer, CapRover and Yacht are examples of application and container orchestration tools.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Server Dashboards:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Purpose:&lt;/strong&gt; Server dashboards are visual representations of real-time or historical server data, allowing users to monitor key metrics and performance indicators. They provide a quick overview of the server&amp;rsquo;s health and status.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scope:&lt;/strong&gt; Dashboards are primarily focused on providing visibility into server performance metrics and may not offer the same depth of configuration and administration features as management tools or control panels.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Examples:&lt;/strong&gt; Grafana, Kibana, and custom dashboards created using tools like Prometheus or Nagios are examples of server dashboards.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In summary, while there is some overlap in functionality, server management tools generally provide a comprehensive set of features for overall server administration. Control panels are more specialized, focusing on specific server functionalities. Application and container orchestration tools are geared towards managing and orchestrating applications and containers, ensuring efficient deployment, scaling, and maintenance. Server dashboards, on the other hand, offer visual representations of server performance metrics for monitoring purposes. The choice between them depends on the specific needs and preferences of the user or organization.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So, even though ChatGPT kind of threw my FOSS requirement to the wind by mentioning famous proprietary panels (that I replaced here), all in all I feel like we did a great job coming up with a good &lt;em&gt;typology of graphical, general purpose GNU/Linux server management solutions&lt;/em&gt; (what a mouthful 😅).&lt;/p&gt;
&lt;h2 id=&#34;category-members&#34;&gt;&lt;a href=&#34;#category-members&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Category members&lt;/h2&gt;&lt;p&gt;Now that our categories are well defined, it is time to flesh them out by filling them with our candidates!&lt;/p&gt;
&lt;p&gt;Without further ado, here&amp;rsquo;s a curated list with stuff somewhat beyond my initial use case:&lt;/p&gt;
&lt;h3 id=&#34;server-management-tools&#34;&gt;&lt;a href=&#34;#server-management-tools&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Server Management Tools:&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://cockpit-project.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Cockpit Project&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; LGPL 2.1&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Web-based server administration and monitoring.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Beginner to Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for both SMEs and large enterprises.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Growing community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Focus on integration with systemd and containers.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/cockpit-project/cockpit&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;http://www.webmin.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Webmin&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; BSD&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Comprehensive web-based server configuration and management.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Varies from beginner-friendly to advanced.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs and large enterprises.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Extensive third-party module support.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/webmin/webmin&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://ajenti.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Ajenti&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; AGPLv3&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Web-based server administration with support for plugins.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Supports various plugins for extended functionality.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ajenti/ajenti&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://www.ispconfig.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ISPConfig&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; BSD&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; All-in-one server management panel.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Intermediate to Advanced.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs and large enterprises.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Strong support for multi-server setups.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/servisys/ispconfig_setup&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://zentyal.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Zentyal&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; GPLv2&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Linux Small Business Server.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Offers a wide range of server modules.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/zentyal/zentyal&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;web-hostingcontrol-panels&#34;&gt;&lt;a href=&#34;#web-hostingcontrol-panels&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Web hosting/Control Panels&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://hestiacp.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HestiaCP&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; GPLv3&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Web hosting control panel.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Manages website hosting, email services, and server configurations.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/hestiacp/hestiacp&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://www.froxlor.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Froxlor&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; GPL&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Server management panel with a focus on web hosting and server administration.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Manages web hosting, domain configurations, and server settings.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/Froxlor/Froxlor&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://www.virtualmin.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Virtualmin&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; GPL&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Web hosting control panel with a focus on managing virtual hosts.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Manages website hosting, email services, and server configurations.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/virtualmin/virtualmin&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt; &lt;em&gt;(Note: Virtualmin is primarily available through its official website, and its source code is available on GitHub for specific components.)&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://cyberpanel.net/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;CyberPanel&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; GPL&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Web hosting control panel with a focus on performance and security.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Manages website hosting, email services, and server configurations.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/usmannasir/cyberpanel&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt; &lt;em&gt;(Note: CyberPanel is primarily available through its official website, and its source code is available on GitHub.)&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://alternc.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;AlternC&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; GPLv3&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Web hosting control panel with a focus on environmental responsibility.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/AlternC/AlternC&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;applicationcontainer-orchestration-tools&#34;&gt;&lt;a href=&#34;#applicationcontainer-orchestration-tools&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Application/Container Orchestration Tools:&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://www.portainer.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Portainer&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; AGPLv3&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Docker container management.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Beginner to Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Manages Docker containers with a user-friendly interface.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/portainer/portainer&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://caprover.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;CapRover&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; Apache License 2.0&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Automated deployment for web apps.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Beginner to Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Focus on automated deployment of web applications.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/caprover/caprover&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://casaos.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;CasaOS&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; AGPLv3&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Server management and automation.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Provides server management and automation features.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/casaos/casaos&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://www.cloudron.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Cloudron&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; Proprietary&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Self-hosted web app platform.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Beginner to Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Manages self-hosted web applications.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://git.cloudron.io/cloudron&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/SelfhostedPro/Yacht&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Yacht&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;License:&lt;/strong&gt; MIT&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Purpose:&lt;/em&gt; Docker management with a focus on simplicity.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Complexity:&lt;/em&gt; Beginner to Intermediate.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Interface Type:&lt;/em&gt; Web-based.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Scalability:&lt;/em&gt; Suitable for SMEs.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Community Support:&lt;/em&gt; Active community.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Integration:&lt;/em&gt; Simplifies Docker container management.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/SelfhostedPro/Yacht&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now it&amp;rsquo;s experimentation time! 🥳&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;PS: If you need even more, &lt;a href=&#34;https://medevel.com/os-server-control-panel/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;here is a random article&lt;/a&gt; listing 30 similar solutions including many dashboards.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Happy hacking!&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Moving an existing install into a virtual machine</title>
      <link>https://bastientraverse.com/en/posts/2022-04-05-physical-to-virtual/</link>
      <pubDate>Tue, 05 Apr 2022 00:00:00 +0200</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2022-04-05-physical-to-virtual/</guid>
      <description>&lt;p&gt;This a follow-up to my &lt;a href=&#34;https://bastientraverse.com/en/posts/2022-02-14-system-imaging/&#34;&gt;tale of a system image&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For fun and convenience, I now wanted to have a bootable image of my old laptop.&lt;/p&gt;
&lt;p&gt;So at first I thought of making a Live ISO out of it, but didn&amp;rsquo;t know the name of the process. I tried a few searches like &amp;ldquo;convert a configured system into ISO&amp;rdquo; or &amp;ldquo;create live ISO from running system&amp;rdquo;, but what I found looked strangely difficult and didn&amp;rsquo;t seem to really address my need.&lt;/p&gt;
&lt;p&gt;Then in the course of writing the aforementioned post, I was reminded of an Archwiki article I had seen some time ago: &lt;a href=&#34;https://wiki.archlinux.org/title/Moving_an_existing_install_into_%28or_out_of%29_a_virtual_machine&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Moving an existing install into (or out of) a virtual machine&lt;/a&gt;. This was exactly what I wanted, as I didn&amp;rsquo;t need a Live ISO so much as a VM that I could boot on my main machine whenever I wanted to check something, or bask nostalgically into the glow of my &lt;a href=&#34;https://flathub.org/apps/details/im.bernard.Nostalgia&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;old wallpaper&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Looking into it, I stumbled upon &lt;a href=&#34;https://clonezilla.org/lecture-materials/017_Canonical_FE_SE_Sprint_Event_in_June_2014/talk/P2V-by-Clonezilla.pdf&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;presentation slides&lt;/a&gt; by Clonezilla and learned that this process had a name: &amp;ldquo;Physical-to-Virtual&amp;rdquo;, or P2V for short (&lt;a href=&#34;https://developer.ibm.com/tutorials/l-clonezilla/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;here&lt;/a&gt; is another article by IBM from 2009 about this topic).&lt;/p&gt;
&lt;h2 id=&#34;the-ultimate-os-conservation-project-virtualizing-to-immortality&#34;&gt;&lt;a href=&#34;#the-ultimate-os-conservation-project-virtualizing-to-immortality&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;The ultimate OS conservation project: virtualizing to immortality&lt;/h2&gt;&lt;p&gt;Indeed, with a VM image of your old install you can easily keep it around forever, as with the specifications of the machine written down into an &lt;a href=&#34;https://libvirt.org/format.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;.xml file&lt;/a&gt; or in a QEMU command line invocation, you can spin one up at will.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll use this opportunity to simplify my system stack, namely to rid it of both LUKS and LVM and consolidate all the existing logical volumes into one single filesystem.&lt;/p&gt;
&lt;p&gt;So how do we go about turning our physical system into a functional VM? Here is a rough outline of the process:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Preparing the VM image&lt;/li&gt;
&lt;li&gt;Transferring the data&lt;/li&gt;
&lt;li&gt;Making the necessary adjustments&lt;/li&gt;
&lt;li&gt;Profit&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;admonition info&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Note&lt;/p&gt;
  &lt;p&gt;There are different ways to approach steps 1 &amp;amp; 2 depending on what you are working with, &lt;em&gt;e.g.&lt;/em&gt; your target &lt;a href=&#34;https://wiki.archlinux.org/title/Category:Hypervisors&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;hypervisor&lt;/a&gt;, what kind of &lt;a href=&#34;https://wiki.archlinux.org/title/Synchronization_and_backup_programs&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;backup/file transfer program&lt;/a&gt; is available to you and whether or not you need to modify the image.&lt;/p&gt;
&lt;p&gt;If you need to do &lt;em&gt;any&lt;/em&gt; modifications to the partitions/filesystems, forget about Clonezilla/partclone/FSArchiver &lt;code&gt;savepart&lt;/code&gt; mode and use a file-level transfer method.&lt;/p&gt;
&lt;p&gt;Since this is my case I&amp;rsquo;ll describe this approach, but if &lt;em&gt;e.g.&lt;/em&gt; for you the physical and virtual machines are connected via the network and no modifications are needed, then &lt;a href=&#34;https://sourceforge.net/p/clonezilla/discussion/Help/thread/b07125e0/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Clonezilla remote device cloning&lt;/a&gt; could work great.&lt;/p&gt;
&lt;p&gt;(Heck, if no modifications are needed you could even just use a loopback file mounted on &lt;code&gt;/home/partimag&lt;/code&gt; in the live environment on the physical machine and have &lt;a href=&#34;https://clonezilla.org/show-live-doc-content.php?topic=clonezilla-live/doc/03_Disk_to_disk_clone&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Clonezilla make a local clone&lt;/a&gt;!)&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Here I will target QEMU for the hypervisor as that&amp;rsquo;s what I use, but only little adjustments should be required for other hypervisors.&lt;/p&gt;
&lt;p&gt;All right, let&amp;rsquo;s delve into it!&lt;/p&gt;
&lt;h2 id=&#34;step-1-preparing-the-vm-image&#34;&gt;&lt;a href=&#34;#step-1-preparing-the-vm-image&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Step 1: Preparing the VM image&lt;/h2&gt;&lt;p&gt;Here we will create and prepare the image file which will be used as the VM drive.&lt;/p&gt;
&lt;p&gt;In this case I will directly create and work with QEMU &lt;a href=&#34;https://en.wikipedia.org/wiki/Qcow&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;qcow&lt;/a&gt; format, but will also illustrate how to do it all with a &lt;a href=&#34;https://en.wikipedia.org/wiki/IMG_%28file_format%29&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;raw image&lt;/a&gt; file which can be later &lt;a href=&#34;https://docs.openstack.org/image-guide/convert-images.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;converted&lt;/a&gt; to the desired format if needed.&lt;/p&gt;
&lt;h3 id=&#34;creating-the-file&#34;&gt;&lt;a href=&#34;#creating-the-file&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Creating the file&lt;/h3&gt;&lt;p&gt;First we create an image of an appropriate size&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;h4 id=&#34;qcow-image&#34;&gt;&lt;a href=&#34;#qcow-image&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;qcow image:&lt;/h4&gt;&lt;pre&gt;&lt;code&gt;qemu-img create -f qcow2 -o cluster_size=2M --prealocation=falloc p2v.qcow2 15G
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition note&#34;&gt;
  The &lt;code&gt;-o cluster_size=2M&lt;/code&gt; option is used to &lt;a href=&#34;https://events19.lfasiallc.com/wp-content/uploads/2017/11/Storage-Performance-Tuning-for-FAST-Virtual-Machines_Fam-Zheng.pdf&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;increase&lt;/a&gt; &lt;a href=&#34;https://www.heiko-sieger.info/tuning-vm-disk-performance/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;performance&lt;/a&gt;.
&lt;/div&gt;
&lt;p&gt;Then we make the image &lt;a href=&#34;https://wiki.archlinux.org/title/QEMU#Mounting_a_partition_from_a_qcow2_image&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;available to the system&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo modprobe nbd max_part=1
sudo qemu-nbd -c /dev/nbd0 p2v.qcow2
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&#34;raw-image&#34;&gt;&lt;a href=&#34;#raw-image&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Raw image:&lt;/h4&gt;&lt;p&gt;On file systems supporting it (ext4, XFS, Btrfs, FAT – &lt;a href=&#34;https://github.com/arter97/exfat-linux/issues/25&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;but not exFAT&lt;/a&gt;), &lt;a href=&#34;https://man.archlinux.org/man/core/util-linux/fallocate.1.en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;fallocate&lt;/a&gt; is &lt;a href=&#34;https://stackoverflow.com/a/11779492&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;the best choice&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fallocate -l 20G p2v.img
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For systems without fallocate but &lt;a href=&#34;https://wiki.archlinux.org/title/Sparse_file&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;sparse file&lt;/a&gt; support, use &lt;a href=&#34;https://man.archlinux.org/man/core/coreutils/truncate.1.en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;truncate&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;truncate -s 20G p2v.img
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If even sparse files are too much to ask, then it&amp;rsquo;s time to get the &lt;a href=&#34;https://opensource.com/article/18/7/how-use-dd-linux&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;disk destroyer&lt;/a&gt; out (warning: might take a while):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;dd if=/dev/zero of=p2v.img bs=1M count=20000
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you really don&amp;rsquo;t want to know/choose and have QEMU installed, let it handle the details for you:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;qemu-img create p2v.img 20G
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;partitioning&#34;&gt;&lt;a href=&#34;#partitioning&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Partitioning&lt;/h3&gt;&lt;p&gt;Now to &lt;a href=&#34;https://wiki.archlinux.org/title/Partitioning&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;partition&lt;/a&gt; our image. It is easier to use the same &lt;a href=&#34;https://wiki.archlinux.org/title/Partitioning#Partition_table&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;partition table type&lt;/a&gt; as your physical machine (MBR or GPT), except if you want to &lt;a href=&#34;https://wiki.archlinux.org/title/GPT_fdisk#Convert_between_MBR_and_GPT&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;convert&lt;/a&gt; it of course.&lt;/p&gt;
&lt;div class=&#34;admonition warning&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Warning&lt;/p&gt;
  All of the following commands must be run with elevated privileges. Be careful with what you execute. Replace &lt;code&gt;/dev/nbd0&lt;/code&gt; with &lt;code&gt;p2v.img&lt;/code&gt; (or whatever you named it) if using a raw disk image.
&lt;/div&gt;
&lt;h4 id=&#34;mbr&#34;&gt;&lt;a href=&#34;#mbr&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;MBR&lt;/h4&gt;&lt;p&gt;Here is the simplest way &lt;a href=&#34;https://superuser.com/questions/332252/how-to-create-and-format-a-partition-using-a-bash-script/1132834#1132834&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;I found&lt;/a&gt; to create a single partition with MBR scheme aligned on the 1 MB boundary (with the default &lt;a href=&#34;https://en.wikipedia.org/wiki/Partition_type&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;partition type&lt;/a&gt; for GNU/Linux).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;printf &#39;,&#39; | sfdisk /dev/nbd0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Crazy right? If that (rightly) scares you, I&amp;rsquo;ve got an equivalent, more &lt;em&gt;spelled-out&lt;/em&gt; &lt;code&gt;parted&lt;/code&gt; one-liner:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;parted --script --align optimal /dev/nbd0 mklabel msdos mkpart primary 1 100%
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&#34;gpt&#34;&gt;&lt;a href=&#34;#gpt&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;GPT&lt;/h4&gt;&lt;p&gt;And here are their GPT equivalents (with &lt;a href=&#34;https://www.rodsbooks.com/gdisk/sgdisk-walkthrough.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;sgdisk&lt;/a&gt; thrown into the mix):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;printf &#39;,&#39; | sfdisk --label gpt /dev/nbd0
sgdisk --largest-new 0 /dev/nbd0
parted --script --align optimal /dev/nbd0 mklabel gpt mkpart $name 1 100%
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition tip&#34;&gt;
  See the &lt;code&gt;$name&lt;/code&gt; in that &lt;em&gt;parted&lt;/em&gt; command here? That&amp;rsquo;s because parted requires (yes, &lt;em&gt;requires&lt;/em&gt;) that a partition be given a name in GPT mode, even though that&amp;rsquo;s absolutely not part of any specification&amp;hellip; So do as you please to christen the first realm of this new digital kingdom!
&lt;/div&gt;
&lt;p&gt;Note however that if you are planning to use UEFI, a second &lt;a href=&#34;https://wiki.archlinux.org/title/EFI_system_partition&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;EFI System Partition&lt;/a&gt; (ESP) is required as well. Here are three more one-liners to create both partitions in one go with a 512 MiB ESP, and the rest for the second partition (&lt;a href=&#34;https://github.com/util-linux/util-linux/issues/267#issue-129814992&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;source&lt;/a&gt; for sfdisk example) :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;printf &#39;,512M,U\n,,&#39; | sfdisk --label gpt /dev/nbd0
sgdisk -n 1:0:+512MiB -t 1:ef00 -n 2:0:0 /dev/nbd0
parted --script --align optimal /dev/nbd0 mklabel gpt mkpart EFI 0% 513MiB mkpart System 513MiB 100% set 1 esp
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;formatting&#34;&gt;&lt;a href=&#34;#formatting&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Formatting&lt;/h3&gt;&lt;p&gt;Before mounting, we need to format our newly created partition(s) with a &lt;a href=&#34;https://wiki.archlinux.org/title/File_systems&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;filesystem&lt;/a&gt;. It&amp;rsquo;s certainly a safe choice to go with the same one as the source system, albeit not strictly required. &lt;a href=&#34;https://wiki.archlinux.org/title/Ext4&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Ext4&lt;/a&gt; example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo mkfs.ext4 /dev/nbd0p1
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition info&#34;&gt;
  &lt;p&gt;If using a raw image file, we first need to use &lt;a href=&#34;https://man.archlinux.org/man/losetup.8.en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;losetup&lt;/a&gt; to make the partition(s) available to the system:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo losetup --partscan --find --show --nooverlap p2v.img
--&amp;gt; /dev/loop0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;From here on replace &lt;code&gt;/dev/nbd0&lt;/code&gt; with &lt;code&gt;/dev/loop0&lt;/code&gt; (or whatever the command returned).&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In case of UEFI, the ESP needs to be formatted as FAT (FAT32 &lt;a href=&#34;https://wiki.archlinux.org/title/EFI_system_partition#Format_the_partition&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;recommended&lt;/a&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo mkfs.fat -F32 /dev/nbd0p1
sudo mkfs.ext4 /dev/nbd0p2
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;mounting&#34;&gt;&lt;a href=&#34;#mounting&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Mounting&lt;/h3&gt;&lt;p&gt;That&amp;rsquo;s it, now we can finally mount our image. For BIOS (single partition):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo mount /dev/nbd0p1 /mnt
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For UEFI (two partitions), replace &lt;code&gt;$ESP&lt;/code&gt; with the desired &lt;a href=&#34;https://wiki.archlinux.org/title/EFI_system_partition#Mount_the_partition&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;mount point&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo mount /dev/nbd0p2 /mnt
sudo mkdir -p /mnt/$ESP
sudo mount /dev/nbd0p1 !$
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That&amp;rsquo;s it for the preparations, we are now ready to transfer the source system content!&lt;/p&gt;
&lt;h2 id=&#34;step-2-transferring-the-data&#34;&gt;&lt;a href=&#34;#step-2-transferring-the-data&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Step 2: Transferring the data&lt;/h2&gt;&lt;p&gt;This part depends on how you realized your &lt;a href=&#34;https://bastientraverse.com/en/posts/2022-02-14-system-imaging/#system-imaging-the-manual-way&#34;&gt;full system backup&lt;/a&gt; on the source machine. For completeness&amp;rsquo; sake and to create the counterpart to the previous article, I&amp;rsquo;ll show the restoration process of the various tools presented in the linked section.&lt;/p&gt;
&lt;h3 id=&#34;partclone&#34;&gt;&lt;a href=&#34;#partclone&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;partclone&lt;/h3&gt;&lt;p&gt;Word of warning concerning partclone: it&amp;rsquo;s not good at restoring to a device smaller than the source, even if the actual content would fit in. Despite its offering of a &amp;ldquo;Don&amp;rsquo;t check device size and free space&amp;rdquo; (&lt;code&gt;-C, --nocheck&lt;/code&gt;) option, my experience matched the &lt;a href=&#34;https://unix.stackexchange.com/questions/118370/restoring-a-big-partition-to-a-smaller-partition-with-clonezilla&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;web&lt;/a&gt; &lt;a href=&#34;https://superuser.com/questions/332808/force-cloned-hard-disk-image-upon-a-smaller-hard-disk&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;reports&lt;/a&gt; saying that restoration fails with a &lt;code&gt;target seek ERROR:Invalid argument&lt;/code&gt;. Clonezilla FAQ even &lt;a href=&#34;https://drbl.org/faq/fine-print.php?path=./2_System/25_restore_larger_disk_to_smaller_one.faq#25_restore_larger_disk_to_smaller_one.faq&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;warns against this use case&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;However, for completeness&amp;rsquo; sake I&amp;rsquo;ll leave a quick restoration example to illustrate how to restore from a zstd-compressed image:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;umount -R /mnt
zstdcat /path/to/partclone.img.zst | partclone.restore -o /dev/nbd0pY
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Replace the &lt;code&gt;Y&lt;/code&gt; at the end with the appropriate partition number for your use case.&lt;/p&gt;
&lt;div class=&#34;admonition tip&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Tip&lt;/p&gt;
  &lt;em&gt;partclone&lt;/em&gt; offers a &lt;code&gt;--restore_raw_file&lt;/code&gt; option that aims at  &amp;ldquo;creating special raw file for loop device&amp;rdquo;. This image wouldn&amp;rsquo;t have a partition table though so it&amp;rsquo;s not useful for our use case, but it&amp;rsquo;s still good to know it&amp;rsquo;s there 😉️
&lt;/div&gt;
&lt;h3 id=&#34;fsarchiver&#34;&gt;&lt;a href=&#34;#fsarchiver&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;FSArchiver&lt;/h3&gt;&lt;p&gt;I have a sweet spot for FSArchiver due to its versatility and very complete feature set. The only real downside I found to it are its exclusion rule patterns being &lt;a href=&#34;https://github.com/fdupoux/fsarchiver/issues/98&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;less than clear&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Being a file-aware tool instead of block-aware one like partclone, it has absolutely no issues restoring to a destination smaller than the source (it is even one of the suggested workaround in the aforementioned Clonezilla FAQ entry!).&lt;/p&gt;
&lt;p&gt;If you made a backup using its &lt;code&gt;savepart&lt;/code&gt; mode, see the &lt;a href=&#34;https://www.fsarchiver.org/quickstart/#how-to-extract-filesystems-from-an-archive&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;official docs&lt;/a&gt; for nice examples illustrating the different restoration cases.&lt;/p&gt;
&lt;p&gt;On the other hand, if like me you used its &lt;code&gt;savedir&lt;/code&gt; mode so as to have more flexibility, restoring is as simple as:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fsarchiver --jobs=$(nproc) restdir /path/to/backup.fsa /mnt/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;May &lt;a href=&#34;https://stallman.org/saint.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;St IGNUcius &lt;/a&gt; bless FSarchiver and its author/team! 😇️&lt;/p&gt;
&lt;h3 id=&#34;squashfs&#34;&gt;&lt;a href=&#34;#squashfs&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;SquashFS&lt;/h3&gt;&lt;p&gt;Another very straightforward option:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;unsquashfs -force -dest /mnt/  backup.squashfs
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Bonus points go to SquashFS compared with FSArchiver and tar because we can very simply access the archived content without having to restore/extract it: a simple &lt;code&gt;mount backup.squashfs /path/to/mount/point&lt;/code&gt; suffices to make it browsable (with very good performance) 👍️&lt;/p&gt;
&lt;h3 id=&#34;rsync--tar&#34;&gt;&lt;a href=&#34;#rsync--tar&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Rsync &amp;amp; tar&lt;/h3&gt;&lt;p&gt;&lt;em&gt;rsync&lt;/em&gt; is just about reversing the source and destination in its invocation, and tar about switching &lt;code&gt;-c, --create&lt;/code&gt; with &lt;code&gt;-x, --extract&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rsync -aHAXUUSh --info=progress2 --partial /path/to/backup/dir/* /mnt/
tar -x --zstd -p --acls --xattrs --atime-preserve=system -f /path/to/backup.tar.zst /mnt/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Alright, now that we have transferred the content of our physical system into the VM image, let&amp;rsquo;s move to the final adjustments.&lt;/p&gt;
&lt;h2 id=&#34;step-3-adjusting-the-system-config&#34;&gt;&lt;a href=&#34;#step-3-adjusting-the-system-config&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Step 3: Adjusting the system config&lt;/h2&gt;&lt;p&gt;Now it is time to chroot into our restored environment and make the needed adjustments. This step is very much dependent on your source system configuration and which modifications you wish to implement (if any).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;arch-chroot /mnt
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition tip&#34;&gt;
  &lt;a href=&#34;https://wiki.archlinux.org/title/Systemd-nspawn&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;systemd-nspawn&lt;/a&gt; can replace &lt;code&gt;arch-chroot&lt;/code&gt; if not using an Arch-based distro.
&lt;/div&gt;
&lt;p&gt;In my case, it equated to removing/commenting out references to the former LVM/LUKS devices in &lt;code&gt;/etc/{fstab,crypttab}&lt;/code&gt; and configuring a single mount:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sed -i &lt;span class=&#34;s1&#34;&gt;&amp;#39;s/^\([^#].*\)/# \1/g&amp;#39;&lt;/span&gt; /etc/crypttab
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sed -i &lt;span class=&#34;s1&#34;&gt;&amp;#39;s/^\([^#].*\)/# \1/g&amp;#39;&lt;/span&gt; /etc/fstab
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;/dev/vda1  /  ext4  noatime  0  1&amp;#34;&lt;/span&gt; &amp;gt;&amp;gt; /etc/fstab
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;admonition info&#34;&gt;
  The two &lt;em&gt;sed&lt;/em&gt; invocations comment out &amp;ldquo;active&amp;rdquo; lines while &lt;a href=&#34;https://stackoverflow.com/questions/34982602/how-to-comment-out-only-uncommented-lines-with-sed-and-leave-blank-empty-lines-1&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;leaving blank lines alone&lt;/a&gt;.
&lt;/div&gt;
&lt;p&gt;For GPT replace the last line with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;printf &amp;quot;/dev/vda2  /  ext4  noatime  0  1\n/dev/vda1  /  vfat  defaults  0  2\n&amp;quot; &amp;gt;&amp;gt; /etc/fstab
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Network-wise, I had nothing to do since NetworkManager was already handling automatic network configuration with DHCP.&lt;/p&gt;
&lt;p&gt;I also removed the now unneeded  &lt;code&gt;lvm2&lt;/code&gt;, &lt;code&gt;encrypt&lt;/code&gt;, &lt;code&gt;keyboard&lt;/code&gt; and &lt;code&gt;keymap&lt;/code&gt; &lt;a href=&#34;https://wiki.archlinux.org/title/Mkinitcpio#Common_hooks&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;mkinitcpio hooks&lt;/a&gt; as well as the &lt;code&gt;i915&lt;/code&gt; module from &lt;code&gt;/etc/mkinitcpio.conf&lt;/code&gt; and &lt;a href=&#34;https://wiki.archlinux.org/title/Mkinitcpio#Manual_generation&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;regenerated the initramfs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Finally, I removed the &lt;code&gt;cryptdevice=&lt;/code&gt; kernel command line parameter from &lt;code&gt;/etc/default/grub&lt;/code&gt;, &lt;a href=&#34;https://wiki.archlinux.org/title/GRUB#Installation&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;installed&lt;/a&gt; GRUB in the image file boot sector and &lt;a href=&#34;https://wiki.archlinux.org/title/GRUB#Generate_the_main_configuration_file&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;regenerated its config&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;grub-install --target&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;i386-pc /dev/nbd0
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sed -i &lt;span class=&#34;s1&#34;&gt;&amp;#39;/cryptdev/s/.*/GRUB_CMDLINE_LINUX_DEFAULT=&amp;#34;quiet&amp;#34;/&amp;#39;&lt;/span&gt; /etc/default/grub
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;grub-mkconfig -o /boot/grub/grub.cfg
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Don&amp;rsquo;t forget to replace references to &lt;code&gt;nbd0&lt;/code&gt; (or &lt;code&gt;loop0&lt;/code&gt;) in &lt;code&gt;/boot/grub/grub.cfg&lt;/code&gt; with whatever disk naming you will use (in my case &lt;code&gt;/dev/vda&lt;/code&gt;):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sed -i &lt;span class=&#34;s1&#34;&gt;&amp;#39;s/nbd0/vda/g&amp;#39;&lt;/span&gt; /boot/grub/grub.cfg
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then exit the chroot, unmount the image file and remove the &lt;code&gt;nbd&lt;/code&gt; device and module:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;exit
sudo umount -R /mnt/
sudo qemu-nbd -d /dev/nbd0
sudo modprobe -r nbd
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or loop mount:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;losetup -d /dev/loop0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(Optionally, &lt;a href=&#34;https://docs.openstack.org/image-guide/convert-images.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;convert&lt;/a&gt; the image to a format suitable to your target hypervisor)&lt;/p&gt;
&lt;p&gt;And &lt;em&gt;voilà&lt;/em&gt;, you are now ready to try out your brand new virtualized system! Hopefully it will boot on the first try, otherwise just &lt;a href=&#34;https://wiki.archlinux.org/title/QEMU#Mounting_a_partition_of_the_guest_on_the_host&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;make the image available&lt;/a&gt; again as before, mount it and chroot in it to troubleshoot the issue.&lt;/p&gt;
&lt;p&gt;Enjoy your nascent hall of past digital abodes! 😉️&lt;/p&gt;
&lt;div class=&#34;admonition tip&#34;&gt;
  &lt;strong&gt;Edit (2024-07-09):&lt;/strong&gt; I&amp;rsquo;ve just stumbled upon &lt;a href=&#34;https://github.com/libguestfs/virt-v2v&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;virt-p2v&lt;/a&gt; from &lt;a href=&#34;http://libguestfs.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;libguestfs&lt;/a&gt;, which is a &amp;ldquo;&lt;em&gt;GUI interface to convert a physical machine to run as virtual machine on KVM&lt;/em&gt;&amp;rdquo;. It is a companion front-end to &lt;a href=&#34;https://github.com/libguestfs/virt-v2v&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;virt-v2v&lt;/a&gt;, and &amp;ldquo;&lt;em&gt;comes as an ISO, CD or PXE image that can be booted on physical machines to virtualize those machines&lt;/em&gt;&amp;rdquo;. Looks like a great alternative to try as well!
&lt;/div&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;At a minimum it should be able to accommodate all the data you&amp;rsquo;re going to transfer from the physical system, plus a little bit of spare space for system maintenance.&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Offline Arch install with local pacman cache</title>
      <link>https://bastientraverse.com/en/posts/2022-03-12-arch-offline-cache/</link>
      <pubDate>Sat, 12 Mar 2022 00:00:00 +0100</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2022-03-12-arch-offline-cache/</guid>
      <description>&lt;p&gt;While developing my &lt;a href=&#34;https://github.com/neitsab/archvm&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Arch VM script&lt;/a&gt;, I had to go through the installation over and over to test every change.&lt;/p&gt;
&lt;p&gt;I am tethered to my phone for Internet connectivity, and the quality and speeds are&amp;hellip; How should I put it? &lt;em&gt;Underwhelming&lt;/em&gt; to say the least (I live in a mountainous rural area).&lt;/p&gt;
&lt;p&gt;So while doing so, I grew increasingly wary of the long wait for packages to download and the &lt;em&gt;287 MB&lt;/em&gt; worth (&lt;em&gt;gah!&lt;/em&gt;) of data it would chip off my 40 GB plan each and every time. What I needed was a way to provide a local package cache to pacman.&lt;/p&gt;
&lt;p&gt;Amazingly, but certainly not surprisingly, &lt;a href=&#34;https://wiki.archlinux.org/title/Offline_installation&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;there is a great article on the Arch wiki&lt;/a&gt; for that.&lt;/p&gt;
&lt;p&gt;However, due to my target file system being exFAT (&lt;em&gt;cough&lt;/em&gt; &lt;a href=&#34;https://bastientraverse.com/en/posts/2022-02-14-system-imaging/#an-unexpected-obstacle-to-boot-ventoy-shenanigans&#34;&gt;ventoy shenanigans&lt;/a&gt;, &lt;em&gt;cough&lt;/em&gt;) and some file names containing the &lt;a href=&#34;https://averstak.tripod.com/fatdox/names.htm&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;forbidden &lt;code&gt;:&lt;/code&gt; character&lt;/a&gt;, this solution didn&amp;rsquo;t work for me.&lt;/p&gt;
&lt;p&gt;Also because I am using GNOME Boxes, &lt;a href=&#34;https://people.gnome.org/~shaunm/help.gnome.org/gnome-boxes/shared-folders.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;sharing a folder&lt;/a&gt; with the host was out of the equation as that entails installing some &lt;a href=&#34;https://www.spice-space.org/index.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;SPICE&lt;/a&gt;-related packages which pull in an entire graphical stack as dependencies, hence defeating the purpose.&lt;/p&gt;
&lt;p&gt;Setting up SSH access  to the guest requires &lt;a href=&#34;https://unix.stackexchange.com/a/649326&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;quite some fiddling&lt;/a&gt;, and anyway it wasn&amp;rsquo;t immediately clear to me how I would instruct pacstrap to tap into the network cache, or it would have likely required some modifications to the live &lt;code&gt;pacman.conf&lt;/code&gt; and I wanted to avoid all that complexity&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;Remastering the ISO was another option that I left out because I wanted the script to work with a vanilla install. No, what I was really looking for was something of the &lt;em&gt;utmost&lt;/em&gt; simplicity&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;What I finally came up with, and not to toot my own horn but I think it is pretty darn &lt;em&gt;brillant&lt;/em&gt; (considering I haven&amp;rsquo;t seen it mentioned anywhere online when I researched the topic&lt;sup id=&#34;fnref:3&#34;&gt;&lt;a href=&#34;#fn:3&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;3&lt;/a&gt;&lt;/sup&gt;), is a &lt;em&gt;bind mounted squashfs&lt;/em&gt;&lt;sup id=&#34;fnref:4&#34;&gt;&lt;a href=&#34;#fn:4&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;4&lt;/a&gt;&lt;/sup&gt; package cache placed on an external medium like a USB flash drive. This in turn can easily be shared in GNOME Boxes even without the SPICE packages installed in the guest!&lt;/p&gt;
&lt;p&gt;Here is a rundown of the process:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;create a SquashFS archive of &lt;code&gt;/var/cache/pacman/pkg&lt;/code&gt; on a system containing the desired package set (I reused a just-installed VM to match its exact minimal set but you can go wild and copy everything from your main rig, that&amp;rsquo;ll give you a larger cache):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mksquashfs /var/cache/pacman/pkg/ pkg.sqsh &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -comp zstd &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -no-exports &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -progress &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -mem 1G &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -not-reproducible
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;copy the SquashFS file on the external medium you will mount during the install&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;boot into the Arch Live environment and create two directories, one for your external medium and one for the archive:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mkdir /tmp/{usb,squash}
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;admonition note&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Note&lt;/p&gt;
  Do not use &lt;code&gt;/mnt&lt;/code&gt; if you plan to use it as the installation mount point.
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;mount the external medium containing the squash file and then the squash file itself:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mount /dev/XXXY /tmp/usb
mount /tmp/usb/pkg.sqsh /tmp/squash
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;finally, and that&amp;rsquo;s what&amp;rsquo;s doing the trick for pacstrap, &lt;strong&gt;bind&lt;/strong&gt;-mount &lt;code&gt;/tmp/squash&lt;/code&gt; on archiso&amp;rsquo;s &lt;code&gt;/var/cache/pacman/pkg&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mount --bind /tmp/squash /var/cache/pacman/pkg
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That&amp;rsquo;s it, now you just have to add &lt;code&gt;-c&lt;/code&gt; to your &lt;a href=&#34;https://man.archlinux.org/man/extra/arch-install-scripts/pacstrap.8.en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;pacstrap&lt;/a&gt; invocation:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;pacstrap -c /mnt base linux [...]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Downloads will be skipped (as long as package versions in the squashfs archive are not older than the synced databases&amp;rsquo; ones), and now you can carry on with your installation, contented by the blissful release of not having to suffer through the hell of this perpetual cycle of reincar&amp;hellip; Err I mean wasteful downloading of already acquired packages 😊️&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://stallman.org/articles/happy-hacking.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Happy hacking&lt;/a&gt;!&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;Just as I was bringing the finishing touches to this article, I realized my blunder: what I needed was an access &lt;em&gt;from&lt;/em&gt; the guest to the host, not the contrary. This would allow me to do something like an &lt;a href=&#34;https://wiki.archlinux.org/title/Pacman/Tips_and_tricks#Read-write_cache&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;SSHFS&lt;/a&gt; mount or even &lt;a href=&#34;https://wiki.archlinux.org/title/Pacman/Tips_and_tricks#Read-only_cache&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;serving the cache via a simple web server&lt;/a&gt;. Follow-up article to come on how &lt;em&gt;easy&lt;/em&gt; it actually is to connect from a guest to the host in GNOME Boxes 😁️&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;Yeah, no seriously, in my use case that was the web server/SSHFS mount. But let&amp;rsquo;s just say this article was &lt;em&gt;actually&lt;/em&gt; meant to be for a fully offline install&amp;hellip; 😂️&amp;#160;&lt;a href=&#34;#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:3&#34;&gt;
&lt;p&gt;I&amp;rsquo;ll admit this may only be due to my constraints being ridiculously specific, but maybe for once I can dream of having come up with a truly original solution, wouldn&amp;rsquo;t you agree ? 😀️&amp;#160;&lt;a href=&#34;#fnref:3&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:4&#34;&gt;
&lt;p&gt;The idea of using &lt;a href=&#34;https://tldp.org/HOWTO/SquashFS-HOWTO/whatis.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;SquashFS&lt;/a&gt; instead of a more common loop-mounted filesystem-in-a-file is what I felt was the real feat of ingeniosity here. And yes, I need to pat myself on the back from time to time, is it something wrong? 😉️&amp;#160;&lt;a href=&#34;#fnref:4&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Ejecting and reattaching a USB drive from the CLI</title>
      <link>https://bastientraverse.com/en/posts/2022-02-24-cli-eject/</link>
      <pubDate>Thu, 24 Feb 2022 00:00:00 +0100</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2022-02-24-cli-eject/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Setup&lt;/strong&gt;: I was booted on &lt;code&gt;archlinux-2022.02.01-x86_64.iso&lt;/code&gt; using a multiboot USB flash drive made with &lt;a href=&#34;https://www.ventoy.net/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Ventoy&lt;/a&gt;  &lt;code&gt;1.0.65&lt;/code&gt;, and had selected the &amp;ldquo;Copy to RAM&amp;rdquo; option in the ISO menu with the idea of reusing the drive as a backup destination for a &lt;a href=&#34;https://bastientraverse.com/en/posts/2022-02-14-system-imaging/&#34;&gt;system backup&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The issue&lt;/strong&gt;: I was unable to normally eject the drive, both &lt;code&gt;eject&lt;/code&gt; and &lt;code&gt;udisksctl power-off&lt;/code&gt; (after installing &lt;code&gt;udisks2&lt;/code&gt;) gave the error &lt;code&gt;Device or resource busy&lt;/code&gt;, and &lt;a href=&#34;https://stackoverflow.com/questions/624154/linux-which-process-is-causing-device-busy-when-doing-umount&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;lsof | grep -e ventoy -e sdb&lt;/a&gt; didn&amp;rsquo;t return anything. Here is what it looked like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root@archiso ~ # lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0           7:0    0 657.4M  1 loop /run/archiso/airootfs
sda             8:0    0 111.8G  0 disk
├─sda1          8:1    0     1G  0 part
│ └─boot-arch 254:1    0   252M  0 lvm  
└─sda2          8:2    0   100G  0 part
sdb             8:16   0  59.6G  0 disk
├─sdb1          8:17   0  59.6G  0 part
│ └─ventoy    254:0    0 812.3M  1 dm    &amp;lt;-- problematic entry
└─sdb2          8:18   0    32M  0 part
sr0            11:0    1  1024M  0 rom

root@archiso ~ # eject -v /dev/sdb
eject: device name is `/dev/sdb&#39;
eject: /dev/sdb: not mounted
eject: /dev/sdb: is whole-disk device
eject: cannot open /dev/sdb: Device or resource busy

root@archiso ~ # eject -v /dev/mapper/ventoy
eject: device name is `/dev/mapper/ventoy&#39;
eject: /dev/mapper/ventoy: not mounted
eject: /dev/mapper/ventoy: is whole-disk device
eject: /dev/mapper/ventoy: is not hot-pluggable device

root@archiso ~ # ls -l /dev/mapper/ventoy  
lrwxrwxrwx 1 root root 7 Feb 24 20:24 /dev/mapper/ventoy -&amp;gt; ../dm-0

root@archiso ~ # ls -l /dev/dm-0
brw-rw---- 1 root disk 254, 0 Feb 24 20:24 /dev/dm-0

root@archiso ~ # cat /sys/class/block/dm-0/dm/name
ventoy
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, I wasn&amp;rsquo;t sure what was causing the issue, and I didn&amp;rsquo;t want to simply pull the drive out as it equates to playing Russian roulette with your devices (do you like getting the rug pulled under you or being knocked inconscious by a stealthy sucker punch? Well, neither do most filesystems).&lt;/p&gt;
&lt;p&gt;At first I had worked around the issue by using &lt;a href=&#34;https://unix.stackexchange.com/a/384075&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this trick&lt;/a&gt; :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;echo offline &amp;gt; /sys/block/sdb/device/state
echo 1 &amp;gt; /sys/block/sdb/device/delete
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;See &lt;a href=&#34;https://bbs.archlinux.org/viewtopic.php?pid=1914290#p1914290&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this post&lt;/a&gt; on the Arch forums for a more thorough procedure along the same vein.&lt;/p&gt;
&lt;p&gt;Still, I wasn&amp;rsquo;t entirely convinced: it didn&amp;rsquo;t address the root cause of the issue.&lt;/p&gt;
&lt;p&gt;Digging &lt;a href=&#34;https://superuser.com/a/131520&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;a little&lt;/a&gt; &lt;a href=&#34;https://unix.stackexchange.com/a/351361&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;deeper&lt;/a&gt; led me to &lt;code&gt;dmsetup&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root@archiso ~ # dmsetup table
boot-arch: 0 516096 linear 8:1 2048
ventoy: 0 1663640 linear 8:17 59447552

root@archiso ~ # dmsetup info /dev/mapper/ventoy  
Name:              ventoy
State:             ACTIVE (READ-ONLY)
Read Ahead:        256
Tables present:    LIVE
Open count:        0
Event number:      0
Major, minor:      254, 0
Number of targets: 1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Well, that &lt;code&gt;READ-ONLY&lt;/code&gt; state was already good news, but checking dmsetup &lt;a href=&#34;https://man.archlinux.org/man/core/device-mapper/dmsetup.8.en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;manpage&lt;/a&gt; I saw it offered a &lt;code&gt;remove&lt;/code&gt; command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root@archiso ~ # dmsetup remove ventoy
root@archiso ~ # lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0           7:0    0 657.4M  1 loop /run/archiso/airootfs
sda             8:0    0 111.8G  0 disk
├─sda1          8:1    0     1G  0 part
│ └─boot-arch 254:1    0   252M  0 lvm  
└─sda2          8:2    0   100G  0 part
sdb             8:16   0  59.6G  0 disk
├─sdb1          8:17   0  59.6G  0 part
└─sdb2          8:18   0    32M  0 part
sr0            11:0    1  1024M  0 rom  
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Victory, the mapping is gone! And now&amp;hellip;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root@archiso ~ # eject /dev/sdb -v
eject: device name is `/dev/sdb&#39;
eject: /dev/sdb: not mounted
eject: /dev/sdb: is whole-disk device
eject: /dev/sdb: trying to eject using CD-ROM eject command
eject: CD-ROM eject command failed
eject: /dev/sdb: trying to eject using SCSI commands
eject: SCSI eject succeeded

root@archiso ~ # lsblk  
NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0           7:0    0 657.4M  1 loop /run/archiso/airootfs
sda             8:0    0 111.8G  0 disk
├─sda1          8:1    0     1G  0 part
│ └─boot-arch 254:1    0   252M  0 lvm  
└─sda2          8:2    0   100G  0 part
sdb             8:16   0  59.6G  0 disk
sr0            11:0    1  1024M  0 rom  
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Success! I saw the LED on my thumb drive flash quickly, and then it fell silent. But wait, what is all this red in my logs?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;archiso kernel: sd 6:0:0:0: [sdb] Media removed, stopped polling
archiso kernel: sd 6:0:0:0: [sdb] tag#0 device offline or changed
archiso kernel: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
archiso kernel: Buffer I/O error on dev sdb, logical block 0, async page read
archiso kernel: sd 6:0:0:0: [sdb] tag#0 device offline or changed
archiso kernel: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
archiso kernel: Buffer I/O error on dev sdb, logical block 0, async page read
archiso kernel: ldm_validate_partition_table(): Disk read failed.
archiso kernel: sd 6:0:0:0: [sdb] tag#0 device offline or changed
archiso kernel: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
archiso kernel: Buffer I/O error on dev sdb, logical block 0, async page read
archiso kernel: sd 6:0:0:0: [sdb] tag#0 device offline or changed
archiso kernel: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
archiso kernel: Buffer I/O error on dev sdb, logical block 0, async page read
archiso kernel: sd 6:0:0:0: [sdb] tag#0 device offline or changed
archiso kernel: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
archiso kernel: Buffer I/O error on dev sdb, logical block 0, async page read
archiso kernel:  sdb: unable to read partition table
archiso kernel: sd 6:0:0:0: [sdb] Media removed, stopped polling
archiso kernel: sd 6:0:0:0: [sdb] tag#0 device offline or changed
archiso kernel: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
archiso kernel: Buffer I/O error on dev sdb, logical block 0, async page read
archiso kernel: sd 6:0:0:0: [sdb] tag#0 device offline or changed
archiso kernel: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
archiso kernel: Buffer I/O error on dev sdb, logical block 0, async page read
archiso kernel: ldm_validate_partition_table(): Disk read failed.
archiso kernel: sd 6:0:0:0: [sdb] tag#0 device offline or changed
archiso kernel: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
archiso kernel: Buffer I/O error on dev sdb, logical block 0, async page read
archiso kernel: sd 6:0:0:0: [sdb] tag#0 device offline or changed
archiso kernel: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
archiso kernel: Buffer I/O error on dev sdb, logical block 0, async page read
archiso kernel: sd 6:0:0:0: [sdb] tag#0 device offline or changed
archiso kernel: I/O error, dev sdb, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
archiso kernel: Buffer I/O error on dev sdb, logical block 0, async page read
archiso kernel:  sdb: unable to read partition table
archiso kernel: sd 6:0:0:0: [sdb] tag#0 device offline or changed
archiso kernel: sd 6:0:0:0: [sdb] tag#0 device offline or changed
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Hum, looks like &lt;code&gt;eject&lt;/code&gt; is doing something kind of dirty&amp;hellip; Let&amp;rsquo;s move ahead for now, we&amp;rsquo;ll come back to it later.&lt;/p&gt;
&lt;p&gt;Now, since this is a laptop laying on my desk, I certainly can manually unplug the drive before plugging it back again to make it available. But what if I am lazy, or the machine is faraway, or I just want to take extra care of that super frail USB plug and prevent a superfluous actuation cycle?&lt;/p&gt;
&lt;h2 id=&#34;reattaching-an-ejected-usb-device-from-the-cli&#34;&gt;&lt;a href=&#34;#reattaching-an-ejected-usb-device-from-the-cli&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Reattaching an ejected USB device from the CLI&lt;/h2&gt;&lt;p&gt;Here we are going to make use of the ability &lt;a href=&#34;https://lwn.net/Articles/143397/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;to bind and unbind drivers from devices manually from user space&lt;/a&gt;. First, get the drive Bus number:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root@archiso ~ # lsusb  
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 003: ID 0781:5580 SanDisk Corp. SDCZ80 Flash Drive  &amp;lt;-- here is my device
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then Port for &amp;ldquo;Bus 4 Device 3&amp;rdquo;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root@archiso ~ # lsusb -t  
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 1: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 5000M  &amp;lt;-- spot it?
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now that I know that my USB device is identified as &lt;code&gt;4-1&lt;/code&gt; (bus-port) (this can be confirmed by checking &lt;code&gt;dmesg | grep usb-storage&lt;/code&gt;), we can make it go through an unbinding/binding cycle:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root@archiso ~ # echo &amp;quot;4-1&amp;quot; &amp;gt; /sys/bus/usb/drivers/usb/unbind
root@archiso ~ # lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0           7:0    0 657.4M  1 loop /run/archiso/airootfs
sda             8:0    0 111.8G  0 disk
├─sda1          8:1    0     1G  0 part
│ └─boot-arch 254:1    0   252M  0 lvm  
└─sda2          8:2    0   100G  0 part
sr0            11:0    1  1024M  0 rom  
root@archiso ~ # echo &amp;quot;4-1&amp;quot; &amp;gt; /sys/bus/usb/drivers/usb/bind  
root@archiso ~ # lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0           7:0    0 657.4M  1 loop /run/archiso/airootfs
sda             8:0    0 111.8G  0 disk
├─sda1          8:1    0     1G  0 part
│ └─boot-arch 254:1    0   252M  0 lvm  
└─sda2          8:2    0   100G  0 part
sdb             8:16   0  59.6G  0 disk
├─sdb1          8:17   0  59.6G  0 part
└─sdb2          8:18   0    32M  0 part
sr0            11:0    1  1024M  0 rom
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et voilà, the flash drive is once again available for &lt;code&gt;mount&lt;/code&gt; without having to physically remove it!&lt;/p&gt;
&lt;div class=&#34;admonition note&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Note&lt;/p&gt;
  Trying to &lt;code&gt;bind&lt;/code&gt; directly after  &lt;code&gt;eject&lt;/code&gt; without &lt;code&gt;unbind&lt;/code&gt; leads to a &lt;code&gt;write error: device or resource busy&lt;/code&gt; . So now I am really left wondering what &lt;code&gt;eject&lt;/code&gt; is doing to my drive&amp;hellip;
&lt;/div&gt;
&lt;p&gt;An alternative to manually writing to &lt;code&gt;/sys/bus/usb/drivers/usb/&lt;/code&gt; is to use &lt;a href=&#34;https://www.draisberghof.de/usb_modeswitch/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;usb_modeswitch&lt;/a&gt; (included on the Arch installation media). In that case we only need the ID pair from &lt;code&gt;lsusb&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root@archiso ~ # lsusb  
...
Bus 004 Device 003: ID 0781:5580 SanDisk Corp. SDCZ80 Flash Drive
                       ==== ==== ------ ---------
                                      |         |
root@archiso ~ # usb_modeswitch -v 0x0781 -p 0x5580 --reset-usb
Look for default devices ...
 Found devices in default mode (1)
Access device 003 on bus 004
Get the current device configuration ...
Current configuration number is 1
Use interface number 0
 with class 8
Warning: no switching method given. See documentation
Reset USB device .
 Device was reset
-&amp;gt; Run lsusb to note any changes. Bye!
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Props to &lt;a href=&#34;https://askubuntu.com/a/859492&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this&lt;/a&gt; AskUbuntu answer, confirmed and extended via &lt;a href=&#34;https://stackoverflow.com/questions/18765725/turning-off-a-single-usb-device-again&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this&lt;/a&gt; Stackoverflow one.&lt;/p&gt;
&lt;h2 id=&#34;wrap-up&#34;&gt;&lt;a href=&#34;#wrap-up&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Wrap up&lt;/h2&gt;&lt;p&gt;After a few trial and errors, I realized &lt;code&gt;eject&lt;/code&gt;ing the drive was entirely unnecessary: I could get away with just &lt;code&gt;dmsetup remove ventoy&lt;/code&gt; and an &lt;code&gt;unbind&lt;/code&gt;/&lt;code&gt;bind&lt;/code&gt; cycle.&lt;/p&gt;
&lt;p&gt;Now if you ever have to &lt;em&gt;cleanly&lt;/em&gt; power-off a device on the command line, here is the &lt;strong&gt;ultimate&lt;/strong&gt; method:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;% udisksctl power-off -h
Utilisation :
  udisksctl power-off [OPTION…]

Safely power off a drive.

Options :
  -p, --object-path         Object path for ATA device
  -b, --block-device        Device file for ATA device
  --no-user-interaction     Do not authenticate the user if needed
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;E.g.&lt;/em&gt; &lt;code&gt;udisksctl power-off -b /dev/sdb&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For the life of me I don&amp;rsquo;t know why this utility isn&amp;rsquo;t included by default on the arch installation media, but in any case you are just one &lt;code&gt;pacman -S udisks2&lt;/code&gt; away from safely-removed device &lt;em&gt;nibbana&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s all folks for today&amp;rsquo;s learning diary. Thanks for reading and take care of your devices!&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>A system imaging tale: LUKS, Clonezilla and friends</title>
      <link>https://bastientraverse.com/en/posts/2022-02-14-system-imaging/</link>
      <pubDate>Mon, 14 Feb 2022 00:00:00 +0100</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2022-02-14-system-imaging/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Today&amp;rsquo;s project:&lt;/strong&gt; make a system image of my previous laptop for archival purposes before refurbishing it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Conditions:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;make a space efficient image, &lt;em&gt;i.e.&lt;/em&gt; not a block-level copy: no need to retain encryption or logical volume setup, only their content matters. However:&lt;/li&gt;
&lt;li&gt;all standard and extended file attributes must be correctly preserved, so that if I ever want to boot this image the system will be in a correct state.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;The plan:&lt;/strong&gt; boot up an Arch ISO, open the encrypted drives, set everything up for &lt;a href=&#34;https://clonezilla.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;clonezilla&lt;/a&gt; &amp;ndash; profit.&lt;/p&gt;
&lt;p&gt;Here is how it actually went.&lt;/p&gt;
&lt;h2 id=&#34;an-unexpected-obstacle-to-boot-ventoy-shenanigans&#34;&gt;&lt;a href=&#34;#an-unexpected-obstacle-to-boot-ventoy-shenanigans&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;An unexpected obstacle to boot: Ventoy shenanigans&lt;/h2&gt;&lt;p&gt;In order to boot into the Arch live environment, I unsheathed my very dear and trusted Sandisk Extreme multiboot USB thumb drive (not the currently sold, lower performing one but the &lt;a href=&#34;https://usb.userbenchmark.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ever chart-topping&lt;/a&gt; one from about 10 years ago), which had been irreproachably and impeccably fulfilling its duty in the two years since I had discovered &lt;a href=&#34;https://www.ventoy.net/en/index.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Ventoy&lt;/a&gt;, the multiboot solution which surpassed them all and ended my long standing quest to find an easy to use, low-maintenance and low-friction multiboot USB solution. And yes, this was the longest sentence of the entire article 😁&lt;/p&gt;
&lt;p&gt;Just recently I had updated it to the latest version using the provided Linux script, which completed without issue. But as soon as I booted on it, I was faced with an error: &lt;code&gt;Warning! This is not a standard device and is not officially supported&lt;/code&gt;. Um, beg your pardon? It was working fine those past two years, so certainly it was the update which broke something&amp;hellip;&lt;/p&gt;
&lt;p&gt;Searching for this error, I eventually &lt;a href=&#34;https://github.com/ventoy/Ventoy/commit/8bbd5a14a3ca4820266bed6afc1314c3f41e76c3&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;found this &amp;ldquo;kill switch&amp;rdquo;&lt;/a&gt; the dev introduced slightly after I used the software, to try and contain the flood of users with non-standard installs complaining to them when something got wrong.&lt;/p&gt;
&lt;p&gt;I can&amp;rsquo;t really fault them for that, but here is the thing: mine was a pure product of the official tool from back in 2020, with no deviation from the &lt;a href=&#34;https://www.ventoy.net/en/doc_disk_layout.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;prescribed layout/FS&lt;/a&gt; whatsoever. The first partition was starting at the 2048/1 MB boundary and formatted with the default exFAT, the second partition was 65536 sector large, the drive had an MBR partition table and all and all&amp;hellip;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# fdisk -l /dev/sda
Disk /dev/sda: 59.63 GiB, 64023257088 bytes, 125045424 sectors
Disk model: Extreme  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd1a119ab

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048 124979887 124977840 59.6G  7 HPFS/NTFS/exFAT
/dev/sda2       124979888 125045423     65536   32M ef EFI (FAT-12/16/32)&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The official command line tool didn&amp;rsquo;t complain either while upgrading or when run manually:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# ventoy -l /dev/sda

**********************************************
      Ventoy: 1.0.65  x86_64
      longpanda admin@ventoy.net
      https://www.ventoy.net
**********************************************

Ventoy Version in Disk: 1.0.65
Disk Partition Style  : MBR
Secure Boot Support   : NO
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Indeed but nope, I got axed by the kill switch all the same. Fuck artificial restrictions and &lt;a href=&#34;https://www.gnu.org/philosophy/can-you-trust.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;treacherous computing&lt;/a&gt;. And I am burned by a free software project at that&amp;hellip; What to expect from this world.&lt;/p&gt;
&lt;p&gt;Anyhoo, after transfering out my 24 GB of GNU/Linux ISOs (God bless USB 3.0 &amp;amp; &lt;em&gt;quality&lt;/em&gt; flash memory speeds), I forced a reinstall with the &lt;code&gt;-I&lt;/code&gt; switch:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# ventoy -I /dev/sda

**********************************************
      Ventoy: 1.0.65  x86_64
      longpanda admin@ventoy.net
      https://www.ventoy.net
**********************************************

Disk : /dev/sda
Size : 59 GB
Style: MBR


Attention:
You will install Ventoy to /dev/sda.
All the data on the disk /dev/sda will be lost!!!

Continue? (y/n) y

All the data on the disk /dev/sda will be lost!!!
Double-check. Continue? (y/n) y

Create partitions on /dev/sda by parted in MBR style ...
Done
Wait for partitions ...
partition exist OK
create efi fat fs /dev/sda2 ...
mkfs.fat 4.2 (2021-01-31)
success
Wait for partitions ...
/dev/sda1 exist OK
/dev/sda2 exist OK
partition exist OK
Format partition 1 /dev/sda1 ...
mkexfatfs 1.3.0
Creating... done.
Flushing... done.
File system created successfully.
mkexfatfs success
writing data to disk ...
sync data ...
esp partition processing ...
Open ventoy efi file 0x610ac0
ventoy x64 efi file size 1757184 ...
Open bootx64 efi file 0x610ac0
Open ventoy ia32 efi file 0x610f10
ventoy efi file size 1183744 ...
Open bootia32 efi file 0x610ac0

Install Ventoy to /dev/sda successfully finished.

sudo ventoy -I /dev/sda  5,11s user 2,58s system 19% cpu 39,813 total
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After transferring my files back and rebooting on the flash drive, everything was back in order and I was ready to rock 🤟&lt;/p&gt;
&lt;h2 id=&#34;optional-step-setting-up-a-comfortable-environment&#34;&gt;&lt;a href=&#34;#optional-step-setting-up-a-comfortable-environment&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Optional step: setting up a comfortable environment&lt;/h2&gt;&lt;p&gt;Being console-based, the archiso environment is somewhat austere. So the first thing I usually do is to set up SSH access so as to connect from my main machine:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# set french keymap&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# the &amp;#34;-latin9&amp;#34; part is only needed if using e.g. accents&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;loadkeys fr-latin9
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# directly connect to a known Wifi SSID&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;iwctl station wlan0 connect &amp;lt;SSID&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Enable NTP to have accurate time&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;timedatectl set-timezone &amp;lt;Area/City&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;timedatectl set-ntp &lt;span class=&#34;nb&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# set root passhrase to enable SSH connection&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;passwd
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# start SSH service&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;systemctl start sshd
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# get IP address&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;iwctl station wlan0 show &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; grep IP &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; awk &lt;span class=&#34;s1&#34;&gt;&amp;#39;{print $3}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# or without iwd:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ip a &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; grep wlan &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; awk &lt;span class=&#34;s1&#34;&gt;&amp;#39;FNR == 2 {print substr($2, 1, length($2)-3)}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally, connect to the live environment via SSH:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ssh -o &lt;span class=&#34;nv&#34;&gt;PreferredAuthentications&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;password &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -o &lt;span class=&#34;nv&#34;&gt;PubkeyAuthentication&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;no &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -o &lt;span class=&#34;nv&#34;&gt;UserKnownHostsFile&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/dev/null &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    root@&amp;lt;other-machine-IP&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;admonition tip&#34;&gt;
  👉️ The options used allow not to be affected by the local SSH configuration (SSH keys&amp;hellip;), as well as well not polluting the local KnownHosts file with this one-time connection.
&lt;/div&gt;
&lt;p&gt;That&amp;rsquo;s it, now we can resume with the common procedure!&lt;/p&gt;
&lt;h2 id=&#34;clonezilla-and-lukslvm&#34;&gt;&lt;a href=&#34;#clonezilla-and-lukslvm&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Clonezilla and LUKS/LVM&lt;/h2&gt;&lt;p&gt;In order to &lt;em&gt;efficiently&lt;/em&gt; image the system, we first need to open any LUKS container and make sure all the LVs are displayed correctly:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cryptsetup open --allow-discards /dev/sdb2 os
lvs
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then we create the &lt;code&gt;/home/partimag&lt;/code&gt; directory (hardcoded backup destination in Clonezilla) and mount our drive on it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mkdir /home/partimag
mount -o noatime /dev/sdc1 !$
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition info&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Note&lt;/p&gt;
  &lt;p&gt;When booting the archiso, I selected the &amp;ldquo;Copy to RAM&amp;rdquo; option so as to free up the drive and reuse it as backup destination.&lt;/p&gt;
&lt;p&gt;However, in order to do that I first needed to get rid of a lingering &lt;code&gt;/dev/mapper/ventoy&lt;/code&gt;  mapping on its first partition, which made &lt;code&gt;eject&lt;/code&gt;/&lt;code&gt;udisksctl&lt;/code&gt; throw errors despite the fact that it wasn&amp;rsquo;t mounted and &lt;code&gt;lsof | grep -e ventoy -e sdb&lt;/code&gt; didn&amp;rsquo;t return anything. I didn&amp;rsquo;t want to pull it out on the off chance it&amp;rsquo;d corrupt something&amp;hellip;&lt;/p&gt;
&lt;p&gt;I wrote a &lt;a href=&#34;https://bastientraverse.com/en/posts/2022-02-24-cli-eject/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;separate post&lt;/a&gt; which goes into the details, but the gist is a simple &lt;code&gt;dmsetup remove ventoy&lt;/code&gt; took care of the mapping, and then I was able to normally mount the drive.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;And now it is &lt;em&gt;&lt;strong&gt;on!&lt;/strong&gt;&lt;/em&gt; Launch &lt;code&gt;clonezilla&lt;/code&gt; from the command line and follow the on-screen instructions depending on your needs. Some personal recommendations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;use expert mode&lt;/li&gt;
&lt;li&gt;avoid the 4G backup splitting by entering a large number when prompted (like 100000)&lt;/li&gt;
&lt;li&gt;select &amp;ldquo;parallel zstd&amp;rdquo; (&lt;code&gt;-z9p&lt;/code&gt;) as the compression algorithm&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Or if you feel like keeping it CLI-only&amp;hellip;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;/usr/bin/ocs-sr &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --use-partclone &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --confirm &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --clone-hidden-data &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --zstdmt-compress
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    --image-size &lt;span class=&#34;m&#34;&gt;1000000&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --fsck-src-part &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --skip-enc-ocs-img &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --postaction choose &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    saveparts &amp;lt;backup-name&amp;gt; sdb1 sdb2
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is the long form equivalent of the&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/usr/bin/ocs-sr -q2 -c -j2 -z9p -i 1000000 -fsck -senc -p choose saveparts &amp;lt;backup-name&amp;gt; sdb1 sdb
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;that got copied in a file under &lt;code&gt;/tmp&lt;/code&gt; after validating my options in the TUI.&lt;/p&gt;
&lt;p&gt;Then we just sit back and relax&amp;hellip; Wait, what? &lt;code&gt;dd mode&lt;/code&gt;? Why aren&amp;rsquo;t my OS logical volumes backed up by the regular free space-aware &lt;code&gt;partclone&lt;/code&gt; mode? I explicitly decrypted the containers for that purpose, and saw the LVs being listed during the preparation screens! Although it&amp;rsquo;s true I could only select whole partitions to be backed up and not specific logical volumes, and saw a line flash by saying something like &lt;code&gt;Shutting down the Volume manager&lt;/code&gt;&amp;hellip; Oh come on.&lt;/p&gt;
&lt;p&gt;One &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;c&lt;/kbd&gt; later the backup of &lt;code&gt;/dev/sdb2&lt;/code&gt; was cancelled, but the unencrypted &lt;code&gt;/dev/sdb1&lt;/code&gt; with the &lt;code&gt;arch&lt;/code&gt; LV (the only one in the &lt;code&gt;boot&lt;/code&gt; VG) proceeded without issue. What the heck clonezilla?&lt;/p&gt;
&lt;p&gt;Hum alright, according to &lt;a href=&#34;https://sourceforge.net/p/clonezilla/discussion/Help/thread/770897b4/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this 2014 thread&lt;/a&gt; with the developer&amp;rsquo;s input, it seems this isn&amp;rsquo;t as straightforward as it looks. And it happened even &lt;a href=&#34;https://sourceforge.net/p/clonezilla/mailman/clonezilla-live/thread/MY6SeQk--3-2%40tuta.io/#msg37260650&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;much more recently&lt;/a&gt; to another user (although according to the dev&amp;rsquo;s answer it shouldn&amp;rsquo;t be the case), so anyway&amp;hellip; Time for some manual &lt;a href=&#34;https://partclone.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;partclone&lt;/a&gt; fun I guess!&lt;/p&gt;
&lt;h2 id=&#34;system-imaging-the-manual-way&#34;&gt;&lt;a href=&#34;#system-imaging-the-manual-way&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;System imaging, the manual way&lt;/h2&gt;&lt;p&gt;Full disclosure: I had already stumbled upon the &amp;ldquo;&lt;em&gt;manual partclone required&lt;/em&gt;&amp;rdquo; caveat when trying to efficiently backup LUKS-encrypted systems with Clonezilla, so I wasn&amp;rsquo;t really at a loss. All in all it&amp;rsquo;s pretty simple, you just have to use &lt;em&gt;partclone&lt;/em&gt; like so:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;partclone.$fstype --clone --source ... --output ...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Wich gave in my case:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;partclone.ext4 --clone --source /dev/mapper/arch-root --output &amp;lt;backup path&amp;gt;/$(date -I)-old-laptop-archroot.ext4-ptcl.img
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition tip&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Tip&lt;/p&gt;
  If you want to have the same nice ncurses-based UI as Clonezilla does, add the &lt;code&gt;-N/--ncurses&lt;/code&gt; option (&lt;a href=&#34;https://linuxconfig.org/how-to-use-partclone-to-create-a-smart-partition-backup&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;example&lt;/a&gt;).
&lt;/div&gt;
&lt;p&gt;Though if we really want to mimick Clonezilla and have space-efficient backups, we gotta add compression to the mix!&lt;/p&gt;
&lt;h3 id=&#34;compressing-partclone-images-with-zstd&#34;&gt;&lt;a href=&#34;#compressing-partclone-images-with-zstd&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Compressing partclone images with zstd&lt;/h3&gt;&lt;p&gt;Being a devout &lt;a href=&#34;https://facebook.github.io/zstd/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Zstandard&lt;/a&gt; Zealot© (&lt;a href=&#34;https://gregoryszorc.com/blog/2017/03/07/better-compression-with-zstandard/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this post&lt;/a&gt; summarizes well my feelings &amp;ndash; no affiliation with the author), here is how to interface it with partclone for a nicely multi-threaded compression:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;partclone.ext4 --clone --source /dev/mapper/arch-root | zstdmt -o &amp;lt;backup path&amp;gt;/$(date -I)-old-laptop-archroot.ext4-ptcl-img.zst
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition info&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Info&lt;/p&gt;
  From &lt;a href=&#34;https://man.archlinux.org/man/zstd.1#SYNOPSIS&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;zstd man page&lt;/a&gt;: &lt;code&gt;zstdmt&lt;/code&gt; is equivalent to &lt;code&gt;zstd -T0&lt;/code&gt;, enabling auto-adjusted multi-threading.
&lt;/div&gt;
&lt;p&gt;If you are like me and have several LVs to clone and their names follow a pattern, you can use a for loop to optimize things a bit:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;for i in arch-{root,home,opt,var} boot-arch; do partclone.ext4 --clone --source /dev/mapper/&amp;quot;${i}&amp;quot; | zstdmt -o &amp;lt;backup path&amp;gt;/$(date -I)-&amp;quot;${i}&amp;quot;.ext4-ptcl-img.zst; done
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;Et voilà&lt;/em&gt;, space-efficient compressed images of your decrypted LVs!&lt;/p&gt;
&lt;div class=&#34;admonition tip&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Tip&lt;/p&gt;
  Someone made a &lt;a href=&#34;https://gist.github.com/andyrbell/4a339c0d8a3bc9465743a6b876671dcb&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;gist&lt;/a&gt; using somewhat older commands and touching upon restoration etc&amp;hellip; Give it a look if you want to review the process!
&lt;/div&gt;
&lt;h2 id=&#34;extra-comparing-the-process-with-different-tools&#34;&gt;&lt;a href=&#34;#extra-comparing-the-process-with-different-tools&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Extra: comparing the process with different tools&lt;/h2&gt;&lt;p&gt;A very precious thing in this world is diversity. Of people, ideas, food&amp;hellip; And backup tools. Here is a rundown of the same task undertaken with four of them:&lt;/p&gt;
&lt;h3 id=&#34;fsarchiver&#34;&gt;&lt;a href=&#34;#fsarchiver&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;FSArchiver&lt;/h3&gt;&lt;p&gt;The first time I realized I couldn&amp;rsquo;t use Clonezilla to properly back up my decrypted LVs, I stumbled upon a great alternative to partclone: &lt;a href=&#34;https://www.fsarchiver.org/compression/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;FSArchiver&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The main reason for using it over the former? FSArchiver:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;directly integrates &lt;a href=&#34;http://www.fsarchiver.org/internal-multithreading/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;multi-threaded&lt;/a&gt; compression with zstd (and &lt;a href=&#34;https://www.fsarchiver.org/compression/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;recommends it over any others&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;allows to specify multiple filesystems to be archived at once&lt;/li&gt;
&lt;li&gt;also works with directories (creating a compressed and checksummed tarball of sorts)&lt;/li&gt;
&lt;li&gt;allows to restore to a different filesystem and creating it in one go&lt;/li&gt;
&lt;li&gt;allows to restore to a smaller partition by default, whereas partclone needs the &lt;code&gt;-C&lt;/code&gt; option (and often just ends on a seek error)&lt;/li&gt;
&lt;li&gt;accepts exclusion patterns to filter what&amp;rsquo;s archived/restored (&lt;a href=&#34;https://github.com/fdupoux/fsarchiver/issues/98#issuecomment-1050415780&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;the syntax is a bit tricky though&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;offers to optionally encrypt data in the archive&lt;/li&gt;
&lt;li&gt;and is generally really careful with data integrity&amp;hellip; If that wasn&amp;rsquo;t already reason enough 😉&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Its multi-threaded compression-ready invocation goes something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fsarchiver --zstd=3 --jobs=$(nproc) savefs &amp;lt;backup path&amp;gt;/&amp;lt;archive-name&amp;gt;.fsa &amp;lt;list of devices to backup&amp;gt; --exclude=&amp;lt;exclude pattern&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--zstd=3&lt;/code&gt; stands for zstd-compression at level 3&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--jobs=$(nproc)&lt;/code&gt; works exactly like the eponymous &lt;code&gt;make&lt;/code&gt; switch, enabling as many threads as there are logical cores on your system.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So for example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fsarchiver -Z3 -j$(nproc) -v savefs &amp;lt;backup-path&amp;gt;/old-laptop.fsa /dev/mapper/arch-{root,home,opt,var} /dev/mapper/boot-arch --exclude=&amp;quot;lost+found&amp;quot; --exclude=&amp;quot;/var/cache/pacman/pkg/*&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;-v/--verbose&lt;/code&gt; option is useful to get a progress report, however it will list every file being archived and as such likely blow away your terminal history.&lt;/p&gt;
&lt;div class=&#34;admonition info&#34;&gt;
  BTW, &lt;a href=&#34;https://sourceforge.net/p/clonezilla/discussion/Open_discussion/thread/295770be/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;here is why&lt;/a&gt; clonezilla defaults to &lt;em&gt;partclone&lt;/em&gt; instead of &lt;em&gt;fsarchiver&lt;/em&gt; in the words of its author. Tldr: partclone supports pipes/stdin/stdout which are needed for other Clonezilla features, while fsarchiver doesn&amp;rsquo;t. Tough life.
&lt;/div&gt;
&lt;p&gt;Note however that FSArchiver (just like partclone) doesn&amp;rsquo;t deal with recreating a partition table on the destination, or any other form of partitioning/preparing the drive such as LUKS/LVM: you gotta do all that manually up to the point where you are ready to restore &lt;em&gt;filsystems&lt;/em&gt; (that is to say, fsarchiver isn&amp;rsquo;t a &lt;em&gt;disk cloning&lt;/em&gt; solution).&lt;/p&gt;
&lt;p&gt;Also, you cannot merge the content of separate partitions created this way into one destination (&lt;em&gt;e.g.&lt;/em&gt; if you want to consolidate separate LVs into one FS): they will overwrite each other. For that you&amp;rsquo;d rather use the &lt;code&gt;savedir/restdir&lt;/code&gt; mode, which is akin to a tarball on steroids.&lt;/p&gt;
&lt;h3 id=&#34;squashfs&#34;&gt;&lt;a href=&#34;#squashfs&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Squashfs&lt;/h3&gt;&lt;p&gt;I discovered this method by stumbling upon this gem on the Arch wiki, &amp;ldquo;&lt;a href=&#34;https://wiki.archlinux.org/title/Full_system_backup_with_SquashFS&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Full system backup with SquashFS&lt;/a&gt;&amp;rdquo;, and although the article is in dire need of a proper rewrite (which I&amp;rsquo;ve added to my todo list) I really wanted to give it a try.&lt;/p&gt;
&lt;p&gt;In the words of &lt;a href=&#34;https://tldp.org/HOWTO/SquashFS-HOWTO/whatis.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;TLDP&lt;/a&gt;, &lt;a href=&#34;https://en.wikipedia.org/wiki/SquashFS&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;SquashFS&lt;/a&gt; is&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;a read-only file system that lets you compress whole file systems or single directories, write them to other devices/partitions or to ordinary files, and then mount them directly (if a device) or using a loopback device (if it is a file). [&amp;hellip;] For archiving purposes, SquashFS gives you a lot more flexibility and performance speed than a tarball archive.&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Its selling points to me are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;random access &amp;amp; transparent decompression: no need to decompress and extract the entire image to browse its content (this is huge, especially when talking about gigabyte-sized images&amp;hellip;)&lt;/li&gt;
&lt;li&gt;file-level deduplication&lt;/li&gt;
&lt;li&gt;exclusion patterns&lt;/li&gt;
&lt;li&gt;zstd support 😊&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;However be aware that it &lt;a href=&#34;https://www.kernel.org/doc/html/latest/filesystems/squashfs.html#todo-list&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;doesn&amp;rsquo;t support ACLs&lt;/a&gt;, so if you rely on them you should look somewhere else.&lt;/p&gt;
&lt;p&gt;After quickly perusing its &lt;a href=&#34;https://www.mankier.com/1/mksquashfs&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;manpage&lt;/a&gt; I gave it a go:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mount -o ro /dev/mapper/arch-root /mnt
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mount -o ro /dev/mapper/boot-arch /mnt/boot
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; i in home opt var&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;do&lt;/span&gt; mount -o ro /dev/mapper/arch-&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;i&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; /mnt/&lt;span class=&#34;nv&#34;&gt;$i&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;cd&lt;/span&gt; /mnt
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mksquashfs ./ &amp;lt;backup-path&amp;gt;/old-laptop.sqsh &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -comp zstd &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -no-exports &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -progress &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -mem 6G &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -not-reproducible &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -e var/cache/pacman/pkg
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Results:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Squashfs 4.0 filesystem, zstd compressed, data block size 131072
	compressed data, compressed metadata, compressed fragments,
	compressed xattrs, compressed ids
	duplicates are removed
Filesystem size 3912057.66 Kbytes (3820.37 Mbytes)
	35.64% of uncompressed filesystem size (10975717.90 Kbytes)
Inode table size 2886293 bytes (2818.65 Kbytes)
	24.42% of uncompressed inode table size (11819496 bytes)
Directory table size 3606490 bytes (3521.96 Kbytes)
	36.39% of uncompressed directory table size (9910813 bytes)
Xattr table size 621 bytes (0.61 Kbytes)
	28.98% of uncompressed xattr table size (2143 bytes)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To put things in perspective:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root@archiso ~ # du -sh /mnt
16G	/mnt
root@archiso ~ # du -sh /mnt/var/cache/pacman/pkg
4.5G	/mnt/var/cache/pacman/pkg
root@archiso ~ # du -h &amp;lt;backup-path&amp;gt;/old-laptop.sqsh
3.8G	&amp;lt;backup-path&amp;gt;/old-laptop.sqsh
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So it went from 16-4.5=11.5 GiB to 3.8&amp;hellip; Nice!&lt;/p&gt;
&lt;p&gt;It produced a slightly smaller archive than both partclone and fsarchiver (even when accounting for the non-excluded pacman cache), but it took 11.5 minutes. After testing, &lt;code&gt;fsarchiver savedir&lt;/code&gt; took 3min08s and produced a 4.2 GiB image (with &lt;code&gt;--exclude=&#39;*.pkg.tar.zst&#39;&lt;/code&gt;), but then fsarchiver doesn&amp;rsquo;t produce browsable archives and doesn&amp;rsquo;t do any deduplication 😊&lt;/p&gt;
&lt;h3 id=&#34;rsync&#34;&gt;&lt;a href=&#34;#rsync&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Rsync&lt;/h3&gt;&lt;p&gt;One step more remote from system imaging, the ever powerful Swiss-army knife of file transfer can evidently also be used to create &lt;a href=&#34;https://wiki.archlinux.org/title/Rsync#Full_system_backup&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;full system backups&lt;/a&gt;. Here is my personal take on it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;rsync &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --archive &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --hard-links &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --acls &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --xattrs &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --atimes &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --open-noatime &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --sparse &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --human-readable &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --info&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;progress2 &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --partial &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --exclude&lt;span class=&#34;o&#34;&gt;={&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;var/cache/pacman/pkg/*&amp;#34;&lt;/span&gt;,&lt;span class=&#34;s2&#34;&gt;&amp;#34;*/lost+found&amp;#34;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    /mnt/* /path/to/backup/dir
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Or as a one-liner:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rsync -aHAXUUSh --info=progress2 --partial --exclude={&amp;quot;var/cache/pacman/pkg/*&amp;quot;,&amp;quot;*/lost+found&amp;quot;} /mnt/* /path/to/backup/dir
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;See its &lt;a href=&#34;https://man.archlinux.org/man/extra/rsync/rsync.1.en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;man page&lt;/a&gt; for details on the options used. Note that the repeated &lt;code&gt;-U&lt;/code&gt; is not a mistake but a shortcut to enable both &lt;code&gt;--atimes&lt;/code&gt; and &lt;code&gt;--open-noatime&lt;/code&gt; 😉&lt;/p&gt;
&lt;p&gt;However, while doing so I realized rsync wasn&amp;rsquo;t exactly the best solution when the destination filesystem is {ex,}FAT&amp;hellip; Timestamps and permissions/ACLs/xattr won&amp;rsquo;t carry over correctly&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; 😒  This is what got me for the very first time interested in using&amp;hellip;&lt;/p&gt;
&lt;h3 id=&#34;tar&#34;&gt;&lt;a href=&#34;#tar&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Tar&lt;/h3&gt;&lt;p&gt;O venerable Lord of computerized backups! Thy name is reminiscent of the glorious days of yore, when backups were mere &lt;em&gt;&lt;strong&gt;t&lt;/strong&gt;ape &lt;strong&gt;ar&lt;/strong&gt;chives&lt;/em&gt;&amp;hellip;&lt;/p&gt;
&lt;p&gt;Okay, but how does it fare in 2022 for complete system backup with high fidelity? After delving into its &lt;a href=&#34;https://man.archlinux.org/man/core/tar/tar.1.en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;manpage&lt;/a&gt; this is what I came up with:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;cd&lt;/span&gt; /mnt
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;tar --create &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --preserve-permissions &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --acls &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --xattrs &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --atime-preserve&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;system &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --exclude&lt;span class=&#34;o&#34;&gt;={&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;var/cache/pacman/pkg/*&amp;#34;&lt;/span&gt;,&lt;span class=&#34;s2&#34;&gt;&amp;#34;*lost+found&amp;#34;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -I zstdmt &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -f /path/to/backup/dir/&amp;lt;backup-name&amp;gt;.tar.zst &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    *
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;tar: /var/run/nscd/socket: socket ignored
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# repeat dozens of times&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Hmmm okay, apart from socket files which apparently &lt;a href=&#34;https://comp.os.linux.redhat.narkive.com/z7CkxLXY/excluding-sockets-in-a-tar-backup&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;clearly&lt;/a&gt; &lt;a href=&#34;https://superuser.com/a/705649&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;don&amp;rsquo;t matter&lt;/a&gt;, what about the completeness of the backup? Sections &lt;a href=&#34;https://www.gnu.org/software/tar/manual/tar.html#verify&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;verify&lt;/a&gt; and &lt;a href=&#34;https://www.gnu.org/software/tar/manual/tar.html#compare&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;compare&lt;/a&gt; from tar manual cover this question. A few pitfalls to be aware of however:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--verify&lt;/code&gt; (only for archive creation) &lt;a href=&#34;https://unix.stackexchange.com/questions/618991/how-to-fix-tar-cannot-verify-compressed-archives-error&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;doesn&amp;rsquo;t work with compressed archives&lt;/a&gt;; if you don&amp;rsquo;t mind you can first create and verify an uncompressed archive, then compress it in a second step&amp;hellip;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--compare&lt;/code&gt; &amp;ldquo;&lt;em&gt;ignores files in the file system that do not have corresponding members in the archive&lt;/em&gt;&amp;rdquo;, so if something was left over during the backup, no errors will be reported.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you have the space and will for it, you could also just extract the archive and &lt;code&gt;diff --recursive&lt;/code&gt; it against the source, but all in all I feel this is an aspect where the original (and still current) purpose of tar as a &lt;em&gt;tape specific archiving tool&lt;/em&gt;, makes itself felt.&lt;/p&gt;
&lt;p&gt;From my superficial testing everything seemed mostly alright, but I can&amp;rsquo;t shake the feelings that tar isn&amp;rsquo;t making as complete a clone as fsarchiver or rsync (see its &lt;a href=&#34;https://en.wikipedia.org/wiki/Tar_%28computing%29#Limitations&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;limitations&lt;/a&gt; too). But that&amp;rsquo;s probably because my beard isn&amp;rsquo;t  &lt;a href=&#34;https://www.urbandictionary.com/define.php?term=grey%20beard&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;grey enough&lt;/a&gt; I guess&amp;hellip; 😁&lt;/p&gt;
&lt;h2 id=&#34;wrap-up&#34;&gt;&lt;a href=&#34;#wrap-up&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Wrap up&lt;/h2&gt;&lt;p&gt;In conclusion, if you are in a situation where Clonezilla doesn&amp;rsquo;t work for you (most notably when using LUKS), my recommendation would be to turn to either &lt;strong&gt;FSArchiver&lt;/strong&gt;, &lt;strong&gt;partclone&lt;/strong&gt; or &lt;strong&gt;SquashFS&lt;/strong&gt;. They seem to provide the most complete and reliable feature-set of the lot for imaging systems in a correct and efficient way. Rsync and tar being more general purpose tools, they require more options not to leave something out or otherwise shoot yourself in the foot.&lt;/p&gt;
&lt;p&gt;Also, while laboring over this article I realized that while it was all fine and dandy to have a static archive of my old system, the next step was to make an &lt;em&gt;interactive&lt;/em&gt; image of it that I could boot on whenever I want to see which GTK theme I used, or otherwise take a nostalgic whiff and relapse in my former computing abode&amp;hellip;&lt;/p&gt;
&lt;p&gt;This reminded me of the &lt;a href=&#34;https://wiki.archlinux.org/title/Moving_an_existing_install_into_%28or_out_of%29_a_virtual_machine&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Moving an existing install into a virtual machine&lt;/a&gt; article, and I have an entire article coming up with the fruits of this endeavour: creating a VM image from the backups made here, testing in the process the oh-so-important restoration side of all the different tools used here (which taught me that an un-restored backup is no backup at all), making the required adjustments to be able to boot from it&amp;hellip; Stay stuned for the second part! [edit: &lt;a href=&#34;https://bastientraverse.com/en/posts/2022-04-05-physical-to-virtual/&#34;&gt;there it goes&lt;/a&gt;]&lt;/p&gt;
&lt;p&gt;Thanks for reading and happy imaging 🙏&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;One workaround is to use a &lt;a href=&#34;https://en.wikipedia.org/wiki/Loop_device&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;loop device&lt;/a&gt; file, &lt;em&gt;i.e.&lt;/em&gt; create a file sufficiently large to hold your backup, partition it, activate it via &lt;code&gt;losetup&lt;/code&gt;, then finally format it with a more amenable filesystem and  mount it as the backup destination (&lt;a href=&#34;https://wiki.archlinux.org/title/Moving_an_existing_install_into_%28or_out_of%29_a_virtual_machine#Create_the_container&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;example&lt;/a&gt;).&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Parallel ffmpeg stream manipulation</title>
      <link>https://bastientraverse.com/en/posts/2021-10-29-parallel-ffmpeg/</link>
      <pubDate>Fri, 29 Oct 2021 00:00:00 +0200</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2021-10-29-parallel-ffmpeg/</guid>
      <description>&lt;p&gt;This post will illustrate how we can apply different operations (audio transcoding, subtitles selection, video, chapters and fonts passthrough) on multistream MKVs with ffmpeg, while optimizing for multicore systems.&lt;/p&gt;
&lt;p&gt;More precisely, here is what we are trying to achieve:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;transcode the Japanese audio track from a entire anime season, from a superfluously lossless Flac to the more efficient Opus format&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;
&lt;li&gt;shed the useless (to me) English audio track (also in Flac, and 5.1&amp;hellip;), as well as the unneeded &amp;ldquo;Signs-only&amp;rdquo; subtitle   tracks&lt;/li&gt;
&lt;li&gt;pass-through the video track&lt;/li&gt;
&lt;li&gt;retain all attachments (fonts, chapters&amp;hellip;)&lt;/li&gt;
&lt;li&gt;preserve file modification times&lt;/li&gt;
&lt;li&gt;replace the original files with the new ones&lt;/li&gt;
&lt;li&gt;do all this as fast and efficiently as possible 😎&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;When starting, I knew how to accomplish this in two steps using two different tools:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Identify and remove the unwanted streams with &lt;a href=&#34;https://mkvtoolnix.download/doc/mkvmerge.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;mkvmerge&lt;/a&gt;&lt;sup&gt;(&lt;a href=&#34;https://www.reddit.com/r/mkvtoolnix/comments/8qcgez/can_somebody_help_with_batch_remove_unwanted/e0jq70n/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;source&lt;/a&gt;):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mkvmerge -i *.mkv
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;File &lt;span class=&#34;s1&#34;&gt;&amp;#39;01.mkv&amp;#39;&lt;/span&gt;: container: Matroska
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Track ID 0: video &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;HEVC/H.265/MPEG-H&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Track ID 1: audio &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;Flac&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Track ID 2: audio &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;Flac&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Track ID 3: subtitles &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;SubStationAlpha&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Track ID 4: subtitles &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;SubStationAlpha&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Track ID 5: subtitles &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;HDMV PGS&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Track ID 6: subtitles &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;HDMV PGS&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Attachment ID 1: &lt;span class=&#34;nb&#34;&gt;type&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;application/vnd.ms-opentype&amp;#39;&lt;/span&gt;, size &lt;span class=&#34;m&#34;&gt;30712&lt;/span&gt; bytes, file name &lt;span class=&#34;s1&#34;&gt;&amp;#39;font.ttf&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;...&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; f in *.mkv&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;do&lt;/span&gt; mkvmerge -o &lt;span class=&#34;s2&#34;&gt;&amp;#34;remuxed/&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; --audio-tracks &lt;span class=&#34;s1&#34;&gt;&amp;#39;!eng&amp;#39;&lt;/span&gt; --subtitle-tracks &lt;span class=&#34;s1&#34;&gt;&amp;#39;!4,6&amp;#39;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;admonition tip&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Note&lt;/p&gt;
  Here I was able to use &lt;code&gt;!eng&lt;/code&gt; because the audio track was labeled as such, but we could achieve the same with numerical index (just as we are doing for subs).
&lt;/div&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;Use ffmpeg to transcode the remaining audio track to Opus, using a &lt;a href=&#34;https://kokomins.wordpress.com/2019/10/10/anime-encoding-guide-for-x265-and-why-to-never-use-flac/#recommended-settings&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;generous 192 kbps&lt;/a&gt; (96k per audio channel) bitrate and then do the cleanup:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; f in remuxed/*.mkv&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;do&lt;/span&gt; ffmpeg -i &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; -map &lt;span class=&#34;m&#34;&gt;0&lt;/span&gt; -c copy -c:a libopus -b:a 192k &lt;span class=&#34;s2&#34;&gt;&amp;#34;tmp_&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; touch -r &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;tmp_&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; mv &lt;span class=&#34;s2&#34;&gt;&amp;#34;tmp_&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Where &lt;code&gt;-map 0&lt;/code&gt; ports over all input streams, &lt;code&gt;-c copy&lt;/code&gt; keeps them intact, and &lt;code&gt;-c:a libopus -b:a 192k&lt;/code&gt; modulates this by transcoding all audio streams (in our case, the one we kept) to 192k Opus. Finally, &lt;code&gt;touch -r&lt;/code&gt; updates our file modtime to reflect the original one, and &lt;code&gt;mv&lt;/code&gt; overwrite the source with the modified file (&lt;strong&gt;warning&lt;/strong&gt;: make sure to always test on a copy first, &lt;strong&gt;otherwise data loss will incur!&lt;/strong&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;From there it was rather easy to merge it all in one fell for loop:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; f in *.mkv&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;do&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    mkvmerge -o &lt;span class=&#34;s2&#34;&gt;&amp;#34;tmp_&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; --audio-tracks &lt;span class=&#34;s1&#34;&gt;&amp;#39;!eng&amp;#39;&lt;/span&gt; --subtitle-tracks &lt;span class=&#34;s1&#34;&gt;&amp;#39;!4,6&amp;#39;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    ffmpeg -i &lt;span class=&#34;s2&#34;&gt;&amp;#34;tmp_&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; -map &lt;span class=&#34;m&#34;&gt;0&lt;/span&gt; -c copy -c:a libopus -b:a 192k &lt;span class=&#34;s2&#34;&gt;&amp;#34;tmp2_&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    touch -r &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;tmp2_&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    mv &lt;span class=&#34;s2&#34;&gt;&amp;#34;tmp2_&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    rm &lt;span class=&#34;s2&#34;&gt;&amp;#34;tmp_&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;However, now the next step was to get rid of the superfluous &lt;em&gt;mkvmerge&lt;/em&gt; and do it all with the Ever Almighty Multimedia Swiss-Army Knife®, ffmpeg. For that I had to dig quite a bit, but here is the result:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; f in *.mkv&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;do&lt;/span&gt; ffmpeg -i &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; -map &lt;span class=&#34;m&#34;&gt;0&lt;/span&gt; -map -0:a:1 -map -0:s:1 -map -0:s:3 -c copy -c:a libopus -b:a 192k &lt;span class=&#34;s2&#34;&gt;&amp;#34;tmp_&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; touch -r &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;tmp_&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; mv &lt;span class=&#34;s2&#34;&gt;&amp;#34;tmp_&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;$f&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As before we first select all streams via &lt;code&gt;-map 0&lt;/code&gt;, then make use of &lt;a href=&#34;https://trac.ffmpeg.org/wiki/Map&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;negative mapping&lt;/a&gt; (notice the minus sign at the front of the subsequent &lt;code&gt;-map&lt;/code&gt; values) to get rid of the unwanted tracks (second audio track, second and fourth sub tracks&amp;hellip; Beware, this time we are using ffmpeg&amp;rsquo;s indexes/IDs which are relative to the category and 0-indexed). Then it is as before, we copy all remaining streams without changing them (&lt;code&gt;-c copy&lt;/code&gt;) except audio ones which are transcoded to Opus.&lt;/p&gt;
&lt;p&gt;Now this is all well and dandy, but this command runs sequentially, iterating over each file while queuing up the others, disregarding our multicore CPU architecture and thus slowing down the process. How can we run all this concurrently, dispatching a job to each CPU thread?&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.gnu.org/software/parallel/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GNU Parallel&lt;/a&gt;&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt; to the rescue!&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;parallel ffmpeg -i &lt;span class=&#34;o&#34;&gt;{}&lt;/span&gt; -map &lt;span class=&#34;m&#34;&gt;0&lt;/span&gt; -map -0:a:1 -map -0:s:1 -map -0:s:3 -c copy -c:a libopus -b:a 192k tmp_&lt;span class=&#34;o&#34;&gt;{}&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;;&amp;#39;&lt;/span&gt; touch -r &lt;span class=&#34;o&#34;&gt;{}&lt;/span&gt; tmp_&lt;span class=&#34;o&#34;&gt;{}&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;;&amp;#39;&lt;/span&gt; mv tmp_&lt;span class=&#34;o&#34;&gt;{}&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{}&lt;/span&gt; ::: *.mkv
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;admonition info&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Note&lt;/p&gt;
  Of course, overall time will also depend on your storage read/write speeds&amp;hellip;
&lt;/div&gt;
&lt;p&gt;&lt;em&gt;Et voilà&lt;/em&gt;, that&amp;rsquo;s how you &lt;em&gt;efficiently&lt;/em&gt; and &lt;em&gt;stylishly&lt;/em&gt; reduce a bloated 10.9GB series to a lean and mean 4.8GB one. Great success! 👍👏🤗&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;See &lt;a href=&#34;https://kokomins.wordpress.com/2019/10/10/anime-encoding-guide-for-x265-and-why-to-never-use-flac/#why-you-should-never-use-flac&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Why you should never use FLAC&lt;/a&gt; (for that use case that is)&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;See &lt;a href=&#34;https://unix.stackexchange.com/a/104798&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this Unix SE answer&lt;/a&gt; for why Parallel is superior to Xargs in this matter.&amp;#160;&lt;a href=&#34;#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Editor-induced bugs</title>
      <link>https://bastientraverse.com/en/posts/2021-05-02-editor-induced-bugs/</link>
      <pubDate>Sun, 02 May 2021 00:00:00 +0200</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2021-05-02-editor-induced-bugs/</guid>
      <description>&lt;p&gt;While working on this site, I suddenly noticed that an extra space was added after any link, but it was only visible when that link was followed by another character like a parenthesis.&lt;/p&gt;
&lt;p&gt;I dug hard and on a hunch, found that it was caused by my &lt;a href=&#34;https://gitlab.com/neitsab/bastientraverse.com/-/commit/387534693548bdf0e61d62df12f723ac98167f8c&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;recent addition of a render hook for links&lt;/a&gt;. I had simply &lt;a href=&#34;https://gohugo.io/templates/render-hooks/#link-with-title-markdown-example&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;followed the instructions&lt;/a&gt; and added the following snippet in &lt;code&gt;layouts/_default/_markup/render-link.html&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;a&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;href&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;{{ .Destination | safeURL }}&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;with&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Title&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}}&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;title&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;{{ . }}&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;end&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}}{{&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;strings&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;HasPrefix&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Destination&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;&amp;#34;http&amp;#34;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}}&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;target&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;_blank&amp;#34;&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;rel&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;noopener&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{{&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;end&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}}&amp;gt;{{&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;Text&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;safeHTML&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}}&amp;lt;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Eventually, I found this &lt;a href=&#34;https://github.com/gohugoio/hugo/issues/6949&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Hugo bug&lt;/a&gt; that enlightened me: turns out some text editors automatically add a newline at the end of the file on save to comply with the &lt;a href=&#34;https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;POSIX standard definition of a line &lt;/a&gt;(&lt;a href=&#34;https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;source&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;This other &lt;a href=&#34;https://stackoverflow.com/questions/3056740/gedit-adds-line-at-end-of-file&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;StackOverflow thread&lt;/a&gt; lists &lt;a href=&#34;https://web.archive.org/web/20230530154654/https://bugzilla.gnome.org/show_bug.cgi?id=625955&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;some&lt;/a&gt; Gedit &lt;a href=&#34;https://bugzilla.gnome.org/show_bug.cgi?id=526612&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;bugs&lt;/a&gt; where devs don&amp;rsquo;t want to add at least a GUI option to enable/disable the automatic addition of newline (the option now exists in gsettings), nor to simply display it&amp;hellip; Some more discussion of this issue on &lt;a href=&#34;https://discourse.gohugo.io/t/markdown-render-hooks-extra-space/27446&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Hugo Forums&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The Hugo-specific solution was to add a Go template snippet at the end of the render hooks which removes trailing newlines (&lt;a href=&#34;https://discourse.gohugo.io/t/markdown-render-hooks-extra-space/27446/5&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;credit&lt;/a&gt;):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;gh&#34;&gt;diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;gh&#34;&gt;index f04b2e3bda072e15cf8ac7787e37e68744a76048..06727fbe334a084ad29a29a85caf8f3a4fd55bda 100644
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;gh&#34;&gt;&lt;/span&gt;&lt;span class=&#34;gd&#34;&gt;--- a/layouts/_default/_markup/render-link.html
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;gd&#34;&gt;&lt;/span&gt;&lt;span class=&#34;gi&#34;&gt;+++ b/layouts/_default/_markup/render-link.html
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;gi&#34;&gt;&lt;/span&gt;&lt;span class=&#34;gu&#34;&gt;@@ -1 +1,2 @@
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;gu&#34;&gt;&lt;/span&gt; &amp;lt;a href=&amp;#34;{{ .Destination | safeURL }}&amp;#34;{{ with .Title}} title=&amp;#34;{{ . }}&amp;#34;{{ end }}{{ if strings.HasPrefix .Destination &amp;#34;http&amp;#34; }} target=&amp;#34;_blank&amp;#34; rel=&amp;#34;noopener&amp;#34;{{ end }}&amp;gt;{{ .Text | safeHTML }}&amp;lt;/a&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;gi&#34;&gt;+{{- /* This comment removes trailing newlines. */ -}}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Information technology is such a complex interaction of countless moving parts, that I often wonder how it can work and produce any results at all!&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Cryptocurrenshit</title>
      <link>https://bastientraverse.com/en/posts/2021-04-27-cryptocurrenshit/</link>
      <pubDate>Tue, 27 Apr 2021 00:00:00 +0200</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2021-04-27-cryptocurrenshit/</guid>
      <description>&lt;p&gt;From &lt;a href=&#34;https://drewdevault.com/2021/04/26/Cryptocurrency-is-a-disaster.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Cryptocurrency is an abject disaster&lt;/a&gt; by Drew DeVault:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Cryptocurrency is one of the worst inventions of the 21st century. I am ashamed to share an industry with this exploitative grift. It has failed to be a useful currency, invented a new class of internet abuse, further enriched the rich, wasted staggering amounts of electricity, hastened climate change, ruined hundreds of otherwise promising projects, provided a climate for hundreds of scams to flourish, created shortages and price hikes for consumer hardware, and injected perverse incentives into technology everywhere. Fuck cryptocurrency.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Ditto.&lt;/p&gt;
&lt;p&gt;Further reading on this topic on &lt;a href=&#34;https://en.wikipedia.org/wiki/Cryptocurrency#Reception&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Wikipedia&lt;/a&gt;, and for an illustration of the abuse it is causing see &lt;a href=&#34;https://news.ycombinator.com/item?id=26936932&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this Hacker News thread&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2021-07-15&lt;/strong&gt; The creator of Dogecoin shared his view on cryptocurrencies:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;After years of studying it, I believe that cryptocurrency is an inherently right-wing, hyper-capitalistic technology built primarily to amplify the wealth of its proponents through a combination of tax avoidance, diminished regulatory oversight and artificially enforced scarcity.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href=&#34;https://mobile.twitter.com/ummjackson/status/1415353984617914370&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Full Twitter thread&lt;/a&gt; / &lt;a href=&#34;https://news.ycombinator.com/item?id=27841947&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HN submission&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2021-10-07&lt;/strong&gt; &lt;a href=&#34;https://ic.unicamp.br/~stolfi/bitcoin/2020-12-31-bitcoin-ponzi.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Bitcoin is a Ponzi scheme&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2021-10-13&lt;/strong&gt; Cryptocurrencies expose you to the risk of developing a form of &lt;a href=&#34;https://castlecraig.co.uk/treatment/behavioral-addictions/bitcoin-addiction-treatment&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;gambling addiction&lt;/a&gt; (on a personal note, I had these exact same symptoms the one and only time I got into the cryptocurren-shit show, when trying to convert in fiat Lumens received from a Keybase initiative. Damn did I get a bad couple of hours stressing over all the parameters and trying to maximize profit&amp;hellip;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2022-01-15&lt;/strong&gt; &amp;hellip; And it&amp;rsquo;s not like &lt;a href=&#34;https://blog.mollywhite.net/its-not-still-the-early-days/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;it was still crypto early days&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2022-02-12&lt;/strong&gt; A very excellent scholarly lecture: &lt;a href=&#34;https://blog.dshr.org/2022/02/ee380-talk.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Can We Mitigate Cryptocurrencies’ Externalities?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2022-02-15&lt;/strong&gt; Here is a &lt;a href=&#34;https://twitter.com/thomasg_eth/status/1492663192404779013&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Twitter thread&lt;/a&gt; where a prominent cryptocurrenshit holder explains how he was victim of a refined scam and very nearly lost all of his millions.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;takeaway n°1: even being super knowledgeable about this space doesn&amp;rsquo;t shield you from those tricky schemes. So what about the average Joes and Janes?&lt;/li&gt;
&lt;li&gt;takeaway n°2: Ethereum-adjacent discourse is straight up alien speak to me. Even though I generally feel rather proficient on the intellectual level, I&amp;rsquo;m still dumbfounded when I read the kind of mumble-jumble this thread is riped with. And in a very different way than when I&amp;rsquo;m reading something technical in a field I am not acquainted with, like say particle physics or philology. The closest thing I can compare it with is global finance, which to me says a lot about the &lt;a href=&#34;https://en.wikipedia.org/wiki/Habitus_%28sociology%29&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;habitus&lt;/a&gt; that governs the field of cryptocurrency&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See also the related &lt;a href=&#34;https://news.ycombinator.com/item?id=30322715&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HN thread&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2022-05-15&lt;/strong&gt; &lt;a href=&#34;https://www.currentaffairs.org/2022/05/why-this-computer-scientist-says-all-cryptocurrency-should-die-in-a-fire/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;All Cryptocurrency Should “Die in a Fire”&lt;/a&gt; &amp;ndash; &lt;a href=&#34;https://news.ycombinator.com/item?id=31376192&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HN thread&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2022-06-23&lt;/strong&gt; &lt;a href=&#34;https://medium.com/@michelcryptdamus/cryptocurrency-is-a-hideous-monstrosity-made-out-of-computers-and-greed-that-must-be-destroyed-99c26a1bbbaf&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Bitcoin Is A Hideous Monstrosity Made Out Of Computers And Greed That Must Be Destroyed Before It Devours The World&lt;/a&gt; &amp;ndash; [HN thread]](&lt;a href=&#34;https://news.ycombinator.com/item?id=31833316&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://news.ycombinator.com/item?id=31833316&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2022-06-24&lt;/strong&gt; Alright that&amp;rsquo;s it, even &lt;a href=&#34;https://www.schneier.com/blog/archives/2022/06/on-the-dangers-of-cryptocurrencies-and-the-uselessness-of-blockchain.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Bruce Schneier is against cryptocurrenshit&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2023-02-09&lt;/strong&gt; &lt;a href=&#34;https://www.stephendiehl.com/blog/crypto-is-a-scam.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Yes, Crypto is ALL a Scam&lt;/a&gt; &amp;ndash; &lt;a href=&#34;https://news.ycombinator.com/item?id=34691425&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HackerNews discussion&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2023-05-30&lt;/strong&gt; &lt;a href=&#34;https://web3isgoinggreat.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Web3 is doing just great&lt;/a&gt; &amp;hellip;and is definitely not an enormous grift that&amp;rsquo;s pouring lighter fluid on our already smoldering planet &amp;ndash; from &lt;a href=&#34;https://news.ycombinator.com/item?id=36128484&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HN thread&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Hugo on Vercel</title>
      <link>https://bastientraverse.com/en/posts/2021-04-26-hugo-vercel/</link>
      <pubDate>Mon, 26 Apr 2021 00:00:00 +0200</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2021-04-26-hugo-vercel/</guid>
      <description>&lt;p&gt;As an attempt to diversify, I have been using &lt;a href=&#34;https://vercel.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Vercel&lt;/a&gt; to build and host this website since its inception, as opposed to going with the more common choice of &lt;a href=&#34;https://www.netlify.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Netlify&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After being pleasantly surprised with the initial setup-and-first-build flow (the automatic HTTPS on custom domains is awesome), I stumbled upon something that baffled me: &lt;strong&gt;the default Hugo version Vercel uses to build your site dates from September 2019&lt;/strong&gt;, and you have to jump through hoops to find out about it.&lt;/p&gt;
&lt;h2 id=&#34;getting-the-version-of-hugo-used-to-build-your-site&#34;&gt;&lt;a href=&#34;#getting-the-version-of-hugo-used-to-build-your-site&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Getting the version of Hugo used to build your site&lt;/h2&gt;&lt;p&gt;This came out due to the many discrepancies I was seeing between my local dev version (using the latest and shiniest &lt;code&gt;v0.82.1&lt;/code&gt;) and the deployed site. It took me a couple of weeks before I realized that Vercel was not using the latest stable version as I was naïvely thinking, but was in fact using version&amp;hellip; &lt;code&gt;0.58.2&lt;/code&gt; from &lt;strong&gt;2019-09-13&lt;/strong&gt;!! 😨&lt;/p&gt;
&lt;p&gt;In order to get this basic information, you need to &lt;a href=&#34;https://github.com/vercel/vercel/discussions/5834#discussioncomment-362986&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;change the build command&lt;/a&gt; to something like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;hugo version &amp;amp;&amp;amp; hugo -D --gc
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I&amp;rsquo;d hope Vercel would make this the default build command, as this undocumented&lt;sup&gt;[&lt;a href=&#34;https://vercel.com/guides/deploying-hugo-with-vercel?query=hugo#optional:-define-a-hugo-version&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;1&lt;/a&gt;][&lt;a href=&#34;https://vercel.com/docs/build-step#framework-versioning&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;2&lt;/a&gt;]&lt;/sup&gt; peculiarity made my first blog-and-deploy experience far more annoying than it ought to be.&lt;/p&gt;
&lt;p&gt;I really don&amp;rsquo;t understand why they&amp;rsquo;d use such an outdated version, without even so much as a warning. Quite some things happened in Hugo-land since the somewhat &amp;ldquo;dramatic&amp;rdquo; &lt;a href=&#34;https://gohugo.io/news/0.60.0-relnotes/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;changes in v0.60&lt;/a&gt;, which may have prompted this version pinning.&lt;/p&gt;
&lt;div class=&#34;admonition tip&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Tip&lt;/p&gt;
  If someone at Vercel reads this, please either use the latest version by default or include the one you are using in your Docs and offer a way to specify a &amp;ldquo;latest&amp;rdquo; as the &lt;code&gt;HUGO_VERSION&lt;/code&gt; environment variable.
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Blogging from a smartphone for tech-savvy people</title>
      <link>https://bastientraverse.com/en/posts/2020-01-21-smartphone-blogging/</link>
      <pubDate>Tue, 21 Jan 2020 00:00:00 +0100</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2020-01-21-smartphone-blogging/</guid>
      <description>&lt;p&gt;In this post we will see how to create and publish a blog using a smartphone, all the while flexing some serious tech chops.&lt;/p&gt;
&lt;h2 id=&#34;requirements&#34;&gt;&lt;a href=&#34;#requirements&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Requirements:&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;a smartphone running Android&lt;/li&gt;
&lt;li&gt;the &lt;a href=&#34;https://termux.com&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Termux&lt;/a&gt; app with &lt;code&gt;git&lt;/code&gt; and &lt;code&gt;hugo&lt;/code&gt; installed (&lt;code&gt;pkg install git hugo&lt;/code&gt;) and properly &lt;a href=&#34;https://wiki.termux.com/wiki/Termux-setup-storage&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;configured&lt;/a&gt; to access the &lt;a href=&#34;https://wiki.termux.com/wiki/Internal_and_external_storage&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;local storage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;a &lt;a href=&#34;https://play.google.com/store/search?q=git%20client&amp;amp;c=apps&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;git client&lt;/a&gt; (Play store link) like the older but quite functional &lt;a href=&#34;https://play.google.com/store/apps/details?id=ch.phcoder.jigit&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Forker&lt;/a&gt; app for easy graphical interactions with git (commit, push&amp;hellip;): especially useful on the long run for a smoother publishing experience, but you may also exclusively use the command line for increased hacker-cred&lt;/li&gt;
&lt;li&gt;a text editor: I strongly recommend &lt;a href=&#34;https://mixplorer.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MiXplorer&lt;/a&gt; (free on &lt;a href=&#34;https://labs.xda-developers.com/store/app/com.mixplorer&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;XDA Labs&lt;/a&gt; or support version in the Play Store), which provides editors suitable for both code and text and is an amazing file explorer all around; &lt;a href=&#34;https://gsantner.net/project/markor.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Markor&lt;/a&gt; is a good second choice&lt;/li&gt;
&lt;li&gt;accounts on compatible git hosting and CDN deployment services (I&amp;rsquo;ll be using &lt;a href=&#34;https://about.gitlab.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitLab&lt;/a&gt; and &lt;a href=&#34;https://vercel.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Vercel&lt;/a&gt;): although the CDN part is optional, it provides some nice benefits and a smoother experience overall than e.g. GitHub/GitLab Pages&lt;/li&gt;
&lt;li&gt;a mobile browser (I recommend &lt;a href=&#34;https://play.google.com/store/apps/details?id=org.mozilla.firefox&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Firefox for Android&lt;/a&gt;) and of course&amp;hellip; Internet access 😁&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;instructions&#34;&gt;&lt;a href=&#34;#instructions&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Instructions:&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;create a new empty project on GitLab and clone it in Termux/Forker (&lt;strong&gt;tip:&lt;/strong&gt; use the HTTPS URL in Termux to avoid having to install and setup openssh)&lt;/li&gt;
&lt;li&gt;in Termux, &lt;code&gt;cd&lt;/code&gt; to the repo folder (&lt;code&gt;~/storage/shared/Android/data/ch.phcoder.jigit/files/repo/*name*&lt;/code&gt; if using Forker) and run &lt;code&gt;hugo create site . -f&lt;/code&gt; in it&lt;/li&gt;
&lt;li&gt;follow &lt;a href=&#34;https://gohugo.io/getting-started/quick-start/#step-3-add-a-theme&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Hugo Quick Start Guide&lt;/a&gt; to add a theme and some content to your site&lt;/li&gt;
&lt;li&gt;check that everything is working as intended by running &lt;code&gt;hugo server -D&lt;/code&gt; and opening &lt;a href=&#34;http://localhost:1313&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;http://localhost:1313&lt;/a&gt; in your browser&lt;/li&gt;
&lt;li&gt;then commit and push your site to GitLab through Termux/Forker&lt;/li&gt;
&lt;li&gt;now follow the official Vercel guide for &lt;a href=&#34;https://vercel.com/guides/deploying-hugo-with-vercel#step-2:-deploy-your-hugo-website-with-vercel&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;deploying a Hugo site&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;finally, enjoy your new blog created on your smartphone and available worldwide! 👍&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;going-further&#34;&gt;&lt;a href=&#34;#going-further&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Going further:&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://gohugo.io/getting-started/configuration/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;customize your site&lt;/a&gt; to suit your needs&lt;/li&gt;
&lt;li&gt;set up a &lt;a href=&#34;https://vercel.com/docs/custom-domains&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;custom domain&lt;/a&gt; and enjoy the automatic HTTPS (really smoothly done by Vercel) to be a good netizen&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now whenever you want to add some content to your blog, just create a new post in the proper folder either using &lt;code&gt;hugo new posts/post_title&lt;/code&gt; in Termux or directly via your text editor, commit and push your changes and your updated site will be automagically deployed. You are officially equipped to blog on the go while roaming the vast world! Great success✌&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Data transmission</title>
      <link>https://bastientraverse.com/en/posts/2015-07-29-data-transmission/</link>
      <pubDate>Wed, 29 Jul 2015 00:00:00 +0200</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2015-07-29-data-transmission/</guid>
      <description>&lt;p&gt;Everything &amp;ldquo;digital&amp;rdquo;, everything related to computers is based on signal and quantization theories.&lt;/p&gt;
&lt;p&gt;Today I was considering the following question: &amp;ldquo;How do electricity and light convey information?&amp;rdquo;. It seemed incomprehensible to me that we could vehicle structured information via those raw streams of particles. How is it possible to give electrons a specific meaning, like to register this text I am writing and send it over various types of wire (copper and optic fiber)?&lt;/p&gt;
&lt;p&gt;I picture the phone line getting out of my house and my home modem-router plugged in it. &lt;em&gt;Everything&lt;/em&gt; Internet related goes through this one copper wire. How is it possible that TV shows, distro images and other emails and web pages are transported by mere unformed electrons? This all seems really mysterious to me, and piqued my interest tonight.&lt;/p&gt;
&lt;p&gt;So after searching a bit I ended up on Wikipedia&amp;rsquo;s &lt;a href=&#34;https://en.wikipedia.org/wiki/Data_transmission&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;data transmission&lt;/a&gt; article via the marvelous process of serendipity, and all my answers started getting answered.&lt;/p&gt;
&lt;p&gt;(To be fair, I got a quick and useful answer from &lt;a href=&#34;http://www.tigoe.com/pcomp/code/circuits/understanding-electricity/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this site&lt;/a&gt; which gathers a few key concepts about electricity and drops in its intro the core of our question).&lt;/p&gt;
&lt;p&gt;So as a matter of fact and to cut the suspense out, information can be coded into electricity and light not by modifying the inner particles but by shaping variations of their flow and parsing those on the receiving end.&lt;/p&gt;
&lt;p&gt;In other words, &lt;em&gt;standardized operations are applied to transported streams that make up the encoding&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;And for the full blown explanation: &lt;a href=&#34;https://en.wikipedia.org/wiki/Physical_layer&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;physical layer&lt;/a&gt; (OSI model), Wikipedia.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Addendum (2022-03-11):&lt;/strong&gt; There is a wonderful book about this exact topic that often gets recommended on Hacker News, &lt;a href=&#34;https://en.wikipedia.org/wiki/Code%3A_The_Hidden_Language_of_Computer_Hardware_and_Software&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Code: The Hidden Language of Computer Hardware and Software&lt;/a&gt; by Charles Petzold. It starts off from the predecessors of digital signal, Morse code, Braille and other ways of encoding information through normalized signals, and then retraces the evolution from there all the way to modern computing. Truly a didactic masterpiece interspersed with many other helpful experiments/practical bits.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>ffmpeg set sub as default</title>
      <link>https://bastientraverse.com/en/posts/2015-05-01-ffmpeg-default-sub/</link>
      <pubDate>Fri, 01 May 2015 00:00:00 +0200</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2015-05-01-ffmpeg-default-sub/</guid>
      <description>&lt;p&gt;Copy of my &lt;a href=&#34;https://superuser.com/q/700082/393261&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;answer&lt;/a&gt; to the question &amp;ldquo;&lt;a href=&#34;https://superuser.com/questions/700082/is-there-an-option-in-ffmpeg-to-specify-a-subtitle-track-that-should-be-shown-by&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Is there an option in ffmpeg to specify a subtitle track that should be shown by default?&lt;/a&gt;&amp;rdquo; on superuser:&lt;/p&gt;
&lt;blockquote&gt;
&lt;h2 id=&#34;no-there-isnt-an-option-in-ffmpeg-to-specify-a-subtitle-track-that-should-be-shown-by-default&#34;&gt;&lt;a href=&#34;#no-there-isnt-an-option-in-ffmpeg-to-specify-a-subtitle-track-that-should-be-shown-by-default&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;No, there isn&amp;rsquo;t an option in ffmpeg to specify a subtitle track that should be shown by default.&lt;/h2&gt;&lt;p&gt;(ffmpeg version 2.6.1 built with gcc 4.9.2 (GCC) 20150304 (prerelease) as default on Arch, see end of answer for compile flags)&lt;/p&gt;
&lt;p&gt;Resources highlighting the lack of command line options for setting default/forced subtitles stream in ffmpeg include the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://ffmpeg.org/pipermail/ffmpeg-user/2012-October/010769.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this Oct. 2012 mailing list thread&lt;/a&gt; (which delves in the matroska format and explains that ffmpeg doesn&amp;rsquo;t write in the required fields)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://ffmpeg.org/pipermail/ffmpeg-user/2013-January/012997.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this Jan. 2013 thread&lt;/a&gt; (shows the lack of interest of ffmpeg devs for this)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://ffmpeg.org/pipermail/ffmpeg-user/2014-January/019641.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this Jan. 2014 thread&lt;/a&gt; (asks about flipping the default flag in Matroska container, to no avail)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=2254&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this very recent forum post&lt;/a&gt; (MP4, zeranoe ffmeg forums)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Finally, &lt;a href=&#34;https://stackoverflow.com/questions/26956762/ffmpeg-set-subtitles-track-as-default&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this question&lt;/a&gt; on StackOverflow asks the same as you but for mkv, and highlights the fact that ffmpeg is the culprit since &lt;a href=&#34;https://www.bunkus.org/videotools/mkvtoolnix/doc/mkvpropedit.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;mkvpropedit&lt;/a&gt; (part of &lt;em&gt;mkvtoolnix&lt;/em&gt;) can do it.&lt;/p&gt;
&lt;h3 id=&#34;however-there-is-a-potential-workaround&#34;&gt;&lt;a href=&#34;#however-there-is-a-potential-workaround&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;However, there is a potential workaround&lt;/h3&gt;&lt;p&gt;&lt;a href=&#34;https://trac.ffmpeg.org/ticket/2402&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;This March 2013 ffmpeg bug report&lt;/a&gt;  (still open) deals with mkv and default flag for subtitles and explains something that we can use to circumvent this limitation in some scenarios:&lt;/p&gt;
&lt;p&gt;The Matroska specification - ​http://matroska.org/technical/specs/index.html (search for FlagDefault) - specifies that the value for the default flag is &amp;ldquo;default&amp;rdquo; if nothing is specified, the demuxer therefore marks all subtitle tracks as &amp;ldquo;default&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;So ffmpeg &lt;em&gt;may&lt;/em&gt; write the default flag on our subtitles stream in some cases; I tried it with different input video files and got mixed results:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;with the &lt;a href=&#34;https://peach.blender.org/download/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Big Buck Bunny&lt;/a&gt; AVI Mpeg4  and a random .srt file, the remuxed mkv subtitles stream &lt;strong&gt;did&lt;/strong&gt; have the default flag:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  $ ffmpeg -i big_buck_bunny_480p_surround-fix.avi -i subtitle.srt -c copy test.mkv
  $ ffmpeg -i test.mkv
  Input #0, matroska,webm, from &#39;test.mkv&#39;:
    Metadata:
      ENCODER         : Lavf56.25.101
    Duration: 00:28:31.40, start: 0.000000, bitrate: 1028 kb/s
      Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 854x480 [SAR 1:1 DAR 427:240], 24 fps, 24 tbr, 1k tbn, 24 tbc (default)
      Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
      Stream #0:2: Subtitle: subrip (default)
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;however I couldn&amp;rsquo;t reproduce this with a &lt;a href=&#34;http://techslides.com/sample-webm-ogg-and-mp4-video-files-for-html5&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;sample mp4-contained H264 sample&lt;/a&gt; neither with a personal mp4, so I guess &lt;code&gt;mp4 --&amp;gt; mkv&lt;/code&gt; doesn&amp;rsquo;t work. But what if&amp;hellip;?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  $ ffmpeg -i sample.mp4 -c copy sample.avi
  $ ffmpeg -i sample.avi -i subtitle.srt -c copy sample.mkv
  $ ffmpeg -i sample.mkv
  ...
Input #0, matroska,webm, from &#39;sample.mkv&#39;:
  Metadata:
	ENCODER         : Lavf56.25.101
  Duration: 00:28:31.40, start: 0.000000, bitrate: 2 kb/s
	Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(tv, bt709), 560x320, SAR 1:1 DAR 7:4, 60 fps, 60 tbr, 1k tbn, 60 tbc (default)
	Stream #0:1: Audio: aac (LC), 48000 Hz, mono, fltp (default)
	Stream #0:2: Subtitle: subrip (default)
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;VICTORY!&lt;/strong&gt; Doing &lt;code&gt;mp4 --&amp;gt; avi&lt;/code&gt; and then &lt;code&gt;avi + srt --&amp;gt; mkv&lt;/code&gt; gets the subtitles stream on by default and VLC displays them correctly.&lt;/p&gt;
&lt;p&gt;Sure that&amp;rsquo;s very roundabout and I&amp;rsquo;d rather not think of the information loss in the process, but at least it works.&lt;/p&gt;
&lt;h3 id=&#34;summary&#34;&gt;&lt;a href=&#34;#summary&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Summary&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;ffmpeg is definitely not adapted right now for setting streams as default or forced,&lt;/li&gt;
&lt;li&gt;mkv is probably better than mp4 as an origin container, since it has a known tool doing the job fine (&lt;a href=&#34;https://www.bunkus.org/videotools/mkvtoolnix/doc/mkvpropedit.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;mkvpropedit&lt;/a&gt; from &lt;em&gt;mkvtoolnix&lt;/em&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;ffmpeg-version-details&#34;&gt;&lt;a href=&#34;#ffmpeg-version-details&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;ffmpeg version details:&lt;/h4&gt;&lt;p&gt;&lt;code&gt;ffmpeg version 2.6.1 built with gcc 4.9.2 (GCC) 20150304 (prerelease) configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-runtime-cpudetect --enable-shared --enable-swresample --enable-vdpau --enable-version3 --enable-x11grab&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
    </item>
    
  </channel>
</rss>
