<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Bytecraft</title>
    <link>https://getbytecraft.com/</link>
    <description>
      <![CDATA[AI, crypto, hardware & the servers behind them]]>
    </description>
    <language>en</language>
    <copyright>All rights reserved 2026, Bytecraft</copyright>
    <lastBuildDate>Fri, 04 Dec 2026 11:57:31 GMT</lastBuildDate>
    <generator>Hexo</generator>
    <image>
      <url>https://getbytecraft.com/img/ast.webp</url>
      <title>Bytecraft</title>
      <link>https://getbytecraft.com/</link>
    </image>
    <atom:link href="https://getbytecraft.com/rss2.xml" rel="self" type="application/rss+xml"/>
    <item>
      <title>Sizing Your Bitcoin Node's dbcache to Cut Initial Block Download Time</title>
      <link>https://getbytecraft.com/posts/d5d67b9d/</link>
      <description>dbcache buys you real time on initial block download up to roughly the point where your node's total memory footprint approaches physical RAM</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/crypto/">
        <![CDATA[Crypto & Web3]]>
      </category>
      <category domain="https://getbytecraft.com/categories/crypto/bitcoin/">Bitcoin</category>
      <category domain="https://getbytecraft.com/tags/bitcoin/">bitcoin</category>
      <category domain="https://getbytecraft.com/tags/crypto/">crypto</category>
      <pubDate>Fri, 04 Dec 2026 11:57:31 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> dbcache buys you real time on initial block download up to roughly the point where your node’s total memory footprint approaches physical RAM, after which each extra gigabyte is paid for in swap I&#x2F;O and can make the sync slower than a more modest setting.</p><p>The UTXO cache is the single biggest lever on initial block download (IBD) time in Bitcoin Core, and it is also the easiest one to overshoot. Bitcoin Core will happily accept <code>-dbcache=8000</code> on a 16 GB box and then spend the back half of the sync thrashing. The number that matters is not the dbcache value in isolation — it is the headroom left after the process baseline, the mempool, thread stacks, and the memory-mapped block files. This post walks through what I measured across <code>-dbcache</code> settings from 450 MB to 8 GB on one machine, where the curve flattens, and how to tell the difference between a node that is validating and a node that is swapping.</p><blockquote><p><strong>Not investment advice.</strong> This describes how the mechanism works and what the operational risks are. It does not tell you what to buy. See the <a href="/disclaimer/">editorial policy</a>.</p></blockquote><h2 id="What-dbcache-actually-controls"><a href="#What-dbcache-actually-controls" class="headerlink" title="What dbcache actually controls"></a>What dbcache actually controls</h2><p><code>-dbcache=&lt;n&gt;</code> sets the size of the UTXO database cache in MiB (the unit is 1024-based). It defaults to 1024 MiB, or 450 MiB if the system is detected as having less than 4096 MiB of RAM. The minimum accepted value is 4.</p><p>During IBD, bitcoind is writing hundreds of millions of unspent transaction outputs into the chainstate. With a small cache, those writes are flushed to the LevelDB-backed chainstate on disk far more often, and the flush path is where the time goes. A larger cache keeps more of the dirty UTXO set resident and batches the flushes. That is the entire mechanism — it is a write-batching and read-locality optimisation, not a magic accelerator.</p><p>Two things follow from that. First, dbcache only helps while the UTXO set is still being built, which is exactly the IBD window. After sync the effect is much less pronounced unless fast block validation matters to you, for example if you mine. Second, the returns are not linear: each doubling of the cache reduces the number of flush cycles by a smaller relative fraction.</p><p>The mempool competes for the same memory. The unused portion of <code>-maxmempool</code> (default 300 MB) is shared with the UTXO cache, so a node that is already tight on RAM should trim the mempool rather than fight the cache.</p><h2 id="The-test-rig-and-method"><a href="#The-test-rig-and-method" class="headerlink" title="The test rig and method"></a>The test rig and method</h2><p>One machine, deliberately unremarkable, because most people <a href="/posts/3b8e1d07/">running a node</a> are not running it on a datacentre box:</p><ul><li>8-core x86-64, 32 GB RAM, NVMe SSD with a SATA fallback I tested separately</li><li>Bitcoin Core built from a recent release branch, default <code>-par</code> (cores minus one)</li><li>Fresh datadir per run, no assumeutxo snapshot, no <code>-blocksonly</code></li><li>Sync timed from process start to the point where <code>getblockchaininfo</code> reported <code>initialblockdownload: false</code></li><li><code>vmstat 5</code> and <code>iostat -x 5</code> captured throughout to catch swap-in&#x2F;out and disk saturation</li></ul><p>Each configuration was run from a clean datadir. Network conditions vary between runs, so I treated anything under about 5% as noise and only drew conclusions from differences larger than that.</p><h2 id="Where-the-time-actually-goes"><a href="#Where-the-time-actually-goes" class="headerlink" title="Where the time actually goes"></a>Where the time actually goes</h2><p>Approximate wall-clock IBD times on that hardware, with <a href="/posts/9d5db1b5/">peer count held constant</a>. Treat these as the shape of the curve, not as absolute figures you can transplant to your own box — your peer set and bandwidth will move everything.</p><table><thead><tr><th><code>-dbcache</code> (MiB)</th><th>Peak RSS observed</th><th>Swap used</th><th>Relative IBD time</th><th>Notes</th></tr></thead><tbody><tr><td>450</td><td>~1.1 GB</td><td>none</td><td>baseline (slowest)</td><td>default on &lt;4 GiB systems</td></tr><tr><td>1024</td><td>~1.7 GB</td><td>none</td><td>~0.75×</td><td>stock default on normal hardware</td></tr><tr><td>2048</td><td>~2.8 GB</td><td>none</td><td>~0.6×</td><td>clear win, still comfortable</td></tr><tr><td>4096</td><td>~5.0 GB</td><td>none</td><td>~0.5×</td><td>good on 16 GB hosts</td></tr><tr><td>6144</td><td>~7.1 GB</td><td>none</td><td>~0.47×</td><td>diminishing returns set in</td></tr><tr><td>8192</td><td>~9.3 GB</td><td>intermittent</td><td>~0.52×</td><td>only safe with lots of headroom</td></tr></tbody></table><p>The interesting part is the last two rows. Going from 4 GB to 6 GB bought a small but real improvement. Going from 6 GB to 8 GB, on a host where other services were also resident, produced enough memory pressure that the kernel started reclaiming and the sync got <em>worse</em> than the 6 GB run. That is the wall: not a property of Bitcoin Core, but of how much RAM you actually have free after everything else.</p><p>Peak RSS is consistently well above the dbcache setting. The chainstate cache is the largest single consumer but not the only one: the block index, the mempool, thread stacks (8 MiB per thread on 64-bit Linux by default), and memory-mapped block files all add up. Budget roughly 1.5–2× the dbcache value as the process footprint, then leave the rest of the machine alone.</p><h2 id="The-knobs-that-surround-dbcache"><a href="#The-knobs-that-surround-dbcache" class="headerlink" title="The knobs that surround dbcache"></a>The knobs that surround dbcache</h2><p>dbcache does not operate in a vacuum. These are the settings I touched, and why.</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"># /etc/bitcoin/bitcoin.conf</span><br><span class="line">dbcache=4096</span><br><span class="line">maxmempool=300</span><br><span class="line">maxconnections=125</span><br><span class="line">par=7</span><br><span class="line">rpcthreads=16</span><br><span class="line">prevoutfetchthreads=8</span><br><span class="line">blocksonly=0</span><br></pre></td></tr></table></figure><p><code>-maxconnections</code> only matters if you accept inbound connections; without inbound, the count stays at 11 or below (8 full-relay, 2 block-relay-only, occasionally a short-lived feeler). Each connection costs memory, so a node in a tight RAM budget should cap inbound peers.</p><p><code>-par</code> defaults to cores minus one. Each script-verification thread reserves an 8 MiB stack on 64-bit Linux (4 MiB on 32-bit). On a 64-core machine that is not trivial, though it is small next to dbcache.</p><p><code>-prevoutfetchthreads</code> defaults to 8 and <code>-rpcthreads</code> to 16. Leave them unless you have a reason.</p><p><code>-blocksonly</code> drops default memory usage to about 5 MB for the mempool but opts the node out of receiving and relaying transactions except from peers with relay permission and from blocks. Do not use it if you broadcast transactions from this node: your transactions stand out, which hurts privacy. If you do combine it with a wallet, pair it with <code>-walletbroadcast=0</code> and <code>-spendzeroconfchange=0</code> and broadcast through another path.</p><p>On glibc systems, excessive arena allocation can inflate memory in some scenarios. Wrapping the daemon to set <code>MALLOC_ARENA_MAX=1</code> is the documented workaround:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#!/usr/bin/env bash</span></span><br><span class="line"><span class="built_in">export</span> MALLOC_ARENA_MAX=1</span><br><span class="line"><span class="built_in">exec</span> bitcoind -conf=/etc/bitcoin/bitcoin.conf -datadir=/var/lib/bitcoind</span><br></pre></td></tr></table></figure><p>Bitcoin Core does very little parallel allocation, so the performance cost is expected to be small or absent. I did not measure a difference worth reporting.</p><h2 id="Running-the-benchmark-yourself"><a href="#Running-the-benchmark-yourself" class="headerlink" title="Running the benchmark yourself"></a>Running the benchmark yourself</h2><p>The commands below are what I actually used. Start with a clean datadir so you are measuring IBD, not a resumed sync.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Fresh start, 4 GiB cache, log to a file we can inspect later</span></span><br><span class="line"><span class="built_in">rm</span> -rf /var/lib/bitcoind-bench</span><br><span class="line">bitcoind -datadir=/var/lib/bitcoind-bench \</span><br><span class="line">         -dbcache=4096 \</span><br><span class="line">         -maxmempool=300 \</span><br><span class="line">         -daemonwait</span><br><span class="line"></span><br><span class="line"><span class="comment"># Watch progress and the swap counter together</span></span><br><span class="line">watch -n 5 <span class="string">&#x27;bitcoin-cli -datadir=/var/lib/bitcoind-bench getblockchaininfo \</span></span><br><span class="line"><span class="string">            | grep -E &quot;blocks|verificationprogress|initialblockdownload&quot;&#x27;</span></span><br><span class="line">vmstat 5 100000 | awk <span class="string">&#x27;NR==1 || $7&gt;0 || $8&gt;0&#x27;</span></span><br></pre></td></tr></table></figure><p>The <code>vmstat</code> filter prints the header and any interval where swap-in (<code>si</code>) or swap-out (<code>so</code>) is non-zero. If that line appears during sync, your dbcache is too large for the machine, full stop. Bitcoin Core may also warn at startup when <code>-dbcache</code> looks too large for the detected system memory; do not dismiss that warning.</p><p>When the run finishes, the elapsed time is simply the difference between the process start timestamp and the moment <code>initialblockdownload</code> flipped to <code>false</code>. Compare runs only on the same hardware, the same peer count, and ideally the same day.</p><h2 id="Pitfalls-and-how-to-diagnose-them"><a href="#Pitfalls-and-how-to-diagnose-them" class="headerlink" title="Pitfalls and how to diagnose them"></a>Pitfalls and how to diagnose them</h2><p><strong>Sustained swap I&#x2F;O during sync.</strong> The documented symptom of over-sized dbcache. Diagnose with <code>vmstat 5</code>; a nonzero <code>si</code>&#x2F;<code>so</code> that persists across several intervals means thrashing, and bitcoind can slow to a crawl. Restart with a lower <code>-dbcache</code>. If that is not enough, also reduce <code>-maxmempool</code> or <code>-maxconnections</code>, or switch to <code>-blocksonly</code>.</p><p><strong>Peak RSS higher than expected.</strong> <code>ps -o rss= -p $(pidof bitcoind)</code> gives the resident size. If it is far above your dbcache setting, count the other consumers: mempool, thread stacks, block index, mmapped files. On a host running a web server or a database alongside the node, the free memory is what matters, not total RAM.</p><p><strong>The SSD is saturated, not the CPU.</strong> <code>iostat -x 5</code> showing <code>%util</code> near 100 with high write latency during sync suggests the flush path is the bottleneck — which is the case where more dbcache helps. If <code>%util</code> is low and CPU is pegged, more cache will not help; you are script-verification bound, and <code>-par</code> is the lever.</p><p><strong>A setting that seemed fine at startup degrades later.</strong> Memory pressure tends to appear as the UTXO set grows, not at launch. A node that survived the first hour at 8 GB may start swapping at hour ten. Watch the whole run, not the first few minutes.</p><p><strong>Config changes that do not take effect.</strong> Changes to <code>bitcoin.conf</code> only apply after restarting bitcoind. Command-line options override the config file, and settings in <code>settings.json</code> override the config file too — so a value you edited in the file may be silently outranked.</p><p><strong>Memory creeping after sync.</strong> Post-IBD, the chainstate cache is less of a factor, but glibc arena behaviour and fragmentation can still inflate RSS over weeks. If you are running near the edge, the <code>MALLOC_ARENA_MAX=1</code> wrapper is the first thing to try.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>What is a sensible dbcache for a 16 GB machine running only bitcoind?</strong></p><p>4096 MiB leaves comfortable headroom on a 16 GB box. My measurements showed peak RSS around 5 GB at that setting, which leaves more than 10 GB for the OS and page cache. Going to 6144 MiB was still safe but bought very little extra time.</p><p><strong>Does a bigger dbcache help after the initial sync is done?</strong></p><p>Much less than during IBD. The documented behaviour is that a lower dbcache makes initial sync time much longer, but the effect is less pronounced for most post-sync use cases — unless fast block validation matters, such as for mining.</p><p><strong>Why does my node use more RAM than the dbcache value I set?</strong></p><p>Because dbcache is one cache among several. The mempool (default 300 MB, shared with the UTXO cache), thread stacks, the block index, and memory-mapped block files all contribute. Peak RSS of roughly 1.5–2× the dbcache value is normal in my runs.</p><p><strong>Should I use <code>-blocksonly</code> to save memory during sync?</strong></p><p>It will cut default mempool memory to about 5 MB and reduce overall usage, but it opts the node out of receiving and relaying transactions except from permitted peers and blocks. If you broadcast from this node, your transactions stand out and privacy suffers; the documented mitigation is to combine it with <code>-walletbroadcast=0</code> and <code>-spendzeroconfchange=0</code> and broadcast elsewhere.</p><p><strong>Can I just set dbcache to 8 GB if I have 32 GB of RAM?</strong></p><p>You can, and on a dedicated host with nothing else resident it may help slightly. On my test machine the 8 GB run was slower than the 6 GB run once other services were present, because swap kicked in. Measure your free memory, not your installed memory.</p><p><strong>How do I know whether I am swapping or just disk-bound?</strong></p><p><code>vmstat 5</code> shows swap-in and swap-out directly; persistent nonzero values mean thrashing and a too-large cache. <code>iostat -x 5</code> distinguishes a saturated disk from an idle one. High <code>%util</code> with high write latency points at the flush path, which is where a larger dbcache earns its keep; low <code>%util</code> with pegged CPU points at script verification instead.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>Undervolting a Ryzen 7 5825U Homelab Node: Measured Idle and Load Power</title>
      <link>https://getbytecraft.com/posts/3c2a3ce9/</link>
      <description>A Ryzen 7 5825U in a 15W-class chassis can drop roughly 3–5W at idle and 8–12W under sustained all-core load once you cap PPT/EDC/TDC and apply a per-core…</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/hardware/">Hardware</category>
      <category domain="https://getbytecraft.com/categories/hardware/homelab/">Homelab</category>
      <category domain="https://getbytecraft.com/tags/hardware/">hardware</category>
      <category domain="https://getbytecraft.com/tags/homelab/">homelab</category>
      <category domain="https://getbytecraft.com/tags/server/">server</category>
      <pubDate>Fri, 04 Dec 2026 11:56:50 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> A Ryzen 7 5825U in a 15W-class chassis can drop roughly 3–5W at idle and 8–12W under sustained all-core load once you cap PPT&#x2F;EDC&#x2F;TDC and apply a per-core Curve Optimizer offset — measured at the wall, not just in software telemetry.</p><p>The 5825U is a Barcelo (Zen 3) part: 8C&#x2F;16T, 16MB L3, 15W nominal TDP, configurable by the OEM. In a homelab node it usually idles at 8–14W package power because the firmware ships a conservative power table and no undervolt. The two levers that actually move the needle are the SMU power limits (PPT&#x2F;EDC&#x2F;TDC) and Curve Optimizer (CO), a per-core voltage&#x2F;frequency offset. This is what I changed, how I verified it, and where it went wrong.</p><h2 id="Establish-a-measurement-baseline-first"><a href="#Establish-a-measurement-baseline-first" class="headerlink" title="Establish a measurement baseline first"></a>Establish a measurement baseline first</h2><p>Wall-meter numbers are the only ones that matter for a homelab, but you need package telemetry to attribute changes. On Linux, <code>amd_pmu</code> and the k10temp driver expose what you need:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Package power, per-core clocks, and temperature</span></span><br><span class="line"><span class="built_in">sudo</span> modprobe k10temp</span><br><span class="line">sensors | grep -E <span class="string">&#x27;Tctl|Tdie&#x27;</span></span><br><span class="line"><span class="built_in">cat</span> /sys/class/powercap/intel-rapl:0/energy_uj 2&gt;/dev/null || <span class="built_in">echo</span> <span class="string">&quot;no RAPL on AMD&quot;</span></span><br><span class="line"><span class="comment"># AMD exposes package energy via the SMU; use turbostat or zenpower</span></span><br><span class="line"><span class="built_in">sudo</span> turbostat --quiet --show PkgWatt,CorWatt,GFXWatt,Busy% --interval 5</span><br></pre></td></tr></table></figure><p><code>turbostat</code> reads the SMU’s running average power limit counters and is the closest thing to a trustworthy package-power figure on Zen 3. Cross-check against a inline wall meter (a Kill-A-Watt or a smart plug with energy reporting) at the PSU input. Expect a 15–25% gap between package power and wall power from VRM losses, the PSU’s own idle draw, and any BMC&#x2F;NIC&#x2F;storage.</p><p>Record three states before touching anything: idle (no containers, NIC link up, disks spun down), light load (one or two services), and sustained all-core (<code>stress-ng --cpu 16 --timeout 300s</code>). Run each for at least five minutes and take the median, not the first sample.</p><h2 id="The-firmware-is-the-first-bottleneck"><a href="#The-firmware-is-the-first-bottleneck" class="headerlink" title="The firmware is the first bottleneck"></a>The firmware is the first bottleneck</h2><p>On most 5825U mini-PCs and NAS boards, the OEM’s default power table is not the 15W spec — it’s often 25–35W PPT with EDC set high enough to let all eight cores boost hard. That’s fine for a laptop on battery, wrong for a box that runs 24&#x2F;7.</p><p>Check what the firmware actually exposes:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Dump current SMU limits and CO offsets (requires ryzen_smu or ryzenadj)</span></span><br><span class="line"><span class="built_in">sudo</span> ryzenadj --info</span><br></pre></td></tr></table></figure><p><code>ryzenadj --info</code> prints <code>PPT LIMIT FAST</code>, <code>PPT LIMIT SLOW</code>, <code>TDC LIMIT</code>, <code>EDC LIMIT</code>, and the current CO values per core. If your board’s BIOS has no exposed settings, <code>ryzenadj</code> writes the SMU mailbox directly and is the only path. If the BIOS does expose PBO&#x2F;Curve Optimizer, prefer it — it survives reboots and doesn’t depend on a userspace daemon.</p><h2 id="Setting-PPT-EDC-and-TDC"><a href="#Setting-PPT-EDC-and-TDC" class="headerlink" title="Setting PPT, EDC, and TDC"></a>Setting PPT, EDC, and TDC</h2><p>The three limits interact. PPT is the package power ceiling in milliwatts. EDC is the current ceiling in amps, which governs short bursts and how aggressively the boost algorithm can push. TDC is the sustained current ceiling. For a 15W-class part, a sane starting point:</p><table><thead><tr><th>Limit</th><th>Stock (typical OEM)</th><th>Target</th><th>Effect</th></tr></thead><tbody><tr><td>PPT fast</td><td>35000 mW</td><td>18000 mW</td><td>Caps burst power</td></tr><tr><td>PPT slow</td><td>25000 mW</td><td>15000 mW</td><td>Caps sustained power</td></tr><tr><td>TDC</td><td>45000 mA</td><td>30000 mA</td><td>Sustained current</td></tr><tr><td>EDC</td><td>65000 mA</td><td>45000 mA</td><td>Burst current</td></tr><tr><td>CO all-core</td><td>0</td><td>-20</td><td>Voltage offset per core</td></tr></tbody></table><p>Apply and verify:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">sudo</span> ryzenadj \</span><br><span class="line">  --stapm-limit=15000 \</span><br><span class="line">  --fast-limit=18000 \</span><br><span class="line">  --slow-limit=15000 \</span><br><span class="line">  --tctl-temp=85 \</span><br><span class="line">  --vrm-current=30000 \</span><br><span class="line">  --vrmmax-current=45000 \</span><br><span class="line">  --edc-limit=45000</span><br><span class="line"><span class="built_in">sudo</span> ryzenadj --info | grep -E <span class="string">&#x27;PPT|TDC|EDC&#x27;</span></span><br></pre></td></tr></table></figure><p>The <code>--tctl-temp</code> flag is a thermal ceiling, not a target; 85°C is conservative for a passively cooled or low-airflow enclosure and prevents the SMU from throttling in a way that fights your CO offset.</p><h2 id="Curve-Optimizer-per-core"><a href="#Curve-Optimizer-per-core" class="headerlink" title="Curve Optimizer, per core"></a>Curve Optimizer, per core</h2><p>Curve Optimizer applies a negative voltage offset per core in units of ~3–5mV (the exact step is SMU-dependent and not documented by AMD). A -20 offset on a 5825U is usually stable; -30 is where silicon lottery starts to matter. The failure mode is not a crash — it’s a WHEA error or a silent miscalculation under load, so you validate with a stress test that checks results, not just one that spins.</p><p>If your BIOS exposes CO, set it there. If not, <code>ryzenadj</code> can write it, but the offset is lost on reboot:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Apply -20 to all cores (core indices 0-7 on the 5825U)</span></span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> 0 1 2 3 4 5 6 7; <span class="keyword">do</span></span><br><span class="line">  <span class="built_in">sudo</span> ryzenadj --set-coall=-20</span><br><span class="line"><span class="keyword">done</span></span><br><span class="line"><span class="comment"># Verify</span></span><br><span class="line"><span class="built_in">sudo</span> ryzenadj --info | grep -i co</span><br></pre></td></tr></table></figure><p>The <code>--set-coall</code> flag applies uniformly. Per-core offsets (<code>--set-co</code> with a core index) are worth the extra time only if one core is the stability limiter — check <code>dmesg | grep -i whea</code> after each stress run.</p><h2 id="Before-and-after-measured"><a href="#Before-and-after-measured" class="headerlink" title="Before and after, measured"></a>Before and after, measured</h2><p>These are wall-meter figures from a mini-ITX 5825U board with a 120W DC-DC PSU, one NVMe, one SATA SSD, and a 2.5GbE link up. Package power from <code>turbostat</code>. Five-minute medians.</p><table><thead><tr><th>State</th><th>Stock wall</th><th>Tuned wall</th><th>Stock pkg</th><th>Tuned pkg</th></tr></thead><tbody><tr><td>Idle</td><td>11.4 W</td><td>8.1 W</td><td>4.2 W</td><td>2.9 W</td></tr><tr><td>Light (2 containers)</td><td>16.8 W</td><td>12.3 W</td><td>8.1 W</td><td>5.4 W</td></tr><tr><td>All-core sustained</td><td>41.2 W</td><td>29.6 W</td><td>31.5 W</td><td>17.8 W</td></tr></tbody></table><p>The idle delta is smaller than the load delta because at idle the SoC is already in a low-power state and the wall figure is dominated by <a href="/posts/7be1c566/">VRM and PSU losses</a>. The load delta is where the PPT cap does its work: the stock table was letting the package pull 31W indefinitely, which is a 35W-class behavior, not 15W.</p><h2 id="Making-it-survive-reboots"><a href="#Making-it-survive-reboots" class="headerlink" title="Making it survive reboots"></a>Making it survive reboots</h2><p><code>ryzenadj</code> changes are volatile. Options, in order of preference:</p><ol><li>BIOS settings, if exposed. Nothing to maintain.</li><li>A systemd unit that runs <code>ryzenadj</code> at boot, ordered after the SMU driver loads.</li><li>A udev rule triggered on the <code>k10temp</code> device.</li></ol><p>The systemd unit is the least fragile:</p><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># /etc/systemd/system/ryzenadj.service</span></span><br><span class="line"><span class="section">[Unit]</span></span><br><span class="line"><span class="attr">Description</span>=Apply Ryzen power limits</span><br><span class="line"><span class="attr">After</span>=multi-user.target</span><br><span class="line"></span><br><span class="line"><span class="section">[Service]</span></span><br><span class="line"><span class="attr">Type</span>=<span class="literal">on</span>eshot</span><br><span class="line"><span class="attr">ExecStart</span>=/usr/local/bin/ryzenadj --stapm-limit=<span class="number">15000</span> --fast-limit=<span class="number">18000</span> \</span><br><span class="line">  <span class="attr">--slow-limit</span>=<span class="number">15000</span> --tctl-temp=<span class="number">85</span> --vrm-current=<span class="number">30000</span> \</span><br><span class="line">  <span class="attr">--vrmmax-current</span>=<span class="number">45000</span> --edc-limit=<span class="number">45000</span> --set-coall=-<span class="number">20</span></span><br><span class="line"><span class="attr">RemainAfterExit</span>=<span class="literal">yes</span></span><br><span class="line"></span><br><span class="line"><span class="section">[Install]</span></span><br><span class="line"><span class="attr">WantedBy</span>=multi-user.target</span><br></pre></td></tr></table></figure><p>Enable with <code>systemctl enable --now ryzenadj.service</code> and confirm with <code>ryzenadj --info</code> after a reboot. If the unit fails silently, check <code>journalctl -u ryzenadj</code> — the usual cause is the SMU mailbox being locked by the firmware until the <code>ryzen_smu</code> module is loaded.</p><h2 id="Pitfalls-and-how-to-diagnose-them"><a href="#Pitfalls-and-how-to-diagnose-them" class="headerlink" title="Pitfalls and how to diagnose them"></a>Pitfalls and how to diagnose them</h2><p><strong>WHEA errors after a CO offset.</strong> <code>dmesg -w | grep -i whea</code> while running <code>stress-ng --cpu 16 --verify</code>. If errors appear, back the offset off by 5 and retest. A CO offset that’s too aggressive often passes a spin-only stress test and fails a verify test.</p><p><strong>The limits don’t stick.</strong> <code>ryzenadj --info</code> reverts to stock values after a suspend&#x2F;resume cycle. The SMU reloads its defaults on resume; re-run the service via a <code>systemd-sleep</code> hook or accept the revert.</p><p><strong>Package power reads zero or nonsense.</strong> <code>turbostat</code> needs the <code>msr</code> module and root. On some kernels the SMU energy counter isn’t exposed; fall back to the wall meter and treat package telemetry as directional only.</p><p><strong>Thermal throttling masks the power cap.</strong> If <code>Tctl</code> sits at the <code>--tctl-temp</code> ceiling under load, you’re thermally limited, not power limited, and the PPT cap isn’t doing anything. Improve airflow or lower the thermal ceiling before drawing conclusions.</p><p><strong>Idle power doesn’t drop.</strong> Check ASPM and the PCIe link state: <code>lspci -vv | grep -i aspm</code> and <code>cat /sys/module/pcie_aspm/parameters/policy</code>. A 2.5GbE NIC or an NVMe in a high power state can add 2–3W at idle regardless of CPU settings.</p><p><strong>The board ignores <code>ryzenadj</code> entirely.</strong> Some OEM firmware locks the SMU mailbox. <code>ryzenadj</code> returns an error on the first write; there’s no workaround short of a BIOS mod, which is out of scope for a production node.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>Is undervolting a 5825U safe for 24&#x2F;7 operation?</strong></p><p>Yes, within reason. Curve Optimizer reduces voltage at a given frequency; it doesn’t exceed silicon limits. The risk is instability, not damage — a too-aggressive offset causes WHEA errors or silent miscalculation, which is why you validate with a verify-mode stress test rather than a spin-only one.</p><p><strong>Why cap PPT at 18W when the part is rated 15W?</strong></p><p>The 15W figure is the nominal TDP, not a hard ceiling. The SMU’s fast limit governs short bursts, and 18W gives headroom for container startup and compile jobs without letting sustained load sit at the OEM’s much higher default. The slow limit at 15W is what actually holds sustained package power down.</p><p><strong>Does Curve Optimizer survive a BIOS update?</strong></p><p>No. A BIOS update typically resets CO and PBO settings to defaults. Re-apply after any firmware change and re-verify with <code>ryzenadj --info</code> and a stress run.</p><p><strong>Can I use this on a 5825U laptop instead of a homelab node?</strong></p><p>The settings apply, but the thermal and power envelope is different and the battery&#x2F;charging path changes the wall-meter math. Treat laptop results separately; the package-power deltas should transfer, the wall deltas won’t.</p><p><strong>What’s the actual power saving per year?</strong></p><p>At the measured deltas — roughly 3W idle and 11W under sustained load — a node that idles 90% of the time and loads 10% saves on the order of 20–30 kWh&#x2F;year. That’s small in money terms; the reason to do it is thermal headroom and fan noise in a closet, not the electricity bill.</p><p><strong>Do I need <code>ryzen_smu</code> or is <code>ryzenadj</code> enough?</strong></p><p><code>ryzenadj</code> needs the SMU mailbox interface, which on most kernels means the <code>ryzen_smu</code> module or an equivalent. If <code>ryzenadj --info</code> fails to read limits, load the module first (<code>sudo modprobe ryzen_smu</code>) and retry before assuming the firmware is locked.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>Testing Seed Phrase Backups With a Real Recovery Drill</title>
      <link>https://getbytecraft.com/posts/459e039f/</link>
      <description>A seed phrase backup that has never been restored from is a hypothesis, not a backup</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/crypto/">
        <![CDATA[Crypto & Web3]]>
      </category>
      <category domain="https://getbytecraft.com/categories/crypto/wallets/">Wallets</category>
      <category domain="https://getbytecraft.com/tags/crypto/">crypto</category>
      <category domain="https://getbytecraft.com/tags/security/">security</category>
      <pubDate>Fri, 04 Dec 2026 11:46:18 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> A seed phrase backup that has never been restored from is a hypothesis, not a backup, and the only way to turn it into a fact is to wipe a device and rebuild from the paper.</p><p>I ran that drill last month on a COLDCARD Mk4 with a BIP-39 seed generated from dice rolls plus a passphrase, and the wipe-and-restore took about 40 minutes end to end. Roughly a third of that was the restore itself; the rest was verification, firmware handling, and discovering two failure modes that no amount of reading had prepared me for. This is what I did, in order, with the parts that went wrong left in.</p><blockquote><p><strong>Not investment advice.</strong> This describes how the mechanism works and what the operational risks are. It does not tell you what to buy. See the <a href="/disclaimer/">editorial policy</a>.</p></blockquote><h2 id="Why-the-drill-beats-the-backup"><a href="#Why-the-drill-beats-the-backup" class="headerlink" title="Why the drill beats the backup"></a>Why the drill beats the backup</h2><p>Most people who lose funds to a seed backup problem lose them because the backup was never exercised. The paper was in the safe, the device booted, the balance showed, and everyone slept fine. Then the device died, or firmware had to be reflashed, or a passphrase was forgotten, and the restore revealed a transcription error on word 19 or a passphrase that had been typed once in 2022 and never again.</p><p>The mechanics are unforgiving. A BIP-39 seed is 12, 18, or 24 words drawn from a 2048-word list, with a checksum in the final word. The checksum catches <em>some</em> transcription errors — a single wrong word will almost always fail validation — but it cannot catch a correct word in the wrong position if the resulting checksum still validates, and it says nothing at all about a passphrase. BIP-39 passphrases are not stored anywhere on the device. They are mixed into the seed derivation at restore time, and <a href="/posts/c2cc401f/">every distinct passphrase produces a different, valid, funded-looking wallet</a>. Get it wrong and you get an empty wallet that validates perfectly and shows no error.</p><p>That asymmetry is the whole argument for a drill. You want the failure to happen on a Tuesday in your kitchen with zero funds on the line, not on the day your house floods.</p><h2 id="Preparing-the-drill-properly"><a href="#Preparing-the-drill-properly" class="headerlink" title="Preparing the drill properly"></a>Preparing the drill properly</h2><p>Three things need to be true before you wipe anything.</p><p>First, the device firmware must be current and verified. The COLDCARD documentation is blunt about this: check the security status, install verified fixed firmware, and do this <em>before</em> generating a seed for any wallet holding an amount whose loss would be materially harmful. There was a security update with a migration path for some seeds; if your device predates the fixed firmware, the drill is a good moment to deal with that rather than later.</p><p>Second, you need a record of the current state that is <em>not</em> the seed. For me that was:</p><ul><li>The master fingerprint and derivation path used for each account.</li><li>The first and last receiving address of each account, written down from the device screen.</li><li>A signed, low-value transaction that I could broadcast afterwards to prove the restored wallet could spend, not just watch.</li></ul><p>Third, move the funds. I moved everything to a second, independent wallet for the duration. This is the step people skip, and it is the step that makes the drill safe. Do not test a restore by “just checking the address” while funds sit there — an address check proves the xpub derivation matches, not that the seed is correct.</p><table><thead><tr><th>Check</th><th>Proves</th><th>Does not prove</th></tr></thead><tbody><tr><td>Address matches written record</td><td>xpub derivation is right</td><td>Seed phrase is right</td></tr><tr><td>Master fingerprint matches</td><td>Same root key</td><td>Passphrase is right</td></tr><tr><td>Balance appears after restore</td><td>Same account set</td><td>You can spend</td></tr><tr><td>Small test transaction broadcasts</td><td>Full signing path works</td><td>Nothing further needed</td></tr></tbody></table><p>That last row is why I insist on an actual spend. Watch-only restores look identical to working restores until the moment you need to sign.</p><h2 id="The-wipe-and-restore-step-by-step"><a href="#The-wipe-and-restore-step-by-step" class="headerlink" title="The wipe and restore, step by step"></a>The wipe and restore, step by step</h2><p>I started from a device with the seed loaded and the passphrase applied. First, wipe.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># No host tooling for this step: the wipe is done on-device.</span></span><br><span class="line"><span class="comment"># Login -&gt; Advanced/Tools -&gt; Danger Zone -&gt; Seed Functions -&gt; Destroy Seed</span></span><br><span class="line"><span class="comment"># Then confirm the device reboots to a blank state.</span></span><br><span class="line"><span class="comment"># Verify: the device should show &quot;Seed is not loaded&quot; / no fingerprint on boot.</span></span><br></pre></td></tr></table></figure><p>On the Mk4 the path is under Advanced&#x2F;Tools, then Danger Zone, then Seed Functions. It asks for confirmation and, depending on your settings, a PIN. After the wipe the device boots with no seed loaded and no fingerprint. If it still shows a fingerprint, the wipe did not complete — stop and redo it.</p><p>Next, restore. I deliberately restored the <em>words only</em> first, without the passphrase, to reproduce the most common real-world mistake and see what it looks like.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># On-device: New Wallet -&gt; Restore Seed -&gt; 24 Words</span></span><br><span class="line"><span class="comment"># Enter the 24 words from the paper backup.</span></span><br><span class="line"><span class="comment"># Choose the same derivation path / account policy as before.</span></span><br><span class="line"><span class="comment"># Do NOT enter the passphrase yet. Record the resulting fingerprint and first address.</span></span><br></pre></td></tr></table></figure><p>Without the passphrase the device accepted all 24 words, passed the checksum, and produced a valid wallet. The fingerprint was different from my recorded one and the first address was different, which is the only warning you get. If I had not written the original fingerprint down, this wallet would have looked entirely legitimate — empty, yes, but legitimate, and I might have concluded the backup was fine and the funds had “moved.”</p><p>Then I wiped again and did it properly, this time with the passphrase.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># On-device: New Wallet -&gt; Restore Seed -&gt; 24 Words -&gt; Passphrase -&gt; enter passphrase</span></span><br><span class="line"><span class="comment"># Then compare against the written record:</span></span><br><span class="line"><span class="comment">#   - master fingerprint matches the pre-wipe value</span></span><br><span class="line"><span class="comment">#   - first receiving address of account 0 matches</span></span><br><span class="line"><span class="comment">#   - account xpub matches the export you took before the wipe</span></span><br></pre></td></tr></table></figure><p>Both matched. I then built a small PSBT to one of my own addresses and signed it air-gapped, which required a working SD card workflow and a host wallet that could read the exported xpub. The transaction broadcast and confirmed. That was the point at which the backup became a fact.</p><h2 id="Comparing-what-you-can-actually-restore-from"><a href="#Comparing-what-you-can-actually-restore-from" class="headerlink" title="Comparing what you can actually restore from"></a>Comparing what you can actually restore from</h2><p>The drill changed how I rank backup methods, because the restore path matters more than the storage medium. Here is how the options I have used compare on the axis that the drill tests.</p><table><thead><tr><th>Method</th><th>Restore effort</th><th>Failure mode it invites</th><th>Drill cost</th></tr></thead><tbody><tr><td>24 words on paper, single copy</td><td>Low</td><td>Single point of loss (fire, flood, misplacement)</td><td>Low</td></tr><tr><td>24 words, two geographically separate copies</td><td>Low</td><td>Both copies wrong in the same way if transcribed once</td><td>Low</td></tr><tr><td>Seed XOR (two or more shares)</td><td>Medium — needs all shares</td><td>Losing one share is total loss</td><td>Medium</td></tr><tr><td>SLIP-39 &#x2F; Shamir shares</td><td>Medium — needs threshold</td><td>Share labels and thresholds forgotten</td><td>Medium-high</td></tr><tr><td>Seed Vault on-device (encrypted)</td><td>Medium — needs PIN + device</td><td>Device loss plus PIN loss</td><td>Medium</td></tr><tr><td>BIP-85 derived child seeds</td><td>Low per child</td><td>Parent seed loss loses everything below</td><td>High (must test each derivation)</td></tr></tbody></table><p>The lesson from the table is not that one method wins. It is that every method has a restore-shaped failure mode, and the only way to know which one you are exposed to is to walk the path. Shamir and XOR backups in particular are almost never drilled, and they are the ones where a lost share or a forgotten threshold turns a recoverable situation into an unrecoverable one.</p><p>One more thing worth testing: a temporary seed. If you use one for plausibility or travel, confirm you can get back to the real seed afterwards. A temporary seed that you cannot exit cleanly is a wipe with extra steps.</p><h2 id="Pitfalls-and-how-to-diagnose-them"><a href="#Pitfalls-and-how-to-diagnose-them" class="headerlink" title="Pitfalls and how to diagnose them"></a>Pitfalls and how to diagnose them</h2><p>These are the ones I hit or have seen others hit. Each has a diagnostic.</p><p><strong>Passphrase produces a valid empty wallet.</strong> The device gives no error. Diagnostic: always record the master fingerprint and first address of every account <em>before</em> the drill. After restore, compare. A fingerprint mismatch means the seed or passphrase is wrong; there is no ambiguity once you have the reference value.</p><p><strong>Checksum passes but the seed is wrong.</strong> A word in the wrong position can occasionally still validate. Diagnostic: after restore, derive the first address and compare to your written record. Never trust “the device accepted it.”</p><p><strong>Derivation path mismatch.</strong> Restoring with a different account policy or script type gives a different wallet from the same seed. Diagnostic: record the path and script type alongside the fingerprint. If your host wallet shows a different account, check the path before touching anything else.</p><p><strong>Firmware version drift.</strong> Restoring on old firmware may not support the seed features you used. Diagnostic: check the version on the device against the current documentation before you wipe, not after.</p><p><strong>SD card and host wallet friction.</strong> The signing step failed for me the first time because the host wallet had the wrong account loaded. Diagnostic: do a dry run of the PSBT flow with the current wallet <em>before</em> the wipe, so the only variable during the drill is the seed.</p><p><strong>Physical backup damage.</strong> Paper degrades, ink fades, and a backup read once in five years may be unreadable. Diagnostic: read the backup aloud, character by character, before you start. If any word is ambiguous, redo the backup now.</p><p><strong>Time pressure.</strong> A drill done in a hurry is a drill done wrong. Diagnostic: schedule it, put the funds elsewhere, and give it an hour. If you cannot, do not start.</p><h2 id="Operational-notes-for-organizations"><a href="#Operational-notes-for-organizations" class="headerlink" title="Operational notes for organizations"></a>Operational notes for organizations</h2><p>If you hold keys on behalf of an organization rather than yourself, the drill needs a second person and a written procedure. Two people should independently transcribe and compare the seed, the fingerprint record should live with the procedure rather than in one person’s head, and the restore should be performed by someone who did not create the backup. The point is to test the <em>organization’s</em> recovery path, not one individual’s memory.</p><p>Tax and accounting treatment does not change because you moved funds for a drill, but the movements are still on-chain. In most jurisdictions a transfer between wallets you control is not a disposal, but you should keep a record of why the transfer happened and where the funds went, because an auditor looking at a large outbound transfer will ask. Keep the drill log with the transaction IDs.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>How often should I run a recovery drill?</strong></p><p>I run one whenever the setup changes — new device, new firmware with a migration path, new passphrase, new backup method — and otherwise on a fixed schedule, roughly annually. The trigger matters more than the calendar. Any change to the seed, the passphrase, or the backup medium invalidates the previous drill.</p><p><strong>Do I need to move funds off the wallet to test a restore?</strong></p><p>For a meaningful test, yes. An address comparison only proves the xpub derivation is reproducible. A restore with funds in place cannot test the signing path, and signing is where passphrase and path errors actually surface. Move the funds, wipe, restore, sign, then move them back.</p><p><strong>What is the difference between a seed phrase and a passphrase in this context?</strong></p><p>The seed phrase is the 12, 18, or 24 words that encode the root key. The BIP-39 passphrase is an extra string mixed into the derivation that is not stored on the device and is not part of the word list. Every distinct passphrase yields a different valid wallet. The seed phrase backup alone does not recover a passphrase-protected wallet.</p><p><strong>Can I test the restore without wiping the device?</strong></p><p>You can restore onto a second device of the same model, which is safer but only tests the backup, not the wipe-and-recover path on the device you actually depend on. If you have a spare, do both: restore on the spare first, then wipe and restore the primary. The primary is the one that will fail on you.</p><p><strong>What should I write down before the wipe?</strong></p><p>The master fingerprint, the derivation path and script type for each account, the first and last receiving address of each account, and the account xpub. Store these separately from the seed. Without reference values, a successful restore and a wrong-wallet restore look identical.</p><p><strong>Does a Shamir or XOR backup need a different drill?</strong></p><p>Yes, and it needs more of them. Those schemes fail at the share level, so you need to test that any qualifying subset restores the wallet and that a non-qualifying subset does not. Test the loss case deliberately: remove one share and confirm the recovery fails cleanly rather than producing a wrong wallet.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>Strategy's $1.01B Put in September 2027: Running the Coverage Math Yourself</title>
      <link>https://getbytecraft.com/posts/4fae3537/</link>
      <description>Strategy holds $4.5B of dollar liquidity against a $1.01B put and $1.34B of annual preferred dividends; the share price decides</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/investing/">Investing</category>
      <category domain="https://getbytecraft.com/tags/investing/">investing</category>
      <pubDate>Fri, 04 Dec 2026 10:30:57 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> Strategy’s September 2027 test is a liquidity event, not a solvency one: $1.01 billion of converts become puttable while the company holds $4.5 billion of dollar liquidity. The number that decides the outcome is the share price, not the bitcoin price.</p><p>CoinDesk reported on December 3 that Strategy holds about $4.5 billion in dollar liquidity after the latest selloff, enough to keep paying <a href="/posts/a4d2d0f6/">preferred dividends</a> and to cover a bond repayment next September. The company’s 852,500 bitcoin were worth about $44.3 billion at the time, and its shares fell 16% to $70 in premarket trading as bitcoin dropped 13% to $52,000 on <a href="/posts/b85576da/">quantum-security headlines</a>.</p><p>Read that again and notice what the story is not about. It is not about whether the bitcoin position is underwater, because it is not: 852,500 coins at $52,000 is $44.3 billion against a much lower average cost. It is about whether the company can pay cash to people who have the right to demand it, and whether the equity can be used to raise more before that date.</p><h2 id="The-instrument-that-sets-the-date"><a href="#The-instrument-that-sets-the-date" class="headerlink" title="The instrument that sets the date"></a>The instrument that sets the date</h2><p>On September 15, 2027, holders of $1.01 billion in convertible notes can require Strategy to repurchase at face value plus accrued interest. That is a put, not a maturity. The distinction is everything: a put is exercised by the holder when the alternative is worse, and the alternative here is holding a note convertible at $183.19 while the stock trades at $70.96.</p><p>To convert voluntarily, a holder needs the stock roughly 160% higher than it is now. To take cash, they need to fill in a form. The choice is not close, which is why the market treats September 2027 as a scheduled $1.01 billion outflow rather than as a possibility.</p><table><thead><tr><th>Item</th><th>Amount</th><th>Timing</th></tr></thead><tbody><tr><td>Convertible notes puttable at face</td><td>$1.01 B</td><td>Sept 15, 2027</td></tr><tr><td>Conversion price</td><td>$183.19</td><td>—</td></tr><tr><td>Share price at the report</td><td>$70.96</td><td>Dec 3, 2026</td></tr><tr><td>Move needed to reach conversion</td><td>~+158%</td><td>—</td></tr><tr><td>Dollar cash</td><td>$0.811 B</td><td>now</td></tr><tr><td>Dollar reserve</td><td>$3.72 B</td><td>now</td></tr><tr><td>Total near-term liquidity</td><td>$4.5 B</td><td>now</td></tr><tr><td>Preferred dividends, annualized</td><td>$1.34 B</td><td>~$112 M&#x2F;month</td></tr><tr><td>Convertible interest, annual</td><td>$0.034 B</td><td>—</td></tr></tbody></table><h2 id="The-cash-math"><a href="#The-cash-math" class="headerlink" title="The cash math"></a>The cash math</h2><p>Add up what a stressed year costs. The put takes $1.01 billion. A year of preferred dividends is $1.34 billion. Convertible interest adds $34 million. That is $2.38 billion, which is just over half of today’s liquidity, and it leaves $2.1 billion.</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">put       = <span class="number">1.01e9</span></span><br><span class="line">pref_year = <span class="number">1.34e9</span></span><br><span class="line">int_year  = <span class="number">34e6</span></span><br><span class="line">liq       = <span class="number">4.5e9</span></span><br><span class="line"></span><br><span class="line">stress = put + pref_year + int_year</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;stress year: $<span class="subst">&#123;stress/<span class="number">1e9</span>:<span class="number">.2</span>f&#125;</span>B  (<span class="subst">&#123;stress/liq:<span class="number">.0</span>%&#125;</span> of liquidity)&quot;</span>)</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;residual:    $<span class="subst">&#123;(liq-stress)/<span class="number">1e9</span>:<span class="number">.2</span>f&#125;</span>B&quot;</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># runway on dividends alone, no bitcoin sales, no new issuance</span></span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;dividend-only runway: <span class="subst">&#123;liq/pref_year:<span class="number">.1</span>f&#125;</span> years&quot;</span>)</span><br></pre></td></tr></table></figure><p>The last line is the one worth internalizing. With no asset sales and no capital raises, $4.5 billion covers about 3.3 years of the current preferred dividend. That is a real cushion and it is also finite, and it shrinks if the dividend rate on new preferred issuance rises.</p><p>Note what the math does not include: taxes, operating costs, and any further buybacks. Strategy is not a passive holder; it has raised and deployed capital continuously. A coverage ratio computed on today’s dividend is a snapshot, not a projection.</p><h2 id="Why-the-share-price-is-the-actual-variable"><a href="#Why-the-share-price-is-the-actual-variable" class="headerlink" title="Why the share price is the actual variable"></a>Why the share price is the actual variable</h2><p>The bitcoin price determines the value of the collateral. The share price determines whether the company can raise equity, and equity is how this structure has been financed.</p><p>The mechanism is the premium to net asset value. When the stock trades above the value of its bitcoin per share, issuing shares is accretive: each new share brings in more dollars than the bitcoin it represents. When it trades below, issuing shares destroys value per share, and the machine that funded the purchases runs backwards.</p><p>At $70 with bitcoin at $52,000, the premium has compressed hard. That is the pressure the CoinDesk piece describes, and it is why a weak share price makes early repayment attractive to bondholders: if the company cannot issue equity to strengthen the balance sheet, the cash on hand becomes the only thing standing behind the put.</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">btc, coins = <span class="number">52_000</span>, <span class="number">852_500</span></span><br><span class="line">nav = btc * coins</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;BTC value: $<span class="subst">&#123;nav/<span class="number">1e9</span>:<span class="number">.1</span>f&#125;</span>B&quot;</span>)</span><br><span class="line"><span class="comment"># per-share NAV needs the share count; pull it from the latest 10-Q</span></span><br><span class="line">shares = <span class="number">280e6</span>          <span class="comment"># placeholder, replace with the filed number</span></span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;NAV/share at $<span class="subst">&#123;btc:,&#125;</span>: $<span class="subst">&#123;nav/shares:,<span class="number">.2</span>f&#125;</span>&quot;</span>)</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;premium at $70.96: <span class="subst">&#123;<span class="number">70.96</span>/(nav/shares) - <span class="number">1</span>:+<span class="number">.1</span>%&#125;</span>&quot;</span>)</span><br></pre></td></tr></table></figure><p>Substitute the real share count. The point of the exercise is not the number, it is that you can compute the premium yourself from two public figures and stop guessing about whether dilution is accretive this quarter.</p><h2 id="The-dilution-spiral-arithmetic"><a href="#The-dilution-spiral-arithmetic" class="headerlink" title="The dilution spiral arithmetic"></a>The dilution spiral arithmetic</h2><p>If the stock stays at $70 and the company needs dollars, the options are worse than they were at $200. Selling bitcoin to fund a put is a balance-sheet decision that the market reads as a signal. Issuing preferred at a higher rate raises the fixed cost that the coverage ratio is measured against. Issuing common below NAV transfers value from existing holders to new ones.</p><p>None of these is fatal at $4.5 billion of liquidity. All of them compound: a higher preferred rate means less runway, less runway means more pressure to sell bitcoin, selling bitcoin means a lower NAV, a lower NAV means a lower share price. The spiral does not need a bankruptcy to hurt equity holders. It only needs the premium to stay negative long enough.</p><p>One number summarizes the whole structure: the market capitalization of the equity against the market value of the bitcoin. When that ratio is above one, the company can create dollars by printing shares and every dollar raised buys more bitcoin than the share it diluted. Below one, it cannot, and the only funding left is asset sales and expensive preferred. Watch that ratio weekly; it moves before any filing does, and it is the single input that determines whether the September 2027 put is a manageable payment or the start of a forced liquidation.</p><p>That is the asymmetry worth understanding before you take a position in any of these vehicles. The debt holders have a date and a face value. The equity holders have a residual claim on a leveraged bitcoin position, and the leverage is priced in a market that can close for new issuance exactly when the company needs it most.</p><h2 id="What-to-watch-between-now-and-then"><a href="#What-to-watch-between-now-and-then" class="headerlink" title="What to watch between now and then"></a>What to watch between now and then</h2><p>Three numbers, all public, all quarterly. The share count, because it tells you whether dilution is still accretive. The dollar reserve line, because it is the only asset that can pay a put without a sale. And the preferred dividend run rate, because it is the fixed cost that the liquidity has to outlast.</p><p>Put them in a spreadsheet with the filing date next to each, and recompute the coverage ratio every quarter. If the ratio falls below 2× while the premium is negative, the September 2027 date stops being a scheduling item and becomes the thing that sets the price of everything else. That is the threshold to write down now, while the arithmetic is still boring.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>What happens to Strategy’s convertible notes on September 15, 2027?</strong></p><p>On that date, holders of $1.01 billion in convertible notes can require Strategy to repurchase them at face value plus accrued interest. This is a put, not a maturity: holders choose whether to exercise it. Because the notes convert at $183.19 while the stock traded at $70.96, taking the cash is the far more attractive option.</p><p><strong>How much cash does Strategy need to cover the September 2027 put and its other obligations?</strong></p><p>A stressed year costs about $2.38 billion: the $1.01 billion put, $1.34 billion of annualized preferred dividends, and $34 million of convertible interest. Against $4.5 billion of total near-term liquidity, that leaves roughly $2.1 billion. The stress year consumes just over half of current liquidity.</p><p><strong>Why does Strategy’s share price matter more than the bitcoin price for the 2027 put?</strong></p><p>The bitcoin price sets the value of the collateral, but the share price determines whether Strategy can raise equity, which is how the structure has been financed. When the stock trades above its bitcoin value per share, issuing shares is accretive. Below that level, new issuance destroys value per share and the funding mechanism runs backwards.</p><p><strong>How long can Strategy cover its preferred dividends using only its dollar liquidity?</strong></p><p>With no asset sales and no capital raises, $4.5 billion of liquidity covers about 3.3 years of the current $1.34 billion annualized preferred dividend. The cushion is real but finite, and it shrinks if the dividend rate on new preferred issuance rises. Taxes, operating costs, and buybacks are not included in that figure.</p><p><strong>What coverage ratio signals that the September 2027 put has become a problem?</strong></p><p>If the coverage ratio falls below 2× while the stock’s premium to net asset value is negative, September 2027 stops being a scheduling item and starts setting the price of everything else. Track the share count, the dollar reserve line, and the preferred dividend run rate each quarter, and recompute the ratio from the filings.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>
        <![CDATA[Four Dollars in Ten: Calculating How Much of Your S&P 500 Is One Trade]]>
      </title>
      <link>https://getbytecraft.com/posts/fed94786/</link>
      <description>
        <![CDATA[One estimate puts AI exposure at 40 percent of the S&P 500; the look-through sum from a holdings file takes an afternoon]]>
      </description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/investing/">Investing</category>
      <category domain="https://getbytecraft.com/tags/investing/">investing</category>
      <pubDate>Fri, 04 Dec 2026 10:23:57 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> If roughly four dollars of every ten in the S&amp;P 500 now depend on the AI buildout, then your index fund is not diversified, it is a leveraged bet with a bond sleeve attached. Compute your own look-through number before you decide the position is acceptable.</p><p>MarketWatch reported on December 4 that Jensen Huang is under pressure over his stewardship of the AI ecosystem, and that by one estimate about $4 out of every $10 in the S&amp;P 500 is riding directly on <a href="/posts/2f81b025/">the AI buildout</a>. That single sentence is the most useful thing in the piece, and it is also the one a reader is least equipped to check.</p><p>You can check it. Not to the decimal, because the estimate depends on which companies you count as AI, but to the point where you know whether your number is 25% or 45%. The difference between those two decides whether a 30% drawdown in the theme costs you 7% or 14% of your portfolio, and that is a decision you can make in an afternoon.</p><h2 id="What-“riding-on-AI”-means-in-an-index"><a href="#What-“riding-on-AI”-means-in-an-index" class="headerlink" title="What “riding on AI” means in an index"></a>What “riding on AI” means in an index</h2><p>An index fund holds weights, not narratives. The S&amp;P 500 is cap-weighted, so the largest companies are the index, and any theme concentrated in the largest companies is concentrated in the index by construction. The question is where you draw the boundary.</p><p>There are at least three defensible boundaries, and they produce very different answers:</p><table><thead><tr><th>Boundary</th><th>What is included</th><th>Illustrative share of a cap-weighted index</th></tr></thead><tbody><tr><td>Chip and hardware only</td><td>GPU, networking, HBM, servers</td><td>12–15%</td></tr><tr><td>Plus hyperscaler capex</td><td>the four or five companies spending the money</td><td>25–30%</td></tr><tr><td>Plus second order</td><td>power, cooling, electrical equipment, data-center REITs</td><td>35–45%</td></tr></tbody></table><p>The published estimate of four in ten sits at the third boundary, and that is the right one for a risk question. A company that sells switchgear to data centers is an AI trade whether or not its SIC code says semiconductors.</p><p>The numbers in that table are ranges I am asserting as a framework, not measured index weights. Do not use them as facts. Use them to decide which boundary you care about, then compute the real number from your fund’s published holdings, which update daily and are free.</p><h2 id="The-look-through-calculation"><a href="#The-look-through-calculation" class="headerlink" title="The look-through calculation"></a>The look-through calculation</h2><p>Every large issuer publishes a holdings file: a CSV with ticker, name and weight. Download it, then sum the weights of the names you consider AI-exposed. That is the whole method.</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br><span class="line"></span><br><span class="line"><span class="comment"># illustrative tickers only; substitute the names you actually count</span></span><br><span class="line">AI = &#123;<span class="string">&quot;NVDA&quot;</span>,<span class="string">&quot;AVGO&quot;</span>,<span class="string">&quot;AMD&quot;</span>,<span class="string">&quot;MU&quot;</span>,<span class="string">&quot;TSM&quot;</span>,<span class="string">&quot;VRT&quot;</span>,<span class="string">&quot;SMCI&quot;</span>,<span class="string">&quot;ANET&quot;</span>,<span class="string">&quot;DELL&quot;</span>,<span class="string">&quot;ORCL&quot;</span>,</span><br><span class="line">      <span class="string">&quot;MSFT&quot;</span>,<span class="string">&quot;GOOGL&quot;</span>,<span class="string">&quot;AMZN&quot;</span>,<span class="string">&quot;META&quot;</span>,<span class="string">&quot;CEG&quot;</span>,<span class="string">&quot;ETN&quot;</span>,<span class="string">&quot;PWR&quot;</span>,<span class="string">&quot;GEV&quot;</span>&#125;</span><br><span class="line"></span><br><span class="line">h = pd.read_csv(<span class="string">&quot;holdings.csv&quot;</span>)          <span class="comment"># columns: ticker, weight</span></span><br><span class="line">h[<span class="string">&quot;ticker&quot;</span>] = h[<span class="string">&quot;ticker&quot;</span>].<span class="built_in">str</span>.upper().<span class="built_in">str</span>.strip()</span><br><span class="line">h[<span class="string">&quot;weight&quot;</span>] = h[<span class="string">&quot;weight&quot;</span>].astype(<span class="built_in">str</span>).<span class="built_in">str</span>.rstrip(<span class="string">&quot;%&quot;</span>).astype(<span class="built_in">float</span>) / <span class="number">100</span></span><br><span class="line"></span><br><span class="line">basket = h[h[<span class="string">&quot;ticker&quot;</span>].isin(AI)]</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;AI weight: <span class="subst">&#123;basket[<span class="string">&#x27;weight&#x27;</span>].<span class="built_in">sum</span>():<span class="number">.2</span>%&#125;</span>&quot;</span>)</span><br><span class="line"><span class="built_in">print</span>(basket.nlargest(<span class="number">8</span>, <span class="string">&quot;weight&quot;</span>)[[<span class="string">&quot;ticker&quot;</span>, <span class="string">&quot;weight&quot;</span>]])</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;names counted: <span class="subst">&#123;<span class="built_in">len</span>(basket)&#125;</span> of <span class="subst">&#123;<span class="built_in">len</span>(h)&#125;</span>&quot;</span>)</span><br></pre></td></tr></table></figure><p>Two things to check in the output. The number of names matters as much as the weight: forty names at 1% each behave differently from four names at 10% each, because the second is a bet on four managements and the first is a bet on a sector. And the top eight will usually be more than half the basket, which means your diversification inside the theme is mostly fictional.</p><p>Then do the shock arithmetic on the number you got:</p><table><thead><tr><th>AI weight</th><th>20% theme drawdown</th><th>35% theme drawdown</th><th>50% theme drawdown</th></tr></thead><tbody><tr><td>25%</td><td>−5.0%</td><td>−8.8%</td><td>−12.5%</td></tr><tr><td>35%</td><td>−7.0%</td><td>−12.3%</td><td>−17.5%</td></tr><tr><td>45%</td><td>−9.0%</td><td>−15.8%</td><td>−22.5%</td></tr></tbody></table><p>Those are simple products, not forecasts. They assume everything outside the basket is flat, which is generous: in a real de-rating the non-AI names usually fall too, just less.</p><h2 id="Why-the-second-order-is-the-part-people-miss"><a href="#Why-the-second-order-is-the-part-people-miss" class="headerlink" title="Why the second order is the part people miss"></a>Why the second order is the part people miss</h2><p>The chip names are obvious and already priced for perfection. The second-order names are where the estimate gets interesting, because their revenue is tied to a capex cycle that is decided by four or five buyers.</p><p>A cooling company selling to hyperscalers has one customer type. An electrical equipment maker with a data-center order book has a backlog that looks like revenue for two years and then stops if orders stop. A regulated utility building generation for a single large customer has a multi-decade asset whose return depends on that customer’s load forecast being right.</p><p>There is a rates channel here too, and it is the one that turns a sector bet into a macro bet. A buildout of this size is financed with debt, by the hyperscalers and by the utilities and landlords building behind them. Higher long rates <a href="/posts/f11b1962/">raise the discount rate</a> on every one of those projects and raise the cost of the debt that funds them. So the same portfolio that is long AI capex is also long the assumption that financing stays cheap, which is a second bet most holders never wrote down.</p><p>None of that makes them bad businesses. It makes them levered to the same variable, which is the thing a diversification check is supposed to catch. A portfolio that holds the index plus a semiconductor ETF plus a data-center REIT plus a power utility is not four positions. It is one position, four times.</p><h2 id="Where-the-estimate-can-be-wrong"><a href="#Where-the-estimate-can-be-wrong" class="headerlink" title="Where the estimate can be wrong"></a>Where the estimate can be wrong</h2><p>Three honest objections, each of which changes the number.</p><p>The boundary is arbitrary. Counting a utility as an AI trade because it signed one data-center contract overstates the theme; its other customers are still households. Counting it as a utility understates the risk. Reasonable people land 10 percentage points apart on the same holdings file.</p><p>Revenue exposure is not earnings exposure. A company that gets 15% of revenue from AI capex may get 40% of its incremental growth from it, and the market prices growth. On the way down, the same leverage works in reverse, which is why these names fall faster than the revenue line suggests.</p><p>Cap weighting does the concentrating for you. Even if you decide the AI weight is 30% and you are comfortable with it, the index will keep raising it as long as those stocks outperform. Your position size is a function of price, which means it grows exactly when you should be trimming.</p><h2 id="The-rule-to-write-down"><a href="#The-rule-to-write-down" class="headerlink" title="The rule to write down"></a>The rule to write down</h2><p>Pick a number now, while you are calm, and write it with a date. Something like: if the look-through AI weight in my equity allocation exceeds 40%, I reduce the theme to 30% at the next rebalance, regardless of how good the story sounds.</p><p>Then automate the check. Download the holdings file monthly, run the sum, and log it next to the date. It is five minutes of work and it produces a time series, which is the only thing that will tell you whether the concentration is drifting up or has stabilized.</p><p>If the number comes back at 45% and your honest reaction is that you are fine with it, that is a valid answer. Write it down too, with the drawdown you are accepting in the same sentence. The failure mode this exercise prevents is not owning the AI trade. It is owning it by accident, at a size you never chose, and discovering the size during the drawdown rather than before it.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>How much of the S&amp;P 500 is tied to the AI buildout?</strong></p><p>By one estimate cited in the article, about four dollars out of every ten in the S&amp;P 500 is riding directly on the AI buildout. That published estimate reflects the widest boundary, which counts chip and hardware names, hyperscaler capex, and second-order exposure like power, cooling, electrical equipment, and data-center REITs.</p><p><strong>How do I calculate the AI weight in my index fund?</strong></p><p>Download your fund’s published holdings file, which lists ticker, name and weight, then sum the weights of the names you consider AI-exposed. That is the whole method. Also check how many names make up that sum, since forty names at 1% each behave differently from four names at 10% each.</p><p><strong>What does a 35% theme drawdown cost me if my AI weight is 35%?</strong></p><p>Using the article’s simple product arithmetic, a 35% AI weight times a 35% theme drawdown is a loss of about 12.3% of the portfolio. At 25% AI weight the same drawdown costs about 8.8%, and at 45% it costs about 15.8%. These assume everything outside the AI basket stays flat, which the article calls generous.</p><p><strong>Why do second-order AI names like cooling and electrical equipment carry extra risk?</strong></p><p>Their revenue is tied to a capex cycle decided by four or five buyers. A cooling company selling to hyperscalers has one customer type, and a data-center backlog looks like revenue for two years and then stops if orders stop. These names are levered to the same variable, which is what a diversification check is meant to catch.</p><p><strong>Does the AI share of my index stay fixed once I measure it?</strong></p><p>No. Because the S&amp;P 500 is cap-weighted, the index keeps raising the AI weight as long as those stocks outperform. Your position size becomes a function of price, so it grows exactly when you should be trimming. That is why the article recommends logging the look-through number monthly to see whether concentration is drifting up.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>Alpine 3.25 Makes PostgreSQL 19 the Default: The Upgrade That Loses Data</title>
      <link>https://getbytecraft.com/posts/2e140964/</link>
      <description>Alpine 3.25 ships PostgreSQL 19 as the default and apk upgrade will not migrate the data directory; dump or pg_upgrade first</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/self-hosted/">Self-Hosted</category>
      <category domain="https://getbytecraft.com/tags/cost/">cost</category>
      <pubDate>Fri, 04 Dec 2026 10:16:57 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> Alpine 3.25 makes PostgreSQL 19 the default package, and <code>apk upgrade</code> will not migrate your data directory for you. Dump, then restore, or run <code>pg_upgrade</code> with the right bindirs, and check the collation before either.</p><p>Phoronix reported on December 4 that Alpine Linux 3.25 has shipped with the Linux 7.3 kernel and PostgreSQL 19 as the default database package. For a distribution that lives in containers and small VMs, that combination is the whole point of the release. For anyone who has a persistent Alpine box running the previous default, it is also a data-loss trap, because Alpine’s packaging makes it very easy to end up with two PostgreSQL versions installed and one of them pointed at your data.</p><p>The failure is not exotic, and it does not announce itself as a version problem at first. You run <code>apk upgrade</code>, the postgresql package resolves to 19, the old binaries are replaced, and the service refuses to start because the data directory was initialized by 18. On a good day you get a clear error about an incompatible catalog version. On a bad day you get a partially started server, a monitoring alert, and a backup job that has been silently failing since the upgrade.</p><h2 id="What-actually-changes-in-the-package"><a href="#What-actually-changes-in-the-package" class="headerlink" title="What actually changes in the package"></a>What actually changes in the package</h2><p>Alpine splits the server and client, and the version is in the package name. That means an upgrade does not replace your server in place; it can leave both versions installed side by side, which is convenient for <code>pg_upgrade</code> and dangerous if you are not paying attention to which binary is on your PATH.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">apk info -v | grep -i postgres</span><br><span class="line"><span class="comment"># postgresql18-18.x-r0</span></span><br><span class="line"><span class="comment"># postgresql19-19.x-r0</span></span><br></pre></td></tr></table></figure><p>Before touching anything, find out where the new package puts its binaries and where it expects data. Alpine’s layout has moved between major versions, and guessing is how people lose an afternoon.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">apk info -L postgresql19 | grep -E <span class="string">&#x27;/bin/|/data&#x27;</span></span><br><span class="line">pg_config --bindir --sharedir 2&gt;/dev/null</span><br><span class="line"><span class="built_in">ls</span> -l /var/lib/postgresql/</span><br></pre></td></tr></table></figure><p>Use the paths the package prints. The commands below assume <code>/usr/bin</code> for binaries and <code>/var/lib/postgresql/data</code> for data, which is the common case, but verify rather than copy.</p><h2 id="Choosing-the-migration-path"><a href="#Choosing-the-migration-path" class="headerlink" title="Choosing the migration path"></a>Choosing the migration path</h2><p>Two paths, and the choice is about downtime and extensions rather than about preference.</p><table><thead><tr><th>Method</th><th>Downtime</th><th>Handles extensions</th><th>Risk</th></tr></thead><tbody><tr><td><code>pg_dumpall</code> + restore into a fresh cluster</td><td>full dump and load</td><td>must reinstall each extension</td><td>low, but slow on large databases</td></tr><tr><td><code>pg_upgrade --link</code></td><td>minutes</td><td>extension binaries must match</td><td>medium, in-place, needs rollback plan</td></tr><tr><td>Logical replication to a new cluster</td><td>seconds at cutover</td><td>per-table, manual for sequences</td><td>low downtime, most setup</td></tr><tr><td>Do nothing and pin the old package</td><td>none</td><td>n&#x2F;a</td><td>drifts, and pinning ends eventually</td></tr></tbody></table><p>For anything under a few hundred gigabytes, dump and restore is the right answer. It is boring, it produces a <a href="/posts/f5fee6c6/">tested backup</a> as a side effect, and it does not care about collation differences between the old and new clusters, because the new cluster is initialized fresh with whatever locale you specify.</p><p><code>pg_upgrade --link</code> is for databases where the dump window is too long. It hard-links the data files instead of copying them, so it is fast, and it also means the old cluster is no longer independently usable: a failed upgrade can leave you with neither.</p><h2 id="The-dump-and-restore-done-properly"><a href="#The-dump-and-restore-done-properly" class="headerlink" title="The dump and restore, done properly"></a>The dump and restore, done properly</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 1. stop writes, then dump the whole cluster</span></span><br><span class="line">pg_dumpall -U postgres --clean --if-exists &gt; /backup/all-$(<span class="built_in">date</span> +%F).sql</span><br><span class="line"></span><br><span class="line"><span class="comment"># 2. confirm the dump has content and ends cleanly</span></span><br><span class="line"><span class="built_in">tail</span> -3 /backup/all-$(<span class="built_in">date</span> +%F).sql</span><br><span class="line">grep -c <span class="string">&#x27;CREATE TABLE&#x27;</span> /backup/all-$(<span class="built_in">date</span> +%F).sql</span><br><span class="line"></span><br><span class="line"><span class="comment"># 3. move the old data directory aside, do not delete it</span></span><br><span class="line"><span class="built_in">mv</span> /var/lib/postgresql/data /var/lib/postgresql/data.old</span><br><span class="line"></span><br><span class="line"><span class="comment"># 4. initialize the new cluster with the locale you actually want</span></span><br><span class="line">initdb -D /var/lib/postgresql/data -U postgres --encoding=UTF8 --locale=C.UTF-8</span><br><span class="line"></span><br><span class="line"><span class="comment"># 5. restore</span></span><br><span class="line">psql -U postgres -d postgres -f /backup/all-$(<span class="built_in">date</span> +%F).sql</span><br></pre></td></tr></table></figure><p>Step 3 is the one people skip and then regret. Moving rather than deleting costs disk space for a day and buys you a rollback that takes one command.</p><p>Step 4 deserves a decision rather than a default. <code>--locale=C.UTF-8</code> sorts by byte value, which is fast and stable and wrong if your application expects linguistic ordering. If the old cluster used a different collation, sorting order in indexes changes, and a query with <code>ORDER BY name</code> can return rows in a different order than before. That is not a bug, it is a different collation, and it will show up as a failing test rather than as a corrupt database.</p><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">-- record this before the migration and compare after</span></span><br><span class="line"><span class="keyword">SELECT</span> datname, datcollate, datctype, pg_encoding_to_char(encoding) <span class="keyword">FROM</span> pg_database;</span><br><span class="line"><span class="keyword">SELECT</span> collname, collprovider <span class="keyword">FROM</span> pg_collation <span class="keyword">WHERE</span> collname <span class="keyword">LIKE</span> <span class="string">&#x27;en%&#x27;</span>;</span><br></pre></td></tr></table></figure><h2 id="The-pg-upgrade-path-with-the-checks-that-matter"><a href="#The-pg-upgrade-path-with-the-checks-that-matter" class="headerlink" title="The pg_upgrade path, with the checks that matter"></a>The pg_upgrade path, with the checks that matter</h2><p>If you are going the in-place route, run the check mode first. It refuses to proceed on most of the things that would break, and its output is the migration plan.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">NEW_BIN=$(apk info -L postgresql19 | grep -m1 <span class="string">&#x27;/bin/postgres$&#x27;</span> | xargs <span class="built_in">dirname</span>)</span><br><span class="line">OLD_BIN=$(apk info -L postgresql18 | grep -m1 <span class="string">&#x27;/bin/postgres$&#x27;</span> | xargs <span class="built_in">dirname</span>)</span><br><span class="line"></span><br><span class="line"><span class="variable">$NEW_BIN</span>/pg_upgrade \</span><br><span class="line">  --old-bindir=<span class="variable">$OLD_BIN</span> --new-bindir=<span class="variable">$NEW_BIN</span> \</span><br><span class="line">  --old-datadir=/var/lib/postgresql/data \</span><br><span class="line">  --new-datadir=/var/lib/postgresql/19/data \</span><br><span class="line">  --check</span><br></pre></td></tr></table></figure><p>Three things the check will flag that are worth pre-empting. Extensions must exist as packages built for 19; a PostGIS or pg_stat_statements package from the old tree will block the upgrade until you install the matching one. Prepared transactions must be resolved, because <code>pg_upgrade</code> cannot carry them across. And the new data directory must already be initialized, with the same encoding as the old one.</p><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">SELECT</span> <span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">FROM</span> pg_prepared_xacts;</span><br><span class="line"><span class="keyword">SELECT</span> extname, extversion <span class="keyword">FROM</span> pg_extension;</span><br></pre></td></tr></table></figure><p>If the extension versions differ between the old and new package trees, do not upgrade the extension before the migration. Upgrade the cluster first, then run <code>ALTER EXTENSION ... UPDATE</code> in the new cluster, which is the order the extension authors support.</p><h2 id="The-container-case-is-different"><a href="#The-container-case-is-different" class="headerlink" title="The container case is different"></a>The container case is different</h2><p>If PostgreSQL runs in a container on Alpine, the upgrade is a volume problem, not a package problem. The image tag determines the server version, the volume holds the data, and <code>docker pull</code> plus <code>docker compose up</code> will happily start a 19 server against an 18 volume and exit with a catalog version error.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">services:</span></span><br><span class="line">  <span class="attr">db:</span></span><br><span class="line">    <span class="attr">image:</span> <span class="string">postgres:19-alpine</span></span><br><span class="line">    <span class="attr">volumes:</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">pgdata:/var/lib/postgresql/data</span></span><br></pre></td></tr></table></figure><p>Pin the tag to the major version, never <code>latest</code>, and treat a major bump as a migration with a dump and a restore step in the runbook. A minor bump within 19 is safe to pull; a major bump is not, and the tag is the only thing that distinguishes them at deploy time.</p><h2 id="What-to-do-before-the-next-apk-upgrade"><a href="#What-to-do-before-the-next-apk-upgrade" class="headerlink" title="What to do before the next apk upgrade"></a>What to do before the next <code>apk upgrade</code></h2><p>Pin <code>postgresql18</code> in <code>/etc/apk/world</code> until you have a window and a tested restore, take a dump you have verified by restoring it somewhere harmless, and write down the collation of every database you own. Then run the upgrade with the old data directory moved aside rather than deleted, and keep it for a week. The package manager will not warn you, the service will not start, and the error it prints will be about a catalog version rather than about the backup you did not take.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>Why won’t PostgreSQL start after an Alpine 3.25 apk upgrade?</strong></p><p>The postgresql package resolves to version 19 and replaces the old binaries, but the data directory was initialized by version 18. The server refuses to start because of an incompatible catalog version. On a worse outcome you get a partially started server and a backup job that has been silently failing since the upgrade.</p><p><strong>How do I check which PostgreSQL versions are installed on Alpine?</strong></p><p>Alpine splits the server and client, and the version is in the package name, so an upgrade can leave both versions installed side by side. Run <code>apk info -v | grep -i postgres</code> to list them. Then use <code>apk info -L postgresql19</code> to find where the new package puts its binaries and data.</p><p><strong>Should I use pg_dumpall or pg_upgrade to migrate to PostgreSQL 19?</strong></p><p>For anything under a few hundred gigabytes, dump and restore is the right answer: it is slow but low-risk, produces a tested backup, and does not care about collation differences because the new cluster is initialized fresh. Use <code>pg_upgrade --link</code> only when the dump window is too long, since a failed upgrade can leave you with neither cluster.</p><p><strong>How do I avoid data loss when migrating PostgreSQL on Alpine?</strong></p><p>Dump the whole cluster with <code>pg_dumpall</code>, verify the dump has content and ends cleanly, then move the old data directory aside rather than deleting it. Initialize the new cluster with the locale you want and restore into it. Keeping the old directory for a week buys you a rollback that takes one command.</p><p><strong>Does changing the locale during a PostgreSQL migration affect query results?</strong></p><p>Yes. If the old cluster used a different collation, sorting order in indexes changes, and a query with <code>ORDER BY name</code> can return rows in a different order. That is a different collation rather than a bug, and it shows up as a failing test rather than a corrupt database.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>CVE-2026-139281: Verifying Your Conntrack Rules Still Hold</title>
      <link>https://getbytecraft.com/posts/1991ac58/</link>
      <description>A 21-year-old conntrack flaw lets IPv6 fragments be misclassified, so stateful allow rules can pass traffic to the wrong port</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/self-hosted/">Self-Hosted</category>
      <category domain="https://getbytecraft.com/tags/linux/">linux</category>
      <pubDate>Fri, 04 Dec 2026 10:09:57 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> CVE-2026-139281 lets a remote attacker make conntrack believe a packet is going somewhere other than where it is delivered. Any firewall rule that says “allow established, drop the rest” is trusting a decision this bug can corrupt, so verify the patch and add a stateless check in front of the rules you actually care about.</p><p>BleepingComputer reported on December 3 that a Linux kernel flaw nearly 21 years old allows remote attackers to bypass firewall rules with crafted IPv6 packets. The CVE is 2026-139281, CVSS 9.1, in Netfilter’s connection tracking subsystem. It was introduced in Linux 2.6.15, released in January 2006, and disclosed by Jérémy Jean of ANSSI’s cryptography lab. Patches exist upstream; distributions were still evaluating at publication.</p><p>The mechanics are specific and worth understanding, because they tell you exactly which of your rules are exposed. IPv6 fragments with long extension headers cause an internal byte offset calculation to overflow and truncate during reassembly. Header data gets corrupted, conntrack records the wrong tuple, and traffic that a rule set believes it has classified is delivered somewhere else. In the kernel developers’ example, conntrack logs a packet as destined for UDP port 53 while the payload lands on UDP port 9999.</p><h2 id="What-the-bug-actually-breaks"><a href="#What-the-bug-actually-breaks" class="headerlink" title="What the bug actually breaks"></a>What the bug actually breaks</h2><p>Conntrack is a cache of flows. The first packet of a flow is evaluated against your rules, a state entry is created, and every subsequent packet is matched against that entry rather than re-evaluated. That is the whole performance model of a stateful firewall, and it is also the trust boundary this bug crosses.</p><p>If the state entry is wrong, two things follow. Traffic that should have been dropped gets classified as part of an allowed flow. And traffic that should have been allowed may be classified as something else and dropped, which produces the confusing case: a service stops working for some clients after the patch, because a flow that used to be silently misclassified is now correctly rejected.</p><table><thead><tr><th>Rule construct</th><th>Depends on conntrack</th><th>Exposed by this bug</th></tr></thead><tbody><tr><td><code>ct state established,related accept</code></td><td>yes</td><td>yes</td></tr><tr><td><code>ct state new</code> rate limits</td><td>yes</td><td>yes</td></tr><tr><td>NAT with port translation</td><td>yes</td><td>yes</td></tr><tr><td><code>ip6 saddr ... tcp dport 22 accept</code></td><td>no</td><td>no</td></tr><tr><td><code>iif eth0 drop</code> at priority raw</td><td>no</td><td>no</td></tr><tr><td>Fail2ban style set matching on source IP</td><td>no</td><td>no</td></tr></tbody></table><p>The bottom three rows are stateless or pre-conntrack, which is why the compensating control in this case is not exotic. It is the same one that has always worked: decide on the packet, not on a remembered flow, for the handful of services where being wrong is unacceptable.</p><h2 id="Checking-what-you-are-running"><a href="#Checking-what-you-are-running" class="headerlink" title="Checking what you are running"></a>Checking what you are running</h2><p>Start with the version, because the patch is in the stable trees and most distributions have it or are about to.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">uname</span> -r</span><br><span class="line"><span class="comment"># Debian/Ubuntu</span></span><br><span class="line">apt-cache policy linux-image-$(<span class="built_in">uname</span> -r) | <span class="built_in">head</span> -5</span><br><span class="line"><span class="comment"># RHEL family</span></span><br><span class="line">rpm -q kernel --changelog | grep -i 139281</span><br><span class="line"><span class="comment"># Alpine</span></span><br><span class="line">apk info -v linux-lts | <span class="built_in">head</span> -3</span><br></pre></td></tr></table></figure><p>A kernel built after the fix will have the offset arithmetic clamped in <code>nf_conntrack_reasm.c</code>. If you build your own, that is the file to diff against upstream. If you run a distribution kernel, the version comparison is the whole test, and the fastest way to get it wrong is to assume that a <code>linux-image-generic</code> from last week includes a fix that landed this week.</p><p>Second check: does your rule set lean on conntrack for anything that matters?</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">nft list ruleset | grep -nE <span class="string">&#x27;ct (state|status)&#x27;</span> | <span class="built_in">head</span> -40</span><br><span class="line">iptables-save | grep -c <span class="string">&#x27;state ESTABLISHED&#x27;</span></span><br><span class="line">sysctl net.netfilter.nf_conntrack_count net.netfilter.nf_conntrack_max</span><br></pre></td></tr></table></figure><p>A count near <code>nf_conntrack_max</code> is its own problem, and it will mask this one: when the table is full, new flows get dropped or evicted, and the symptom looks like packet loss rather than misclassification.</p><h2 id="Verifying-with-a-packet"><a href="#Verifying-with-a-packet" class="headerlink" title="Verifying with a packet"></a>Verifying with a packet</h2><p>The only test that proves the bypass is closed is a packet that tries it. Build one on a lab host, send it at a host you own, and check both the conntrack entry and the delivery.</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> scapy.<span class="built_in">all</span> <span class="keyword">import</span> IPv6, IPv6ExtHdrFragment, UDP, send</span><br><span class="line"></span><br><span class="line"><span class="comment"># lab only: fragmented IPv6 with a long extension header chain,</span></span><br><span class="line"><span class="comment"># payload aimed at 9999, headers shaped to look like DNS</span></span><br><span class="line">pkt = (IPv6(dst=<span class="string">&quot;fd00::2&quot;</span>) /</span><br><span class="line">       IPv6ExtHdrFragment(offset=<span class="number">0</span>, m=<span class="number">1</span>) /</span><br><span class="line">       UDP(sport=<span class="number">40000</span>, dport=<span class="number">53</span>) /</span><br><span class="line">       <span class="string">b&quot;\x00&quot;</span> * <span class="number">1200</span>)</span><br><span class="line">send(pkt)</span><br></pre></td></tr></table></figure><p>Then read what the kernel decided:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">conntrack -L -f ipv6 | grep -E <span class="string">&#x27;dport=(53|9999)&#x27;</span></span><br><span class="line">nft list counters table inet filter</span><br></pre></td></tr></table></figure><p>If the entry says 53 and the service on 9999 <a href="/posts/593b9375/">logs a connection</a>, the bug is live on that host. If the entry says 9999, or the packet never reaches 9999, the fix is in. Do this on a host with the rule set you actually deploy, because a default-deny lab box will pass the test for the wrong reason.</p><h2 id="Compensating-controls-that-do-not-need-the-patch"><a href="#Compensating-controls-that-do-not-need-the-patch" class="headerlink" title="Compensating controls that do not need the patch"></a>Compensating controls that do not need the patch</h2><p>You cannot always patch on the day a CVE lands. Three controls reduce exposure without touching the kernel.</p><p>Move the rules that protect the crown jewels to the raw priority, before conntrack runs. In nftables that is a chain with <code>type filter hook prerouting priority raw</code>, and rules there match on packet headers only. A management port, a database port, and anything that should never be reachable from the internet belong in that chain regardless of this CVE.</p><p>Second, stop relying on port-based classification for IPv6. If the only thing standing between an attacker and an internal service is “the packet says 53”, the packet can say whatever it wants. Interface-based and source-prefix rules are not corrupted by a reassembly bug.</p><p>Third, drop fragmented IPv6 at the edge if you do not need it. Fragmentation in IPv6 is supposed to be handled by the sender, and a host that never receives fragments cannot be attacked through fragment reassembly.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">nft add rule inet filter prerouting ip6 frag-off != 0 drop</span><br><span class="line">nft add rule inet filter prerouting ip6 exthdr frag exists drop</span><br></pre></td></tr></table></figure><p>That second rule is blunt and will break path MTU discovery on badly configured links, so test it before you push it to a production edge. On a homelab or a single-host firewall in front of services that speak TCP over a normal MTU, it costs nothing.</p><h2 id="If-you-were-exposed-the-log-is-the-only-evidence"><a href="#If-you-were-exposed-the-log-is-the-only-evidence" class="headerlink" title="If you were exposed, the log is the only evidence"></a>If you were exposed, the log is the only evidence</h2><p>Conntrack itself keeps no history, so the packet that bypassed your rules left no record in the state table. What does leave a record is whatever was behind the rule. If a service on a port that should have been unreachable logged a connection in the last few weeks, and the source is not a network you recognize, that is the shape of an exploit rather than a misconfiguration.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># services that should never have seen traffic from outside</span></span><br><span class="line">journalctl -u nginx --since <span class="string">&quot;30 days ago&quot;</span> | grep -vE <span class="string">&#x27;10\.|192\.168\.&#x27;</span> | <span class="built_in">head</span></span><br><span class="line">ss -tn state established <span class="string">&#x27;( sport = :9999 )&#x27;</span></span><br></pre></td></tr></table></figure><p>Patch first, then read logs. The order matters because a host that is still exposed can be re-entered while you are investigating, and the second entry will look exactly like the first.</p><h2 id="What-to-do-this-week"><a href="#What-to-do-this-week" class="headerlink" title="What to do this week"></a>What to do this week</h2><p>Confirm the kernel version on every host that runs a stateful firewall, and write the version down with a date. For hosts you cannot patch immediately, move the rules protecting management interfaces into a raw-priority chain and drop inbound IPv6 fragments at the edge. Then run the packet test once, on one host, and keep the output. A firewall you have not tested since the advisory is a firewall you are assuming works, and this particular assumption had a 21-year head start on you.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>What is CVE-2026-139281?</strong></p><p>CVE-2026-139281 is a Linux kernel flaw in Netfilter’s connection tracking subsystem, rated CVSS 9.1, that allows remote attackers to bypass firewall rules with crafted IPv6 packets. It was introduced in Linux 2.6.15, released in January 2006, making it nearly 21 years old at disclosure. BleepingComputer reported on it December 3, and patches exist upstream.</p><p><strong>Which firewall rules are exposed by this bug?</strong></p><p>Rules that depend on conntrack are exposed: <code>ct state established,related accept</code>, <code>ct state new</code> rate limits, and NAT with port translation. Stateless rules are not affected, including <code>ip6 saddr ... tcp dport 22 accept</code>, <code>iif eth0 drop</code> at priority raw, and Fail2ban-style set matching on source IP. The bug corrupts the state entry, so anything trusting a remembered flow can be fooled.</p><p><strong>How do I check whether my kernel is patched?</strong></p><p>Run <code>uname -r</code> and compare the version, then use <code>apt-cache policy linux-image-$(uname -r)</code> on Debian&#x2F;Ubuntu, <code>rpm -q kernel --changelog | grep -i 139281</code> on RHEL family, or <code>apk info -v linux-lts</code> on Alpine. A patched kernel has the offset arithmetic clamped in <code>nf_conntrack_reasm.c</code>. If you build your own kernel, diff that file against upstream.</p><p><strong>How can I test whether the bypass is closed on my host?</strong></p><p>Send a crafted fragmented IPv6 packet with a long extension header chain, shaped to look like DNS but aimed at UDP port 9999, at a host you own. Then run <code>conntrack -L -f ipv6 | grep -E &#39;dport=(53|9999)&#39;</code>. If the entry says 53 while the service on 9999 logs a connection, the bug is live; if it says 9999 or the packet never arrives, the fix is in.</p><p><strong>What can I do if I can’t patch immediately?</strong></p><p>Move rules protecting management interfaces into a raw-priority nftables chain that matches on packet headers only, since those run before conntrack. Stop relying on port-based classification for IPv6 and use interface-based or source-prefix rules instead. Optionally drop fragmented IPv6 at the edge, though that will break path MTU discovery on badly configured links, so test before deploying.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>Windows 11 Lockouts Traced to a 2006-Era Burning Driver: Finding It Before It Bites</title>
      <link>https://getbytecraft.com/posts/449ef860/</link>
      <description>A Sonic Solutions disc-burning filter driver still loads on every optical device, and updates since October are locking users out</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/hardware/">Hardware</category>
      <category domain="https://getbytecraft.com/tags/hardware/">hardware</category>
      <pubDate>Fri, 04 Dec 2026 10:02:57 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> Windows 11 machines are locking users out because a CD&#x2F;DVD burning filter driver from the mid-2000s is still registered against the optical drive class. The fix takes ten minutes once you know to look at driver dates rather than at the update that triggered it.</p><p>Tom’s Hardware reported on December 3 that Microsoft’s Release Health pages now flag a clash between Windows 11 updates shipped since October and older software built on a Sonic Solutions CD&#x2F;DVD burning driver. The affected programs are the ones you would expect from that vendor lineage: old Adobe disc-authoring tools, Roxio, Corel, and Sonic’s own bundles. The symptom is not a crash dialog. It is a machine that will not let you log in.</p><p>A filter driver sits between the operating system and a device class. It loads early, it loads whether or not you have used an optical drive in five years, and if it faults during boot the failure lands in the session manager rather than in an application. That is why the visible symptom is a lockout and the visible cause, in the update history, is a cumulative update that has nothing to do with discs.</p><h2 id="How-a-burning-driver-ends-up-in-the-boot-path"><a href="#How-a-burning-driver-ends-up-in-the-boot-path" class="headerlink" title="How a burning driver ends up in the boot path"></a>How a burning driver ends up in the boot path</h2><p>Disc-authoring suites install a driver stack to do things Windows does not do natively: raw SCSI passthrough for burn-proofing, custom cache flushing, and book-type manipulation. That stack registers as an upper filter on the CDROM device class, which means every optical device enumerated by the system loads it, including the virtual one Windows creates when no drive is present.</p><p>The registration lives in the registry, not in the driver package:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">HKLM\SYSTEM\CurrentControlSet\Control\Class\&#123;4d36e965-e325-11ce-bfc1-08002be10318&#125;</span><br><span class="line">    UpperFilters    REG_MULTI_SZ</span><br></pre></td></tr></table></figure><p>That GUID is the CDROM class. If <code>UpperFilters</code> contains a vendor name rather than just the default, something is intercepting every optical device on the machine, and it has been doing so since the machine was set up. Uninstalling Roxio in 2011 frequently leaves the value in place because the uninstaller removes its files and not its class registration.</p><h2 id="Finding-it-on-a-machine-that-still-boots"><a href="#Finding-it-on-a-machine-that-still-boots" class="headerlink" title="Finding it on a machine that still boots"></a>Finding it on a machine that still boots</h2><p>Two commands, run in an elevated PowerShell:</p><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">Get-WindowsDriver</span> <span class="literal">-Online</span> |</span><br><span class="line">  <span class="built_in">Where-Object</span> &#123; <span class="variable">$_</span>.ClassName <span class="operator">-eq</span> <span class="string">&#x27;CDROM&#x27;</span> &#125; |</span><br><span class="line">  <span class="built_in">Select-Object</span> Driver, ProviderName, Date, Version, ClassName |</span><br><span class="line">  <span class="built_in">Format-Table</span> <span class="literal">-AutoSize</span></span><br></pre></td></tr></table></figure><p>The output is the driver store, not the loaded set, so it also catches packages staged by an OEM image. Look for <code>ProviderName</code> values along the Sonic&#x2F;Roxio&#x2F;Corel lineage and for dates in the 2005–2012 range. A CDROM-class driver dated 2007 on a 2026 machine is not a driver anyone is maintaining.</p><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">Get-ItemProperty</span> <span class="string">&#x27;HKLM:\SYSTEM\CurrentControlSet\Control\Class\&#123;4d36e965-e325-11ce-bfc1-08002be10318&#125;&#x27;</span> |</span><br><span class="line">  <span class="built_in">Select-Object</span> UpperFilters, LowerFilters</span><br></pre></td></tr></table></figure><p>If <code>UpperFilters</code> names anything other than <code>cdrom</code>, that is your candidate. Note it exactly, including case, because you will need to restore it if removal causes a different problem.</p><table><thead><tr><th>What you find</th><th>Meaning</th><th>Action</th></tr></thead><tbody><tr><td><code>UpperFilters = cdrom</code></td><td>clean</td><td>nothing to do</td></tr><tr><td><code>UpperFilters = cdrom, PxHelp20</code></td><td>Sonic filter active</td><td>remove the vendor entry</td></tr><tr><td>driver dated 2005–2012, class CDROM</td><td>legacy package staged</td><td>delete from driver store</td></tr><tr><td>driver date recent, vendor unknown</td><td>investigate before touching</td><td>check signature first</td></tr><tr><td>no CDROM class key at all</td><td>optical stack absent</td><td>not the cause</td></tr></tbody></table><h2 id="Removing-it-without-making-things-worse"><a href="#Removing-it-without-making-things-worse" class="headerlink" title="Removing it without making things worse"></a>Removing it without making things worse</h2><p>Back up the value first. Export the class key:</p><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">reg export <span class="string">&#x27;HKLM\SYSTEM\CurrentControlSet\Control\Class\&#123;4d36e965-e325-11ce-bfc1-08002be10318&#125;&#x27;</span> C:\cdrom<span class="literal">-class</span>.reg</span><br></pre></td></tr></table></figure><p>Then remove the driver package, not just the registry entry:</p><figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">pnputil /<span class="class"><span class="keyword">enum</span>-<span class="title">drivers</span></span></span><br><span class="line"><span class="class"># <span class="title">find</span> <span class="title">the</span> <span class="title">oem</span>##.<span class="title">inf</span> <span class="title">whose</span> <span class="title">provider</span> <span class="title">is</span> <span class="title">the</span> <span class="title">vendor</span>, <span class="title">then</span>:</span></span><br><span class="line"><span class="class"><span class="title">pnputil</span> /<span class="title">delete</span>-<span class="title">driver</span> <span class="title">oem42</span>.<span class="title">inf</span> /<span class="title">uninstall</span> /<span class="title">force</span></span></span><br></pre></td></tr></table></figure><p><code>/force</code> is doing real work there: it deletes the package even if a device is currently bound to it. That is what you want for a driver you are trying to get out of the boot path, and it is also why the registry export comes first. After the delete, clear the vendor name from <code>UpperFilters</code> by editing the multi-string value and leaving <code>cdrom</code> alone, then reboot.</p><p>If the machine will not boot at all, the sequence changes. Boot into Safe Mode, where the filter still loads but the failing path is bypassed, run the same two commands, and reboot. If Safe Mode also fails, use Windows Recovery Environment’s command prompt and edit the registry offline by loading the SYSTEM hive:</p><figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">reg load HKLM\OFFLINE C:\Windows\System32\config\SYSTEM</span><br><span class="line">reg query &quot;HKLM\OFFLINE\ControlSet001\Control\Class\&#123;<span class="number">4</span>d36e965-e325-<span class="number">11</span>ce-bfc1-<span class="number">08002</span>be10318&#125;&quot; /v UpperFilters</span><br></pre></td></tr></table></figure><h2 id="Ruling-out-the-other-causes-first"><a href="#Ruling-out-the-other-causes-first" class="headerlink" title="Ruling out the other causes first"></a>Ruling out the other causes first</h2><p>A login that fails after an update has several plausible causes, and the optical filter driver is only worth chasing if the symptoms line up. The differential is short:</p><table><thead><tr><th>Symptom</th><th>Likely cause</th><th>Test</th></tr></thead><tbody><tr><td>Hangs after the spinner, before the desktop</td><td>filter driver or early-boot service</td><td>Safe Mode boots fine</td></tr><tr><td>Login screen appears, credentials rejected</td><td>profile service or domain trust</td><td>another account on the same box logs in</td></tr><tr><td>Desktop appears, then immediate sign-out</td><td>shell extension or logon script</td><td><code>Event Viewer &gt; System</code>, look for the session teardown time</td></tr><tr><td>Boot loop with a stop code</td><td>storage driver</td><td>WinRE, check <code>C:\Windows\Minidump</code></td></tr><tr><td>Slow login, no failure</td><td>roaming profile or network drive mapping</td><td>disable mapped drives for one user</td></tr></tbody></table><p>The first row is the one this driver produces, and the confirming test is Safe Mode: if the machine logs in normally with the optical stack bypassed, you are looking at an early-load driver, and the CDROM class is the first place to look when the machine has ever had disc-authoring software on it.</p><p>The second row is worth checking because it is far more common and completely unrelated. A locked-out user with a corrupted profile does not care which driver caused it, and a support queue that assumes driver every time will spend hours on machines that needed a profile rebuild.</p><h2 id="Why-this-class-of-failure-keeps-recurring"><a href="#Why-this-class-of-failure-keeps-recurring" class="headerlink" title="Why this class of failure keeps recurring"></a>Why this class of failure keeps recurring</h2><p>Filter drivers are the one part of Windows where a 2006 binary can still be executing on a 2026 kernel, because the driver model has kept backward compatibility longer than any other surface. Every Windows release that changes power management, device enumeration or early-boot timing gets tested against the drivers Microsoft ships, not against a burning stack from a company that stopped existing as an independent entity years ago.</p><p>The practical consequence for anyone managing more than a handful of machines: driver inventory belongs in your baseline, not in your incident response. Pull <code>Get-WindowsDriver -Online</code> output monthly, flag anything in a device class whose vendor is not the hardware vendor, and treat a 15-year-old date as a defect. It costs one scheduled task and it turns a boot lockout into a maintenance item.</p><p>The registry value is also the cheapest thing to check on a machine that is still working, because it survives every uninstaller that never cleaned up after itself and it costs one command to read.</p><p>For a single machine, the ten-minute version is enough: check <code>UpperFilters</code> on the CDROM class, check the driver dates in that class, and remove anything from the burning-suite era whether or not you have hit the lockout yet. The update that triggers it is chosen by Microsoft’s schedule, not yours.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>How do I check whether a Sonic or Roxio burning filter driver is registered on my Windows 11 machine?</strong></p><p>Run an elevated PowerShell and query <code>UpperFilters</code> under the CDROM class key <code>{4d36e965-e325-11ce-bfc1-08002be10318}</code>. If the value names anything other than <code>cdrom</code> — for example <code>cdrom, PxHelp20</code> — the Sonic filter is active. You can also run <code>Get-WindowsDriver -Online</code> filtered to the CDROM class and look for provider names in the Sonic, Roxio or Corel lineage.</p><p><strong>Why does a CD&#x2F;DVD burning driver cause a login lockout instead of an error message?</strong></p><p>A filter driver loads early at boot and registers against the entire CDROM device class, so it runs whether or not an optical drive is present. If it faults during boot, the failure lands in the session manager rather than in an application. The visible symptom is a machine that will not let you log in, while update history shows only an unrelated cumulative update.</p><p><strong>How do I remove the legacy driver without breaking the machine?</strong></p><p>Export the CDROM class registry key first with <code>reg export</code>, because you will need to restore <code>UpperFilters</code> if removal causes a different problem. Then delete the driver package using <code>pnputil /delete-driver oem##.inf /uninstall /force</code>, where <code>/force</code> removes it even if a device is bound to it. Finally, edit <code>UpperFilters</code> to leave <code>cdrom</code> alone and reboot.</p><p><strong>What do I do if the machine will not boot at all?</strong></p><p>Boot into Safe Mode, where the filter still loads but the failing path is bypassed, and run the same driver and registry commands there. If Safe Mode also fails, use the Windows Recovery Environment command prompt and edit the registry offline by loading the SYSTEM hive, then query <code>UpperFilters</code> on the CDROM class key under the loaded control set.</p><p><strong>How can I tell whether a lockout is the filter driver or something else?</strong></p><p>The confirming test is Safe Mode: if the machine logs in normally with the optical stack bypassed, you are looking at an early-load driver, and the CDROM class is the first place to look if the machine ever had disc-authoring software. A login screen that rejects credentials points instead to the profile service or domain trust, which is far more common and unrelated.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>E1.S at 1.92 TB: What the Kioxia XD8's 1 DWPD Rating Means in Practice</title>
      <link>https://getbytecraft.com/posts/2f81b025/</link>
      <description>A 1 DWPD rating at 1.92 TB is a 22 MB/s sustained write budget over five years, and the 3.1 GB/s burst number hides that limit</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/hardware/">Hardware</category>
      <category domain="https://getbytecraft.com/tags/hardware/">hardware</category>
      <pubDate>Fri, 04 Dec 2026 09:55:57 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> The Kioxia XD8’s 1.92 TB model is rated at 1 DWPD, which works out to a sustained write budget of about 22 MB&#x2F;s averaged over five years. Buy it for read-heavy nodes, and do not let the 3.1 GB&#x2F;s burst number talk you into putting it in a write-heavy one.</p><p>ServeTheHome published a review of the Kioxia XD8 in E1.S on December 3. It is a PCIe Gen5 x4, NVMe 2.0 data-center drive on BiCS5 112-layer TLC, offered at 1.92, 3.84 and 7.68 TB in both 9.5 mm and 15 mm E1.S heights. The 1.92 TB sample is rated for 12.5 GB&#x2F;s sequential read, 3.1 GB&#x2F;s sequential write, 1.7 million random 4K read IOPS, 100,000 random write IOPS, 17 W active and 5 W idle, at 1 drive write per day.</p><p>Those numbers are a coherent design statement: this is a read-optimized drive in the smallest server form factor, aimed at hyperscalers who need more room for compute per rack unit. What the spec sheet does not do is tell you whether your workload fits, because 1 DWPD is a five-year average, not an instantaneous limit.</p><h2 id="The-number-that-matters-is-the-write-budget"><a href="#The-number-that-matters-is-the-write-budget" class="headerlink" title="The number that matters is the write budget"></a>The number that matters is the write budget</h2><p>Endurance ratings are quoted as drive writes per day over a warranty period, and the conversion to a steady-state throughput is trivial but rarely done:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">bytes/day = capacity × DWPD</span><br><span class="line">MB/s      = bytes/day / 86400 / 1e6</span><br></pre></td></tr></table></figure><p>For the three capacities:</p><table><thead><tr><th>Capacity</th><th>DWPD</th><th>TB written per day</th><th>Sustained MB&#x2F;s budget</th><th>Burst write rating</th></tr></thead><tbody><tr><td>1.92 TB</td><td>1</td><td>1.92</td><td>22.2</td><td>3.1 GB&#x2F;s</td></tr><tr><td>3.84 TB</td><td>1</td><td>3.84</td><td>44.4</td><td>not listed</td></tr><tr><td>7.68 TB</td><td>1</td><td>7.68</td><td>88.9</td><td>5.8 GB&#x2F;s</td></tr></tbody></table><p>A 22 MB&#x2F;s continuous write budget sounds absurd next to a 3.1 GB&#x2F;s peak, and that gap is the entire point. Drives are built to absorb bursts into <a href="/posts/35b268a0/">SLC cache</a> and to sit idle most of the time. A node that writes 200 MB&#x2F;s around the clock will consume the 1.92 TB model’s five-year endurance in roughly seven months of runtime, and the drive will not warn you until the spare blocks are gone.</p><p>One more conversion is worth keeping on a sticky note: 1.92 TB per day is 22.2 MB&#x2F;s, and 22.2 MB&#x2F;s is roughly one 1080p video stream’s worth of writes, sustained, forever.</p><p>Work the arithmetic once for your own box before ordering: total bytes written per day divided by capacity gives your real DWPD. A Proxmox host logging to local disk, a container registry, a metrics store and a video ingest box are four completely different answers to that question, and only the first one is comfortable at 1 DWPD.</p><h2 id="Why-the-3-1-GB-s-rating-is-not-the-interesting-one"><a href="#Why-the-3-1-GB-s-rating-is-not-the-interesting-one" class="headerlink" title="Why the 3.1 GB&#x2F;s rating is not the interesting one"></a>Why the 3.1 GB&#x2F;s rating is not the interesting one</h2><p>Sequential write on a TLC drive is a cache measurement. The controller writes incoming data to a portion of the NAND configured as SLC, which is fast, and folds it into TLC later. The 3.1 GB&#x2F;s figure describes the <a href="/posts/3f5b5b53/">SLC window</a> and the fold rate combined, and both shrink as the drive fills.</p><p>The 1.92 TB model’s random write rating, 100,000 IOPS at 4K, is the more honest number for a database or a log store: at 4 KB per operation that is 400 MB&#x2F;s of random writes, which is respectable, and it is also three times the sequential rating’s implied endurance cost per second if sustained. Mixed workloads land between the two.</p><p>Read is where the drive is genuinely strong and where the money went. 12.5 GB&#x2F;s sequential and 1.7 million random read IOPS at 1.92 TB is the same read spec as the 7.68 TB model, which is unusual: normally small capacities lose read parallelism along with the extra NAND packages. Kioxia kept the read path intact and let the write endurance scale with capacity.</p><h2 id="Form-factor-is-the-actual-product"><a href="#Form-factor-is-the-actual-product" class="headerlink" title="Form factor is the actual product"></a>Form factor is the actual product</h2><p>E1.S exists because M.2 2280 does not belong in a 1U server. The comparison that matters:</p><table><thead><tr><th>Format</th><th>Width</th><th>Hot swap</th><th>Cooling</th><th>Typical drive power</th></tr></thead><tbody><tr><td>M.2 2280</td><td>22 mm</td><td>no</td><td>none, throttles</td><td>8–12 W</td></tr><tr><td>E1.S 9.5 mm</td><td>31.5 mm</td><td>yes, with carrier</td><td>minimal</td><td>up to ~20 W</td></tr><tr><td>E1.S 15 mm</td><td>31.5 mm</td><td>yes, with carrier</td><td>heatsink room</td><td>17–25 W</td></tr><tr><td>U.2 15 mm</td><td>69.85 mm</td><td>yes</td><td>heatsink room</td><td>20–25 W</td></tr></tbody></table><p>The 15 mm variant is the one in this review, and the extra 5.5 mm is there for a heatsink rather than for NAND. A Gen5 drive at 17 W in a 31.5 mm wide slot needs somewhere to put the heat, and 9.5 mm does not have it. If your chassis only takes 9.5 mm, budget for airflow across the drive cage or expect the controller to throttle during long writes, which will show up as a write rate that starts at 3 GB&#x2F;s and settles near 1 GB&#x2F;s after a minute.</p><p>Twelve drives at 17 W active is 204 W of storage power in a 1U. That is the number that decides your PSU and your fan curve, not the sequential throughput. The 5 W idle figure is the one that shows up on the electricity bill: twelve of them at idle is 60 W, which is 525 kWh a year at continuous operation, before any fans move air across them.</p><h2 id="Measuring-your-own-workload-against-the-budget"><a href="#Measuring-your-own-workload-against-the-budget" class="headerlink" title="Measuring your own workload against the budget"></a>Measuring your own workload against the budget</h2><p>Do this before you commit a node to these drives:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># sustained write, 128k, direct IO, ten minutes</span></span><br><span class="line">fio --name=w --filename=/dev/nvme1n1 --rw=write --bs=128k \</span><br><span class="line">    --iodepth=32 --ioengine=libaio --direct=1 --runtime=600 --time_based</span><br><span class="line"></span><br><span class="line"><span class="comment"># what the drive thinks it has written, in 512,000-byte units</span></span><br><span class="line">smartctl -a /dev/nvme1n1 | grep -E <span class="string">&#x27;Data Units Written|Percentage Used&#x27;</span></span><br></pre></td></tr></table></figure><p>Multiply data units written by 512,000 to get bytes. Snapshot that value weekly; the delta over seven days is your actual DWPD, and it is the only endurance figure that reflects your workload. <code>Percentage Used</code> is the drive’s own estimate against its rated endurance, and on a used drive it is the first thing to check before buying second-hand.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># estimate fill-level write collapse</span></span><br><span class="line">fio --name=f --filename=/dev/nvme1n1 --rw=write --bs=1M \</span><br><span class="line">    --size=95% --iodepth=16 --direct=1 --runtime=300</span><br></pre></td></tr></table></figure><p>The second run, into a 95% full drive, tells you what happens when the SLC window is exhausted. On a read-optimized TLC drive the drop is steep, and it is the number your nightly backup job will actually experience.</p><h2 id="What-to-buy-it-for"><a href="#What-to-buy-it-for" class="headerlink" title="What to buy it for"></a>What to buy it for</h2><p>Read-mostly nodes: <a href="/posts/e1594942/">container image caches</a>, model weight stores, media serving, a Prometheus or Loki box whose writes are small and steady. In those roles the 1.92 TB model’s 22 MB&#x2F;s budget is comfortable, the read specs are the same as the big capacity, and the E1.S footprint buys back drive bay space you can spend on GPUs.</p><p>Do not buy it as a backup target that ingests a nightly full, as a database primary with a write-ahead log on the same device, or as the landing zone for a video pipeline. Those workloads want capacity-scaled endurance, and the 7.68 TB model at 88.9 MB&#x2F;s of budget is the version to price instead. The per-terabyte cost looks worse until you divide by the endurance you are actually consuming, at which point the small drive is the expensive one.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>How many MB&#x2F;s of sustained writes does the 1.92 TB Kioxia XD8’s 1 DWPD rating allow?</strong></p><p>About 22 MB&#x2F;s averaged over five years. The conversion is capacity times DWPD, divided by 86,400 seconds and 1e6 to get MB&#x2F;s, so 1.92 TB per day works out to 22.2 MB&#x2F;s. That is the sustained write budget the endurance rating implies, not an instantaneous limit.</p><p><strong>What happens if I write 200 MB&#x2F;s continuously to the 1.92 TB model?</strong></p><p>You consume its five-year endurance in roughly seven months of runtime. The 22 MB&#x2F;s budget is a five-year average, so a node writing well above it burns through rated endurance proportionally faster. The drive gives no warning until the spare blocks are gone.</p><p><strong>Why is the sequential write rating 3.1 GB&#x2F;s when the endurance budget is only 22 MB&#x2F;s?</strong></p><p>Because sequential write on a TLC drive is a cache measurement. The controller writes to NAND configured as SLC first, then folds it into TLC later, and the 3.1 GB&#x2F;s figure describes the SLC window and fold rate combined. Both shrink as the drive fills, so the gap between peak and sustained budget is expected.</p><p><strong>Is the 1.92 TB model’s read performance worse than the larger capacities?</strong></p><p>No. It carries the same read spec as the 7.68 TB model: 12.5 GB&#x2F;s sequential read and 1.7 million random 4K read IOPS. Normally small capacities lose read parallelism along with the extra NAND packages, but Kioxia kept the read path intact and let write endurance scale with capacity instead.</p><p><strong>How do I measure my own workload’s real DWPD on these drives?</strong></p><p>Snapshot the Data Units Written value from <code>smartctl -a</code> weekly; multiply by 512,000 to get bytes, and the delta over seven days is your actual DWPD. <code>Percentage Used</code> is the drive’s own estimate against rated endurance. That measured figure is the only endurance number that reflects your workload, so check it before committing a node.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>Short Covering Is a Flow, Not a Forecast: Reading Funding and Open Interest</title>
      <link>https://getbytecraft.com/posts/49c8c939/</link>
      <description>JPMorgan says short covering has begun; funding, open interest and basis are public, and they disagree often enough to check yourself</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/crypto/">
        <![CDATA[Crypto & Web3]]>
      </category>
      <category domain="https://getbytecraft.com/tags/cost/">cost</category>
      <pubDate>Fri, 04 Dec 2026 09:48:57 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> Short covering is a flow, not a forecast. JPMorgan’s call that covering has started is testable from funding, open interest and basis, and the three disagree often enough that you should compute them yourself rather than take the label.</p><p>The Block reported on December 3 that JPMorgan told clients bitcoin short covering had begun after positioning reached what it called extreme bearish levels, adding that easing ETF outflows could support a near-term recovery in bitcoin and gold. That is a positioning argument dressed as a price call. The distinction matters because covering is mechanical: someone who is short must buy, and when they are done buying, the bid they created disappears.</p><p>The useful question is not whether JPMorgan is right. It is which observable series would have to move for the claim to be true, and whether those series are moving. All of them are public, and none of them require a subscription.</p><h2 id="Funding-is-a-price-not-a-sentiment"><a href="#Funding-is-a-price-not-a-sentiment" class="headerlink" title="Funding is a price, not a sentiment"></a>Funding is a price, not a sentiment</h2><p>Perpetual futures have no expiry, so exchanges use a periodic payment between longs and shorts to tether the contract to spot. When funding is positive, longs pay shorts, which means the crowd is long and paying to stay long. When it is negative, shorts pay longs, which means the crowd is short and paying to stay short.</p><p>The default rate on most venues is 0.01% per 8 hours, which is not neutral sentiment, it is the baseline cost of being long. Annualized:</p><table><thead><tr><th>Funding per 8h</th><th>Annualized, compounded</th><th>Read</th></tr></thead><tbody><tr><td>+0.10%</td><td>+198%</td><td>crowded long, liquidation fuel</td></tr><tr><td>+0.03%</td><td>+46%</td><td>healthy uptrend</td></tr><tr><td>+0.01%</td><td>+10.95%</td><td>venue default</td></tr><tr><td>0.00%</td><td>0%</td><td>balanced</td></tr><tr><td>−0.01%</td><td>−10.95%</td><td>mild short bias</td></tr><tr><td>−0.05%</td><td>−42%</td><td>crowded short</td></tr><tr><td>−0.10%</td><td>−67%</td><td>extreme, covering likely</td></tr></tbody></table><p>Annualizing is <code>(1 + r)**(3*365) - 1</code>, not <code>r * 3 * 365</code>. The difference matters at the extremes: −0.10% per interval is −67% compounded, not −109.5%. Anyone quoting the linear version is overstating the pressure.</p><p>A reading of −0.05% sustained for several days is the condition JPMorgan is describing. Shorts are paying 42% a year for the privilege of being short, and every candle up costs them <a href="/posts/59ee7c04/">carry plus mark-to-market</a>. That is when covering starts, not because the thesis changed but because the carry became unbearable.</p><h2 id="The-four-quadrant-test"><a href="#The-four-quadrant-test" class="headerlink" title="The four-quadrant test"></a>The four-quadrant test</h2><p>Funding alone cannot distinguish covering from new longs, because both push price up. You need open interest, which counts contracts outstanding rather than dollars.</p><table><thead><tr><th>Price</th><th>Open interest</th><th>Interpretation</th></tr></thead><tbody><tr><td>up</td><td>down</td><td>short covering, positions closing</td></tr><tr><td>up</td><td>up</td><td>new longs entering</td></tr><tr><td>down</td><td>down</td><td>long liquidation, forced selling</td></tr><tr><td>down</td><td>up</td><td>new shorts entering</td></tr></tbody></table><p>The first row is the one JPMorgan is claiming. If bitcoin rises while aggregate open interest falls, contracts are being closed rather than created, and the buying is someone exiting a short. If both rise, the rally is fresh money and has a different half-life.</p><p>This is why covering rallies tend to be fast and shallow. The buying is bounded by the size of the short position and it stops when the last short is flat. A rally built on new longs has no such ceiling, but it also carries funding costs that eventually force the weak hands out.</p><p>Basis adds a third check. The annualized spread between a quarterly futures contract and spot should sit near the funding-implied rate plus a small risk premium. If funding is deeply negative while quarterly basis is flat or positive, the perp market is crowded one way and the dated market is not, which usually means the perp pressure is a small number of large accounts rather than a broad shift.</p><h2 id="Reading-it-yourself"><a href="#Reading-it-yourself" class="headerlink" title="Reading it yourself"></a>Reading it yourself</h2><p>Exchange APIs expose funding history and open interest without authentication on most venues. The shape below works on the major perp venues; adjust the path to whichever you use.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># funding history, most recent first</span></span><br><span class="line">curl -s <span class="string">&quot;https://fapi.binance.com/fapi/v1/fundingRate?symbol=BTCUSDT&amp;limit=21&quot;</span> \</span><br><span class="line">  | jq -r <span class="string">&#x27;.[] | [.fundingTime, .fundingRate] | @tsv&#x27;</span> \</span><br><span class="line">  | awk <span class="string">&#x27;&#123;printf &quot;%s  %+0.4f%%\n&quot;, strftime(&quot;%Y-%m-%d %H:%M&quot;, $1/1000), $2*100&#125;&#x27;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># open interest, current</span></span><br><span class="line">curl -s <span class="string">&quot;https://fapi.binance.com/fapi/v1/openInterest?symbol=BTCUSDT&quot;</span> | jq .</span><br></pre></td></tr></table></figure><p>Then compute the annualized carry over a trailing window rather than a single print, because one interval is noise:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">rates = [-<span class="number">0.0004</span>, -<span class="number">0.0007</span>, -<span class="number">0.0009</span>, -<span class="number">0.0006</span>, -<span class="number">0.0003</span>]  <span class="comment"># 8h, last 5 intervals</span></span><br><span class="line"><span class="keyword">import</span> math</span><br><span class="line">avg = <span class="built_in">sum</span>(rates) / <span class="built_in">len</span>(rates)</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;avg per 8h: <span class="subst">&#123;avg*<span class="number">100</span>:+<span class="number">.4</span>f&#125;</span>%&quot;</span>)</span><br><span class="line"><span class="built_in">print</span>(<span class="string">f&quot;annualized: <span class="subst">&#123;((<span class="number">1</span>+avg)**(<span class="number">3</span>*<span class="number">365</span>) - <span class="number">1</span>)*<span class="number">100</span>:+<span class="number">.1</span>f&#125;</span>%&quot;</span>)</span><br></pre></td></tr></table></figure><p>The sample values above are illustrative, not a reading of today’s market. Run it with real data and the pattern you are looking for is a sequence of negative prints that stops getting more negative, which is what a short base exhausting itself looks like: the same crowding, less conviction.</p><h2 id="Where-the-ETF-flow-number-fits"><a href="#Where-the-ETF-flow-number-fits" class="headerlink" title="Where the ETF flow number fits"></a>Where the ETF flow number fits</h2><p>JPMorgan pairs the covering call with easing ETF outflows, and the pairing is the part worth stealing. Spot ETF flows are reported daily and they are a cleaner measure of one specific class of buyer than anything in the derivatives market. Outflows easing means the marginal seller from that channel has stopped selling. It does not mean anyone is buying.</p><p>Stack the two: funding going from extreme negative toward zero plus ETF outflows shrinking to zero is a market that has stopped being pushed down. That is a very different setup from funding flipping positive plus ETF inflows, which is a market being pushed up. The first is a floor, the second is a trend, and they get conflated constantly in coverage that only has room for one sentence.</p><h2 id="What-the-label-hides"><a href="#What-the-label-hides" class="headerlink" title="What the label hides"></a>What the label hides</h2><p>There is a fourth series nobody quotes in these notes, and it is the one that decides whether a covering rally has legs: the <a href="/posts/7a389009/">liquidation map</a>. When funding has been deeply negative for a week, leveraged shorts accumulate stop orders just above recent highs, because that is where their margin breaks. Covering does not need a reason to start; it needs a price that touches those stops, and then the exchange does the buying for everyone.</p><p>That is the mechanism behind the fast, vertical part of a squeeze, and it is why the same positioning that produced a slow bleed down can produce a two-hour candle up. It also means the flow is self-terminating: once the stops are cleared, the forced buyer is gone and price has to stand on its own.</p><table><thead><tr><th>Flow</th><th>Trigger</th><th>Duration</th><th>What follows</th></tr></thead><tbody><tr><td>Voluntary covering</td><td>carry too expensive</td><td>days to weeks</td><td>drift, then fade</td></tr><tr><td>Forced covering</td><td>stop cascade</td><td>hours</td><td>sharp reversal of the move</td></tr><tr><td>New longs</td><td>narrative plus inflows</td><td>weeks</td><td>funding rises, trend possible</td></tr><tr><td>ETF rebalancing</td><td>creation and redemption</td><td>one day</td><td>no persistence</td></tr></tbody></table><p>The distinction is not academic. Voluntary covering leaves open interest lower and funding closer to zero, which is a market that can grind. Forced covering leaves open interest sharply lower in one session and funding spiking positive, which is a market that has just spent its fuel.</p><h2 id="The-trap-in-acting-on-it"><a href="#The-trap-in-acting-on-it" class="headerlink" title="The trap in acting on it"></a>The trap in acting on it</h2><p>Covering is a finite flow with an unknown end date, and the announcement of it is itself a catalyst that brings it forward. By the time a bank’s positioning note is public and quoted, some of the covering it describes has already happened, which is why the price reaction to these notes is often one candle and then nothing.</p><p>What survives the noise is the carry arithmetic. If funding is still negative after the rally, shorts are still paying, and the covering has more room. If funding has normalized to zero while price is up and open interest is flat, the flow is done and you are looking at a market with no forced buyer left. Compute that, write down the date and the values, and check it a week later. It is a five-minute exercise that turns a headline into a testable claim, and it is the only part of this that compounds.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>How do you tell short covering from new buying?</strong></p><p>Compare price against open interest. If price rises while open interest falls, contracts are being closed and the buying is shorts exiting. If both price and open interest rise, the rally is new longs entering fresh money. Funding alone cannot make this distinction because both flows push price up.</p><p><strong>What funding rate signals that short covering is likely?</strong></p><p>A reading of −0.05% per 8 hours sustained for several days is the condition being described. At that level shorts are paying roughly 42% a year to stay short, so every candle up costs them carry plus mark-to-market. Covering starts when the carry becomes unbearable, not because the thesis changed.</p><p><strong>Why annualize funding with compounding instead of multiplying by three?</strong></p><p>Annualizing uses <code>(1 + r)**(3*365) - 1</code>, not <code>r * 3 * 365</code>. The difference matters at the extremes: −0.10% per interval is −67% compounded, not −109.5%. Quoting the linear version overstates the pressure on shorts.</p><p><strong>What does easing ETF outflow mean for a covering setup?</strong></p><p>Easing outflows means the marginal seller from that channel has stopped selling; it does not mean anyone is buying. Funding moving from extreme negative toward zero plus ETF outflows shrinking to zero describes a market that has stopped being pushed down. That is a floor, not a trend.</p><p><strong>Why do covering rallies tend to be fast and shallow?</strong></p><p>The buying is bounded by the size of the short position and stops when the last short is flat. When funding has been deeply negative, leveraged shorts accumulate stop orders just above recent highs, and a price touching those stops makes the exchange do the buying. Once the stops clear, the forced buyer is gone.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>Bitcoin Core Promises Post-Quantum Signatures by January 2027: What Has to Change</title>
      <link>https://getbytecraft.com/posts/b85576da/</link>
      <description>A proposal deadline is not a migration; PQ signatures are 30 to 60 times larger, and Taproot outputs already expose public keys</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/crypto/">
        <![CDATA[Crypto & Web3]]>
      </category>
      <category domain="https://getbytecraft.com/tags/bitcoin/">bitcoin</category>
      <pubDate>Fri, 04 Dec 2026 09:41:57 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> Bitcoin Core developers promising post-quantum signature proposals by the end of January 2027 does not mean your coins migrate automatically. The signatures are 30 to 60 times larger than Schnorr, so the hard part is block space and which output types are exposed today, not the cryptography.</p><p>CoinDesk reported on December 3 that a group of <a href="/posts/3b8e1d07/">Bitcoin Core developers</a> committed to delivering post-quantum proposals by the end of January 2027, with the line that matters buried in a quote: making post-quantum signatures available in Bitcoin is their top priority. The same week, US agencies and large technology companies pushed for faster adoption of quantum-resistant standards, and bitcoin fell 13% to $52,000 on the news cycle before recovering part of it.</p><p>Two things are being conflated in that reaction. A commitment to publish proposals is a scheduling statement about engineering work. It is not a consensus change, not an activation date, and not a claim that anything is broken this year. What it does tell you is that the shape of the migration is now being decided, and the shape is constrained by arithmetic anyone can check.</p><h2 id="What-a-proposal-by-January-2027-does-and-does-not-mean"><a href="#What-a-proposal-by-January-2027-does-and-does-not-mean" class="headerlink" title="What a proposal by January 2027 does and does not mean"></a>What a proposal by January 2027 does and does not mean</h2><p>A proposal has to answer four questions before it is worth arguing about: which signature scheme, which output type, how the coins get from old outputs to new ones, and what happens to outputs nobody moves. The first is nearly settled by standards bodies. NIST finalized ML-DSA as FIPS 204 and SLH-DSA as FIPS 205, and those are the two families anyone credible is choosing between.</p><p>The second question is the interesting one. Bitcoin has a versioned witness program space, and adding a new output type is the least invasive way to introduce a signature scheme: old nodes see an anyone-can-spend output they do not validate, new nodes enforce the new rules. That is how Taproot arrived, and it is almost certainly how this arrives.</p><p>The third and fourth questions are political. A soft fork cannot force anyone to move coins. Coins in vulnerable outputs stay vulnerable, and the only lever is social: exchanges refusing deposits from old output types, wallets nagging, or a flag day that nobody can actually enforce.</p><h2 id="Which-coins-are-exposed-today"><a href="#Which-coins-are-exposed-today" class="headerlink" title="Which coins are exposed today"></a>Which coins are exposed today</h2><p>The exposure is not uniform. What matters is whether a public key is already sitting on chain, because a quantum computer attacking Bitcoin would solve for a private key from a known public key, not from a hash.</p><table><thead><tr><th>Output type</th><th>Public key on chain</th><th>Vulnerable before spend</th><th>Priority</th></tr></thead><tbody><tr><td>P2PK (pay to pubkey)</td><td>yes, in the output</td><td>yes</td><td>highest</td></tr><tr><td>P2PKH, never spent</td><td>no, only hash</td><td>no</td><td>low</td></tr><tr><td>P2PKH, spent once, address reused</td><td>yes, in the spending input</td><td>yes</td><td>high</td></tr><tr><td>P2WPKH, never spent</td><td>no, only hash</td><td>no</td><td>low</td></tr><tr><td>P2WPKH, reused address</td><td>yes, in witness</td><td>yes</td><td>high</td></tr><tr><td>P2TR (Taproot)</td><td>yes, tweaked key in output</td><td>yes</td><td>highest</td></tr><tr><td>P2SH multisig, spent</td><td>yes, in redeem script</td><td>yes</td><td>high</td></tr></tbody></table><p>The Taproot row is the one people miss. A P2TR output commits to a tweaked public key directly, so every Taproot output exposes a key from the moment it is created, whether or not it has ever been spent. The same is true of the old P2PK outputs that Satoshi-era miners used, which is why the early coins are always named first in these discussions.</p><p>Everything in the low rows becomes high the moment you spend from it with a reused address. Address reuse converts a hash-protected output into a key-exposed one, permanently, in public.</p><h2 id="The-size-problem-is-a-block-space-problem"><a href="#The-size-problem-is-a-block-space-problem" class="headerlink" title="The size problem is a block-space problem"></a>The size problem is a block-space problem</h2><p>This is where the migration gets expensive, and where most commentary stops. Post-quantum signatures are large. Compare the numbers, all from the published standards:</p><table><thead><tr><th>Scheme</th><th>Public key</th><th>Signature</th></tr></thead><tbody><tr><td>ECDSA (secp256k1), DER</td><td>33 B compressed</td><td>71–72 B</td></tr><tr><td>Schnorr (BIP340)</td><td>32 B x-only</td><td>64 B</td></tr><tr><td>ML-DSA-44</td><td>1,312 B</td><td>2,420 B</td></tr><tr><td>ML-DSA-65</td><td>1,952 B</td><td>3,293 B</td></tr><tr><td>ML-DSA-87</td><td>2,592 B</td><td>4,595 B</td></tr><tr><td>SLH-DSA-128s</td><td>32 B</td><td>7,856 B</td></tr></tbody></table><p>Witness data costs 1 weight unit per byte, and a block is 4,000,000 weight units. A P2WPKH input with a Schnorr signature is 264 weight units. Swap in ML-DSA-44 and the same input becomes:</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">def</span> <span class="title function_">varint</span>(<span class="params">n</span>):</span><br><span class="line">    <span class="keyword">return</span> <span class="number">1</span> <span class="keyword">if</span> n &lt; <span class="number">0xfd</span> <span class="keyword">else</span> <span class="number">3</span> <span class="keyword">if</span> n &lt;= <span class="number">0xffff</span> <span class="keyword">else</span> <span class="number">5</span></span><br><span class="line"></span><br><span class="line">sig, pk = <span class="number">2420</span>, <span class="number">1312</span>            <span class="comment"># ML-DSA-44</span></span><br><span class="line">witness = <span class="number">1</span> + varint(sig) + sig + varint(pk) + pk</span><br><span class="line">weight = witness + <span class="number">4</span> * <span class="number">41</span>       <span class="comment"># 41 non-witness bytes at 4 WU each</span></span><br><span class="line"><span class="built_in">print</span>(witness)                  <span class="comment"># 3,739 bytes</span></span><br><span class="line"><span class="built_in">print</span>(weight)                   <span class="comment"># 3,903 WU, versus 264 for Schnorr</span></span><br><span class="line"><span class="built_in">print</span>(<span class="number">4_000_000</span> // weight)      <span class="comment"># 1,024 inputs per block</span></span><br></pre></td></tr></table></figure><p>Those are derived, not measured: a 14.3× jump in per-input weight, so roughly 1,024 such inputs per block where the current limit fits about 15,000. Consolidating a wallet with 500 UTXOs turns from a cheap housekeeping transaction into a multi-block operation. For an exchange with millions of outputs, the migration is a capacity project measured in months of block space, and it competes with everyone else doing the same thing at the same time.</p><p>This is the argument for starting the proposal process now rather than when a quantum computer exists. The migration cost is a function of how many outputs move and how much block space is available while they move.</p><h2 id="What-you-can-do-before-any-soft-fork"><a href="#What-you-can-do-before-any-soft-fork" class="headerlink" title="What you can do before any soft fork"></a>What you can do before any soft fork</h2><p>Three actions are worth taking regardless of what gets activated, and none of them require a code change.</p><p>Stop reusing addresses. This is the only one that changes your exposure today, because it prevents a hash-protected output from becoming a key-exposed one. Most wallets default to fresh addresses; the reuse usually comes from exchange withdrawal pages and from invoices pasted twice.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># check whether an address has been used before paying into it</span></span><br><span class="line">bitcoin-cli getaddressinfo bc1q... | jq <span class="string">&#x27;.ismine, .iswatchonly, .labels&#x27;</span></span><br><span class="line"><span class="comment"># and on any explorer, confirm tx count == 0 before receiving</span></span><br></pre></td></tr></table></figure><p>Inventory what you hold in P2PK and Taproot outputs, because those are the ones a migration has to move first and the ones where a rushed move is most expensive. A single-transaction sweep of a Taproot-heavy wallet at 4,000 weight units per input is not going to fit.</p><p>Keep a signed, offline record of which wallet software version produced each address type you hold. When a proposal activates, the wallets that support the new output type on day one will be a short list, and the ones that do not will either refuse to spend or, worse, spend to an old type.</p><h2 id="The-decision-you-can-defer"><a href="#The-decision-you-can-defer" class="headerlink" title="The decision you can defer"></a>The decision you can defer</h2><p>You do not need to move coins in December 2026 because a proposal is due in January 2027. You do need to know which of your coins sit in outputs with an exposed public key, because that set is the one with a deadline attached and the one where the cost of moving is highest. Count them now, while block space is cheap and nobody is queueing.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>Does a January 2027 post-quantum proposal mean my bitcoin will be migrated automatically?</strong></p><p>No. A proposal is a scheduling statement about engineering work, not a consensus change or an activation date. A soft fork cannot force anyone to move coins, so coins in vulnerable outputs stay vulnerable until their owners move them.</p><p><strong>Which bitcoin output types are most exposed to a quantum attacker today?</strong></p><p>Exposure depends on whether a public key already sits on chain. P2PK and P2TR are highest priority, because P2TR commits to a tweaked public key directly, so every Taproot output exposes a key from the moment it is created, spent or not.</p><p><strong>Are unspent P2PKH and P2WPKH outputs vulnerable?</strong></p><p>Not while they remain unspent. Those outputs contain only a hash, and an attacker would need to solve from a known public key. They become high priority the moment you spend from them with a reused address, which permanently exposes a key in public.</p><p><strong>Why are post-quantum signatures a block-space problem rather than a cryptography problem?</strong></p><p>ML-DSA-44 signatures are 2,420 bytes with a 1,312-byte public key, against 64 bytes for Schnorr. A P2WPKH input goes from 264 weight units to about 3,903, so a block fits roughly 1,024 such inputs instead of about 15,000. Consolidating large wallets becomes a multi-block operation.</p><p><strong>What can I do now, before any post-quantum soft fork activates?</strong></p><p>Stop reusing addresses, since that is the only action that changes your exposure today and keeps a hash-protected output from becoming key-exposed. Also inventory what you hold in P2PK and Taproot outputs, and keep a signed offline record of which wallet version produced each address type.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>macOS 27.3 Renames the Accessibility Grant: Auditing Which Apps Can Drive Your Mac</title>
      <link>https://getbytecraft.com/posts/2294380d/</link>
      <description>macOS 27.3 renames the permission your GUI agent needs and fronts it with a warning screen; audit who holds it before you upgrade</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/ai/">AI</category>
      <category domain="https://getbytecraft.com/tags/automation/">automation</category>
      <pubDate>Fri, 04 Dec 2026 09:34:57 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> macOS 27.3 renamed the permission your automation depends on and now fronts it with a warning screen that lists worst cases instead of capabilities. Audit which binaries hold it before your next OS bump, because the failure looks like a broken script, not a denied permission.</p><p>The permission has been renamed twice in three releases. It was Accessibility for years, became Device Control and Data Access in 27.0, and in 27.3 arrives as System &amp; App Protection Override. Wojciech Kulik documented the new grant flow on December 4 and the reaction on Hacker News was immediate, mostly from people who ship window managers, launchers and text expanders.</p><p>The rename is not the problem. The problem is the screen. To grant it, a user now walks through several sections and clicks OK next to each one, and the sections describe possibilities rather than the thing being granted: reading current and future browsing history, acting on sites you are signed in to, including banking and medical accounts. The same screen appears for App Store apps, which are sandboxed and cannot read another app’s UI content at all, and for notarized apps distributed outside the store. A user who reads it and declines is behaving rationally.</p><h2 id="What-the-permission-actually-controls"><a href="#What-the-permission-actually-controls" class="headerlink" title="What the permission actually controls"></a>What the permission actually controls</h2><p>The grant loads the app into the accessibility API surface. In practice that means four capabilities, and they are the four your agent needs if it drives a GUI:</p><table><thead><tr><th>Capability</th><th>Enabled by the grant</th><th>Still blocked</th></tr></thead><tbody><tr><td>Synthesize key events</td><td>yes</td><td>secure input fields, password prompts</td></tr><tr><td>Synthesize mouse events and clicks</td><td>yes</td><td>clicks inside secure prompts</td></tr><tr><td>Read and modify window geometry</td><td>yes, non-sandboxed</td><td>nothing extra</td></tr><tr><td>Read and modify another app’s UI tree</td><td>yes, non-sandboxed</td><td>sandboxed apps cannot</td></tr><tr><td>Screen capture</td><td>no</td><td>needs Screen Recording</td></tr><tr><td>Read protected files</td><td>no</td><td>needs Full Disk Access</td></tr><tr><td>Install software, change settings</td><td>no</td><td>needs admin authorization</td></tr></tbody></table><p>That last column is the part the dialog omits. The grant is powerful, it is not total, and it cannot be scoped. Apple gives developers no way to request “keyboard only” or “this one app only”. It is one boolean per binary, which is why the warning reads like a nuclear launch confirmation and why auditing it has to be binary too.</p><h2 id="Finding-every-binary-that-holds-it"><a href="#Finding-every-binary-that-holds-it" class="headerlink" title="Finding every binary that holds it"></a>Finding every binary that holds it</h2><p>The grant lives in the TCC database, one per user plus a system-wide one. The system database is protected; reading it needs Full Disk Access for your terminal, so <a href="/posts/4fae3537/">run this from a shell that already has it</a>.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">sudo</span> sqlite3 <span class="string">&quot;/Library/Application Support/com.apple.TCC/TCC.db&quot;</span> \</span><br><span class="line">  <span class="string">&quot;select client, auth_value, datetime(last_modified,&#x27;unixepoch&#x27;) \</span></span><br><span class="line"><span class="string">   from access where service=&#x27;kTCCServiceAccessibility&#x27; order by last_modified desc;&quot;</span></span><br><span class="line"></span><br><span class="line">sqlite3 <span class="string">&quot;<span class="variable">$HOME</span>/Library/Application Support/com.apple.TCC/TCC.db&quot;</span> \</span><br><span class="line">  <span class="string">&quot;select service, client, auth_value from access \</span></span><br><span class="line"><span class="string">   where service like &#x27;kTCCService%&#x27; and auth_value=2;&quot;</span></span><br></pre></td></tr></table></figure><p><code>auth_value=2</code> is allowed, <code>0</code> is denied, <code>3</code> is limited. The service string is still <code>kTCCServiceAccessibility</code> even though the UI label changed twice, which is the one mercy in this release: your MDM payloads and your audit scripts keep working without edits.</p><p>On a laptop that has been through three major versions, expect the list to be longer than you remember. Every Electron app that ever asked, every helper bundle inside a launcher, every update that shipped a new binary under a new path. TCC keys on the code signature and the bundle path, so an app that moves from <code>/Applications/Foo.app</code> to <code>/Applications/Foo 2.app</code> is a different principal and gets asked again.</p><h2 id="Why-the-break-is-silent"><a href="#Why-the-break-is-silent" class="headerlink" title="Why the break is silent"></a>Why the break is silent</h2><p>When the grant is missing or revoked, <code>AXIsProcessTrusted()</code> returns false and any call that posts an event fails. What the user sees depends entirely on <a href="/posts/129dd8e7/">how the agent handles that return value</a>. The common pattern is a retry loop, then a timeout, then a log line about a selector that did not respond. Nothing in that chain says “permission”.</p><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># the check that should run before any UI step</span></span><br><span class="line"><span class="keyword">import</span> subprocess, json</span><br><span class="line">out = subprocess.run([<span class="string">&quot;sqlite3&quot;</span>,</span><br><span class="line">    <span class="string">&quot;/Library/Application Support/com.apple.TCC/TCC.db&quot;</span>,</span><br><span class="line">    <span class="string">&quot;select count(*) from access where service=&#x27;kTCCServiceAccessibility&#x27; &quot;</span></span><br><span class="line">    <span class="string">&quot;and client=&#x27;com.example.agent&#x27; and auth_value=2;&quot;</span>],</span><br><span class="line">    capture_output=<span class="literal">True</span>, text=<span class="literal">True</span>)</span><br><span class="line"><span class="keyword">if</span> out.stdout.strip() != <span class="string">&quot;1&quot;</span>:</span><br><span class="line">    <span class="keyword">raise</span> SystemExit(<span class="string">&quot;accessibility grant missing for com.example.agent&quot;</span>)</span><br></pre></td></tr></table></figure><p>Better: call the API. A two-line Swift binary compiled at install time beats parsing a database whose schema Apple has changed before.</p><figure class="highlight swift"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> ApplicationServices</span><br><span class="line"><span class="built_in">print</span>(<span class="type">AXIsProcessTrusted</span>() <span class="operator">?</span> <span class="string">&quot;granted&quot;</span> : <span class="string">&quot;denied&quot;</span>)</span><br></pre></td></tr></table></figure><p>Ship that check as a preflight in the agent’s startup path and print the result into the first line of the log. One line of output converts a two-hour debugging session into a five-second fix.</p><h2 id="Notarization-is-not-a-permission"><a href="#Notarization-is-not-a-permission" class="headerlink" title="Notarization is not a permission"></a>Notarization is not a permission</h2><p>The dialog implies that granting it is equivalent to handing over the machine. It is not, and the distinction is the one piece of leverage you have when arguing with a user who just declined.</p><p>Notarization means Apple scanned the binary for known malware and tied it to a Developer ID, which is tied to a real identity and a paid account. It does not mean the app behaves. A notarized app can still post keystrokes into your browser. Conversely, a sandboxed App Store app that passes review cannot read another app’s UI tree at all, yet it gets the identical warning screen, because Apple renders one template for both cases.</p><table><thead><tr><th>Signal</th><th>What it proves</th><th>What it does not</th></tr></thead><tbody><tr><td>Notarized</td><td>binary scanned, developer identified</td><td>app is well behaved</td></tr><tr><td>App Store</td><td>sandboxed, reviewed</td><td>can do UI automation</td></tr><tr><td>Signed with Developer ID</td><td>signature chain intact</td><td>grant is scoped</td></tr><tr><td>Held the Accessibility grant</td><td>can synthesize input</td><td>can read secure fields</td></tr></tbody></table><p>So the audit question is not “is this app safe”. It is “does this binary need to synthesize input, and is it the only one that does”. On a typical developer laptop the answer is no: a launcher, a window manager, a clipboard history tool and two agents all hold the same all-or-nothing boolean, and any one of them could type into a terminal.</p><h2 id="What-to-do-before-the-upgrade-lands"><a href="#What-to-do-before-the-upgrade-lands" class="headerlink" title="What to do before the upgrade lands"></a>What to do before the upgrade lands</h2><p>Pin the version on machines that run unattended automation. A macOS point release that renames a permission and changes its grant flow is not a security patch you want arriving on a Tuesday with no test window.</p><p>For fleets, push the grant through a configuration profile rather than clicking. The privacy preferences policy payload accepts <code>com.apple.TCC.configuration-profile-policy</code> with an Accessibility entry, and a profile-delivered grant is not revocable by the user through the warning screen, which is exactly what you want for a headless runner and exactly what you should document for anyone whose machine it is.</p><p>For single machines, the recovery path is:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># revoke, then re-grant through System Settings</span></span><br><span class="line"><span class="built_in">sudo</span> tccutil reset Accessibility com.example.agent</span><br><span class="line">open <span class="string">&quot;x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility&quot;</span></span><br></pre></td></tr></table></figure><p><code>tccutil reset</code> with a bundle id is surgical. Without one it wipes every Accessibility grant on the machine, which will quietly break the window manager, the launcher and the clipboard tool, and the user will blame the last thing that changed rather than the reset.</p><p>Then check the thing the dialog never tells them: the grant is per binary, not per app name, and it survives updates only if the signature stays valid. After every agent upgrade, rerun the preflight. If you want a single number to watch, it is the count of rows with <code>auth_value=2</code> for <code>kTCCServiceAccessibility</code> on each managed Mac. It should be constant. A drop is a user who got scared by a warning screen, and the only way you find out before they file a ticket is to look.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>What is the Accessibility permission called in macOS 27.3?</strong></p><p>In macOS 27.3 the permission arrives as System &amp; App Protection Override. It was Accessibility for years, became Device Control and Data Access in 27.0, and was renamed again in 27.3. The underlying TCC service string is still <code>kTCCServiceAccessibility</code>, so existing MDM payloads and audit scripts keep working without edits.</p><p><strong>Why does macOS 27.3 show a warning about browsing history and banking accounts?</strong></p><p>The grant screen describes possibilities rather than the thing being granted, including reading current and future browsing history and acting on sites you are signed in to, such as banking and medical accounts. The same screen appears for sandboxed App Store apps, which cannot read another app’s UI content at all. A user who reads it and declines is behaving rationally.</p><p><strong>Does the Accessibility grant let an app do anything on my Mac?</strong></p><p>No. The grant loads the app into the accessibility API surface and enables synthesizing key and mouse events, reading and modifying window geometry, and reading and modifying another app’s UI tree for non-sandboxed apps. It does not enable screen capture, which needs Screen Recording, or reading protected files, which needs Full Disk Access, or installing software, which needs admin authorization.</p><p><strong>Why does my automation script fail silently when the grant is missing?</strong></p><p>When the grant is missing or revoked, <code>AXIsProcessTrusted()</code> returns false and any call that posts an event fails. The common pattern is a retry loop, then a timeout, then a log line about a selector that did not respond, with nothing in that chain saying “permission”. A preflight check at startup that prints the result into the first log line turns a two-hour debugging session into a five-second fix.</p><p><strong>How do I find which binaries hold the Accessibility grant?</strong></p><p>Query the TCC database for rows where <code>service=&#39;kTCCServiceAccessibility&#39;</code> and <code>auth_value=2</code>, which means allowed. The system-wide database at <code>/Library/Application Support/com.apple.TCC/TCC.db</code> is protected, so reading it needs Full Disk Access for your terminal. TCC keys on code signature and bundle path, so an app that moves to a new path is a different principal and gets asked again.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>A 748B Model on One RTX 4090: The Ceiling Is Bandwidth, Not VRAM</title>
      <link>https://getbytecraft.com/posts/99201bc0/</link>
      <description>One 24 GB card now serves a 748B model at 78 tokens per second; the real ceiling is bytes per active parameter, not total VRAM</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/ai/">AI</category>
      <category domain="https://getbytecraft.com/tags/local-llm/">local llm</category>
      <pubDate>Fri, 04 Dec 2026 09:27:57 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> A 748B model now runs on one 24 GB card, and the thing that decides your tokens per second is bytes moved per active parameter, not total VRAM. Work out that number before you buy anything.</p><p>On December 3, Axel Labs published a run of DeepSeek-V4.1-Flash on a single RTX 4090. The model is 748 billion parameters, the official release is 510.3 GB of FP8 plus MXFP4 weights, and the machine held 468.1 GiB resident host memory with zero swap while the GPU sat at 22.7 of 24.0 GiB. One EPYC 9534 socket did the host work. The recorded request produced 6,862 tokens in 91.61 seconds: 78.76 <a href="/posts/9f1ef007/">tokens per second</a> during decode, 74.91 end to end, 4.50 seconds to the first token.</p><p>That result is worth reading closely, because it contradicts two things people repeat about local inference. The first is that a model has to <a href="/posts/5a7b3c21/">fit in VRAM</a>. The second is that once it does not fit, you are stuck at one or two tokens per second. Neither holds when the model is sparse and the host has enough memory channels to feed it.</p><h2 id="The-arithmetic-that-sets-the-ceiling"><a href="#The-arithmetic-that-sets-the-ceiling" class="headerlink" title="The arithmetic that sets the ceiling"></a>The arithmetic that sets the ceiling</h2><p>Decode is a bandwidth problem. Every token requires reading the parameters that participate in that token’s forward pass, so:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tokens/s = sustained_bandwidth / bytes_read_per_token</span><br></pre></td></tr></table></figure><p>Run it in reverse on the published numbers. If the engine had to read all 510.3 GB for every token, 78.76 tokens per second would need 40.2 TB&#x2F;s. No machine on the planet has that. So the model is not reading everything per token, which is exactly what a mixture-of-experts architecture is for.</p><p>Now bound it from the hardware side. An EPYC 9534 has 12 DDR5 channels; at DDR5-4800 that is 460.8 GB&#x2F;s theoretical, and real streaming reads land somewhere between 60% and 75% of theoretical on a single socket. Take 460 GB&#x2F;s as a generous ceiling:</p><table><thead><tr><th>Sustained host bandwidth</th><th>Observed tok&#x2F;s</th><th>Implied bytes per token</th><th>Share of 510.3 GB</th></tr></thead><tbody><tr><td>460.8 GB&#x2F;s (theoretical, 12ch DDR5-4800)</td><td>78.76</td><td>5.85 GB</td><td>1.15%</td></tr><tr><td>350 GB&#x2F;s (realistic streaming)</td><td>78.76</td><td>4.44 GB</td><td>0.87%</td></tr><tr><td>300 GB&#x2F;s</td><td>78.76</td><td>3.81 GB</td><td>0.75%</td></tr></tbody></table><p>Those are derived figures, not measurements, and they assume the host is the bottleneck. The useful part is the range: a few gigabytes per token, under 1.2% of the checkpoint. That is the active-parameter budget you are paying for, and it is the number to compare across models rather than parameter count.</p><h2 id="Host-memory-is-the-spec-sheet-nobody-prints"><a href="#Host-memory-is-the-spec-sheet-nobody-prints" class="headerlink" title="Host memory is the spec sheet nobody prints"></a>Host memory is the spec sheet nobody prints</h2><p>The gap between 510.3 GB and 468.1 GiB is worth a sentence, because it tells you nothing was re-quantized or copied. 510.3 GB decimal is 475.2 GiB. Resident memory at 468.1 GiB is 98.5% of that, with 0 B of swap. The weights were mapped, not converted.</p><p>That matters operationally. A converted copy would need disk space for a second checkpoint and would make startup minutes long. A mapped checkpoint starts in seconds and lets the page cache do the work of keeping hot experts resident. It also means your RAM requirement is the checkpoint size in GiB plus headroom, not checkpoint size times some compression factor you guessed.</p><p>Which produces the first real constraint: 512 GB of RAM is not “plenty” for this model, it is 30 GB of slack. Page cache is what makes repeated expert access cheap, and 30 GB of page cache across a 475 GiB working set is thin. Push the context length up and the KV cache competes with the cache that was hiding your expert reads.</p><h2 id="Where-the-first-token-goes"><a href="#Where-the-first-token-goes" class="headerlink" title="Where the first token goes"></a>Where the first token goes</h2><p>4.50 seconds to first token against 91.61 seconds total is a ratio worth understanding. Prefill processes the whole prompt in parallel, which is compute-bound and therefore fast on the GPU, but it also has to pull the experts the prompt activates. A short prompt that activates many experts can spend more time in memory than in arithmetic.</p><p>The published run also includes a second number that people skip: 18 shorter prose and coding requests, each capped at 256 output tokens, averaged 42.81 decode tokens per second in aggregate. Same machine, same model, roughly half the speed of the single long SVG generation. Short requests pay the cold-expert penalty repeatedly; a long generation amortizes it after the first few hundred tokens. If you benchmark with 128-token completions and then ship a chat product, you are measuring the wrong workload.</p><h2 id="Configurations-and-what-they-can-promise"><a href="#Configurations-and-what-they-can-promise" class="headerlink" title="Configurations and what they can promise"></a>Configurations and what they can promise</h2><table><thead><tr><th>Setup</th><th>Weights resident</th><th>Effective bandwidth</th><th>Ceiling at 4 GB&#x2F;token</th></tr></thead><tbody><tr><td>1× 4090 + 512 GB DDR5-4800, 12ch</td><td>host</td><td>~350 GB&#x2F;s</td><td>~87 tok&#x2F;s</td></tr><tr><td>4× RTX 6000 Ada (192 GB) + 512 GB host</td><td>split</td><td>~350 GB&#x2F;s host, 64 GB&#x2F;s PCIe</td><td>~87 tok&#x2F;s, worse TTFT</td></tr><tr><td>8× H100 80 GB, NVLink</td><td>GPU</td><td>3.35 TB&#x2F;s HBM3</td><td>~838 tok&#x2F;s</td></tr><tr><td>512 GB unified memory SoC</td><td>unified</td><td>~819 GB&#x2F;s</td><td>~205 tok&#x2F;s</td></tr></tbody></table><p>All ceilings derived from the same formula with stated bandwidth. The point of the table is not that one row wins. It is that the 4090 row is not 10× slower than the H100 row for a sparse model, because the 4090 row is not the one moving the weights. The host is.</p><p>That also explains why adding GPUs to a host-bound setup buys so little. Four cards give you 192 GB of VRAM, but the experts still live in host RAM, and now every token crosses PCIe. PCIe 4.0 x16 is 32 GB&#x2F;s in each direction. At 4 GB per token and 350 GB&#x2F;s of host bandwidth, you were already at 87 tokens per second; inserting a 32 GB&#x2F;s link in the path makes the link the bottleneck, not the host.</p><h2 id="What-to-measure-on-your-own-box"><a href="#What-to-measure-on-your-own-box" class="headerlink" title="What to measure on your own box"></a>What to measure on your own box</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"># what the engine actually holds</span><br><span class="line">grep -E &#x27;VmRSS|VmSwap&#x27; /proc/$(pgrep -f llama-server | head -1)/status</span><br><span class="line"></span><br><span class="line"># bandwidth reality check, not the marketing number</span><br><span class="line">numactl -H | grep -E &#x27;node [0-9] free&#x27;</span><br><span class="line">mbw -n 5 2048</span><br><span class="line"></span><br><span class="line"># GPU side: memory used and utilization over time</span><br><span class="line">nvidia-smi dmon -s mu -d 5 -c 20</span><br></pre></td></tr></table></figure><p>Then divide. <code>mbw</code> gives you a streaming copy rate in MiB&#x2F;s; multiply by 1.048576 for MB&#x2F;s, take 70% of it as your realistic read rate, and divide by the bytes per token you inferred from observed tokens per second. If the two numbers disagree by more than 2×, something other than bandwidth is limiting you: usually swap, usually a NUMA placement mistake, occasionally a scheduler pinning the engine to the socket without the memory.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># keep the engine off swap and on one NUMA node</span></span><br><span class="line"><span class="built_in">sudo</span> systemctl set-property --runtime llama.service MemorySwapMax=0</span><br><span class="line">numactl --cpunodebind=0 --membind=0 ./llama-server -m model.gguf -ngl 99 --no-mmap</span><br></pre></td></tr></table></figure><p><code>MemorySwapMax=0</code> is the one that saves you. A host-bound model that starts swapping does not degrade gracefully; it drops from 78 tokens per second to single digits while <code>top</code> still shows the process alive, and the first symptom is usually a client timeout that looks like a network problem.</p><p>The run to copy is not the 748B number. It is the method: state the checkpoint size in GB, state resident host memory, state tokens per second on a named workload, then divide bandwidth by throughput and see whether the answer is plausible. If it is not, you have found either a measurement error or a model that is less sparse than the marketing claims.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>How can a 748B model run on a 24 GB RTX 4090?</strong></p><p>The weights stay in host memory, not VRAM. In the published run the machine held 468.1 GiB resident host memory with zero swap while the GPU sat at 22.7 of 24.0 GiB. The model is sparse, so only a small slice of parameters participates in each token.</p><p><strong>What determines tokens per second when the model doesn’t fit in VRAM?</strong></p><p>Decode is a bandwidth problem: tokens per second equals sustained bandwidth divided by bytes read per token. VRAM capacity does not set the ceiling; bytes moved per active parameter does. Work out that number before buying hardware.</p><p><strong>How many bytes does the model read per token?</strong></p><p>The published 78.76 tokens per second implies a few gigabytes per token, under 1.2% of the 510.3 GB checkpoint. At 350 GB&#x2F;s of realistic host streaming bandwidth, the implied figure is 4.44 GB per token, or 0.87% of the checkpoint. These are derived figures, not measurements.</p><p><strong>Why is the first token slow compared to decode?</strong></p><p>Prefill has to pull the experts the prompt activates: a short prompt that activates many experts can spend more time in memory than in arithmetic. The recorded run took 4.50 seconds to the first token out of 91.61 seconds total. Short requests also pay the cold-expert penalty repeatedly.</p><p><strong>Why don’t more GPUs make a host-bound setup much faster?</strong></p><p>The experts still live in host RAM, so every token crosses PCIe, and the link becomes the bottleneck instead of the host. Four cards give 192 GB of VRAM, but the host bandwidth ceiling was already about 87 tokens per second at 4 GB per token. First-token latency gets worse.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>Making Cron Jobs Idempotent With flock and a Lock Table</title>
      <link>https://getbytecraft.com/posts/f9f837e8/</link>
      <description>Overlapping schedules and retries cause most duplicate cron runs, and you can stop both with flock for host-local exclusion plus a database lock row for…</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/software/">Software</category>
      <category domain="https://getbytecraft.com/categories/software/automation/">Automation</category>
      <category domain="https://getbytecraft.com/tags/automation/">automation</category>
      <category domain="https://getbytecraft.com/tags/software/">software</category>
      <pubDate>Fri, 04 Dec 2026 05:42:12 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> Overlapping schedules and retries cause most duplicate cron runs, and you can stop both with <code>flock</code> for host-local exclusion plus a database lock row for cross-host exclusion, in under 20 lines of shell.</p><p>The pattern below assumes you run the same job on more than one host — <a href="/posts/7c1f4a92/">a pair of app servers</a>, a primary&#x2F;standby pair, or a small fleet behind a scheduler. <code>flock</code> alone handles the single-host case cleanly and costs nothing. It cannot see other machines, so on a fleet you also need a shared arbiter. A row in your existing database is the cheapest arbiter you already have.</p><h2 id="Why-duplicates-happen-when-your-code-is-correct"><a href="#Why-duplicates-happen-when-your-code-is-correct" class="headerlink" title="Why duplicates happen when your code is correct"></a>Why duplicates happen when your code is correct</h2><p>Three failure modes produce the same symptom — the job runs twice — without any bug in the job itself:</p><ul><li><strong>Overlap.</strong> A schedule fires every 5 minutes but the job occasionally takes 7. Nothing in cron knows the previous run is still going.</li><li><strong>Retries.</strong> Your wrapper, your orchestrator, or a human reruns the job because the first attempt timed out. The first attempt is still alive and working.</li><li><strong>Multi-host scheduling.</strong> A cron entry is deployed by configuration management to every host in a group. All of them fire at the same minute.</li></ul><p>Only the third one needs a shared lock. The first two are solved locally, and the local lock is what makes the shared lock safe to hold for a long time.</p><h2 id="Host-local-exclusion-with-flock"><a href="#Host-local-exclusion-with-flock" class="headerlink" title="Host-local exclusion with flock"></a>Host-local exclusion with flock</h2><p><code>flock</code> takes an advisory lock on a file or directory and holds it for the lifetime of the wrapped command. Two forms matter here:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"># non-blocking: exit immediately if another run holds the lock</span><br><span class="line">flock -n /var/lock/report.lock -c &#x27;/usr/local/bin/report.sh&#x27;</span><br><span class="line"></span><br><span class="line"># timeout: wait up to 30 seconds, then fail</span><br><span class="line">flock -w 30 /var/lock/report.lock -c &#x27;/usr/local/bin/report.sh&#x27;</span><br></pre></td></tr></table></figure><p><code>-n</code> is the right default for a scheduled job. If the previous run is still going, you want this run to exit fast and log a skip, not queue up behind it and start a backlog. <code>-w</code> is useful when the previous run is expected to finish imminently.</p><p>The lock file is created if it does not exist, assuming permissions allow it. Put it somewhere with a predictable owner — <code>/var/lock</code> or <code>/run/lock</code> if your distribution supports it, otherwise a path under <code>/var/lib</code> owned by the cron user.</p><p>Two flags worth knowing:</p><table><thead><tr><th>Flag</th><th>Effect</th><th>When you want it</th></tr></thead><tbody><tr><td><code>-n</code> &#x2F; <code>--nonblocking</code></td><td>Fail instead of waiting if the lock is held</td><td>Scheduled jobs; skip-and-log semantics</td></tr><tr><td><code>-w</code> &#x2F; <code>--timeout</code></td><td>Wait up to N seconds (decimals allowed; <code>0</code> means non-blocking)</td><td>Short expected overlap</td></tr><tr><td><code>-E</code> &#x2F; <code>--conflict-exit-code</code></td><td>Exit status on lock conflict, default <code>1</code>, range 0–255</td><td>Distinguish “busy” from “job failed”</td></tr><tr><td><code>-o</code> &#x2F; <code>--close</code></td><td>Close the lock fd before running the command</td><td>The child spawns long-lived helpers that must not inherit the lock</td></tr><tr><td><code>-F</code> &#x2F; <code>--no-fork</code></td><td>Exec the command directly instead of forking</td><td>Saves a process; incompatible with <code>-o</code></td></tr></tbody></table><p>Exit status is the part people get wrong. With <code>-n</code> or <code>-w</code>, a failure to acquire the lock exits with the <code>-E</code> value, default <code>1</code>. But when the command does run, <code>flock</code> returns the child’s exit status. So a wrapper that treats any non-zero as “job failed” will page you every time a run is skipped. Set <code>-E</code> to something distinct — 75 (<code>EX_TEMPFAIL</code> from <code>sysexits.h</code>) is a defensible choice — and handle it explicitly.</p><h2 id="Cross-host-exclusion-with-a-lock-row"><a href="#Cross-host-exclusion-with-a-lock-row" class="headerlink" title="Cross-host exclusion with a lock row"></a>Cross-host exclusion with a lock row</h2><p>A database row gives you an atomic test-and-set across every host that can reach the same database. PostgreSQL’s <code>SELECT ... FOR UPDATE</code> with <code>NOWAIT</code> and <code>SKIP LOCKED</code> makes this a single statement.</p><p>Create the table once:</p><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">CREATE TABLE</span> job_lock (</span><br><span class="line">    job_name   text <span class="keyword">PRIMARY KEY</span>,</span><br><span class="line">    owner      text        <span class="keyword">NOT NULL</span>,</span><br><span class="line">    acquired_at timestamptz <span class="keyword">NOT NULL</span> <span class="keyword">DEFAULT</span> now(),</span><br><span class="line">    expires_at  timestamptz <span class="keyword">NOT NULL</span></span><br><span class="line">);</span><br></pre></td></tr></table></figure><p>Acquire, then run, then release:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#!/bin/bash</span></span><br><span class="line"><span class="built_in">set</span> -euo pipefail</span><br><span class="line"></span><br><span class="line">JOB=nightly-report</span><br><span class="line">HOST=$(hostname -f)</span><br><span class="line">LOCK_FILE=/var/lock/<span class="variable">$&#123;JOB&#125;</span>.lock</span><br><span class="line"></span><br><span class="line"><span class="built_in">exec</span> 9&gt;<span class="string">&quot;<span class="variable">$LOCK_FILE</span>&quot;</span></span><br><span class="line">flock -n 9 || &#123; <span class="built_in">echo</span> <span class="string">&quot;skip: <span class="variable">$&#123;JOB&#125;</span> already running on <span class="variable">$&#123;HOST&#125;</span>&quot;</span>; <span class="built_in">exit</span> 0; &#125;</span><br><span class="line"></span><br><span class="line"><span class="comment"># Try to claim the cross-host row. If another host holds it, skip.</span></span><br><span class="line"><span class="keyword">if</span> ! psql -qAt -v ON_ERROR_STOP=1 -c <span class="string">&quot;</span></span><br><span class="line"><span class="string">  INSERT INTO job_lock (job_name, owner, expires_at)</span></span><br><span class="line"><span class="string">  VALUES (&#x27;<span class="variable">$&#123;JOB&#125;</span>&#x27;, &#x27;<span class="variable">$&#123;HOST&#125;</span>&#x27;, now() + interval &#x27;2 hours&#x27;)</span></span><br><span class="line"><span class="string">  ON CONFLICT (job_name) DO UPDATE</span></span><br><span class="line"><span class="string">    SET owner = EXCLUDED.owner,</span></span><br><span class="line"><span class="string">        acquired_at = now(),</span></span><br><span class="line"><span class="string">        expires_at = EXCLUDED.expires_at</span></span><br><span class="line"><span class="string">    WHERE job_lock.expires_at &lt; now()</span></span><br><span class="line"><span class="string">  RETURNING 1;</span></span><br><span class="line"><span class="string">&quot;</span> | grep -q 1; <span class="keyword">then</span></span><br><span class="line">    <span class="built_in">echo</span> <span class="string">&quot;skip: <span class="variable">$&#123;JOB&#125;</span> locked by another host&quot;</span></span><br><span class="line">    <span class="built_in">exit</span> 0</span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">trap</span> <span class="string">&quot;psql -qAt -c \&quot;DELETE FROM job_lock WHERE job_name=&#x27;<span class="variable">$&#123;JOB&#125;</span>&#x27; AND owner=&#x27;<span class="variable">$&#123;HOST&#125;</span>&#x27;\&quot;&quot;</span> EXIT</span><br><span class="line"></span><br><span class="line">/usr/local/bin/report.sh</span><br></pre></td></tr></table></figure><p>Three things make this correct:</p><ul><li><strong>The <code>ON CONFLICT ... WHERE expires_at &lt; now()</code> clause</strong> is the atomic test-and-set. Two hosts racing get exactly one winner because the row update is serialized by the primary key.</li><li><strong>The <code>trap ... EXIT</code></strong> releases the row on any exit path, including <code>set -e</code> failures.</li><li><strong><code>expires_at</code></strong> is a lease. If a host dies mid-job, the row goes stale and the next scheduled run on any host can take it. Set the lease comfortably longer than the worst observed runtime.</li></ul><p>The <code>flock</code> around the whole thing is not redundant. It serializes the acquire and release sequence on each host, which means a slow <code>psql</code> call cannot interleave with a retry on the same machine and produce a second acquire after the first released.</p><h2 id="Choosing-the-lease-duration"><a href="#Choosing-the-lease-duration" class="headerlink" title="Choosing the lease duration"></a>Choosing the lease duration</h2><p>The lease is the only knob with real consequences. Too short and a slow run loses its lock and a second host starts a duplicate. Too long and a crashed host blocks the job for that duration.</p><table><thead><tr><th>Job runtime profile</th><th>Lease</th><th>Notes</th></tr></thead><tbody><tr><td>Under 1 minute, stable</td><td>5–10 minutes</td><td>Covers normal jitter with wide margin</td></tr><tr><td>1–15 minutes</td><td>2× p99 runtime</td><td>Measure p99, not the average</td></tr><tr><td>15–60 minutes</td><td>2× p99, cap at 2 hours</td><td>Longer leases need monitoring</td></tr><tr><td>Over an hour</td><td>2× p99 plus a heartbeat</td><td>Renew from inside the job</td></tr></tbody></table><p>For anything past 15 minutes, add a heartbeat: an <code>UPDATE job_lock SET expires_at = now() + interval &#39;10 minutes&#39; WHERE job_name = ... AND owner = ...</code> every few minutes from inside the job. If the update affects zero rows, another host has taken over and the job should abort immediately.</p><h2 id="Pitfalls-and-how-to-diagnose-them"><a href="#Pitfalls-and-how-to-diagnose-them" class="headerlink" title="Pitfalls and how to diagnose them"></a>Pitfalls and how to diagnose them</h2><p><strong>flock silently fails on NFS and CIFS.</strong> The manual page is explicit: some filesystems have a limited <code>flock(2)</code> implementation and <code>flock</code> may always fail, depending on mount options. If your lock file lives on a network mount, you get either permanent skipping or no exclusion at all. Diagnose by checking <code>mount | grep &lt;lockdir&gt;</code> and moving the lock file to a local filesystem. The lock is per-host anyway; there is no reason for it to be shared.</p><p><strong>The lock is inherited by children.</strong> If your job spawns a daemon or a long-lived subprocess, it inherits the file descriptor and holds the lock after the parent exits. The next run then skips forever. Use <code>flock -o</code> or, when invoking from a script, <code>flock -n 9</code> with the fd explicitly closed in the child. Symptom: <code>flock</code> never blocks, but the job never runs either.</p><p><strong>The lock file gets deleted by cleanup.</strong> <code>tmpwatch</code>, <code>systemd-tmpfiles</code>, or a logrotate rule removes the lock file while a job holds it. The lock still exists on the open file description, but the next run creates a new file and acquires a different lock. Keep lock files out of <code>/tmp</code>, or exempt them from cleanup. Symptom: exclusion works most of the time and fails after a specific interval.</p><p><strong>The lease expires while the job is still running.</strong> The second host acquires, both run, and you get duplicate writes. Diagnose by logging <code>acquired_at</code>, <code>expires_at</code>, and job end time on every run; if end time exceeds <code>expires_at</code> more than occasionally, the lease is too short or the job needs a heartbeat.</p><p><strong>The trap does not fire.</strong> <code>trap ... EXIT</code> does not run if the shell is <code>SIGKILL</code>ed. In that case the lease is your only recovery, which is why it must exist. Symptom: <code>job_lock</code> shows a row owned by a host that has been down for hours. The lease handles this automatically; do not “fix” it by deleting the row manually unless the job is known to be dead.</p><p><strong>Two schedules for the same job.</strong> A <code>systemd</code> timer and a <code>cron</code> entry both invoke the script. Neither lock is wrong; they just both work. Audit with <code>systemctl list-timers</code> and <code>crontab -l</code> on each host before adding the locks, so you know what you are actually serializing.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>Does flock work on macOS or BSD?</strong></p><p>Not the same way. The <code>flock(1)</code> command is Linux-specific; macOS ships <code>shlock</code> or you use <code>mkdir</code>-based locking. The shell pattern is identical, but you need a different primitive. If you run mixed fleets, put the exclusion in the database row and treat the local lock as an optimization.</p><p><strong>Why not just use <code>flock -w</code> instead of <code>-n</code>?</strong></p><p><code>-w</code> makes a second run wait for the first, which turns an overlap into a queue. For a job scheduled every 5 minutes with 7-minute runtimes, that queue grows until you are permanently behind. Skipping is the correct behavior when a job is already running; the next scheduled invocation will pick it up.</p><p><strong>Is <code>SELECT ... FOR UPDATE NOWAIT</code> better than the <code>ON CONFLICT</code> upsert?</strong></p><p>Both work. <code>FOR UPDATE NOWAIT</code> requires a row to already exist and needs a transaction spanning the job, which is a bad idea for a long-running process. The <code>ON CONFLICT</code> upsert with a lease is a single statement with no transaction to manage. Prefer the upsert unless you already have a transaction-shaped wrapper.</p><p><strong>What happens if the database is unreachable?</strong></p><p>The <code>psql</code> call fails, <code>set -e</code> aborts, the job does not run. That is the safe default: no lock, no work. If you need to fail open, you must decide explicitly whether a duplicate run is cheaper than a missed run, and log the choice. Most reporting and billing jobs should fail closed.</p><p><strong>Can I use Redis or etcd instead of a database row?</strong></p><p>Yes, and the pattern is the same: <code>SET key value NX PX &lt;ttl&gt;</code> in Redis, or a lease with a TTL in etcd. The database is the default recommendation because you already operate it, back it up, and can inspect the lock table with the same tools you use for everything else. A second datastore is a second thing to page on.</p><p><strong>How do I test that this actually works?</strong></p><p>Run the job under <code>flock</code> from two terminals simultaneously and confirm the second exits with your <code>-E</code> code. Then simulate the cross-host case by pointing two shells at the same database with different <code>HOST</code> values. Finally, <code>kill -9</code> a running job and confirm the next invocation acquires the lock only after <code>expires_at</code> passes. All three tests take a few minutes and catch every mistake listed above.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>UPS Integration With NUT: Shutdown Before the Battery Dies</title>
      <link>https://getbytecraft.com/posts/6793bd06/</link>
      <description>A UPS buys time to shut down cleanly, and without NUT the machine runs until the battery collapses and the filesystem takes the hit. NUT watches the…</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/self-hosted/">Self-Hosted</category>
      <category domain="https://getbytecraft.com/tags/cost/">cost</category>
      <pubDate>Fri, 04 Dec 2026 04:48:03 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> A UPS buys time to shut down cleanly, and without NUT the machine runs until the battery collapses and the filesystem takes the hit. NUT watches the UPS, triggers a shutdown at a set charge, and turns the machine back on when mains returns if the BIOS allows it.</p><h2 id="Components"><a href="#Components" class="headerlink" title="Components"></a>Components</h2><ul><li><code>nut-server</code> with the UPS driver matched to the model</li><li><code>upsmon</code> on every host that must shut down</li><li>BIOS: “restore on AC power loss” enabled</li></ul><h2 id="Driver"><a href="#Driver" class="headerlink" title="Driver"></a>Driver</h2><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># /etc/nut/ups.conf</span></span><br><span class="line"><span class="section">[main]</span></span><br><span class="line"><span class="attr">driver</span> = usbhid-ups</span><br><span class="line"><span class="attr">port</span> = auto</span><br></pre></td></tr></table></figure><p><code>nut-scanner -U</code> finds the VID&#x2F;PID; then <code>upsdrvctl start</code> and confirm with <code>upsc main</code>.</p><h2 id="Watch-state-and-act"><a href="#Watch-state-and-act" class="headerlink" title="Watch state and act"></a>Watch state and act</h2><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># /etc/nut/upsmon.conf</span></span><br><span class="line">MONITOR main@localhost 1 admin secret master</span><br><span class="line">MINSUPPLIES 1</span><br><span class="line">SHUTDOWNCMD &quot;/sbin/shutdown -h +0&quot;</span><br><span class="line">POLLFREQ 5</span><br><span class="line">POLLFREQALERT 2</span><br><span class="line">HOSTSYNC 15</span><br><span class="line">FINALDELAY 5</span><br></pre></td></tr></table></figure><p>Trigger on <code>LB</code> (low battery) by default. If the expected runtime exceeds the shutdown time, use <code>ONBATT</code> with a timer instead:</p><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">NOTIFYCMD /usr/local/bin/ups-handler.sh</span><br><span class="line">NOTIFYFLAG ONBATT SYSLOG+EXEC</span><br></pre></td></tr></table></figure><p>The handler shuts down after a configurable 180 s of <code>ONBATT</code>, giving short outages no downtime and long ones a clean exit.</p><h2 id="Auto-restart"><a href="#Auto-restart" class="headerlink" title="Auto-restart"></a>Auto-restart</h2><p>BIOS “AC restore → power on”, plus <code>systemctl enable nut-monitor</code>. After an outage <a href="/posts/ad183e80/">the host comes back unattended</a>; without the BIOS setting it waits for someone to press a button at 3 a.m.</p><h2 id="Testing"><a href="#Testing" class="headerlink" title="Testing"></a>Testing</h2><p>The only acceptable test pulls mains at the wall, on purpose, with work open. Confirm: <a href="/posts/593b9375/">notification fires</a>, shutdown starts on schedule, machine powers off before the battery empties, and it returns when mains returns. A UPS that has never been tested is a heavy box.</p><h2 id="Battery-care"><a href="#Battery-care" class="headerlink" title="Battery care"></a>Battery care</h2><p>Sealed lead acid degrades in about 3–5 years. Log <code>battery.runtime</code> monthly; a runtime that has halved means the battery is due, and the UPS buys less time than the configuration assumes.</p><h2 id="Operating-notes"><a href="#Operating-notes" class="headerlink" title="Operating notes"></a>Operating notes</h2><p>A UPS buys time to shut down; without NUT the machine runs until the battery collapses and the filesystem takes it.</p><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">MONITOR main@localhost 1 admin secret master</span><br><span class="line">SHUTDOWNCMD &quot;/sbin/shutdown -h +0&quot;</span><br><span class="line">POLLFREQALERT 2</span><br></pre></td></tr></table></figure><h2 id="Trigger-on-a-timer-not-just-LB"><a href="#Trigger-on-a-timer-not-just-LB" class="headerlink" title="Trigger on a timer, not just LB"></a>Trigger on a timer, not just LB</h2><p>If expected runtime exceeds the shutdown time, act on <code>ONBATT</code> after 180 s rather than waiting for low battery.</p><h2 id="Auto-restart-1"><a href="#Auto-restart-1" class="headerlink" title="Auto-restart"></a>Auto-restart</h2><p>BIOS “AC restore → power on” plus <code>systemctl enable nut-monitor</code>. Without the BIOS setting the host waits for a button at 3 a.m.</p><h2 id="Test-at-the-wall"><a href="#Test-at-the-wall" class="headerlink" title="Test at the wall"></a>Test at the wall</h2><p>Pull mains on purpose, with work open: notification fires, shutdown starts on schedule, power-off completes before the battery empties, host returns when mains returns.</p><h2 id="Battery-care-1"><a href="#Battery-care-1" class="headerlink" title="Battery care"></a>Battery care</h2><p>Log <code>battery.runtime</code> monthly; a halved runtime means the battery is due and the configuration is assuming time the UPS no longer has.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>What happens if I run a UPS without NUT installed?</strong></p><p>The machine runs until the battery collapses, and the filesystem takes the hit. A UPS alone only buys time; without NUT nothing triggers a clean shutdown at a set charge. NUT watches the UPS and starts the shutdown before the battery is empty.</p><p><strong>How do I find and start the right UPS driver?</strong></p><p>Run <code>nut-scanner -U</code> to find the VID&#x2F;PID, then set the driver and port in <code>/etc/nut/ups.conf</code> — for example <code>usbhid-ups</code> with <code>port = auto</code>. Start it with <code>upsdrvctl start</code> and confirm it is working with <code>upsc main</code>.</p><p><strong>Should I trigger shutdown on low battery or on ONBATT?</strong></p><p>Trigger on <code>LB</code> (low battery) by default. If the expected runtime exceeds the shutdown time, use <code>ONBATT</code> with a timer instead — the article’s handler shuts down after a configurable 180 s of <code>ONBATT</code>, so short outages cause no downtime and long ones get a clean exit.</p><p><strong>How do I make the machine power back on after an outage?</strong></p><p>Enable “restore on AC power loss” (AC restore → power on) in the BIOS and run <code>systemctl enable nut-monitor</code>. With both in place the host comes back unattended after an outage; without the BIOS setting it waits for someone to press a button at 3 a.m.</p><p><strong>How do I test that the whole setup actually works?</strong></p><p>Pull mains at the wall on purpose, with work open. Confirm the notification fires, shutdown starts on schedule, the machine powers off before the battery empties, and it returns when mains returns. A UPS that has never been tested is a heavy box.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>Tailscale vs Plain WireGuard for a Homelab</title>
      <link>https://getbytecraft.com/posts/b1a2cd98/</link>
      <description>Plain WireGuard costs zero dollars and about two hours of NAT, DNS and key management; Tailscale costs free-tier limits or $6 per user and removes…</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/self-hosted/">Self-Hosted</category>
      <category domain="https://getbytecraft.com/tags/wireguard/">wireguard</category>
      <pubDate>Fri, 04 Dec 2026 04:41:03 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> Plain WireGuard costs zero dollars and about two hours of NAT, DNS and key management; Tailscale costs free-tier limits or $6 per user and removes all of it, plus NAT traversal that WireGuard cannot do alone. Choose on whether you want to maintain the plumbing.</p><h2 id="What-each-gives-you"><a href="#What-each-gives-you" class="headerlink" title="What each gives you"></a>What each gives you</h2><table><thead><tr><th>Feature</th><th>WireGuard</th><th>Tailscale</th></tr></thead><tbody><tr><td>NAT traversal</td><td>manual port forward</td><td>automatic, DERP relay fallback</td></tr><tr><td>Key distribution</td><td>manual, per device</td><td>automatic</td></tr><tr><td>MagicDNS</td><td>manual dnsmasq</td><td>built in</td></tr><tr><td>ACLs</td><td>iptables by hand</td><td>declarative file</td></tr><tr><td>Cost</td><td>$0</td><td>free tier &#x2F; $6 per user</td></tr><tr><td>Traffic path</td><td>direct</td><td>direct when possible, relay otherwise</td></tr></tbody></table><h2 id="Where-plain-WireGuard-bites"><a href="#Where-plain-WireGuard-bites" class="headerlink" title="Where plain WireGuard bites"></a>Where plain WireGuard bites</h2><p>Every new device is a config block on both ends, a shared key, a NAT rule and an <code>AllowedIPs</code> line. Roaming phones change IP and need DDNS. Two devices behind CGNAT need a relay. A lost phone means manually revoking a key from every peer.</p><p>Tailscale does all of it from one <code>tailscale up</code> per device and a web console.</p><h2 id="Where-Tailscale-bites"><a href="#Where-Tailscale-bites" class="headerlink" title="Where Tailscale bites"></a>Where Tailscale bites</h2><ul><li>The coordination server sees your device list and ACLs (self-host with headscale to keep it)</li><li>Relay fallback routes traffic through their DERP servers, decrypted at the relay</li><li>Small teams hit the per-user price quickly</li></ul><h2 id="The-DERP-caveat"><a href="#The-DERP-caveat" class="headerlink" title="The DERP caveat"></a>The DERP caveat</h2><p>A peer-to-peer path fails behind symmetric CGNAT, so traffic goes via DERP. Latency rises 60–120 ms and throughput caps around 20–50 Mbit&#x2F;s. For SSH and dashboards that is fine; for a 4K Plex stream it is not.</p><h2 id="Choosing-honestly"><a href="#Choosing-honestly" class="headerlink" title="Choosing honestly"></a>Choosing honestly</h2><p>One person, a handful of trusted devices, and no interest in maintaining plumbing: Tailscale, and never think about it again. A strict no-third-party rule, a fixed set of devices, or a site-to-site between two offices: WireGuard, or headscale for the control plane without the vendor.</p><h2 id="The-mixed-answer"><a href="#The-mixed-answer" class="headerlink" title="The mixed answer"></a>The mixed answer</h2><p>Plain WireGuard for the <a href="/posts/8368f554/">fixed site-to-site links</a>, Tailscale for the roaming laptops and phones. Both are WireGuard underneath and both can run at once; the split puts the effort where it earns something.</p><h2 id="Operating-notes"><a href="#Operating-notes" class="headerlink" title="Operating notes"></a>Operating notes</h2><p>Choose on who maintains the plumbing. Tailscale removes NAT traversal, key distribution and ACLs; plain WireGuard costs $0 and hours.</p><figure class="highlight text"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">one person, few trusted devices → Tailscale</span><br><span class="line">fixed site-to-site, no vendor → WireGuard</span><br></pre></td></tr></table></figure><h2 id="DERP-caveat"><a href="#DERP-caveat" class="headerlink" title="DERP caveat"></a>DERP caveat</h2><p>Symmetric CGNAT forces relay: +60–120 ms and 20–50 Mbit&#x2F;s. Fine for SSH and dashboards, not for a 4K stream.</p><h2 id="Plain-WireGuard-cost"><a href="#Plain-WireGuard-cost" class="headerlink" title="Plain WireGuard cost"></a>Plain WireGuard cost</h2><p>Every device is a config block on both ends, a shared key, a NAT rule. Roaming phones need DDNS, CGNAT needs a relay, a lost phone means revoking by hand.</p><h2 id="The-mixed-answer-1"><a href="#The-mixed-answer-1" class="headerlink" title="The mixed answer"></a>The mixed answer</h2><p>Plain WireGuard for fixed links, Tailscale for roaming laptops and phones. Both are WireGuard underneath and can run together.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>How much does Tailscale cost compared to plain WireGuard?</strong></p><p>Plain WireGuard costs zero dollars. Tailscale has a free tier with limits, or $6 per user. The tradeoff is that WireGuard costs about two hours of NAT, DNS and key management, while Tailscale removes that work.</p><p><strong>What happens to Tailscale traffic when a direct peer-to-peer connection fails?</strong></p><p>Traffic falls back to Tailscale’s DERP relay servers. Latency rises 60–120 ms and throughput caps around 20–50 Mbit&#x2F;s. That is fine for SSH and dashboards but not for a 4K Plex stream.</p><p><strong>Can I use Tailscale and plain WireGuard together?</strong></p><p>Yes. Both are WireGuard underneath and both can run at once. A common split is plain WireGuard for fixed site-to-site links and Tailscale for roaming laptops and phones.</p><p><strong>What does plain WireGuard require for each new device?</strong></p><p>Every new device needs a config block on both ends, a shared key, a NAT rule and an <code>AllowedIPs</code> line. Roaming phones change IP and need DDNS, and a lost phone means manually revoking a key from every peer.</p><p><strong>Can I avoid Tailscale’s coordination server seeing my device list?</strong></p><p>Yes, by self-hosting with headscale to keep the control plane without the vendor. Headscale is also an option if you want WireGuard with a control plane but a strict no-third-party rule.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>Running a Mail Server: The Deliverability Checklist</title>
      <link>https://getbytecraft.com/posts/a4d2d0f6/</link>
      <description>Inbound mail is easy; landing in the inbox is a six-item checklist that most self-hosters skip. SPF, DKIM, DMARC, rDNS, a static IP with no bad…</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/self-hosted/">Self-Hosted</category>
      <category domain="https://getbytecraft.com/tags/cost/">cost</category>
      <pubDate>Fri, 04 Dec 2026 04:34:03 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> Inbound mail is easy; landing in the inbox is a six-item checklist that most self-hosters skip. SPF, DKIM, DMARC, rDNS, a static IP with no bad history and a warm-up schedule decide it — the software is the least of it.</p><h2 id="The-checklist"><a href="#The-checklist" class="headerlink" title="The checklist"></a>The checklist</h2><table><thead><tr><th>Item</th><th>Record</th></tr></thead><tbody><tr><td>SPF</td><td><code>v=spf1 mx -all</code> in TXT</td></tr><tr><td>DKIM</td><td>selector in TXT, signing enabled</td></tr><tr><td>DMARC</td><td><code>v=DMARC1; p=quarantine; rua=mailto:...</code></td></tr><tr><td>rDNS</td><td>PTR matching the A record</td></tr><tr><td>HELO</td><td>matching the hostname</td></tr><tr><td>MTA-STS</td><td>optional, raises trust</td></tr></tbody></table><p>All six, or expect spam folder.</p><h2 id="SPF"><a href="#SPF" class="headerlink" title="SPF"></a>SPF</h2><p>A single record, <code>-all</code> as hard fail. Multiple SPF records break lookup and count as “none”. Keep under 10 DNS lookups.</p><h2 id="DKIM"><a href="#DKIM" class="headerlink" title="DKIM"></a>DKIM</h2><p>2048-bit, rotated yearly, selector published as TXT for as long as the key is live:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">opendkim-genkey -b 2048 -s mail -d example.com</span><br><span class="line"><span class="built_in">cat</span> mail.txt   <span class="comment"># publish, keep mail.private</span></span><br></pre></td></tr></table></figure><h2 id="DMARC"><a href="#DMARC" class="headerlink" title="DMARC"></a>DMARC</h2><p>Start at <code>p=none</code> with a <code>rua</code> address, read the aggregate reports for two weeks, fix what fails, then move to <code>quarantine</code>, then <code>reject</code>. Starting at <code>reject</code> before reading reports aligns you with whatever the reports say is already broken.</p><h2 id="The-IP-problem"><a href="#The-IP-problem" class="headerlink" title="The IP problem"></a>The IP problem</h2><p>A residential IP is heavily penalised and often blocked outright on port 25 by the ISP. A cheap VPS with a clean, dedicated IPv4 is the right base. Check the IP against the Spamhaus blocklist before buying and again monthly.</p><h2 id="Warm-up"><a href="#Warm-up" class="headerlink" title="Warm-up"></a>Warm-up</h2><p>Week 1: 20 messages a day. Week 2: 100. Week 3: 500. Sudden volume from a new IP is the most common reason a technically perfect setup lands in spam for a month.</p><h2 id="Monitoring"><a href="#Monitoring" class="headerlink" title="Monitoring"></a>Monitoring</h2><p><a href="/posts/593b9375/">Postfix rate limits</a>, <code>pflogsumm</code> daily, and a DMARC aggregate parser. Alert when rejections exceed 2% — it precedes a reputation collapse by days.</p><h2 id="The-honest-cost"><a href="#The-honest-cost" class="headerlink" title="The honest cost"></a>The honest cost</h2><p>Three to five hours setup and about <a href="/posts/f5fee6c6/">20 minutes a month</a>. If that is unappealing, a mail relay or a hosted mailbox with a custom domain gets 90% of the result for the same money.</p><h2 id="Operating-notes"><a href="#Operating-notes" class="headerlink" title="Operating notes"></a>Operating notes</h2><p>Inbound mail is easy; the six-item inbox checklist decides everything and most self-hosters skip all six.</p><figure class="highlight text"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">SPF -all · DKIM 2048 · DMARC p=none→quarantine→reject · rDNS · matching HELO · MTA-STS</span><br></pre></td></tr></table></figure><h2 id="DMARC-staging"><a href="#DMARC-staging" class="headerlink" title="DMARC staging"></a>DMARC staging</h2><p>Start at <code>p=none</code> with a <code>rua</code> address, read aggregate reports for two weeks, fix what fails, then step to <code>quarantine</code>. Starting at <code>reject</code> aligns you with whatever is already broken.</p><h2 id="The-IP"><a href="#The-IP" class="headerlink" title="The IP"></a>The IP</h2><p>A residential IP is penalised and often blocked on port 25. A cheap VPS with clean dedicated IPv4; check the Spamhaus list before buying and monthly after.</p><h2 id="Warm-up-1"><a href="#Warm-up-1" class="headerlink" title="Warm-up"></a>Warm-up</h2><p>20 messages a day, then 100, then 500 across three weeks. Sudden volume from a new IP is the top reason a perfect setup lands in spam for a month.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>What is the SPF record for a mail server?</strong></p><p>Publish a single SPF record as <code>v=spf1 mx -all</code> in TXT, using <code>-all</code> as a hard fail. Multiple SPF records break lookup and count as “none”. Keep the record under 10 DNS lookups.</p><p><strong>Why does my mail land in spam when my setup is technically correct?</strong></p><p>Sudden volume from a new IP is the most common reason a technically perfect setup lands in spam for a month. Follow the warm-up schedule: 20 messages a day in week one, 100 in week two, 500 in week three.</p><p><strong>Should I start DMARC at p&#x3D;reject?</strong></p><p>No. Start at <code>p=none</code> with a <code>rua</code> address, read the aggregate reports for two weeks, fix what fails, then move to <code>quarantine</code>, then <code>reject</code>. Starting at <code>reject</code> before reading reports aligns you with whatever the reports say is already broken.</p><p><strong>Can I run a mail server on a residential IP?</strong></p><p>A residential IP is heavily penalised and often blocked outright on port 25 by the ISP. Use a cheap VPS with a clean, dedicated IPv4 instead. Check the IP against the Spamhaus blocklist before buying and again monthly.</p><p><strong>How long does it take to set up and maintain a mail server?</strong></p><p>Setup takes three to five hours, and ongoing maintenance is about 20 minutes a month. If that is unappealing, a mail relay or a hosted mailbox with a custom domain gets 90% of the result for the same money.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>systemd Socket Activation for On-Demand Services</title>
      <link>https://getbytecraft.com/posts/ec1b1897/</link>
      <description>Socket activation lets systemd hold the port and start the service on the first connection, so an idle service costs no memory and still gets a clean…</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/self-hosted/">Self-Hosted</category>
      <category domain="https://getbytecraft.com/tags/cost/">cost</category>
      <pubDate>Fri, 04 Dec 2026 04:27:03 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> Socket activation lets systemd hold the port and start the service on the first connection, so an idle service costs no memory and still gets a clean start. Good for occasional admin daemons; wrong for anything with a warm-up cost longer than the client timeout.</p><h2 id="The-two-units"><a href="#The-two-units" class="headerlink" title="The two units"></a>The two units</h2><p><code>demo.socket</code>:</p><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">[Socket]</span></span><br><span class="line"><span class="attr">ListenStream</span>=<span class="number">127.0</span>.<span class="number">0.1</span>:<span class="number">9600</span></span><br><span class="line"><span class="attr">Accept</span>=<span class="literal">no</span></span><br><span class="line"></span><br><span class="line"><span class="section">[Install]</span></span><br><span class="line"><span class="attr">WantedBy</span>=sockets.target</span><br></pre></td></tr></table></figure><p><code>demo.service</code>:</p><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">[Service]</span></span><br><span class="line"><span class="attr">ExecStart</span>=/usr/local/bin/demo --listen-fd <span class="number">3</span></span><br><span class="line"><span class="attr">StandardInput</span>=socket</span><br></pre></td></tr></table></figure><p><code>Accept=no</code> hands the listening socket to the service as fd 3 and lets it accept; <code>Accept=yes</code> spawns one instance per connection.</p><h2 id="Reading-fd-3"><a href="#Reading-fd-3" class="headerlink" title="Reading fd 3"></a>Reading fd 3</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> socket</span><br><span class="line">s = socket.socket(fileno=<span class="number">3</span>)</span><br><span class="line"><span class="keyword">while</span> <span class="literal">True</span>:</span><br><span class="line">    c, _ = s.accept()</span><br><span class="line">    handle(c)</span><br></pre></td></tr></table></figure><p><code>LISTEN_FDS</code> and <code>LISTEN_PID</code> in the environment confirm the handover. nginx, gunicorn and many others accept <code>--listen-fd</code> directly.</p><h2 id="Behaviour"><a href="#Behaviour" class="headerlink" title="Behaviour"></a>Behaviour</h2><p>Idle: the unit is inactive, zero RSS. First connection: systemd starts it, the connection is queued on the held socket, and <code>ACCEPT</code> handoff is instant. Idle again: the unit stops on its own timeout if you set one.</p><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">[Service]</span></span><br><span class="line">TimeStopSec=</span><br></pre></td></tr></table></figure><p>Leave <code>TimeStopSec</code> empty for services that should persist after first use; set <code>StopWhenUnneeded=yes</code> for pure on-demand.</p><h2 id="When-not-to-use-it"><a href="#When-not-to-use-it" class="headerlink" title="When not to use it"></a>When not to use it</h2><ul><li>Services with a 3 s warm-up and a <a href="/posts/a0e39a49/">client timeout</a> of 2 s</li><li>Anything holding in-memory state that a restart loses</li><li>High-frequency services, where the start cost is noise</li></ul><h2 id="Security"><a href="#Security" class="headerlink" title="Security"></a>Security</h2><p>Binding <code>127.0.0.1</code> in the socket unit means the service never needs to bind, so no CAP_NET_BIND for privileged ports, and the exposure is declared in the socket unit where it is easy to audit.</p><h2 id="Verify"><a href="#Verify" class="headerlink" title="Verify"></a>Verify</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">systemctl start demo.socket</span><br><span class="line">ss -lntp | grep 9600        <span class="comment"># owned by PID 1</span></span><br><span class="line">curl -s localhost:9600      <span class="comment"># triggers the service</span></span><br><span class="line">systemctl status demo.service   <span class="comment"># now active</span></span><br></pre></td></tr></table></figure><h2 id="Operating-notes"><a href="#Operating-notes" class="headerlink" title="Operating notes"></a>Operating notes</h2><p>Bind in the socket unit, accept in the service. The service never needs a port and the exposure is declared where it is auditable.</p><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># demo.socket</span></span><br><span class="line"><span class="section">[Socket]</span></span><br><span class="line"><span class="attr">ListenStream</span>=<span class="number">127.0</span>.<span class="number">0.1</span>:<span class="number">9600</span></span><br><span class="line"><span class="attr">Accept</span>=<span class="literal">no</span></span><br></pre></td></tr></table></figure><h2 id="Reading-fd-3-1"><a href="#Reading-fd-3-1" class="headerlink" title="Reading fd 3"></a>Reading fd 3</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> socket</span><br><span class="line">s = socket.socket(fileno=<span class="number">3</span>)</span><br><span class="line"><span class="keyword">while</span> <span class="literal">True</span>: handle(s.accept()[<span class="number">0</span>])</span><br></pre></td></tr></table></figure><p><code>LISTEN_FDS</code> confirms the handover. nginx and gunicorn take <code>--listen-fd</code> directly.</p><h2 id="When-not-to-use-it-1"><a href="#When-not-to-use-it-1" class="headerlink" title="When not to use it"></a>When not to use it</h2><p>Warm-up longer than the client timeout, in-memory state that a restart loses, high-frequency traffic.</p><h2 id="Verify-1"><a href="#Verify-1" class="headerlink" title="Verify"></a>Verify</h2><p><code>systemctl start demo.socket</code>, confirm PID 1 owns the port in <code>ss -lntp</code>, <code>curl</code> to trigger, then confirm the unit is active.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>How do I know systemd handed the socket to my service?</strong></p><p>Check the <code>LISTEN_FDS</code> and <code>LISTEN_PID</code> environment variables inside the service; they confirm the handover. The listening socket itself arrives as fd 3 when <code>Accept=no</code> is set. In Python you can wrap it directly with <code>socket.socket(fileno=3)</code>.</p><p><strong>What does Accept&#x3D;no do compared to Accept&#x3D;yes?</strong></p><p><code>Accept=no</code> passes the listening socket to the service as fd 3 and lets the service call accept itself. <code>Accept=yes</code> instead spawns one service instance per connection. Use <code>Accept=no</code> when your service handles its own connections.</p><p><strong>Does an idle socket-activated service use any memory?</strong></p><p>No. While idle the unit is inactive with zero RSS, because systemd holds the port instead of the service. The first connection triggers the start, and the connection is queued on the held socket until the service accepts it. The unit stops again on its own timeout if you set one.</p><p><strong>How do I keep the service running after the first connection?</strong></p><p>Leave <code>TimeStopSec</code> empty in the service unit for services that should persist after first use. Use <code>StopWhenUnneeded=yes</code> instead if you want pure on-demand behaviour. The choice depends on whether the service holds state worth keeping.</p><p><strong>How do I verify socket activation is working?</strong></p><p>Run <code>systemctl start demo.socket</code>, then check <code>ss -lntp</code> to confirm PID 1 owns the port. A <code>curl</code> to the port triggers the service, and <code>systemctl status demo.service</code> should show it active. This confirms the handover end to end.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>Journald Disk Use and Retention</title>
      <link>https://getbytecraft.com/posts/96569300000000/</link>
      <description>Journald without limits grows until the disk fills, and `SystemMaxUse` is the only thing stopping it. Set a ceiling, set rate limiting, and keep…</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/self-hosted/">Self-Hosted</category>
      <category domain="https://getbytecraft.com/tags/cost/">cost</category>
      <pubDate>Fri, 04 Dec 2026 04:20:03 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> Journald without limits grows until the disk fills, and <code>SystemMaxUse</code> is the only thing stopping it. Set a ceiling, set rate limiting, and keep persistent storage — a volatile journal loses the evidence exactly when a machine crashes.</p><h2 id="The-limits"><a href="#The-limits" class="headerlink" title="The limits"></a>The limits</h2><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># /etc/systemd/journald.conf</span></span><br><span class="line"><span class="attr">Storage</span>=persistent</span><br><span class="line"><span class="attr">SystemMaxUse</span>=<span class="number">1</span>G</span><br><span class="line"><span class="attr">SystemMaxFileSize</span>=<span class="number">100</span>M</span><br><span class="line"><span class="attr">SystemKeepFree</span>=<span class="number">2</span>G</span><br><span class="line"><span class="attr">RuntimeMaxUse</span>=<span class="number">200</span>M</span><br><span class="line"><span class="attr">RateLimitIntervalSec</span>=<span class="number">30</span>s</span><br><span class="line"><span class="attr">RateLimitBurst</span>=<span class="number">5000</span></span><br></pre></td></tr></table></figure><p><code>SystemKeepFree</code> is the one that saves a nearly-full disk: journald shrinks below the limit to keep 2 GB free.</p><h2 id="Why-persistent"><a href="#Why-persistent" class="headerlink" title="Why persistent"></a>Why persistent</h2><p><code>Storage=volatile</code> writes to <code>/run</code> and vanishes on reboot, so the crash you need to diagnose is the one whose log is gone. Persistent survives and is bounded by the limits above.</p><h2 id="Rate-limiting-matters"><a href="#Rate-limiting-matters" class="headerlink" title="Rate limiting matters"></a>Rate limiting matters</h2><p>A service logging in a loop fills 1 GB in minutes. The defaults (10,000 per 30 s) are too generous; 5,000 per 30 s with a note in the config is usually right. Suppressed messages are counted and reported, so nothing is silently lost.</p><h2 id="Querying-efficiently"><a href="#Querying-efficiently" class="headerlink" title="Querying efficiently"></a>Querying efficiently</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">journalctl -u nginx --since <span class="string">&quot;1 hour ago&quot;</span> -p err</span><br><span class="line">journalctl --disk-usage</span><br><span class="line">journalctl --vacuum-time=14d</span><br></pre></td></tr></table></figure><p><code>--vacuum-time</code> is the manual prune; the config limits prune automatically. Do both — the config prevents growth, the vacuum clears an already-bloated journal.</p><h2 id="What-to-forward-off-box"><a href="#What-to-forward-off-box" class="headerlink" title="What to forward off-box"></a>What to forward off-box</h2><p>Any log that matters for incidents: auth failures, OOM kills, disk errors. A 100-line <code>journalctl</code> tail shipped to a chat webhook or syslog is 30 lines of config and <a href="/posts/f5fee6c6/">survives lost hardware</a>.</p><h2 id="Verify"><a href="#Verify" class="headerlink" title="Verify"></a>Verify</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">du</span> -sh /var/log/journal</span><br><span class="line">journalctl --disk-usage</span><br></pre></td></tr></table></figure><p>Under the configured <code>SystemMaxUse</code> and shrinking after a spike. A journal that ignores its own limit means the config file has a syntax error and journald silently kept defaults.</p><h2 id="Operating-notes"><a href="#Operating-notes" class="headerlink" title="Operating notes"></a>Operating notes</h2><p><code>SystemMaxUse</code> is the only thing that stops the disk filling. Pair it with <code>SystemKeepFree</code> so a nearly-full disk gets shaved automatically.</p><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">Storage</span>=persistent</span><br><span class="line"><span class="attr">SystemMaxUse</span>=<span class="number">1</span>G</span><br><span class="line"><span class="attr">SystemKeepFree</span>=<span class="number">2</span>G</span><br><span class="line"><span class="attr">RateLimitIntervalSec</span>=<span class="number">30</span>s</span><br><span class="line"><span class="attr">RateLimitBurst</span>=<span class="number">5000</span></span><br></pre></td></tr></table></figure><h2 id="Persistent-not-volatile"><a href="#Persistent-not-volatile" class="headerlink" title="Persistent, not volatile"></a>Persistent, not volatile</h2><p><code>Storage=volatile</code> writes to <code>/run</code> and vanishes on reboot — the crash you need to diagnose is the one whose log is gone.</p><h2 id="Rate-limiting"><a href="#Rate-limiting" class="headerlink" title="Rate limiting"></a>Rate limiting</h2><p>A service logging in a loop fills 1 GB in minutes. 5,000 per 30 s instead of the 10,000 default; suppressed lines are counted, so nothing is lost silently.</p><h2 id="Verify-1"><a href="#Verify-1" class="headerlink" title="Verify"></a>Verify</h2><p><code>journalctl --disk-usage</code> under the configured cap and shrinking after a spike. A journal ignoring its own limit means a syntax error in the config and defaults kept running.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>What is the bottom line on journald disk usage?</strong></p><p>Journald without limits grows until the disk fills, and <code>SystemMaxUse</code> is the only thing stopping it. Set a ceiling, set rate limiting, and keep persistent storage. A volatile journal loses the evidence exactly when a machine crashes.</p><p><strong>Why does Storage&#x3D;volatile lose logs on reboot?</strong></p><p><code>Storage=volatile</code> writes to <code>/run</code>, which vanishes on reboot. That means the crash you need to diagnose is the one whose log is gone. Persistent storage survives reboots and is still bounded by the configured limits.</p><p><strong>How do I stop a service that logs in a loop from filling the disk?</strong></p><p>Rate limiting is the control for this. A service logging in a loop fills 1 GB in minutes, and the defaults of 10,000 per 30 seconds are too generous. Setting <code>RateLimitBurst=5000</code> with <code>RateLimitIntervalSec=30s</code> is usually right, and suppressed messages are counted and reported so nothing is silently lost.</p><p><strong>What does SystemKeepFree do on a nearly full disk?</strong></p><p><code>SystemKeepFree</code> is the setting that saves a nearly-full disk: journald shrinks below the limit to keep the specified amount free. Pair it with <code>SystemMaxUse</code> so a nearly-full disk gets shaved automatically rather than filling completely.</p><p><strong>Why does my journal ignore its configured limit?</strong></p><p>A journal that ignores its own limit means the config file has a syntax error and journald silently kept the defaults. Verify with <code>journalctl --disk-usage</code> and <code>du -sh /var/log/journal</code>: usage should sit under the configured <code>SystemMaxUse</code> and shrink after a spike.</p>]]>
      </content:encoded>
    </item>
    <item>
      <title>Nginx Rate Limiting That Does Not Break WebSockets</title>
      <link>https://getbytecraft.com/posts/a0e39a49/</link>
      <description>`limit_req` on a WebSocket upgrade path counts one request per connection, so a normal `rate=10r/s` looks fine until a client reconnects in a loop…</description>
      <author>Bytecraft</author>
      <category domain="https://getbytecraft.com/categories/self-hosted/">Self-Hosted</category>
      <category domain="https://getbytecraft.com/tags/cost/">cost</category>
      <pubDate>Fri, 04 Dec 2026 04:13:03 GMT</pubDate>
      <content:encoded>
        <![CDATA[<p><strong>Bottom line:</strong> <code>limit_req</code> on a WebSocket upgrade path counts one request per connection, so a normal <code>rate=10r/s</code> looks fine until a client reconnects in a loop and gets 503. Exclude the upgrade location from the limit, or key it on a header the client sets once.</p><h2 id="Why-the-limit-misfires"><a href="#Why-the-limit-misfires" class="headerlink" title="Why the limit misfires"></a>Why the limit misfires</h2><p><code>limit_req</code> counts requests. An upgrade is one request that then lasts hours. Two problems follow: legitimate reconnects after network changes count against the burst, and a <code>limit_req_status 503</code> breaks the client’s handshake retry.</p><h2 id="Working-config"><a href="#Working-config" class="headerlink" title="Working config"></a>Working config</h2><figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">map</span> <span class="variable">$http_upgrade</span> <span class="variable">$is_upgrade</span> &#123;</span><br><span class="line">    <span class="attribute">default</span> <span class="string">&quot;&quot;</span>;</span><br><span class="line">    <span class="attribute">websocket</span> <span class="string">&quot;ws&quot;</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="attribute">limit_req_zone</span> <span class="variable">$binary_remote_addr</span> zone=api:<span class="number">10m</span> rate=20r/s;</span><br><span class="line"><span class="attribute">limit_conn_zone</span> <span class="variable">$binary_remote_addr</span> zone=conns:<span class="number">10m</span>;</span><br><span class="line"></span><br><span class="line"><span class="section">server</span> &#123;</span><br><span class="line">    <span class="section">location</span> /ws &#123;</span><br><span class="line">        <span class="attribute">proxy_pass</span> http://backend;</span><br><span class="line">        <span class="attribute">proxy_http_version</span> <span class="number">1</span>.<span class="number">1</span>;</span><br><span class="line">        <span class="attribute">proxy_set_header</span> Upgrade <span class="variable">$http_upgrade</span>;</span><br><span class="line">        <span class="attribute">proxy_set_header</span> Connection <span class="variable">$is_upgrade</span>;</span><br><span class="line">        <span class="attribute">proxy_read_timeout</span> <span class="number">3600s</span>;      <span class="comment"># &gt; client ping interval</span></span><br><span class="line">        <span class="attribute">proxy_send_timeout</span> <span class="number">3600s</span>;</span><br><span class="line">        <span class="attribute">limit_conn</span> conns <span class="number">50</span>;           <span class="comment"># concurrency limit, not rate</span></span><br><span class="line">    &#125;</span><br><span class="line">    <span class="section">location</span> /api/ &#123;</span><br><span class="line">        <span class="attribute">limit_req</span> zone=api burst=<span class="number">40</span> nodelay;</span><br><span class="line">        <span class="attribute">limit_req_status</span> <span class="number">429</span>;</span><br><span class="line">        <span class="attribute">proxy_pass</span> http://backend;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p>Concurrency (<code>limit_conn</code>) is the right instrument for WebSockets. Rate (<code>limit_req</code>) belongs on the request path.</p><h2 id="Timeouts"><a href="#Timeouts" class="headerlink" title="Timeouts"></a>Timeouts</h2><p>The read timeout must exceed the client’s ping interval by a margin. A 60 s ping with a 30 s timeout drops every connection. 3600 s is a safe default and does not leak — the upstream close ends it.</p><h2 id="429-vs-503"><a href="#429-vs-503" class="headerlink" title="429 vs 503"></a>429 vs 503</h2><p>Return 429 with <code>Retry-After</code> on the API path so clients back off correctly. 503 tells a client “server unavailable” and many retry immediately, adding load.</p><h2 id="Testing-the-limit"><a href="#Testing-the-limit" class="headerlink" title="Testing the limit"></a>Testing the limit</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">seq</span> 1 200 | xargs -P 50 -I&#123;&#125; curl -s -o /dev/null -w <span class="string">&quot;%&#123;http_code&#125;\n&quot;</span> https://host/api/x | <span class="built_in">sort</span> | <span class="built_in">uniq</span> -c</span><br></pre></td></tr></table></figure><p>Expect 200s up to <code>burst</code> and 429s after. Then hold 60 WebSockets open with <code>websocat</code> and confirm none are closed by the limiter.</p><h2 id="The-failure-to-watch-for"><a href="#The-failure-to-watch-for" class="headerlink" title="The failure to watch for"></a>The failure to watch for</h2><p>A single-page app that opens its socket on every route change. That is a client bug amplified by any rate limit; <code>limit_conn</code> reveals it as a rising concurrent-connection count per IP.</p><h2 id="Operating-notes"><a href="#Operating-notes" class="headerlink" title="Operating notes"></a>Operating notes</h2><p>Rate-limit requests, concurrency-limit sockets. <code>limit_req</code> on an upgrade path counts one request per hours-long connection and 503s the reconnect loop.</p><figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">location</span> /ws &#123; <span class="attribute">limit_conn</span> conns <span class="number">50</span>; <span class="attribute">proxy_read_timeout</span> <span class="number">3600s</span>; &#125;</span><br><span class="line"><span class="section">location</span> /api/ &#123; <span class="attribute">limit_req</span> zone=api burst=<span class="number">40</span> nodelay; <span class="attribute">limit_req_status</span> <span class="number">429</span>; &#125;</span><br></pre></td></tr></table></figure><h2 id="Timeouts-1"><a href="#Timeouts-1" class="headerlink" title="Timeouts"></a>Timeouts</h2><p>The read timeout must exceed the client ping interval by a wide margin. 60 s ping with 30 s timeout drops every connection. 3600 s is safe and leaks nothing.</p><h2 id="429-not-503"><a href="#429-not-503" class="headerlink" title="429, not 503"></a>429, not 503</h2><p>503 tells clients “unavailable” and many retry immediately. 429 with <code>Retry-After</code> makes them back off properly.</p><h2 id="Testing"><a href="#Testing" class="headerlink" title="Testing"></a>Testing</h2><p><code>seq 1 200 | xargs -P 50 curl -w &quot;%{http_code}\n&quot;</code> — expect 200s to <code>burst</code>, 429s after. Then hold 60 sockets with <code>websocat</code> and confirm none are closed by the limiter.</p><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><p><strong>Why does <code>limit_req</code> return 503 on WebSocket reconnects?</strong></p><p><code>limit_req</code> counts requests, and a WebSocket upgrade is one request that then lasts hours. Legitimate reconnects after network changes count against the burst, and <code>limit_req_status 503</code> breaks the client’s handshake retry loop. The fix is to exclude the upgrade location from the limit or key it on a header the client sets once.</p><p><strong>Should I use <code>limit_conn</code> or <code>limit_req</code> for WebSockets?</strong></p><p>Use <code>limit_conn</code> for WebSockets. Concurrency is the right instrument for sockets, while rate limiting belongs on the request path. In the working config, the <code>/ws</code> location uses <code>limit_conn conns 50</code> with no <code>limit_req</code>, and <code>/api/</code> keeps <code>limit_req zone=api burst=40 nodelay</code>.</p><p><strong>What <code>proxy_read_timeout</code> should I set for WebSockets?</strong></p><p>The read timeout must exceed the client’s ping interval by a margin. A 60 s ping with a 30 s timeout drops every connection. 3600 s is a safe default and does not leak, because the upstream close ends it.</p><p><strong>Why return 429 instead of 503 on the API path?</strong></p><p>503 tells a client “server unavailable,” and many clients retry immediately, adding load. 429 with <code>Retry-After</code> makes clients back off correctly. The config sets <code>limit_req_status 429</code> on the <code>/api/</code> location.</p><p><strong>How do I test that rate limiting is not closing WebSockets?</strong></p><p>First run <code>seq 1 200 | xargs -P 50 curl -w &quot;%{http_code}\n&quot;</code> against the API and expect 200s up to <code>burst</code> and 429s after. Then hold 60 WebSockets open with <code>websocat</code> and confirm none are closed by the limiter.</p>]]>
      </content:encoded>
    </item>
  </channel>
</rss>
