<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://til.yusuke.cloud/feed.xml" rel="self" type="application/atom+xml" /><link href="https://til.yusuke.cloud/" rel="alternate" type="text/html" /><updated>2026-08-02T16:35:33+00:00</updated><id>https://til.yusuke.cloud/feed.xml</id><title type="html">Today I Learned</title><subtitle>Micro Tech Blog generated from github issues. Main blog is https://yusuke.cloud</subtitle><entry><title type="html">git commit -S fails under Claude Code on WSL: route pinentry to Gpg4win</title><link href="https://til.yusuke.cloud/git/2026/08/02/5043328115.html" rel="alternate" type="text/html" title="git commit -S fails under Claude Code on WSL: route pinentry to Gpg4win" /><published>2026-08-02T16:08:30+00:00</published><updated>2026-08-02T16:08:30+00:00</updated><id>https://til.yusuke.cloud/git/2026/08/02/5043328115</id><content type="html" xml:base="https://til.yusuke.cloud/git/2026/08/02/5043328115.html"><![CDATA[<p>Signing commits from inside Claude Code kept failing on my Ubuntu-on-WSL setup:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>error: gpg failed to sign the data
error: unable to sign the tag
gpg: signing failed: No pinentry
</code></pre></div></div>

<p>Running the same <code class="language-plaintext highlighter-rouge">git commit -S</code> by hand in my terminal worked. That gap is the whole story.</p>

<h2 id="why-it-happens">Why it happens</h2>

<p>Claude Code executes shell commands in a non-interactive shell with <strong>no controlling TTY</strong> — the terminal is owned by the session UI, not by the command. <code class="language-plaintext highlighter-rouge">GPG_TTY</code> evaluates to <code class="language-plaintext highlighter-rouge">not a tty</code> there.</p>

<p>A terminal-based pinentry (<code class="language-plaintext highlighter-rouge">pinentry-curses</code>, <code class="language-plaintext highlighter-rouge">pinentry-tty</code>) has to draw its passphrase prompt onto a TTY. With none available, gpg either hangs forever or gives up with <code class="language-plaintext highlighter-rouge">No pinentry</code>. This isn’t specific to gpg: <code class="language-plaintext highlighter-rouge">sudo</code> prompts, ssh key passphrases, and <code class="language-plaintext highlighter-rouge">git rebase -i</code> fail the same way for the same reason.</p>

<p>It’s intermittent, which makes it confusing. gpg-agent caches your passphrase for <code class="language-plaintext highlighter-rouge">default-cache-ttl</code> seconds (600 by default), so signing succeeds while the cache is warm and fails the moment a prompt becomes necessary. I had a commit sign fine at 00:25 and a tag refuse at 00:37.</p>

<h2 id="the-fix-prompt-outside-the-terminal">The fix: prompt outside the terminal</h2>

<p>Install <a href="https://gpg4win.org/">Gpg4win</a> on the Windows side and point WSL’s gpg-agent at its pinentry. A Windows GUI dialog renders on the desktop — out-of-band, needing no TTY at all — so signing works from a non-interactive shell.</p>

<p><code class="language-plaintext highlighter-rouge">~/.gnupg/gpg-agent.conf</code>:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>pinentry-program /mnt/c/Program Files/Gpg4win/bin/pinentry.exe
</code></pre></div></div>

<p>Then restart the agent:</p>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gpgconf <span class="nt">--kill</span> gpg-agent
</code></pre></div></div>

<p>Use <code class="language-plaintext highlighter-rouge">--kill</code>, not <code class="language-plaintext highlighter-rouge">--reload</code> — a changed <code class="language-plaintext highlighter-rouge">pinentry-program</code> isn’t picked up on reload. The agent restarts on the next gpg call.</p>

<p>Verify:</p>

<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo test</span> | gpg <span class="nt">--clearsign</span> <span class="nt">-u</span> &lt;YOUR_KEY_ID&gt; <span class="o">&gt;</span> /dev/null
</code></pre></div></div>

<p>A Windows passphrase dialog should pop up. After that, <code class="language-plaintext highlighter-rouge">git commit -S</code> and <code class="language-plaintext highlighter-rouge">git tag -s</code> work from inside Claude Code.</p>

<h2 id="gotchas">Gotchas</h2>

<ul>
  <li><strong>Spaces in the path need no quoting or escaping.</strong> gpg-agent takes the entire rest of the line as the filename.</li>
  <li><strong>Check the path still exists after a Gpg4win upgrade.</strong> Mine broke when Gpg4win moved into the 64-bit tree: my config still pointed at <code class="language-plaintext highlighter-rouge">C:\Program Files (x86)\GnuPG\bin\pinentry.exe</code>, which had been emptied out, while the working binary was at <code class="language-plaintext highlighter-rouge">C:\Program Files\Gpg4win\bin\pinentry.exe</code>.</li>
  <li><strong><code class="language-plaintext highlighter-rouge">pinentry-w32.exe</code></strong> sits in the same directory as a fallback if the Qt build misbehaves across the WSL boundary.</li>
  <li>
    <p><strong>Diagnose without hanging:</strong></p>

    <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo test</span> | gpg <span class="nt">--batch</span> <span class="nt">--pinentry-mode</span> error <span class="nt">--clearsign</span> <span class="nt">-u</span> &lt;KEY&gt;   <span class="c"># fails fast</span>
gpg-connect-agent <span class="s1">'keyinfo --list'</span> /bye                              <span class="c"># is the key cached?</span>
</code></pre></div>    </div>
  </li>
  <li>
    <p><strong>Raise the cache</strong> if a commit-then-tag sequence re-prompts:</p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>default-cache-ttl 3600
max-cache-ttl 7200
</code></pre></div>    </div>
  </li>
  <li><strong><code class="language-plaintext highlighter-rouge">export GPG_TTY=$(tty)</code></strong> in your shell rc matters only for terminal pinentry. Harmless to keep, irrelevant to this route.</li>
</ul>

<h2 id="alternatives-i-passed-on">Alternatives I passed on</h2>

<p><strong>Unlock in a real terminal, then let the agent work within the cache window.</strong> Fragile — it expires mid-session, which is exactly what bit me.</p>

<p><strong>SSH-format signing</strong> (<code class="language-plaintext highlighter-rouge">git config gpg.format ssh</code> with an ssh-agent-held key) sidesteps pinentry entirely, but changes how verification appears on GitHub.</p>

<p>The GUI route is the only one that’s unconditionally safe from a non-interactive shell.</p>

<hr />
<p><a href="https://github.com/junkpiano/til/issues/50">discussion</a></p>]]></content><author><name></name></author><category term="git" /><summary type="html"><![CDATA[Signing commits from inside Claude Code kept failing on my Ubuntu-on-WSL setup:]]></summary></entry><entry><title type="html">Claude Code Permission Modes: Manual vs Accept Edits vs Plan vs Auto</title><link href="https://til.yusuke.cloud/claude%20code/2026/08/02/5042723850.html" rel="alternate" type="text/html" title="Claude Code Permission Modes: Manual vs Accept Edits vs Plan vs Auto" /><published>2026-08-02T13:50:33+00:00</published><updated>2026-08-02T13:50:33+00:00</updated><id>https://til.yusuke.cloud/claude%20code/2026/08/02/5042723850</id><content type="html" xml:base="https://til.yusuke.cloud/claude%20code/2026/08/02/5042723850.html"><![CDATA[<table>
  <thead>
    <tr>
      <th>Mode</th>
      <th>Runs without asking</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><strong>Manual</strong> (<code class="language-plaintext highlighter-rouge">default</code>)</td>
      <td>Reads only</td>
    </tr>
    <tr>
      <td><strong>Accept edits</strong> (<code class="language-plaintext highlighter-rouge">acceptEdits</code>)</td>
      <td>Reads + file edits in the working directory + basic filesystem commands</td>
    </tr>
    <tr>
      <td><strong>Plan</strong> (<code class="language-plaintext highlighter-rouge">plan</code>)</td>
      <td>Reads only. <strong>No edits at all</strong></td>
    </tr>
    <tr>
      <td><strong>Auto</strong> (<code class="language-plaintext highlighter-rouge">auto</code>)</td>
      <td>Everything, but a classifier model reviews each action first</td>
    </tr>
  </tbody>
</table>

<h2 id="key-points">Key points</h2>

<ul>
  <li>Manual → Accept edits differs only in <em>how often</em> you’re asked. Both keep the guardrails on risky operations.</li>
  <li>Plan is on a different axis. Not about frequency — it confines Claude to research and proposals.</li>
  <li>Auto isn’t just “looser.” It adds a separate mechanism: a classifier vetting actions before they run.</li>
</ul>

<h2 id="tokens">Tokens</h2>

<p>Only Auto adds model calls. The other three are equivalent.</p>

<h2 id="practical-pattern">Practical pattern</h2>

<p>For anything non-trivial: start in Plan, approve, then execute in Accept edits.</p>

<hr />
<p><a href="https://github.com/junkpiano/til/issues/49">discussion</a></p>]]></content><author><name></name></author><category term="Claude Code" /><summary type="html"><![CDATA[Mode Runs without asking Manual (default) Reads only Accept edits (acceptEdits) Reads + file edits in the working directory + basic filesystem commands Plan (plan) Reads only. No edits at all Auto (auto) Everything, but a classifier model reviews each action first]]></summary></entry><entry><title type="html">Eliminating Raspberry Pi Fan Noise with Temperature-Based Control</title><link href="https://til.yusuke.cloud/hardware/2026/02/19/3963432083.html" rel="alternate" type="text/html" title="Eliminating Raspberry Pi Fan Noise with Temperature-Based Control" /><published>2026-02-19T15:02:36+00:00</published><updated>2026-02-19T15:02:36+00:00</updated><id>https://til.yusuke.cloud/hardware/2026/02/19/3963432083</id><content type="html" xml:base="https://til.yusuke.cloud/hardware/2026/02/19/3963432083.html"><![CDATA[<h2 id="-problem">🎯 Problem</h2>

<p>My Raspberry Pi (running MPD, Navidrome, and Grafana) had a small 5V case fan connected directly to:</p>

<ul>
  <li>Red → Pin 4 (5V)</li>
  <li>Black → Pin 6 (GND)</li>
</ul>

<p>This caused:</p>

<ul>
  <li>Constant full-speed rotation</li>
  <li>Audible “shhh” fan noise</li>
  <li>Noise louder than the music at low volume</li>
</ul>

<p>Despite this, CPU temperature was only:</p>

<ul>
  <li>25–30°C with fan</li>
  <li>~47–48°C without fan</li>
</ul>

<p>The system was massively overcooled.</p>

<hr />

<h2 id="-root-cause">🔎 Root Cause</h2>

<p>The fan was powered directly by 5V, meaning:</p>

<ul>
  <li>No temperature awareness</li>
  <li>Always running at maximum speed</li>
  <li>Cooling far beyond what the workload required</li>
</ul>

<p>For lightweight workloads (MPD + Docker services), this level of cooling is unnecessary.</p>

<hr />

<h2 id="-solution-temperature-based-fan-control">🛠 Solution: Temperature-Based Fan Control</h2>

<p>Instead of removing cooling entirely, I implemented <strong>fan-on-demand control</strong>.</p>

<h3 id="1️⃣-rewire-the-fan">1️⃣ Rewire the Fan</h3>

<p>From:</p>

<ul>
  <li>Red → Pin 4 (5V)</li>
</ul>

<p>To:</p>

<ul>
  <li>Red → <strong>Pin 8 (GPIO14)</strong></li>
  <li>Black → Pin 6 (GND)</li>
</ul>

<p>This allows software to control the fan.</p>

<hr />

<h3 id="2️⃣-enable-gpio-fan-overlay">2️⃣ Enable <code class="language-plaintext highlighter-rouge">gpio-fan</code> Overlay</h3>

<p>Edit:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>nano /boot/firmware/config.txt
</code></pre></div></div>

<p>Under <code class="language-plaintext highlighter-rouge">[all]</code>, add:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dtoverlay=gpio-fan,gpiopin=14,temp=65000,hyst=5000
</code></pre></div></div>

<p>Meaning:</p>

<ul>
  <li>Fan ON at 65°C</li>
  <li>Fan OFF at 60°C</li>
  <li>5°C hysteresis prevents rapid toggling</li>
</ul>

<hr />

<h3 id="3️⃣-reboot">3️⃣ Reboot</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>reboot
</code></pre></div></div>

<hr />

<h2 id="-result">📊 Result</h2>

<p>Under normal workload:</p>

<ul>
  <li>Temperature: ~47°C</li>
  <li>Fan: OFF</li>
  <li>Noise: Completely silent</li>
</ul>

<p>The fan now only activates if the CPU reaches 65°C, which is unlikely during music playback.</p>

<hr />

<h2 id="-key-insight">🧠 Key Insight</h2>

<p>Constant cooling is not the same as optimal cooling.</p>

<p>For audio-focused Raspberry Pi use:</p>

<ul>
  <li>Overcooling adds noise</li>
  <li>Noise defeats the purpose of a jukebox</li>
  <li>Smart thermal thresholds preserve silence</li>
</ul>

<p>Temperature control became a <strong>countermeasure to fan noise</strong>, not a thermal necessity.</p>

<hr />

<h2 id="-final-state">🎵 Final State</h2>

<ul>
  <li>Silent Raspberry Pi</li>
  <li>No constant mechanical noise</li>
  <li>Automatic thermal protection</li>
  <li>Clean, intentional design</li>
</ul>

<blockquote>
  <p>Silence first. Cooling only when required.</p>
</blockquote>

<hr />
<p><a href="https://github.com/junkpiano/til/issues/48">discussion</a></p>]]></content><author><name></name></author><category term="hardware" /><summary type="html"><![CDATA[🎯 Problem]]></summary></entry><entry><title type="html">Ubuntu 24.04: “No Wi-Fi Adapter Found” on Intel Core Ultra (ILL) – fixed by forcing OEM kernel via GRUB</title><link href="https://til.yusuke.cloud/linux/2026/02/10/3921717904.html" rel="alternate" type="text/html" title="Ubuntu 24.04: “No Wi-Fi Adapter Found” on Intel Core Ultra (ILL) – fixed by forcing OEM kernel via GRUB" /><published>2026-02-10T14:16:08+00:00</published><updated>2026-02-10T14:16:08+00:00</updated><id>https://til.yusuke.cloud/linux/2026/02/10/3921717904</id><content type="html" xml:base="https://til.yusuke.cloud/linux/2026/02/10/3921717904.html"><![CDATA[<h2 id="summary">Summary</h2>

<p>On Ubuntu 24.04 LTS running on a laptop with an Intel Core Ultra (ILL) CPU and Intel Wi-Fi (Wi-Fi 7 class), Wi-Fi was completely unavailable even though the device was detected at the PCI level.</p>

<p>The issue was not missing drivers, but booting an incompatible kernel.
The system was stuck booting a newer mainline kernel, while a working OEM kernel was already installed but never selected.</p>

<p>The issue was resolved by forcing GRUB to boot the OEM kernel (6.14) and updating GRUB.</p>

<h2 id="environment">Environment</h2>

<ul>
  <li>OS: Ubuntu 24.04 LTS</li>
  <li>Hardware: Laptop with Intel Core Ultra (ILL) CPU</li>
  <li>Wi-Fi: Intel Wi-Fi (Wi-Fi 7 class, e.g. Intel Corporation Device a840)</li>
  <li>Firmware: Standard linux-firmware from Ubuntu repos</li>
  <li>Boot mode: UEFI (GRUB menu hidden by default)</li>
</ul>

<h2 id="symptoms">Symptoms</h2>

<p>GNOME Network Settings shows: “No Wi-Fi Adapter Found”
Wi-Fi device is detected:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lspci | grep -i network
</code></pre></div></div>

<p>But driver is not bound:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo lshw -C network
# *-network UNCLAIMED
</code></pre></div></div>

<h2 id="investigation">Investigation</h2>

<p>The system was booting into a newer mainline kernel:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>uname -r
# 6.17.0-14-generic
</code></pre></div></div>

<p>However, a stable OEM kernel was already present:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ls /boot | grep vmlinuz
# vmlinuz-6.14.0-37-generic
# vmlinuz-6.17.0-14-generic
</code></pre></div></div>

<p>Because the GRUB menu was hidden (UEFI fast boot), the system always booted into 6.17, which caused a kernel–firmware mismatch.
As a result, iwlwifi failed to claim the device (UNCLAIMED).</p>

<h2 id="root-cause">Root Cause</h2>

<ul>
  <li>Intel Wi-Fi drivers (iwlwifi) are highly sensitive to kernel ↔ firmware compatibility</li>
  <li>Kernel 6.17 was too new for the shipped firmware</li>
  <li>Kernel 6.14 (OEM) contains backported fixes suitable for this hardware</li>
  <li>GRUB never selected 6.14 automatically</li>
  <li>This is not a DKMS or driver installation issue.</li>
</ul>

<h2 id="solution-what-fixed-it">Solution (What Fixed It)</h2>

<p>Force GRUB to always boot the OEM kernel and update GRUB:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo sed -i 's/^GRUB_DEFAULT=.*/GRUB_DEFAULT="Advanced options for Ubuntu&gt;Ubuntu, with Linux 6.14.0-37-generic"/' /etc/default/grub
sudo update-grub
sudo reboot
</code></pre></div></div>

<p>After reboot:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>uname -r
# 6.14.0-37-generic
</code></pre></div></div>

<p>Then reinstall firmware:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo apt update
sudo apt install --reinstall linux-firmware
sudo reboot
</code></pre></div></div>

<p>Wi-Fi immediately became available.</p>

<h2 id="cleanup-recommended">Cleanup (Recommended)</h2>

<p>After confirming stability:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo apt remove 'linux-image-6.17.*' 'linux-headers-6.17.*'
sudo apt autoremove
sudo update-grub
</code></pre></div></div>

<h2 id="lessons--notes">Lessons / Notes</h2>

<ol>
  <li>UNCLAIMED often indicates a kernel/firmware mismatch, not missing drivers</li>
  <li>On new Intel Core Ultra (ILL) systems, OEM kernels may be required</li>
  <li>Hidden GRUB menus on UEFI systems can silently lock users into a broken kernel</li>
  <li>update-grub is a critical step when dealing with kernel selection</li>
</ol>

<h2 id="expected-improvement">Expected Improvement</h2>

<p>It would be helpful if Ubuntu:</p>

<ul>
  <li>Preferred OEM kernels automatically on supported hardware, or</li>
  <li>Warned when booting experimental/mainline kernels that break firmware compatibility</li>
</ul>

<hr />
<p><a href="https://github.com/junkpiano/til/issues/47">discussion</a></p>]]></content><author><name></name></author><category term="linux" /><summary type="html"><![CDATA[Summary]]></summary></entry><entry><title type="html">Fixing Podman “Pipe Busy” Errors on Windows via WSL Update</title><link href="https://til.yusuke.cloud/windows/2026/01/04/3778965288.html" rel="alternate" type="text/html" title="Fixing Podman “Pipe Busy” Errors on Windows via WSL Update" /><published>2026-01-04T07:49:57+00:00</published><updated>2026-01-04T07:49:57+00:00</updated><id>https://til.yusuke.cloud/windows/2026/01/04/3778965288</id><content type="html" xml:base="https://til.yusuke.cloud/windows/2026/01/04/3778965288.html"><![CDATA[<p>In my local development environment using <strong>Podman Desktop</strong> and <strong>Kind (Kubernetes in Docker)</strong> on Windows, I encountered a persistent and frustrating error that prevented Podman from starting its own VM.</p>
<h2 id="the-problem">The Problem</h2>

<p>Every time I restarted my machine or Podman, I was greeted with this error:</p>

<blockquote>
  <p><code class="language-plaintext highlighter-rouge">CreateFile \\.\pipe\docker_engine: All pipe instances are busy.</code></p>
</blockquote>

<p>This error indicated that the “bridge” between the Windows host and the Podman engine inside WSL2 was broken. Specifically, the <strong>Named Pipe</strong> (<code class="language-plaintext highlighter-rouge">\\.\pipe\docker_engine</code>)—which allows Windows tools like <code class="language-plaintext highlighter-rouge">kubectl</code> to talk to the container engine—was either locked or failing to initialize.</p>

<h2 id="the-solution-wsl---update">The Solution: <code class="language-plaintext highlighter-rouge">wsl --update</code></h2>

<p>After attempting to restart services and prune containers to no avail, the fix turned out to be updating the WSL subsystem itself.</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">wsl</span><span class="w"> </span><span class="nt">--update</span><span class="w">
</span><span class="n">wsl</span><span class="w"> </span><span class="nt">--shutdown</span><span class="w">

</span></code></pre></div></div>

<h3 id="why-did-this-work">Why did this work?</h3>

<ol>
  <li><strong>Kernel Stability:</strong> <code class="language-plaintext highlighter-rouge">wsl --update</code> installs the latest Microsoft Linux kernel. Newer kernels have improved handling of <strong>AF_UNIX</strong> sockets and <strong>Named Pipe</strong> translations, which are critical for Podman’s “Docker Compatibility” mode.</li>
  <li><strong>Process Cleanup:</strong> The update process forces a clean state. Unlike a simple restart, it ensures that no “zombie” processes (like <code class="language-plaintext highlighter-rouge">gvproxy.exe</code> or <code class="language-plaintext highlighter-rouge">win-sshproxy.exe</code>) are holding onto the <code class="language-plaintext highlighter-rouge">docker_engine</code> pipe in a hung state.</li>
  <li><strong>Bridge Reliability:</strong> Podman on Windows relies on an SSH tunnel to forward the socket from inside the VM to Windows. Updates often resolve bugs in the WSL networking stack that cause these tunnels to fail with “Pipe instances are busy.”</li>
</ol>

<h2 id="key-takeaways-for-podman--kind-users">Key Takeaways for Podman + Kind Users</h2>

<p>If you are running a heavy stack like <strong>ArgoCD</strong> inside <strong>Kind</strong> on <strong>Podman</strong>, keep these three things in mind:</p>

<ul>
  <li><strong>Resource Exhaustion:</strong> Kubernetes is memory-intensive. If your Podman Machine runs out of RAM, it can hang the entire WSL instance, leading to pipe errors.</li>
  <li>
    <p><em>Tip:</em> Use <code class="language-plaintext highlighter-rouge">podman machine set --memory 8192</code> to give it enough breathing room.</p>
  </li>
  <li><strong>The “Golden” Reset:</strong> When in doubt, <code class="language-plaintext highlighter-rouge">wsl --shutdown</code> is your best friend. It releases all file handles and pipes that might be stuck.</li>
  <li><strong>Version Sync:</strong> Always ensure your WSL version is up to date. The bridge between Windows and Linux is complex and frequently patched.</li>
</ul>

<h2 id="conclusion">Conclusion</h2>

<p>If your <code class="language-plaintext highlighter-rouge">kubectl</code> commands are failing and Podman reports that “pipe instances are busy,” don’t just restart the app. Update the infrastructure. A simple <code class="language-plaintext highlighter-rouge">wsl --update</code> can resolve deep-seated networking conflicts that manual troubleshooting cannot touch.</p>

<hr />
<p><a href="https://github.com/junkpiano/til/issues/46">discussion</a></p>]]></content><author><name></name></author><category term="windows" /><summary type="html"><![CDATA[In my local development environment using Podman Desktop and Kind (Kubernetes in Docker) on Windows, I encountered a persistent and frustrating error that prevented Podman from starting its own VM. The Problem]]></summary></entry><entry><title type="html">Windows + WSL2 + k3s + Helm + Argo CD</title><link href="https://til.yusuke.cloud/kubernetes/2026/01/02/3776716818.html" rel="alternate" type="text/html" title="Windows + WSL2 + k3s + Helm + Argo CD" /><published>2026-01-02T16:36:16+00:00</published><updated>2026-01-02T16:36:16+00:00</updated><id>https://til.yusuke.cloud/kubernetes/2026/01/02/3776716818</id><content type="html" xml:base="https://til.yusuke.cloud/kubernetes/2026/01/02/3776716818.html"><![CDATA[<h2 id="sudo-kubectl-assumed--no-port-forward--persistent-gui">(sudo kubectl assumed / no port-forward / persistent GUI)</h2>

<p>This article explains <strong>how to build k3s on WSL2 (Ubuntu) running on Windows,<br />
and set up a GitOps environment with Helm + Argo CD, exposing the GUI persistently without using port-forward</strong>.</p>

<p>Based on real troubleshooting experience, this guide prioritizes <strong>reproducibility above all else</strong>.</p>

<hr />

<h2 id="assumptions--design-policy-important">Assumptions &amp; Design Policy (Important)</h2>

<ul>
  <li>k3s is used as a <strong>development-only single-node cluster</strong></li>
  <li><strong><code class="language-plaintext highlighter-rouge">sudo kubectl</code> is the default on the server (WSL) side</strong></li>
  <li>The canonical kubeconfig is <code class="language-plaintext highlighter-rouge">/etc/rancher/k3s/k3s.yaml</code></li>
  <li>We do <strong>not</strong> force kubectl to run as a non-root user</li>
  <li>Windows is treated purely as an <strong>entry point (Ingress / GUI)</strong></li>
</ul>

<blockquote>
  <p>This policy fully aligns with the design philosophy described in the official k3s documentation.</p>
</blockquote>

<hr />

<h2 id="goal-final-state">Goal (Final State)</h2>

<ul>
  <li>k3s running on WSL2 (Ubuntu)</li>
  <li>Cluster operations performed via <code class="language-plaintext highlighter-rouge">sudo kubectl</code></li>
  <li>Argo CD exposed persistently via <strong>Ingress (Traefik)</strong></li>
  <li>No use of <code class="language-plaintext highlighter-rouge">kubectl port-forward</code></li>
  <li>Resilient to WSL IP address changes</li>
  <li>Accessible from Windows browser at<br />
<code class="language-plaintext highlighter-rouge">http://argocd.localhost</code></li>
</ul>

<hr />

<h2 id="1-preparing-wsl2--ubuntu-windows">1. Preparing WSL2 / Ubuntu (Windows)</h2>

<h3 id="install-wsl2-if-not-already-installed">Install WSL2 (if not already installed)</h3>
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">wsl</span><span class="w"> </span><span class="nt">--install</span><span class="w">
</span></code></pre></div></div>

<h3 id="verify-status">Verify status</h3>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">wsl</span><span class="w"> </span><span class="nt">--list</span><span class="w"> </span><span class="nt">--verbose</span><span class="w">
</span></code></pre></div></div>

<ul>
  <li>Ubuntu must exist</li>
  <li>Version must be <code class="language-plaintext highlighter-rouge">2</code></li>
</ul>

<hr />

<h2 id="2-initial-ubuntu-setup-wsl">2. Initial Ubuntu Setup (WSL)</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt update <span class="o">&amp;&amp;</span> <span class="nb">sudo </span>apt upgrade <span class="nt">-y</span>
<span class="nb">sudo </span>apt <span class="nb">install</span> <span class="nt">-y</span> curl ca-certificates gnupg lsb-release
</code></pre></div></div>

<hr />

<h2 id="3-installing-k3s-wsl">3. Installing k3s (WSL)</h2>

<h3 id="31-installation">3.1 Installation</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-sfL</span> https://get.k3s.io | sh -
</code></pre></div></div>

<h3 id="32-verify-startup-as-per-official-docs">3.2 Verify startup (as per official docs)</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>kubectl get nodes
</code></pre></div></div>

<p>If the node shows <code class="language-plaintext highlighter-rouge">Ready</code>, k3s is working correctly.</p>

<hr />

<h2 id="4-k3s-and-sudo-kubectl">4. k3s and sudo kubectl</h2>

<p>k3s is designed to be <strong>managed as root</strong>, including:</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">/etc/rancher/k3s/k3s.yaml</code></li>
  <li>containerd</li>
  <li>CNI / Traefik</li>
</ul>

<p>Therefore:</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">sudo kubectl</code> is the default</li>
  <li><code class="language-plaintext highlighter-rouge">permission denied</code> errors are not abnormal</li>
  <li>For development, reproducibility is preferred over permission tuning</li>
</ul>

<hr />

<h2 id="5-installing-helm-wsl">5. Installing Helm (WSL)</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-fsSL</span> https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm version
</code></pre></div></div>

<hr />

<h2 id="6-installing-argo-cd-sudo-kubectl">6. Installing Argo CD (sudo kubectl)</h2>

<h3 id="61-create-namespace">6.1 Create namespace</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>kubectl create namespace argocd
</code></pre></div></div>

<h3 id="62-apply-manifests">6.2 Apply manifests</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>kubectl apply <span class="nt">-n</span> argocd <span class="se">\</span>
  <span class="nt">-f</span> https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
</code></pre></div></div>

<h3 id="63-verify-startup">6.3 Verify startup</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>kubectl get pods <span class="nt">-n</span> argocd
<span class="nb">sudo </span>kubectl get svc  <span class="nt">-n</span> argocd
</code></pre></div></div>

<hr />

<h2 id="7-exposing-argo-cd-via-ingress-no-port-forward">7. Exposing Argo CD via Ingress (No port-forward)</h2>

<p>Traefik is enabled by default in k3s.</p>

<h3 id="71-run-argocd-server-in-http-mode">7.1 Run argocd-server in HTTP mode</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>kubectl <span class="nt">-n</span> argocd patch deployment argocd-server <span class="se">\</span>
  <span class="nt">--type</span><span class="o">=</span><span class="s1">'json'</span> <span class="se">\</span>
  <span class="nt">-p</span><span class="o">=</span><span class="s1">'[
    {"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--insecure"}
  ]'</span>

<span class="nb">sudo </span>kubectl rollout restart deployment argocd-server <span class="nt">-n</span> argocd
</code></pre></div></div>

<hr />

<h3 id="72-create-ingress-traefik">7.2 Create Ingress (Traefik)</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>kubectl apply <span class="nt">-f</span> - <span class="o">&lt;&lt;</span><span class="sh">'</span><span class="no">EOF</span><span class="sh">'
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: argocd
  namespace: argocd
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: argocd.localhost
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: argocd-server
            port:
              number: 80
</span><span class="no">EOF
</span></code></pre></div></div>

<p>Verification:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>kubectl get ingress <span class="nt">-n</span> argocd
<span class="nb">sudo </span>kubectl describe ingress argocd <span class="nt">-n</span> argocd
</code></pre></div></div>

<hr />

<h2 id="8-connectivity-check-from-wsl-critical">8. Connectivity Check from WSL (Critical)</h2>

<p>Verify Ingress behavior <strong>directly from inside WSL</strong>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-H</span> <span class="s2">"Host: argocd.localhost"</span> http://127.0.0.1
</code></pre></div></div>

<p>If HTML is returned,
<strong>k3s + Traefik + Argo CD are fully functional</strong>.</p>

<hr />

<h2 id="9-editing-windows-hosts-file">9. Editing Windows hosts File</h2>

<p>Open Notepad as Administrator:</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">notepad</span><span class="w"> </span><span class="nx">C:\Windows\System32\drivers\etc\hosts</span><span class="w">
</span></code></pre></div></div>

<p>Append:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>127.0.0.1 argocd.localhost
</code></pre></div></div>

<p>Verify:</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ping</span><span class="w"> </span><span class="nx">argocd.localhost</span><span class="w">
</span></code></pre></div></div>

<hr />

<h2 id="10-forwarding-windows--wsl-ingress-port-80">10. Forwarding Windows → WSL (Ingress Port 80)</h2>

<p><strong>Note: This is separate from the Kubernetes API port (6443).</strong></p>

<p>Administrator PowerShell:</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$wslIp</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">wsl</span><span class="w"> </span><span class="nx">hostname</span><span class="w"> </span><span class="nt">-I</span><span class="p">)</span><span class="o">.</span><span class="nf">Trim</span><span class="p">()</span><span class="o">.</span><span class="nf">Split</span><span class="p">(</span><span class="s2">" "</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="w">

</span><span class="n">netsh</span><span class="w"> </span><span class="nx">interface</span><span class="w"> </span><span class="nx">portproxy</span><span class="w"> </span><span class="nx">reset</span><span class="w">

</span><span class="n">netsh</span><span class="w"> </span><span class="nx">interface</span><span class="w"> </span><span class="nx">portproxy</span><span class="w"> </span><span class="nx">add</span><span class="w"> </span><span class="se">`
</span><span class="w">  </span><span class="nx">v4tov4</span><span class="w"> </span><span class="se">`
</span><span class="w">  </span><span class="nx">listenaddress</span><span class="o">=</span><span class="mf">127.0</span><span class="o">.</span><span class="nf">0</span><span class="o">.</span><span class="nf">1</span><span class="w"> </span><span class="err">`</span><span class="w">
  </span><span class="n">listenport</span><span class="o">=</span><span class="mi">80</span><span class="w"> </span><span class="err">`</span><span class="w">
  </span><span class="n">connectaddress</span><span class="o">=</span><span class="nv">$wslIp</span><span class="w"> </span><span class="err">`</span><span class="w">
  </span><span class="n">connectport</span><span class="o">=</span><span class="mi">80</span><span class="w">
</span></code></pre></div></div>

<p>Verify:</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">netsh</span><span class="w"> </span><span class="nx">interface</span><span class="w"> </span><span class="nx">portproxy</span><span class="w"> </span><span class="nx">show</span><span class="w"> </span><span class="nx">all</span><span class="w">
</span></code></pre></div></div>

<hr />

<h2 id="11-accessing-argo-cd-from-browser">11. Accessing Argo CD from Browser</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>http://argocd.localhost
</code></pre></div></div>

<p>Retrieve login credentials (WSL):</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>kubectl <span class="nt">-n</span> argocd get secret argocd-initial-admin-secret <span class="se">\</span>
  <span class="nt">-o</span> <span class="nv">jsonpath</span><span class="o">=</span><span class="s2">"{.data.password}"</span> | <span class="nb">base64</span> <span class="nt">-d</span> <span class="o">&amp;&amp;</span> <span class="nb">echo</span>
</code></pre></div></div>

<ul>
  <li>user: <code class="language-plaintext highlighter-rouge">admin</code></li>
  <li>password: output of the command above</li>
</ul>

<hr />

<h2 id="12-handling-wsl-ip-changes-windows-script">12. Handling WSL IP Changes (Windows Script)</h2>

<p>Since WSL IPs change on restart, create a script to update portproxy automatically.</p>

<h3 id="121-script-creation">12.1 Script Creation</h3>

<p><code class="language-plaintext highlighter-rouge">%USERPROFILE%\update-argocd-portproxy.ps1</code></p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># ==========================================================</span><span class="w">
</span><span class="c"># k3s on WSL portproxy updater</span><span class="w">
</span><span class="c"># - API Server : 127.0.0.1:6443 -&gt; WSL:6443</span><span class="w">
</span><span class="c"># - Ingress    : 127.0.0.1:80   -&gt; WSL:80</span><span class="w">
</span><span class="c"># ==========================================================</span><span class="w">

</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"Starting k3s portproxy updater..."</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Cyan</span><span class="w">

</span><span class="c"># Ensure WSL is running</span><span class="w">
</span><span class="n">wsl</span><span class="w"> </span><span class="nt">-e</span><span class="w"> </span><span class="nx">bash</span><span class="w"> </span><span class="nt">-c</span><span class="w"> </span><span class="s2">"true"</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Out-Null</span><span class="w">

</span><span class="c"># Retrieve WSL IP</span><span class="w">
</span><span class="nv">$wslIp</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">wsl</span><span class="w"> </span><span class="nx">hostname</span><span class="w"> </span><span class="nt">-I</span><span class="p">)</span><span class="o">.</span><span class="nf">Trim</span><span class="p">()</span><span class="o">.</span><span class="nf">Split</span><span class="p">(</span><span class="s2">" "</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="w">

</span><span class="kr">if</span><span class="w"> </span><span class="p">(</span><span class="o">-not</span><span class="w"> </span><span class="nv">$wslIp</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="n">Write-Error</span><span class="w"> </span><span class="s2">"WSL IP address not found"</span><span class="w">
    </span><span class="kr">exit</span><span class="w"> </span><span class="mi">1</span><span class="w">
</span><span class="p">}</span><span class="w">

</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"WSL IP detected: </span><span class="nv">$wslIp</span><span class="s2">"</span><span class="w">

</span><span class="c"># Reset existing portproxy rules</span><span class="w">
</span><span class="n">netsh</span><span class="w"> </span><span class="nx">interface</span><span class="w"> </span><span class="nx">portproxy</span><span class="w"> </span><span class="nx">reset</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Out-Null</span><span class="w">

</span><span class="c"># ----------------------------------------------------------</span><span class="w">
</span><span class="c"># Kubernetes API Server (kubectl / Lens / VS Code)</span><span class="w">
</span><span class="c"># ----------------------------------------------------------</span><span class="w">
</span><span class="n">netsh</span><span class="w"> </span><span class="nx">interface</span><span class="w"> </span><span class="nx">portproxy</span><span class="w"> </span><span class="nx">add</span><span class="w"> </span><span class="se">`
</span><span class="w">  </span><span class="nx">v4tov4</span><span class="w"> </span><span class="se">`
</span><span class="w">  </span><span class="nx">listenaddress</span><span class="o">=</span><span class="mf">127.0</span><span class="o">.</span><span class="nf">0</span><span class="o">.</span><span class="nf">1</span><span class="w"> </span><span class="err">`</span><span class="w">
  </span><span class="n">listenport</span><span class="o">=</span><span class="mi">6443</span><span class="w"> </span><span class="err">`</span><span class="w">
  </span><span class="n">connectaddress</span><span class="o">=</span><span class="nv">$wslIp</span><span class="w"> </span><span class="err">`</span><span class="w">
  </span><span class="n">connectport</span><span class="o">=</span><span class="mi">6443</span><span class="w">

</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"API portproxy updated : 127.0.0.1:6443 -&gt; </span><span class="nv">$</span><span class="nn">wslIp</span><span class="p">:</span><span class="nv">6443</span><span class="s2">"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">

</span><span class="c"># ----------------------------------------------------------</span><span class="w">
</span><span class="c"># Ingress (Argo CD / Web UI)</span><span class="w">
</span><span class="c"># ----------------------------------------------------------</span><span class="w">
</span><span class="n">netsh</span><span class="w"> </span><span class="nx">interface</span><span class="w"> </span><span class="nx">portproxy</span><span class="w"> </span><span class="nx">add</span><span class="w"> </span><span class="se">`
</span><span class="w">  </span><span class="nx">v4tov4</span><span class="w"> </span><span class="se">`
</span><span class="w">  </span><span class="nx">listenaddress</span><span class="o">=</span><span class="mf">127.0</span><span class="o">.</span><span class="nf">0</span><span class="o">.</span><span class="nf">1</span><span class="w"> </span><span class="err">`</span><span class="w">
  </span><span class="n">listenport</span><span class="o">=</span><span class="mi">80</span><span class="w"> </span><span class="err">`</span><span class="w">
  </span><span class="n">connectaddress</span><span class="o">=</span><span class="nv">$wslIp</span><span class="w"> </span><span class="err">`</span><span class="w">
  </span><span class="n">connectport</span><span class="o">=</span><span class="mi">80</span><span class="w">

</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"Ingress portproxy updated : 127.0.0.1:80 -&gt; </span><span class="nv">$</span><span class="nn">wslIp</span><span class="p">:</span><span class="nv">80</span><span class="s2">"</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Green</span><span class="w">

</span><span class="n">Write-Host</span><span class="w"> </span><span class="s2">"k3s portproxy update completed."</span><span class="w"> </span><span class="nt">-ForegroundColor</span><span class="w"> </span><span class="nx">Cyan</span><span class="w">
</span></code></pre></div></div>

<p>Execute:</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">powershell</span><span class="w"> </span><span class="nt">-ExecutionPolicy</span><span class="w"> </span><span class="nx">Bypass</span><span class="w"> </span><span class="nt">-File</span><span class="w"> </span><span class="nv">$</span><span class="nn">env</span><span class="p">:</span><span class="nv">USERPROFILE</span><span class="nx">\update-argocd-portproxy.ps1</span><span class="w">
</span></code></pre></div></div>

<hr />

<h2 id="13-summary">13. Summary</h2>

<ul>
  <li>k3s is most stable when operated with <strong><code class="language-plaintext highlighter-rouge">sudo kubectl</code></strong></li>
  <li>Follow the platform’s design philosophy instead of fighting permissions</li>
  <li>Combine Ingress + hosts + portproxy for a persistent GUI</li>
  <li>Avoiding port-forward significantly improves developer experience</li>
  <li>Argo CD provides a natural entry point into GitOps workflows</li>
</ul>

<hr />

<h2 id="what-to-do-next-follow-up-topics">What to Do Next (Follow-up Topics)</h2>

<ul>
  <li>Managing Helm values via GitOps</li>
  <li>App-of-apps pattern</li>
  <li>Enabling HTTPS with cert-manager</li>
  <li>Differences when migrating from k3s to EKS/GKE</li>
</ul>

<hr />
<p><a href="https://github.com/junkpiano/til/issues/45">discussion</a></p>]]></content><author><name></name></author><category term="kubernetes" /><summary type="html"><![CDATA[(sudo kubectl assumed / no port-forward / persistent GUI)]]></summary></entry><entry><title type="html">Fixing “Timestamp was ahead of the server’s time” on WSL2</title><link href="https://til.yusuke.cloud/windows/2025/09/13/3413490711.html" rel="alternate" type="text/html" title="Fixing “Timestamp was ahead of the server’s time” on WSL2" /><published>2025-09-13T13:33:57+00:00</published><updated>2025-09-13T13:33:57+00:00</updated><id>https://til.yusuke.cloud/windows/2025/09/13/3413490711</id><content type="html" xml:base="https://til.yusuke.cloud/windows/2025/09/13/3413490711.html"><![CDATA[<p>While working on an API integration, I kept hitting an annoying error:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Error: Timestamp for this request was 1000ms ahead of the server's time.
</code></pre></div></div>

<p>Even after enabling NTP sync inside my Ubuntu WSL2 environment with <code class="language-plaintext highlighter-rouge">chrony</code> or <code class="language-plaintext highlighter-rouge">timedatectl</code>, the error persisted. It turned out the real culprit was <strong>the Windows host clock</strong>.</p>

<hr />

<h2 id="why-does-this-happen">Why does this happen?</h2>

<ul>
  <li>Some APIs are very strict about request timestamps.</li>
  <li>If your local clock is even <strong>1 second ahead</strong>, requests can be rejected.</li>
  <li>In WSL2, the Linux subsystem doesn’t manage its own hardware clock. Instead, it <strong>inherits the system time from the Windows host</strong>.</li>
  <li>So even if Ubuntu inside WSL2 says <code class="language-plaintext highlighter-rouge">System clock synchronized: yes</code>, if Windows itself is out of sync, your requests will fail.</li>
</ul>

<hr />

<h2 id="the-fix-sync-windows-not-just-wsl2">The Fix: Sync Windows, Not Just WSL2</h2>

<ol>
  <li>
    <p>Open <strong>PowerShell as Administrator</strong>.</p>
  </li>
  <li>
    <p>Restart and resync the Windows Time service:</p>

    <div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">Start-Service</span><span class="w"> </span><span class="nx">W32Time</span><span class="w">
</span><span class="n">w32tm</span><span class="w"> </span><span class="nx">/config</span><span class="w"> </span><span class="nx">/update</span><span class="w">
</span><span class="n">w32tm</span><span class="w"> </span><span class="nx">/resync</span><span class="w"> </span><span class="nx">/force</span><span class="w">
</span></code></pre></div>    </div>
  </li>
  <li>
    <p>Verify status:</p>

    <div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">w32tm</span><span class="w"> </span><span class="nx">/query</span><span class="w"> </span><span class="nx">/status</span><span class="w">
</span></code></pre></div>    </div>

    <p>You should see something like:</p>

    <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Stratum: 2
Precision: -23 (119.209ns per tick)
Last Successful Sync Time: ...
</code></pre></div>    </div>
  </li>
  <li>
    <p>(Optional) Set reliable NTP servers:</p>

    <div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">w32tm</span><span class="w"> </span><span class="nx">/config</span><span class="w"> </span><span class="nx">/manualpeerlist:</span><span class="s2">"time.windows.com,0x9 time.google.com,0x9"</span><span class="w"> </span><span class="nx">/syncfromflags:manual</span><span class="w"> </span><span class="nx">/update</span><span class="w">
</span><span class="n">w32tm</span><span class="w"> </span><span class="nx">/resync</span><span class="w"> </span><span class="nx">/force</span><span class="w">
</span></code></pre></div>    </div>
  </li>
  <li>
    <p>Restart WSL2 if needed:</p>

    <div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">wsl.exe</span><span class="w"> </span><span class="nt">--shutdown</span><span class="w">
</span></code></pre></div>    </div>
  </li>
</ol>

<hr />

<h2 id="lessons-learned">Lessons Learned</h2>

<ul>
  <li><strong>In WSL2, your Linux clock is only as good as your Windows clock.</strong></li>
  <li>Don’t waste hours debugging <code class="language-plaintext highlighter-rouge">timedatectl</code> or <code class="language-plaintext highlighter-rouge">chrony</code> if you’re still seeing errors.</li>
  <li>Sync your Windows host with NTP → restart WSL2 → problem solved.</li>
</ul>

<hr />

<h2 id="conclusion">Conclusion</h2>

<p>If you’re building anything time-sensitive on WSL2 and run into the dreaded <strong>“Timestamp ahead”</strong> error:
👉 <strong>Fix your Windows time sync, not just Ubuntu.</strong></p>

<p>It saved me from endless frustration, and now my scripts run flawlessly.</p>

<hr />
<p><a href="https://github.com/junkpiano/til/issues/44">discussion</a></p>]]></content><author><name></name></author><category term="windows" /><summary type="html"><![CDATA[While working on an API integration, I kept hitting an annoying error:]]></summary></entry><entry><title type="html">Powershell Cheatsheet</title><link href="https://til.yusuke.cloud/windows/2024/10/13/2583811583.html" rel="alternate" type="text/html" title="Powershell Cheatsheet" /><published>2024-10-13T09:18:30+00:00</published><updated>2024-10-13T09:18:30+00:00</updated><id>https://til.yusuke.cloud/windows/2024/10/13/2583811583</id><content type="html" xml:base="https://til.yusuke.cloud/windows/2024/10/13/2583811583.html"><![CDATA[<h2 id="list-a-directory">List a directory</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dir ./my-project # ls -la
</code></pre></div></div>

<h2 id="remove-directory">Remove Directory</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Remove-Item -Recurse ./my-project
</code></pre></div></div>

<hr />
<p><a href="https://github.com/junkpiano/til/issues/42">discussion</a></p>]]></content><author><name></name></author><category term="windows" /><summary type="html"><![CDATA[List a directory dir ./my-project # ls -la Remove Directory Remove-Item -Recurse ./my-project]]></summary></entry><entry><title type="html">How to fix markdown-preview plugin</title><link href="https://til.yusuke.cloud/nvim/2024/10/09/2574578200.html" rel="alternate" type="text/html" title="How to fix markdown-preview plugin" /><published>2024-10-09T02:29:46+00:00</published><updated>2024-10-09T02:29:46+00:00</updated><id>https://til.yusuke.cloud/nvim/2024/10/09/2574578200</id><content type="html" xml:base="https://til.yusuke.cloud/nvim/2024/10/09/2574578200.html"><![CDATA[<p>The issue is that nothing happens except printing nodejs version when running <code class="language-plaintext highlighter-rouge">MarkdownPreview</code> command.
The reason is. automatic install doesn’t work. This is how I fixed.</p>

<p>You need to add this to <code class="language-plaintext highlighter-rouge">plugins/markdown.lua</code>, or create it if you don’t have it.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>return {
  {
    "iamcco/markdown-preview.nvim",
    cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
    build = "cd app &amp;&amp; npm install", // if you prefer `yarn`, replace `npm` with `yarn`
    init = function()
      vim.g.mkdp_filetypes = { "markdown" }
    end,
    ft = { "markdown" },
  },
}
</code></pre></div></div>

<p>and then run these commands to install manually,</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cd ~/.local/share/nvim/lazy/markdown-preview.nvim/app
./install.sh
</code></pre></div></div>

<p>You will be able to see markdown preview on the browser.</p>

<hr />
<p><a href="https://github.com/junkpiano/til/issues/41">discussion</a></p>]]></content><author><name></name></author><category term="nvim" /><summary type="html"><![CDATA[The issue is that nothing happens except printing nodejs version when running MarkdownPreview command. The reason is. automatic install doesn’t work. This is how I fixed. You need to add this to plugins/markdown.lua, or create it if you don’t have it. return { { "iamcco/markdown-preview.nvim", cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, build = "cd app &amp;&amp; npm install", // if you prefer `yarn`, replace `npm` with `yarn` init = function() vim.g.mkdp_filetypes = { "markdown" } end, ft = { "markdown" }, }, } and then run these commands to install manually, cd ~/.local/share/nvim/lazy/markdown-preview.nvim/app ./install.sh You will be able to see markdown preview on the browser.]]></summary></entry><entry><title type="html">Horizontal Scroll using Mouse</title><link href="https://til.yusuke.cloud/hardware/2024/09/09/2513204781.html" rel="alternate" type="text/html" title="Horizontal Scroll using Mouse" /><published>2024-09-09T07:59:10+00:00</published><updated>2024-09-09T07:59:10+00:00</updated><id>https://til.yusuke.cloud/hardware/2024/09/09/2513204781</id><content type="html" xml:base="https://til.yusuke.cloud/hardware/2024/09/09/2513204781.html"><![CDATA[<p><del>Buy an advanced mouse.</del></p>

<p><strong>Shift + Mouse Wheel!</strong></p>

<h2 id="other-tips">Other Tips</h2>

<h3 id="fast-scroll">Fast Scroll</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Option(Alt) + Wheel
</code></pre></div></div>

<h3 id="browser-backforward">Browser Back/Forward</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Cmd + Arrow Left/Arrow Right
</code></pre></div></div>

<hr />
<p><a href="https://github.com/junkpiano/til/issues/37">discussion</a></p>]]></content><author><name></name></author><category term="hardware" /><summary type="html"><![CDATA[Buy an advanced mouse. Shift + Mouse Wheel! Other Tips Fast Scroll Option(Alt) + Wheel Browser Back/Forward Cmd + Arrow Left/Arrow Right]]></summary></entry></feed>