<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://alshedivat.github.io/feed.xml" rel="self" type="application/atom+xml"/><link href="https://alshedivat.github.io/" rel="alternate" type="text/html" hreflang="en"/><updated>2026-11-26T16:24:16+00:00</updated><id>https://alshedivat.github.io/feed.xml</id><title type="html">blank</title><subtitle>A simple, whitespace theme for academics. Based on [*folio](https://github.com/bogoli/-folio) design. </subtitle><entry><title type="html">Debugging Nextcloud LDAP with occ</title><link href="https://alshedivat.github.io/blog/2026/nextcloud-ldap-debug/" rel="alternate" type="text/html" title="Debugging Nextcloud LDAP with occ"/><published>2026-10-09T00:01:00+00:00</published><updated>2026-10-09T00:01:00+00:00</updated><id>https://alshedivat.github.io/blog/2026/nextcloud-ldap-debug</id><content type="html" xml:base="https://alshedivat.github.io/blog/2026/nextcloud-ldap-debug/"><![CDATA[<p>When Nextcloud’s LDAP backend stops working, for example after the LDAP server moves to a new host or port, the admin UI is a slow place to debug it. The <code class="language-plaintext highlighter-rouge">occ</code> command-line tool lets you dump the LDAP configuration, change single keys, and test the connection in seconds. These are my notes for doing that in Docker and in Kubernetes, including a memory-limit pitfall I hit in the Kubernetes case.</p> <h2 id="the-three-commands">The three commands</h2> <p>LDAP debugging with <code class="language-plaintext highlighter-rouge">occ</code> comes down to three subcommands:</p> <ul> <li><code class="language-plaintext highlighter-rouge">ldap:show-config [configID]</code> prints all LDAP configurations, or only the given one.</li> <li><code class="language-plaintext highlighter-rouge">ldap:set-config &lt;configID&gt; &lt;key&gt; &lt;value&gt;</code> changes a single setting, such as <code class="language-plaintext highlighter-rouge">ldapHost</code> or <code class="language-plaintext highlighter-rouge">ldapPort</code>.</li> <li><code class="language-plaintext highlighter-rouge">ldap:test-config &lt;configID&gt;</code> validates the configuration and tries to connect to the LDAP server.</li> </ul> <p>The first LDAP configuration gets the ID <code class="language-plaintext highlighter-rouge">s01</code>; <code class="language-plaintext highlighter-rouge">ldap:show-config</code> lists the IDs of any others. <code class="language-plaintext highlighter-rouge">occ</code> must run as the web server user, which is <code class="language-plaintext highlighter-rouge">www-data</code> in the official Nextcloud image.</p> <h2 id="docker">Docker</h2> <p><code class="language-plaintext highlighter-rouge">docker exec --user www-data</code> runs <code class="language-plaintext highlighter-rouge">occ</code> as the right user and keeps the container’s environment. Replace <code class="language-plaintext highlighter-rouge">nextcloud-app</code> with your container name:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker <span class="nb">exec</span> <span class="nt">--user</span> www-data <span class="nt">-it</span> nextcloud-app php occ ldap:show-config
docker <span class="nb">exec</span> <span class="nt">--user</span> www-data <span class="nt">-it</span> nextcloud-app php occ ldap:set-config <span class="s2">"s01"</span> <span class="s2">"ldapPort"</span> <span class="s2">"389"</span>
docker <span class="nb">exec</span> <span class="nt">--user</span> www-data <span class="nt">-it</span> nextcloud-app php occ ldap:test-config s01
</code></pre></div></div> <p>The usual loop is to change <code class="language-plaintext highlighter-rouge">ldapHost</code> or <code class="language-plaintext highlighter-rouge">ldapPort</code>, run <code class="language-plaintext highlighter-rouge">ldap:test-config</code>, and repeat until it reports “The configuration is valid and the connection could be established!”. The screenshot below starts with the tail of the <code class="language-plaintext highlighter-rouge">ldap:show-config</code> output (user filter, object classes, UUID attributes). After that come two rounds of the loop: first <code class="language-plaintext highlighter-rouge">s01</code> points at an LDAP server by hostname (<code class="language-plaintext highlighter-rouge">ldap-backend</code> on port 389), then at a server on another host listening on port 30389. Both pass the test.</p> <figure> <picture> <source class="responsive-img-srcset" srcset="/assets/img/posts/nextcloud-ldap-debug/occ-ldap-show-test-config-480.webp 480w,/assets/img/posts/nextcloud-ldap-debug/occ-ldap-show-test-config-800.webp 800w,/assets/img/posts/nextcloud-ldap-debug/occ-ldap-show-test-config-1400.webp 1400w," sizes="95vw" type="image/webp"/> <img src="/assets/img/posts/nextcloud-ldap-debug/occ-ldap-show-test-config.png" class="img-fluid rounded z-depth-1" width="100%" height="auto" data-zoomable="" loading="eager" onerror="this.onerror=null; $('.responsive-img-srcset').remove();"/> </picture> </figure> <div class="caption">Tail of <code>ldap:show-config</code>, then changing <code>ldapHost</code>/<code>ldapPort</code> and checking each change with <code>ldap:test-config s01</code>.</div> <h2 id="kubernetes">Kubernetes</h2> <p><code class="language-plaintext highlighter-rouge">kubectl exec</code> has no <code class="language-plaintext highlighter-rouge">--user</code> flag, so you enter the pod as the container’s user (root in the official image) and must switch to <code class="language-plaintext highlighter-rouge">www-data</code> yourself. Running <code class="language-plaintext highlighter-rouge">occ</code> as root fails: it refuses and suggests <code class="language-plaintext highlighter-rouge">sudo -u #33</code> (UID 33 is <code class="language-plaintext highlighter-rouge">www-data</code>). If your pod already runs as UID 33, you can call <code class="language-plaintext highlighter-rouge">php occ</code> directly.</p> <h3 id="switch-users-with-su">Switch users with su</h3> <p>The simplest way is <code class="language-plaintext highlighter-rouge">su</code>, which is already in the image. <code class="language-plaintext highlighter-rouge">www-data</code> has <code class="language-plaintext highlighter-rouge">/usr/sbin/nologin</code> as its login shell, so pass a shell with <code class="language-plaintext highlighter-rouge">-s</code>:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>kubectl <span class="nb">exec</span> <span class="nt">-it</span> &lt;nextcloud-pod&gt; <span class="nt">--</span> su <span class="nt">-s</span> /bin/bash www-data
<span class="c"># then, inside that shell:</span>
php occ ldap:show-config
php occ ldap:test-config s01
</code></pre></div></div> <p>Or run a single command, the way the Nextcloud Helm chart documents it (<code class="language-plaintext highlighter-rouge">/bin/sh</code> also works on Alpine-based images, which have no bash):</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>kubectl <span class="nb">exec</span> &lt;nextcloud-pod&gt; <span class="nt">--</span> su <span class="nt">-s</span> /bin/sh www-data <span class="nt">-c</span> <span class="s2">"php occ ldap:test-config s01"</span>
</code></pre></div></div> <p>Plain <code class="language-plaintext highlighter-rouge">su</code> (without <code class="language-plaintext highlighter-rouge">-</code> or <code class="language-plaintext highlighter-rouge">-l</code>) keeps the current environment. That matters, for the reason below.</p> <h3 id="pitfall-sudo-drops-php_memory_limit">Pitfall: sudo drops PHP_MEMORY_LIMIT</h3> <p>My first attempt used <code class="language-plaintext highlighter-rouge">sudo</code> instead, which meant installing it first because the image doesn’t include it. <code class="language-plaintext highlighter-rouge">occ</code> then failed with an error that has nothing to do with users:</p> <figure> <picture> <source class="responsive-img-srcset" srcset="/assets/img/posts/nextcloud-ldap-debug/occ-k8s-php-memory-limit-480.webp 480w,/assets/img/posts/nextcloud-ldap-debug/occ-k8s-php-memory-limit-800.webp 800w,/assets/img/posts/nextcloud-ldap-debug/occ-k8s-php-memory-limit-1400.webp 1400w," sizes="95vw" type="image/webp"/> <img src="/assets/img/posts/nextcloud-ldap-debug/occ-k8s-php-memory-limit.png" class="img-fluid rounded z-depth-1" width="100%" height="auto" data-zoomable="" loading="eager" onerror="this.onerror=null; $('.responsive-img-srcset').remove();"/> </picture> </figure> <div class="caption">Inside the pod: <code>occ</code> refuses to run as root, dies at a 2 MB memory limit under <code>sudo -u www-data</code>, and works after <code>export PHP_MEMORY_LIMIT=512M</code>.</div> <p>The cause is in the image itself. Its Dockerfile sets <code class="language-plaintext highlighter-rouge">ENV PHP_MEMORY_LIMIT 512M</code> and writes <code class="language-plaintext highlighter-rouge">memory_limit=${PHP_MEMORY_LIMIT}</code> into PHP’s <code class="language-plaintext highlighter-rouge">conf.d/nextcloud.ini</code>, so PHP reads its memory limit from an environment variable. <code class="language-plaintext highlighter-rouge">sudo</code> resets the environment by default, so the variable disappears and <code class="language-plaintext highlighter-rouge">memory_limit</code> comes out empty. PHP then falls back to its 2 MB minimum, which is the 2097152 bytes in the error.</p> <p>If you use <code class="language-plaintext highlighter-rouge">sudo</code> anyway (install it as root with <code class="language-plaintext highlighter-rouge">apt-get update &amp;&amp; apt-get install -y sudo</code>), set the variable again:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo</span> <span class="nt">-u</span> www-data bash
<span class="nb">export </span><span class="nv">PHP_MEMORY_LIMIT</span><span class="o">=</span>512M
php occ ...
</code></pre></div></div> <p>Or preserve the environment with <code class="language-plaintext highlighter-rouge">-E</code>, as the Nextcloud admin manual does:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo</span> <span class="nt">-E</span> <span class="nt">-u</span> www-data php occ ldap:test-config s01
</code></pre></div></div> <p>Still, <code class="language-plaintext highlighter-rouge">su</code> is the better choice. It needs no extra package, and anything installed into a running pod is lost on the next restart anyway.</p>]]></content><author><name></name></author><category term="IT"/><category term="nextcloud"/><category term="ldap"/><category term="docker"/><category term="kubernetes"/><category term="IT"/><summary type="html"><![CDATA[Inspect, change, and test Nextcloud's LDAP configuration from the command line in Docker and Kubernetes.]]></summary></entry><entry><title type="html">Complete Guide to Intel i3-12100 iGPU SR-IOV on Proxmox VE 9</title><link href="https://alshedivat.github.io/blog/2026/pve9-intel-igpu-sr-iov/" rel="alternate" type="text/html" title="Complete Guide to Intel i3-12100 iGPU SR-IOV on Proxmox VE 9"/><published>2026-03-21T00:01:00+00:00</published><updated>2026-03-21T00:01:00+00:00</updated><id>https://alshedivat.github.io/blog/2026/pve9-intel-igpu-sr-iov</id><content type="html" xml:base="https://alshedivat.github.io/blog/2026/pve9-intel-igpu-sr-iov/"><![CDATA[<p>This guide walks through enabling SR-IOV on an Alder Lake iGPU under Proxmox VE 9, so that a single integrated GPU can be shared by several VMs.</p> <blockquote> <ul> <li><strong>Hardware</strong>: Intel i3-12100 (Alder Lake, UHD 730 Xe iGPU)</li> <li><strong>System</strong>: Proxmox VE 9.x, ZFS root with systemd-boot</li> <li><strong>Goal</strong>: Use SR-IOV to split the iGPU into up to 7 virtual functions (VFs) and assign them to multiple VMs</li> </ul> </blockquote> <hr/> <h2 id="disclaimer">Disclaimer</h2> <ul> <li>This setup relies on a community DKMS driver (<code class="language-plaintext highlighter-rouge">i915-sriov-dkms</code>) and is <strong>not supported by Proxmox or Intel</strong>.</li> <li><strong>Do not try this directly on a production host.</strong> Validate it in a test environment first.</li> <li>Take a full backup before you start, especially of your VM configurations and important data.</li> </ul> <hr/> <h2 id="check-the-hardware-and-environment">Check the Hardware and Environment</h2> <h3 id="identify-the-cpu-and-igpu">Identify the CPU and iGPU</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Show the CPU model</span>
lscpu | <span class="nb">grep</span> <span class="s2">"Model name"</span>
<span class="c"># Expected: 12th Gen Intel(R) Core(TM) i3-12100</span>

<span class="c"># Show the iGPU PCI device</span>
lspci | <span class="nb">grep </span>VGA
<span class="c"># Expected: 00:02.0 VGA compatible controller: Intel Corporation Alder Lake-S GT1 [UHD Graphics 730] (rev 0c)</span>

<span class="c"># Note the iGPU's PCI address (usually 00:02.0); you will need it later</span>
</code></pre></div></div> <blockquote> <p><strong>Why SR-IOV</strong>: The i3-12100 is a 12th-gen Alder Lake part with a UHD 730 (Xe) iGPU. It does <strong>not</strong> support GVT-g, which only covers 5th through 10th gen, so <strong>SR-IOV</strong> is the only option.</p> </blockquote> <h3 id="bios-settings">BIOS Settings</h3> <p>Enter the motherboard firmware setup and make sure the following options are set:</p> <table> <thead> <tr> <th>Setting</th> <th>Value</th> <th>Notes</th> </tr> </thead> <tbody> <tr> <td>Intel VT-d (IOMMU)</td> <td><strong>Enabled</strong></td> <td>The foundation for device passthrough</td> </tr> <tr> <td>SR-IOV</td> <td><strong>Enabled</strong></td> <td>Some boards have a separate toggle</td> </tr> <tr> <td>Internal Graphics</td> <td><strong>Enabled</strong></td> <td>Make sure the iGPU is not disabled</td> </tr> <tr> <td>Primary Display</td> <td><strong>CPU Graphics or Auto</strong></td> <td>Make sure the system can see the iGPU</td> </tr> <tr> <td>Secure Boot</td> <td><strong>Disabled</strong></td> <td>Out-of-tree DKMS modules won’t load with Secure Boot on (unless you sign them, see the upstream <a href="https://github.com/strongtz/i915-sriov-dkms/blob/master/docs/secure-boot.md">Secure Boot guide</a>)</td> </tr> <tr> <td>Above 4G Decoding</td> <td><strong>Enabled</strong></td> <td>Recommended</td> </tr> </tbody> </table> <blockquote> <p><strong>Note</strong>: Option names differ between vendors (ASUS, MSI, Gigabyte, and so on). Look under Advanced &gt; System Agent or the chipset configuration.</p> </blockquote> <h3 id="check-the-pve-version-and-kernel">Check the PVE Version and Kernel</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Show the PVE version</span>
pveversion <span class="nt">-v</span>

<span class="c"># Show the running kernel</span>
<span class="nb">uname</span> <span class="nt">-r</span>
<span class="c"># PVE 9.0 shipped kernel 6.14.x-pve; PVE 9.1 made 6.17.x-pve the default</span>
</code></pre></div></div> <p>The kernel version matters twice in this guide: the kernel headers you install must match the running kernel, and each <code class="language-plaintext highlighter-rouge">i915-sriov-dkms</code> release only supports a specific kernel range.</p> <h3 id="determine-the-bootloader-important">Determine the Bootloader (Important)</h3> <p>This guide assumes a ZFS root installed in UEFI mode with Secure Boot disabled. In that configuration PVE boots with <strong>systemd-boot</strong>, not GRUB. ZFS installs on legacy BIOS, or installed with Secure Boot enabled, use GRUB instead, so confirm which one you have:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Method 1: check the EFI directory</span>
<span class="nb">ls</span> /sys/firmware/efi
<span class="c"># If the directory exists, the system booted in UEFI mode</span>

<span class="c"># Method 2: check the active EFI boot entry (the most reliable check on a running system)</span>
efibootmgr <span class="nt">-v</span>
<span class="c"># systemd-boot: Boot0006* Linux Boot Manager    [...] File(\EFI\systemd\systemd-bootx64.efi)</span>
<span class="c"># GRUB:         Boot0005* proxmox       [...] File(\EFI\proxmox\grubx64.efi)  (shimx64.efi with Secure Boot)</span>

<span class="c"># Method 3: check the boot tool status</span>
proxmox-boot-tool status
<span class="c"># Output that mentions "systemd-boot" (or similar) means systemd-boot</span>

<span class="c"># Method 4: check whether the cmdline file exists</span>
<span class="nb">cat</span> /etc/kernel/cmdline
<span class="c"># ZFS + UEFI (systemd-boot) uses this file instead of /etc/default/grub</span>
<span class="c"># Typically: root=ZFS=rpool/ROOT/pve-1 boot=zfs</span>
</code></pre></div></div> <blockquote> <p><strong>With systemd-boot, the kernel command line lives in <code class="language-plaintext highlighter-rouge">/etc/kernel/cmdline</code>. Don’t edit <code class="language-plaintext highlighter-rouge">/etc/default/grub</code>.</strong> Apply changes with <code class="language-plaintext highlighter-rouge">proxmox-boot-tool refresh</code>, not <code class="language-plaintext highlighter-rouge">update-grub</code>. If your host turns out to boot with GRUB, put the parameters in <code class="language-plaintext highlighter-rouge">GRUB_CMDLINE_LINUX_DEFAULT</code> in <code class="language-plaintext highlighter-rouge">/etc/default/grub</code> and run <code class="language-plaintext highlighter-rouge">update-grub</code> instead.</p> </blockquote> <h3 id="check-whether-iommu-is-enabled">Check Whether IOMMU Is Enabled</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dmesg | <span class="nb">grep</span> <span class="nt">-i</span> <span class="nt">-e</span> DMAR <span class="nt">-e</span> IOMMU
<span class="c"># Messages like "DMAR: IOMMU enabled" mean the IOMMU is active</span>
<span class="c"># If not, check VT-d in the BIOS; the kernel parameters added below also cover it</span>
</code></pre></div></div> <blockquote> <p>On kernel 6.8 and newer, the Intel IOMMU is enabled by default, so it should already be on with PVE 9 kernels. <code class="language-plaintext highlighter-rouge">intel_iommu=on</code> is redundant there, but harmless, and the upstream driver docs list it anyway.</p> </blockquote> <hr/> <h2 id="configure-repositories-and-install-the-sr-iov-dkms-module">Configure Repositories and Install the SR-IOV DKMS Module</h2> <h3 id="configure-the-proxmox-repositories-important">Configure the Proxmox Repositories (Important)</h3> <p><code class="language-plaintext highlighter-rouge">proxmox-headers</code> and the other packages you need live in the <strong>Proxmox repositories</strong>, not in Debian’s. If no usable Proxmox repository is configured, installing the kernel headers and the DKMS module will fail.</p> <p><strong>Check the current sources</strong>:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">ls</span> /etc/apt/sources.list.d/
<span class="nb">cat</span> /etc/apt/sources.list.d/<span class="k">*</span>.list 2&gt;/dev/null
<span class="nb">cat</span> /etc/apt/sources.list.d/<span class="k">*</span>.sources 2&gt;/dev/null
</code></pre></div></div> <p>If nothing points at <code class="language-plaintext highlighter-rouge">download.proxmox.com</code>, add the repository yourself.</p> <p><strong>Add the free no-subscription repository</strong>. PVE 9 is based on Debian Trixie and uses the deb822 <code class="language-plaintext highlighter-rouge">.sources</code> format (apt on Trixie warns about the legacy one-line <code class="language-plaintext highlighter-rouge">.list</code> format):</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cat</span> <span class="o">&gt;</span> /etc/apt/sources.list.d/proxmox.sources <span class="o">&lt;&lt;</span><span class="sh">'</span><span class="no">EOF</span><span class="sh">'
Types: deb
URIs: http://download.proxmox.com/debian/pve
Suites: trixie
Components: pve-no-subscription
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
</span><span class="no">EOF
</span></code></pre></div></div> <p><strong>Disable the enterprise repositories (if you have no subscription)</strong>. On PVE 9 they are <code class="language-plaintext highlighter-rouge">.sources</code> files, and an entry is disabled by adding <code class="language-plaintext highlighter-rouge">Enabled: no</code> to it:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Check whether the enterprise sources exist</span>
<span class="nb">cat</span> /etc/apt/sources.list.d/pve-enterprise.sources 2&gt;/dev/null
<span class="nb">cat</span> /etc/apt/sources.list.d/ceph.sources 2&gt;/dev/null

<span class="c"># Disable pve-enterprise (single entry) to avoid 401 errors from apt update</span>
<span class="nb">grep</span> <span class="nt">-q</span> <span class="s1">'^Enabled:'</span> /etc/apt/sources.list.d/pve-enterprise.sources <span class="o">||</span> <span class="nb">echo</span> <span class="s1">'Enabled: no'</span> <span class="o">&gt;&gt;</span> /etc/apt/sources.list.d/pve-enterprise.sources
</code></pre></div></div> <p>If <code class="language-plaintext highlighter-rouge">ceph.sources</code> contains an entry pointing at <code class="language-plaintext highlighter-rouge">enterprise.proxmox.com</code>, add <code class="language-plaintext highlighter-rouge">Enabled: no</code> to that entry as well. You can also toggle both repositories in the web UI under the node’s <strong>Updates → Repositories</strong> panel.</p> <blockquote> <p><strong>Why this step?</strong></p> <p>A fresh PVE install enables the enterprise repository, which requires a paid subscription. Without one, <code class="language-plaintext highlighter-rouge">apt update</code> fails with <code class="language-plaintext highlighter-rouge">401 Unauthorized</code>. Packages such as <code class="language-plaintext highlighter-rouge">proxmox-headers</code> and <code class="language-plaintext highlighter-rouge">proxmox-kernel</code> only exist in the Proxmox repositories, not in Debian’s official ones. Without a Proxmox repository, installing the headers fails with <code class="language-plaintext highlighter-rouge">Unable to locate package</code>.</p> </blockquote> <p><strong>Verify the repository configuration</strong>:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>apt update
<span class="c"># The output should contain a line like this, with no errors:</span>
<span class="c"># Hit:X http://download.proxmox.com/debian/pve trixie InRelease</span>
</code></pre></div></div> <h3 id="update-the-system">Update the System</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>apt update <span class="o">&amp;&amp;</span> apt full-upgrade <span class="nt">-y</span>
reboot
</code></pre></div></div> <p>After the reboot, check the kernel version:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">uname</span> <span class="nt">-r</span>
<span class="c"># You should now be on the newest kernel installed by the upgrade (6.14.x-pve on PVE 9.0, 6.17.x-pve on PVE 9.1)</span>
</code></pre></div></div> <h3 id="install-the-dependencies">Install the Dependencies</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Build tools and kernel headers (the meta package tracks the default kernel series)</span>
apt <span class="nb">install </span>dkms build-essential proxmox-default-headers sysfsutils <span class="nt">-y</span>
</code></pre></div></div> <blockquote> <p><code class="language-plaintext highlighter-rouge">proxmox-default-headers</code> is a meta package that pulls in headers for the current default kernel series, and keeps doing so when that kernel is updated. DKMS can only build against headers that <strong>exactly match the running kernel</strong>, which is why you reboot into the new kernel first. To install the matching headers explicitly:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Exactly the running kernel (most reliable)</span>
apt <span class="nb">install </span>proxmox-headers-<span class="si">$(</span><span class="nb">uname</span> <span class="nt">-r</span><span class="si">)</span>
<span class="c"># Or by kernel series, e.g. proxmox-headers-6.14 on PVE 9.0, proxmox-headers-6.17 on PVE 9.1</span>
apt <span class="nb">install </span>proxmox-headers-6.17
</code></pre></div> </div> </blockquote> <p><strong>Verify that the headers are installed</strong>:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">ls</span> /usr/src/linux-headers-<span class="si">$(</span><span class="nb">uname</span> <span class="nt">-r</span><span class="si">)</span>
<span class="c"># The directory should exist and contain a Makefile and other files</span>
</code></pre></div></div> <blockquote> <p><strong>Common error</strong>: if <code class="language-plaintext highlighter-rouge">proxmox-headers</code> still can’t be found, check that:</p> <ol> <li>The Proxmox repository is configured (see “Configure the Proxmox Repositories” above)</li> <li><code class="language-plaintext highlighter-rouge">apt update</code> ran without errors</li> <li>You rebooted into the newest kernel (the version from <code class="language-plaintext highlighter-rouge">uname -r</code> matches the headers available in the repository)</li> </ol> </blockquote> <h3 id="download-and-install-the-dkms-module">Download and Install the DKMS Module</h3> <p>Get the latest <code class="language-plaintext highlighter-rouge">.deb</code> from the <a href="https://github.com/strongtz/i915-sriov-dkms/releases">i915-sriov-dkms releases</a> page. Each release supports a specific kernel range (listed under “Required kernel” in the project README) and older kernels are served by older releases, so pick the release that covers the kernel shown by <code class="language-plaintext highlighter-rouge">uname -r</code>.</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Create a working directory</span>
<span class="nb">mkdir</span> <span class="nt">-p</span> /opt/i915-sriov <span class="o">&amp;&amp;</span> <span class="nb">cd</span> /opt/i915-sriov

<span class="c"># Download a release (replace with the URL of the release that matches your kernel)</span>
<span class="c"># The URL below is only an example; get the current one from GitHub</span>
wget <span class="nt">-O</span> i915-sriov-dkms.deb <span class="s2">"https://github.com/strongtz/i915-sriov-dkms/releases/download/2025.11.10/i915-sriov-dkms_2025.11.10_amd64.deb"</span>

<span class="c"># Install the package</span>
dpkg <span class="nt">-i</span> i915-sriov-dkms.deb
</code></pre></div></div> <blockquote> <p><strong>If the installation fails</strong>, remove the old version first. Upstream’s uninstall command is <code class="language-plaintext highlighter-rouge">dpkg -P i915-sriov-dkms</code>; if leftovers remain, delete them manually:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">rm</span> <span class="nt">-rf</span> /var/lib/dkms/i915-sriov-dkms<span class="k">*</span>
<span class="nb">rm</span> <span class="nt">-rf</span> /usr/src/i915-sriov-dkms<span class="k">*</span>
<span class="c"># Then install again</span>
dpkg <span class="nt">-i</span> i915-sriov-dkms.deb
</code></pre></div> </div> </blockquote> <h3 id="verify-the-dkms-build">Verify the DKMS Build</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dkms status
<span class="c"># Expected output similar to:</span>
<span class="c"># i915-sriov-dkms/2025.11.10, 6.14.x-x-pve, x86_64: installed</span>
</code></pre></div></div> <p>If the status is not <code class="language-plaintext highlighter-rouge">installed</code>, check the build log:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cat</span> /var/lib/dkms/i915-sriov-dkms/<span class="k">*</span>/build/make.log
</code></pre></div></div> <hr/> <h2 id="set-the-kernel-parameters-zfs--systemd-boot">Set the Kernel Parameters (ZFS / systemd-boot)</h2> <h3 id="edit-the-kernel-command-line">Edit the Kernel Command Line</h3> <blockquote> <p><strong>On a ZFS root with systemd-boot, edit <code class="language-plaintext highlighter-rouge">/etc/kernel/cmdline</code>, not <code class="language-plaintext highlighter-rouge">/etc/default/grub</code>.</strong></p> </blockquote> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Back it up first</span>
<span class="nb">cp</span> /etc/kernel/cmdline /etc/kernel/cmdline.bak

<span class="c"># Show the current contents</span>
<span class="nb">cat</span> /etc/kernel/cmdline
<span class="c"># Typically: root=ZFS=rpool/ROOT/pve-1 boot=zfs</span>
</code></pre></div></div> <p>Edit the file:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nano /etc/kernel/cmdline
</code></pre></div></div> <p>Append the following parameters to the end of the <strong>same line</strong>. The whole file must be a single line with no blank lines:</p> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root=ZFS=rpool/ROOT/pve-1 boot=zfs intel_iommu=on iommu=pt i915.enable_guc=3 i915.max_vfs=7 module_blacklist=xe
</code></pre></div></div> <p><strong>Parameters</strong>:</p> <table> <thead> <tr> <th>Parameter</th> <th>Purpose</th> </tr> </thead> <tbody> <tr> <td><code class="language-plaintext highlighter-rouge">intel_iommu=on</code></td> <td>Enables the Intel IOMMU (VT-d)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">iommu=pt</code></td> <td>IOMMU passthrough mode; improves performance for devices not passed through</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">i915.enable_guc=3</code></td> <td>Enables GuC submission and HuC loading (required for SR-IOV)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">i915.max_vfs=7</code></td> <td>Sets the maximum number of virtual functions (up to 7)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">module_blacklist=xe</code></td> <td>Blocks the newer <code class="language-plaintext highlighter-rouge">xe</code> driver so that <code class="language-plaintext highlighter-rouge">i915</code> is used</td> </tr> </tbody> </table> <blockquote> <p><strong>Remember</strong>:</p> <ul> <li>Everything must be on <strong>one line</strong>, with no line breaks</li> <li>No blank lines; a single trailing newline at the end of the file is fine</li> <li>Keep your existing <code class="language-plaintext highlighter-rouge">root=ZFS=...</code> part exactly as it is</li> </ul> </blockquote> <h3 id="refresh-the-boot-configuration">Refresh the Boot Configuration</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Update the initramfs</span>
update-initramfs <span class="nt">-u</span> <span class="nt">-k</span> all

<span class="c"># Refresh the systemd-boot configuration (the key step on a ZFS root)</span>
proxmox-boot-tool refresh
</code></pre></div></div> <h3 id="create-the-vfs-at-boot-with-sysfsutils">Create the VFs at Boot with sysfsutils</h3> <p>First confirm the iGPU’s PCI address:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lspci | <span class="nb">grep </span>VGA
<span class="c"># Usually 00:02.0</span>
</code></pre></div></div> <p>Have <code class="language-plaintext highlighter-rouge">sysfsutils</code> create the virtual functions at boot. Debian’s <code class="language-plaintext highlighter-rouge">sysfsutils</code> reads <code class="language-plaintext highlighter-rouge">/etc/sysfs.conf</code> plus any <code class="language-plaintext highlighter-rouge">/etc/sysfs.d/*.conf</code>, so put the setting in its own file instead of overwriting <code class="language-plaintext highlighter-rouge">/etc/sysfs.conf</code>:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s2">"devices/pci0000:00/0000:00:02.0/sriov_numvfs = 7"</span> <span class="o">&gt;</span> /etc/sysfs.d/i915-sriov.conf
</code></pre></div></div> <blockquote> <ul> <li>If your iGPU is not at <code class="language-plaintext highlighter-rouge">00:02.0</code>, use the actual address.</li> <li>Leave the package’s default <code class="language-plaintext highlighter-rouge">/etc/sysfs.conf</code> in place: the <code class="language-plaintext highlighter-rouge">sysfsutils</code> systemd unit only runs if that file exists.</li> <li>If you’d rather keep everything in <code class="language-plaintext highlighter-rouge">/etc/sysfs.conf</code>, append the line idempotently instead of overwriting the file: <code class="language-plaintext highlighter-rouge">grep -qs 'sriov_numvfs' /etc/sysfs.conf || echo "devices/pci0000:00/0000:00:02.0/sriov_numvfs = 7" &gt;&gt; /etc/sysfs.conf</code></li> </ul> </blockquote> <h3 id="reboot">Reboot</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>reboot
</code></pre></div></div> <hr/> <h2 id="verify-that-sr-iov-works">Verify That SR-IOV Works</h2> <h3 id="check-the-kernel-parameters">Check the Kernel Parameters</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cat</span> /proc/cmdline
<span class="c"># Should contain intel_iommu=on i915.enable_guc=3 i915.max_vfs=7 module_blacklist=xe</span>
</code></pre></div></div> <h3 id="check-that-i915-loaded">Check That i915 Loaded</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dmesg | <span class="nb">grep </span>i915
<span class="c"># Look for lines like these (illustrative; exact wording varies by kernel and driver version):</span>
<span class="c"># i915 0000:00:02.0: Running on Alder Lake-S</span>
<span class="c"># i915 0000:00:02.0: [drm] GT0: GUC: submission enabled</span>
<span class="c"># i915 0000:00:02.0: [drm] GT0: HuC: authenticated</span>
</code></pre></div></div> <p><strong>What to look for</strong>:</p> <ul> <li><code class="language-plaintext highlighter-rouge">GUC: submission enabled</code>: GuC submission is active</li> <li><code class="language-plaintext highlighter-rouge">HuC: authenticated</code>: HuC is authenticated</li> <li>No errors such as <code class="language-plaintext highlighter-rouge">Incompatible option enable_guc</code></li> </ul> <h3 id="check-the-virtual-functions">Check the Virtual Functions</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lspci | <span class="nb">grep </span>VGA
<span class="c"># Expected: 1 PF + 7 VFs (illustrative; device names may differ slightly)</span>
<span class="c"># 00:02.0 VGA compatible controller: Intel Corporation Alder Lake-S GT1 [UHD Graphics 730]</span>
<span class="c"># 00:02.1 VGA compatible controller: Intel Corporation Alder Lake-S GT1 [UHD Graphics 730]</span>
<span class="c"># 00:02.2 VGA compatible controller: Intel Corporation Alder Lake-S GT1 [UHD Graphics 730]</span>
<span class="c"># 00:02.3 VGA compatible controller: Intel Corporation Alder Lake-S GT1 [UHD Graphics 730]</span>
<span class="c"># 00:02.4 VGA compatible controller: Intel Corporation Alder Lake-S GT1 [UHD Graphics 730]</span>
<span class="c"># 00:02.5 VGA compatible controller: Intel Corporation Alder Lake-S GT1 [UHD Graphics 730]</span>
<span class="c"># 00:02.6 VGA compatible controller: Intel Corporation Alder Lake-S GT1 [UHD Graphics 730]</span>
<span class="c"># 00:02.7 VGA compatible controller: Intel Corporation Alder Lake-S GT1 [UHD Graphics 730]</span>
</code></pre></div></div> <blockquote> <p><code class="language-plaintext highlighter-rouge">00:02.0</code> is the physical function (PF); <code class="language-plaintext highlighter-rouge">00:02.1</code> through <code class="language-plaintext highlighter-rouge">00:02.7</code> are the virtual functions (VFs).</p> </blockquote> <h3 id="check-sriov_numvfs">Check sriov_numvfs</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cat</span> /sys/devices/pci0000:00/0000:00:02.0/sriov_numvfs
<span class="c"># Expected: 7</span>
</code></pre></div></div> <h3 id="check-the-driver-in-use">Check the Driver in Use</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lspci <span class="nt">-nnk</span> | <span class="nb">grep</span> <span class="nt">-A3</span> <span class="s2">"VGA"</span>
<span class="c"># Both the PF and the VFs should use the i915 driver</span>
<span class="c"># Kernel driver in use: i915</span>
</code></pre></div></div> <hr/> <h2 id="assign-a-vf-to-a-vm">Assign a VF to a VM</h2> <h3 id="windows-vms">Windows VMs</h3> <h4 id="in-the-web-ui">In the Web UI</h4> <ol> <li>Select the VM → <strong>Hardware</strong> → <strong>Add</strong> → <strong>PCI Device</strong></li> <li>Pick a VF (for example <code class="language-plaintext highlighter-rouge">0000:00:02.1</code>). <strong>Never pick 00:02.0, the PF</strong>: passing the PF to a VM crashes all the other VFs.</li> <li>Set the options: <ul> <li><strong>All Functions</strong>: unchecked</li> <li><strong>Primary GPU</strong>: check it if this should be the VM’s primary display adapter</li> <li><strong>ROM-Bar</strong>: <strong>turning it off is recommended</strong> (a known issue with PVE 9 on kernel 6.14)</li> <li><strong>PCI-Express</strong>: checked (requires the q35 machine type)</li> </ul> </li> </ol> <h4 id="on-the-command-line">On the Command Line</h4> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Edit the VM config (replace &lt;VMID&gt; with the actual ID)</span>
nano /etc/pve/qemu-server/&lt;VMID&gt;.conf
</code></pre></div></div> <p>Add this line (<code class="language-plaintext highlighter-rouge">rombar=0</code> is the CLI equivalent of unchecking ROM-Bar):</p> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>hostpci0: 0000:00:02.1,pcie=1,rombar=0
</code></pre></div></div> <blockquote> <p>To use it as the primary GPU:</p> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>hostpci0: 0000:00:02.1,pcie=1,rombar=0,x-vga=1
</code></pre></div> </div> </blockquote> <h4 id="other-recommended-vm-settings">Other Recommended VM Settings</h4> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>machine: q35
bios: ovmf
cpu: host
</code></pre></div></div> <h4 id="install-the-driver-inside-windows">Install the Driver Inside Windows</h4> <ol> <li>Boot the VM and install the Intel graphics driver.</li> <li>Recommended driver versions: <strong>32.0.101.6460</strong> or <strong>32.0.101.6259</strong> (tested and known to work).</li> <li>Download it from the <a href="https://www.intel.com/content/www/us/en/download-center/home.html">Intel Download Center</a>.</li> </ol> <h3 id="linux-vms">Linux VMs</h3> <p>Linux guests need the <code class="language-plaintext highlighter-rouge">i915-sriov-dkms</code> module as well:</p> <ol> <li>Assign a VF to the VM as a PCIe device (same as above).</li> <li>Inside the VM, install the build tools and headers (<code class="language-plaintext highlighter-rouge">apt install build-essential dkms linux-headers-$(uname -r)</code> on Debian/Ubuntu), then install <code class="language-plaintext highlighter-rouge">i915-sriov-dkms</code>. Using the same version as the host is the simplest choice, although upstream notes that host and guest don’t strictly have to match.</li> <li>Add <code class="language-plaintext highlighter-rouge">i915.enable_guc=3 module_blacklist=xe</code> to the guest’s kernel command line (for GRUB guests: <code class="language-plaintext highlighter-rouge">GRUB_CMDLINE_LINUX_DEFAULT</code> in <code class="language-plaintext highlighter-rouge">/etc/default/grub</code>, then <code class="language-plaintext highlighter-rouge">update-grub</code> and <code class="language-plaintext highlighter-rouge">update-initramfs -u</code>), and reboot the VM.</li> <li>Install <code class="language-plaintext highlighter-rouge">vainfo</code> to verify hardware acceleration:</li> </ol> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Run inside the VM</span>
apt <span class="nb">install </span>vainfo
vainfo
<span class="c"># Should list the codecs supported through VA-API</span>
</code></pre></div></div> <h3 id="lxc-containers">LXC Containers</h3> <p>If you only need hardware acceleration inside LXC (for example Jellyfin transcoding), you can map the device directly. SR-IOV isn’t required for this:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Edit the container config</span>
nano /etc/pve/lxc/&lt;CTID&gt;.conf

<span class="c"># Add these lines</span>
lxc.cgroup2.devices.allow: c 226:<span class="k">*</span> rwm
lxc.mount.entry: /dev/dri dev/dri none <span class="nb">bind</span>,optional,create<span class="o">=</span><span class="nb">dir</span>
</code></pre></div></div> <hr/> <h2 id="troubleshooting">Troubleshooting</h2> <h3 id="the-host-wont-boot--black-screen">The Host Won’t Boot / Black Screen</h3> <p><strong>Symptom</strong>: the system no longer boots after changing the kernel parameters.</p> <p><strong>Fix</strong>: temporarily disable the drivers from the boot menu:</p> <ol> <li>Press <code class="language-plaintext highlighter-rouge">e</code> in the systemd-boot menu to edit the boot entry.</li> <li>Append <code class="language-plaintext highlighter-rouge">module_blacklist=i915,xe</code> (preceded by a space) to the end of the kernel command line.</li> <li>Press Enter to boot.</li> <li>Once the system is up, fix <code class="language-plaintext highlighter-rouge">/etc/kernel/cmdline</code> and run <code class="language-plaintext highlighter-rouge">proxmox-boot-tool refresh</code>.</li> </ol> <p><strong>If you can’t reach the boot menu at all</strong>, rescue the system from the PVE installer ISO. Boot the ISO <strong>in UEFI mode</strong> (<code class="language-plaintext highlighter-rouge">proxmox-boot-tool</code> checks <code class="language-plaintext highlighter-rouge">/sys/firmware/efi</code> to decide between systemd-boot and GRUB), choose the debug-mode install under Advanced Options, and work at the second shell prompt, which has the full toolset including ZFS:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Import the pool under /mnt without mounting anything, then mount only the root dataset</span>
zpool import <span class="nt">-f</span> <span class="nt">-N</span> <span class="nt">-R</span> /mnt rpool
zfs mount rpool/ROOT/pve-1

<span class="c"># Bind-mount the pseudo filesystems needed inside the chroot</span>
mount <span class="nt">--make-private</span> <span class="nt">--rbind</span> /dev  /mnt/dev
mount <span class="nt">--make-private</span> <span class="nt">--rbind</span> /proc /mnt/proc
mount <span class="nt">--make-private</span> <span class="nt">--rbind</span> /sys  /mnt/sys

<span class="nb">chroot</span> /mnt /bin/bash

<span class="c"># Restore the backup, or remove the offending parameters by hand</span>
<span class="nb">cp</span> /etc/kernel/cmdline.bak /etc/kernel/cmdline   <span class="c"># or: nano /etc/kernel/cmdline</span>
proxmox-boot-tool refresh
<span class="nb">exit</span>

<span class="c"># Unmount everything and export the pool before rebooting</span>
umount <span class="nt">-R</span> /mnt/dev /mnt/proc /mnt/sys
zpool <span class="nb">export </span>rpool
reboot
</code></pre></div></div> <blockquote> <ul> <li><code class="language-plaintext highlighter-rouge">-N</code> keeps <code class="language-plaintext highlighter-rouge">zpool import</code> from auto-mounting datasets, and <code class="language-plaintext highlighter-rouge">-R /mnt</code> sets a temporary altroot, so nothing gets mounted over the rescue system’s own <code class="language-plaintext highlighter-rouge">/</code>.</li> <li><code class="language-plaintext highlighter-rouge">proxmox-boot-tool refresh</code> mounts the ESPs itself and does not need a separate <code class="language-plaintext highlighter-rouge">efivarfs</code> mount (only <code class="language-plaintext highlighter-rouge">proxmox-boot-tool init</code> installs the bootloader). The recursive <code class="language-plaintext highlighter-rouge">/sys</code> bind carries <code class="language-plaintext highlighter-rouge">efivars</code> along anyway if the rescue system has it mounted.</li> <li>Don’t skip <code class="language-plaintext highlighter-rouge">zpool export rpool</code>. The pool was last imported by the rescue system, so if it isn’t exported, the next boot can refuse to import it and drop you into the initramfs shell, where you would have to run <code class="language-plaintext highlighter-rouge">zpool import -f rpool</code> by hand.</li> </ul> </blockquote> <h3 id="dkms-build-fails">DKMS Build Fails</h3> <p><strong>Symptom</strong>: <code class="language-plaintext highlighter-rouge">dkms status</code> shows <code class="language-plaintext highlighter-rouge">build error</code>.</p> <p><strong>Steps</strong>:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Read the full build log</span>
<span class="nb">cat</span> /var/lib/dkms/i915-sriov-dkms/<span class="k">*</span>/build/make.log

<span class="c"># Common cause 1: headers don't match the running kernel</span>
apt <span class="nb">install </span>proxmox-headers-<span class="si">$(</span><span class="nb">uname</span> <span class="nt">-r</span><span class="si">)</span>
<span class="c"># Note: reboot into the newest kernel before installing headers</span>

<span class="c"># Common cause 2: leftovers from an old version</span>
dpkg <span class="nt">-P</span> i915-sriov-dkms
<span class="nb">rm</span> <span class="nt">-rf</span> /var/lib/dkms/i915-sriov-dkms<span class="k">*</span>
<span class="nb">rm</span> <span class="nt">-rf</span> /usr/src/i915-sriov-dkms<span class="k">*</span>
<span class="c"># Then reinstall the deb package</span>

<span class="c"># Common cause 3: the kernel version isn't supported by this DKMS release</span>
<span class="c"># Check the supported kernel range in the README / release notes on GitHub</span>
</code></pre></div></div> <h3 id="no-vfs-lspci-only-shows-00020">No VFs (lspci Only Shows 00:02.0)</h3> <p><strong>Steps</strong>:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Check whether sriov_numvfs was set</span>
<span class="nb">cat</span> /sys/devices/pci0000:00/0000:00:02.0/sriov_numvfs

<span class="c"># If it's 0, try setting it manually</span>
<span class="nb">echo </span>7 <span class="o">&gt;</span> /sys/devices/pci0000:00/0000:00:02.0/sriov_numvfs

<span class="c"># Look for errors in dmesg</span>
dmesg | <span class="nb">grep</span> <span class="nt">-i</span> <span class="nt">-e</span> sriov <span class="nt">-e</span> i915 <span class="nt">-e</span> error

<span class="c"># Make sure the sysfsutils service ran</span>
systemctl status sysfsutils

<span class="c"># Make sure the sysfs config is correct</span>
<span class="nb">cat</span> /etc/sysfs.d/i915-sriov.conf
<span class="c"># Should print: devices/pci0000:00/0000:00:02.0/sriov_numvfs = 7</span>
</code></pre></div></div> <h3 id="guc-submission-not-enabled">GuC Submission Not Enabled</h3> <p><strong>Symptom</strong>: <code class="language-plaintext highlighter-rouge">dmesg | grep i915</code> shows <code class="language-plaintext highlighter-rouge">Incompatible option enable_guc</code>.</p> <p><strong>Cause</strong>: this usually happens on older iGPUs without GuC support. The i3-12100’s UHD 730 should support it.</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Make sure the xe driver is blocked</span>
lsmod | <span class="nb">grep</span> <span class="nt">-w</span> xe
<span class="c"># Should print nothing</span>

<span class="c"># Make sure the i915 module is loaded</span>
lsmod | <span class="nb">grep </span>i915
<span class="c"># Should print something</span>
</code></pre></div></div> <h3 id="the-vm-hangs-or-times-out-on-start">The VM Hangs or Times Out on Start</h3> <p><strong>Symptom</strong>: after assigning a VF, the VM won’t start and the console times out.</p> <p><strong>Steps</strong>:</p> <ol> <li> <p><strong>Turn off ROM-Bar</strong>: a known issue with PVE 9 on kernel 6.14.</p> <ul> <li>Web UI → VM → Hardware → PCI Device → Edit → <strong>uncheck ROM-Bar</strong></li> </ul> </li> <li> <p><strong>Use a newer machine version</strong>:</p> <ul> <li>VM → <strong>Hardware</strong> → <strong>Machine</strong> → Edit, then pick <strong>9.1</strong> or newer (or Latest) in the <strong>Version</strong> drop-down (shown under Advanced). Windows VMs are pinned to the machine version they were created with, so an older VM may still be on an old one.</li> </ul> </li> <li> <p><strong>Check the VM config</strong>:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cat</span> /etc/pve/qemu-server/&lt;VMID&gt;.conf
<span class="c"># Make sure it uses the q35 machine type and OVMF</span>
<span class="c"># machine: q35</span>
<span class="c"># bios: ovmf</span>
</code></pre></div> </div> </li> </ol> <h3 id="sr-iov-stops-working-after-a-kernel-update">SR-IOV Stops Working After a Kernel Update</h3> <p>The DKMS module has to be rebuilt for every new PVE kernel. With <code class="language-plaintext highlighter-rouge">proxmox-default-headers</code> installed, the matching headers come with the kernel update and DKMS normally rebuilds the module automatically. If it didn’t, fix it after booting into the new kernel:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Check whether the automatic build succeeded</span>
dkms status

<span class="c"># If the new kernel isn't listed as installed</span>
apt <span class="nb">install </span>proxmox-headers-<span class="si">$(</span><span class="nb">uname</span> <span class="nt">-r</span><span class="si">)</span>
dkms autoinstall

<span class="c"># Refresh the boot configuration</span>
proxmox-boot-tool refresh
reboot
</code></pre></div></div> <p>If the new kernel is outside the range supported by your <code class="language-plaintext highlighter-rouge">i915-sriov-dkms</code> release, install a release that supports it.</p> <blockquote> <p><strong>Tip</strong>: pin the known-good kernel before updating:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>proxmox-boot-tool kernel pin <span class="si">$(</span><span class="nb">uname</span> <span class="nt">-r</span><span class="si">)</span>
proxmox-boot-tool refresh
</code></pre></div> </div> <p>Once the new kernel and DKMS module are confirmed working, unpin it:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>proxmox-boot-tool kernel unpin
proxmox-boot-tool refresh
</code></pre></div> </div> </blockquote> <hr/> <h2 id="command-cheat-sheet">Command Cheat Sheet</h2> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># === Status ===</span>
lspci | <span class="nb">grep </span>VGA                                          <span class="c"># List all GPU devices</span>
dmesg | <span class="nb">grep </span>i915                                         <span class="c"># i915 driver log</span>
dmesg | <span class="nb">grep</span> <span class="nt">-i</span> iommu                                     <span class="c"># IOMMU status</span>
<span class="nb">cat</span> /proc/cmdline                                         <span class="c"># Current kernel parameters</span>
<span class="nb">cat</span> /sys/devices/pci0000:00/0000:00:02.0/sriov_numvfs     <span class="c"># Number of VFs</span>
lspci <span class="nt">-nnk</span> | <span class="nb">grep</span> <span class="nt">-A3</span> VGA                                 <span class="c"># Driver binding</span>
dkms status                                               <span class="c"># DKMS module status</span>
proxmox-boot-tool status                                  <span class="c"># Boot tool status</span>

<span class="c"># === Maintenance ===</span>
proxmox-boot-tool refresh                <span class="c"># Refresh systemd-boot (required after editing cmdline)</span>
update-initramfs <span class="nt">-u</span> <span class="nt">-k</span> all               <span class="c"># Update the initramfs</span>
proxmox-boot-tool kernel pin &lt;version&gt;   <span class="c"># Pin a kernel version</span>
proxmox-boot-tool kernel unpin           <span class="c"># Remove the pin</span>

<span class="c"># === Debugging ===</span>
<span class="nb">cat</span> /var/lib/dkms/i915-sriov-dkms/<span class="k">*</span>/build/make.log   <span class="c"># DKMS build log</span>
journalctl <span class="nt">-b</span> | <span class="nb">grep </span>i915                            <span class="c"># i915 log for the current boot</span>
systemctl status sysfsutils                          <span class="c"># sysfsutils service status</span>
</code></pre></div></div> <hr/> <h2 id="references">References</h2> <ul> <li><strong>DKMS driver project</strong>: <a href="https://github.com/strongtz/i915-sriov-dkms">https://github.com/strongtz/i915-sriov-dkms</a></li> <li><strong>PVE host bootloader docs</strong>: <a href="https://pve.proxmox.com/wiki/Host_Bootloader">https://pve.proxmox.com/wiki/Host_Bootloader</a></li> <li><strong>PVE PCIe passthrough docs</strong>: <a href="https://pve.proxmox.com/wiki/PCI(e)_Passthrough">https://pve.proxmox.com/wiki/PCI(e)_Passthrough</a></li> <li><strong>PVE package repositories</strong>: <a href="https://pve.proxmox.com/wiki/Package_Repositories">https://pve.proxmox.com/wiki/Package_Repositories</a></li> <li><strong>Community guide</strong>: <a href="https://github.com/Upinel/PVE-Intel-vGPU">https://github.com/Upinel/PVE-Intel-vGPU</a></li> </ul> <hr/> <p><em>Last updated: 2026-03</em></p>]]></content><author><name></name></author><category term="IT"/><category term="proxmox"/><category term="sr-iov"/><category term="gpu"/><category term="virtualization"/><category term="IT"/><summary type="html"><![CDATA[Split the UHD 730 iGPU of an i3-12100 into SR-IOV virtual functions for multiple VMs on Proxmox VE 9 (ZFS, systemd-boot) with i915-sriov-dkms.]]></summary></entry><entry><title type="html">InfiniBand Quick Command Reference</title><link href="https://alshedivat.github.io/blog/2025/infiniband-quick-commands/" rel="alternate" type="text/html" title="InfiniBand Quick Command Reference"/><published>2025-10-28T00:01:00+00:00</published><updated>2025-10-28T00:01:00+00:00</updated><id>https://alshedivat.github.io/blog/2025/infiniband-quick-commands</id><content type="html" xml:base="https://alshedivat.github.io/blog/2025/infiniband-quick-commands/"><![CDATA[<p>This is a cheat sheet of the commands I use to set up InfiniBand on Ubuntu with Mellanox/NVIDIA ConnectX cards. On Ubuntu 24.04 you no longer need to install the driver from the vendor ISO (MLNX_OFED), because the in-box drivers are enough.</p> <h2 id="install-rdma-packages">Install RDMA packages</h2> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt-get <span class="nb">install </span>rdma-core
<span class="nb">sudo </span>apt-get <span class="nb">install </span>libibverbs1 librdmacm1 libibmad5 libibumad3 ibverbs-providers rdmacm-utils infiniband-diags libfabric1 ibverbs-utils
</code></pre></div></div> <p>On Ubuntu 24.04, <code class="language-plaintext highlighter-rouge">librdmacm1</code> was renamed to <code class="language-plaintext highlighter-rouge">librdmacm1t64</code> during the 64-bit <code class="language-plaintext highlighter-rouge">time_t</code> transition. On 64-bit systems apt picks the new package automatically.</p> <h2 id="install-infiniband-diagnostic-tools">Install InfiniBand diagnostic tools</h2> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt <span class="nb">install </span>infiniband-diags
</code></pre></div></div> <p>This package provides tools such as <code class="language-plaintext highlighter-rouge">ibstat</code>, which shows the HCA and port state.</p> <h2 id="install-mst-tools">Install MST tools</h2> <p>You need these for Mellanox NICs. The <code class="language-plaintext highlighter-rouge">mstflint</code> package provides both <code class="language-plaintext highlighter-rouge">mstflint</code> and <code class="language-plaintext highlighter-rouge">mstconfig</code>.</p> <div class="language-shell 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 <span class="nb">install </span>mstflint
</code></pre></div></div> <h2 id="find-the-nics-pci-address">Find the NIC’s PCI address</h2> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lspci | <span class="nb">grep </span>Mel
</code></pre></div></div> <p>The first column (for example <code class="language-plaintext highlighter-rouge">05:00.0</code>) is the PCI address that you pass to <code class="language-plaintext highlighter-rouge">mstflint</code>/<code class="language-plaintext highlighter-rouge">mstconfig</code> with <code class="language-plaintext highlighter-rouge">-d</code>.</p> <h2 id="flash-firmware">Flash firmware</h2> <p>Check the current firmware version and PSID, then burn the new image:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>mstflint <span class="nt">-d</span> 86:00.0 query
<span class="nb">sudo </span>mstflint <span class="nt">-d</span> 86:00.0 <span class="nt">-i</span> fw-ConnectX3-rel-2_42_5000-MCX354A-FCB_A2-A5-FlexBoot-3.4.752.bin <span class="nt">-allow_psid_change</span> burn
</code></pre></div></div> <ul> <li><code class="language-plaintext highlighter-rouge">86:00.0</code> is the NIC’s PCI address.</li> <li><code class="language-plaintext highlighter-rouge">-allow_psid_change</code> lets you burn an image whose PSID (Parameter Set ID) differs from the one on the card. This is how you put stock firmware on an OEM-branded card. Use it with care, because a wrong PSID can make the card malfunction.</li> </ul> <p>Firmware images: <a href="https://network.nvidia.com/support/firmware/firmware-downloads/">https://network.nvidia.com/support/firmware/firmware-downloads/</a></p> <h2 id="set-the-port-link-type-to-infiniband">Set the port link type to InfiniBand</h2> <p>VPI cards can run each port as InfiniBand or Ethernet. To switch both ports to InfiniBand:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>mstconfig <span class="nt">-d</span> 05:00.0 query | <span class="nb">grep </span>LINK_TYPE
<span class="nb">sudo </span>mstconfig <span class="nt">-d</span> 05:00.0 <span class="nb">set </span><span class="nv">LINK_TYPE_P1</span><span class="o">=</span>IB <span class="nv">LINK_TYPE_P2</span><span class="o">=</span>IB  <span class="c"># valid values: IB, ETH, VPI</span>
<span class="nb">sudo </span>reboot
</code></pre></div></div> <ul> <li><code class="language-plaintext highlighter-rouge">LINK_TYPE_P1</code> and <code class="language-plaintext highlighter-rouge">LINK_TYPE_P2</code> configure port 1 and port 2. On a single-port card, set only <code class="language-plaintext highlighter-rouge">LINK_TYPE_P1</code>.</li> <li>Valid values are <code class="language-plaintext highlighter-rouge">IB</code>, <code class="language-plaintext highlighter-rouge">ETH</code> and <code class="language-plaintext highlighter-rouge">VPI</code>. <code class="language-plaintext highlighter-rouge">query</code> shows them as <code class="language-plaintext highlighter-rouge">IB(1)</code> and <code class="language-plaintext highlighter-rouge">ETH(2)</code>. Not every adapter supports <code class="language-plaintext highlighter-rouge">VPI</code>.</li> <li>The new setting takes effect after a reboot.</li> </ul> <h2 id="load-the-ipoib-modules">Load the IPoIB modules</h2> <p>To load the modules at boot, use one of these two methods.</p> <p>Option 1: append them to <code class="language-plaintext highlighter-rouge">/etc/modules</code>:</p> <div class="language-conf highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># /etc/modules
</span><span class="n">ib_ipoib</span>
<span class="n">ib_umad</span>
</code></pre></div></div> <p>Option 2: put them in their own file under <code class="language-plaintext highlighter-rouge">/etc/modules-load.d/</code>:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo tee</span> /etc/modules-load.d/ipoib.conf <span class="o">&lt;&lt;</span> <span class="no">EOF</span><span class="sh">
ib_ipoib
ib_umad
</span><span class="no">EOF
</span></code></pre></div></div> <p>To load them right away without rebooting:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>modprobe ib_ipoib
<span class="nb">sudo </span>modprobe ib_umad
</code></pre></div></div> <h2 id="run-a-subnet-manager-opensm">Run a subnet manager (OpenSM)</h2> <p>Every InfiniBand fabric needs one subnet manager. If your switch doesn’t run one (for example, an unmanaged switch or two hosts connected back-to-back), run OpenSM on one of the hosts:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt <span class="nb">install </span>opensm
<span class="nb">sudo </span>systemctl <span class="nb">enable</span> <span class="nt">--now</span> opensm
</code></pre></div></div> <h2 id="configure-an-infiniband-switch">Configure an InfiniBand switch</h2> <p>See this post: <a href="https://blog.xjn819.com/post/Upgrade-from-10Gbps-to-40Gbps-network.html">https://blog.xjn819.com/post/Upgrade-from-10Gbps-to-40Gbps-network.html</a></p> <h2 id="test-rdma-bandwidth-and-latency-with-qperf">Test RDMA bandwidth and latency with qperf</h2> <p>Install <code class="language-plaintext highlighter-rouge">qperf</code> on both nodes:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt <span class="nb">install </span>qperf
</code></pre></div></div> <p>Server side (with no arguments, qperf runs in server mode):</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>qperf
</code></pre></div></div> <p>Client side, running RC (Reliable Connection) RDMA bandwidth and latency tests:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>qperf &lt;server-ip&gt; rc_bw rc_lat
</code></pre></div></div> <p>qperf sets up the test over a TCP control connection, so <code class="language-plaintext highlighter-rouge">&lt;server-ip&gt;</code> must be reachable over IP (IPoIB or Ethernet).</p> <h2 id="test-ipoib-tcp-throughput-with-iperf">Test IPoIB TCP throughput with iperf</h2> <p><code class="language-plaintext highlighter-rouge">iperf</code> measures plain TCP throughput over the IPoIB interface. It doesn’t test RDMA.</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt <span class="nb">install </span>iperf
</code></pre></div></div> <p>Server side:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>iperf <span class="nt">-s</span> <span class="nt">-i</span> 1 <span class="nt">-f</span> m
</code></pre></div></div> <p>Client side, using the server’s IPoIB address (for example on <code class="language-plaintext highlighter-rouge">ib0</code>):</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>iperf <span class="nt">-c</span> &lt;server-ip&gt; <span class="nt">-i</span> 1 <span class="nt">-t</span> 30 <span class="nt">-f</span> m
</code></pre></div></div> <p><code class="language-plaintext highlighter-rouge">-i 1</code> prints a report every second, <code class="language-plaintext highlighter-rouge">-f m</code> reports in Mbit/s, and <code class="language-plaintext highlighter-rouge">-t 30</code> runs the test for 30 seconds.</p>]]></content><author><name></name></author><category term="IT"/><category term="infiniband"/><category term="rdma"/><category term="network"/><category term="IT"/><summary type="html"><![CDATA[A cheat sheet for bringing up InfiniBand on Ubuntu, from packages and firmware to IPoIB, OpenSM and benchmarks.]]></summary></entry><entry><title type="html">NFS over RDMA Configuration Guide</title><link href="https://alshedivat.github.io/blog/2025/nfs-over-rdma/" rel="alternate" type="text/html" title="NFS over RDMA Configuration Guide"/><published>2025-10-28T00:01:00+00:00</published><updated>2025-10-28T00:01:00+00:00</updated><id>https://alshedivat.github.io/blog/2025/nfs-over-rdma</id><content type="html" xml:base="https://alshedivat.github.io/blog/2025/nfs-over-rdma/"><![CDATA[<p>This guide sets up NFS over RDMA on an InfiniBand fabric: load the kernel transport, turn on nfsd’s RDMA listener, export a filesystem, and mount it from a client over RDMA. It targets <strong>Ubuntu 22.04 LTS and 24.04 LTS</strong>. Since 22.04, all NFS services read <code class="language-plaintext highlighter-rouge">/etc/nfs.conf</code> and <code class="language-plaintext highlighter-rouge">/etc/nfs.conf.d/*.conf</code>. On 20.04 and earlier, the equivalent settings live in <code class="language-plaintext highlighter-rouge">/etc/default/nfs-kernel-server</code>.</p> <p>In the examples, <code class="language-plaintext highlighter-rouge">10.0.0.0/24</code> is the IPoIB subnet, <code class="language-plaintext highlighter-rouge">10.0.0.2</code> is the server, and <code class="language-plaintext highlighter-rouge">/mnt/fs0</code> is the exported directory.</p> <h2 id="before-you-start">Before you start</h2> <ul> <li>Run <code class="language-plaintext highlighter-rouge">ibv_devinfo</code> to confirm that the RDMA device and its port are up.</li> <li>Run <code class="language-plaintext highlighter-rouge">ib_send_bw</code> (from perftest) to measure raw RDMA bandwidth between the nodes.</li> <li>If a host firewall is active, open port 20049 for both TCP and UDP.</li> </ul> <h2 id="kernel-module-server-and-client">Kernel module (server and client)</h2> <p>The server-side (<code class="language-plaintext highlighter-rouge">svcrdma</code>) and client-side (<code class="language-plaintext highlighter-rouge">xprtrdma</code>) transports both live in <code class="language-plaintext highlighter-rouge">rpcrdma.ko</code>, and those two names are just module aliases for it. The kernel loads the module on demand when nfsd opens an RDMA listener or a client mounts with <code class="language-plaintext highlighter-rouge">proto=rdma</code>. Loading it at boot is optional, but it makes the dependency explicit:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo </span>rpcrdma | <span class="nb">sudo tee</span> /etc/modules-load.d/rdma.conf
<span class="nb">sudo </span>modprobe rpcrdma
</code></pre></div></div> <h2 id="server">Server</h2> <h3 id="1-configure-nfsd">1. Configure nfsd</h3> <p>On Ubuntu 22.04+, <code class="language-plaintext highlighter-rouge">nfs-server.service</code> (also reachable under its alias <code class="language-plaintext highlighter-rouge">nfs-kernel-server.service</code>) runs a bare <code class="language-plaintext highlighter-rouge">/usr/sbin/rpc.nfsd</code>, which reads its settings from the <code class="language-plaintext highlighter-rouge">[nfsd]</code> section of nfs.conf. <code class="language-plaintext highlighter-rouge">RPCNFSDCOUNT</code> and <code class="language-plaintext highlighter-rouge">RPCNFSDOPTS</code> in <code class="language-plaintext highlighter-rouge">/etc/default/nfs-kernel-server</code> are no longer read. Put the settings in a drop-in file instead:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo tee</span> /etc/nfs.conf.d/rdma.conf <span class="o">&lt;&lt;</span> <span class="no">EOF</span><span class="sh">
[nfsd]
threads=16
vers4.2=y
rdma=y
rdma-port=20049
</span><span class="no">EOF
</span></code></pre></div></div> <ul> <li><code class="language-plaintext highlighter-rouge">threads</code>: start from the server’s CPU core count, then adjust for InfiniBand bandwidth and the actual client load. This example uses 16. You can change it at runtime by writing a number to <code class="language-plaintext highlighter-rouge">/proc/fs/nfsd/threads</code>.</li> <li><code class="language-plaintext highlighter-rouge">rdma=y</code> makes <code class="language-plaintext highlighter-rouge">rpc.nfsd</code> open the RDMA listener itself (it writes <code class="language-plaintext highlighter-rouge">rdma 20049</code> to <code class="language-plaintext highlighter-rouge">/proc/fs/nfsd/portlist</code>). With <code class="language-plaintext highlighter-rouge">rdma=y</code> alone, the port comes from the <code class="language-plaintext highlighter-rouge">nfsrdma</code> service name. Setting <code class="language-plaintext highlighter-rouge">rdma-port=20049</code> explicitly removes the dependency on <code class="language-plaintext highlighter-rouge">/etc/services</code>.</li> <li><code class="language-plaintext highlighter-rouge">vers4.2=y</code> makes sure NFSv4.2 is offered. RDMA does not depend on it: the RDMA transport works with NFSv3 and NFSv4.x alike.</li> </ul> <h3 id="2-export-the-filesystem">2. Export the filesystem</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo tee</span> /etc/exports <span class="o">&lt;&lt;</span> <span class="no">EOF</span><span class="sh">
/mnt/fs0 10.0.0.0/24(rw,async,crossmnt,insecure,fsid=0,no_subtree_check,no_root_squash,no_all_squash)
</span><span class="no">EOF
</span></code></pre></div></div> <ul> <li><code class="language-plaintext highlighter-rouge">insecure</code> is required because the NFS/RDMA client does not use a reserved source port.</li> <li><code class="language-plaintext highlighter-rouge">fsid=0</code> makes <code class="language-plaintext highlighter-rouge">/mnt/fs0</code> the NFSv4 pseudo-root, so NFSv4 clients mount it as <code class="language-plaintext highlighter-rouge">10.0.0.2:/</code>, not <code class="language-plaintext highlighter-rouge">10.0.0.2:/mnt/fs0</code>. If you’d rather mount by the full server path, drop <code class="language-plaintext highlighter-rouge">fsid=0</code>.</li> <li><code class="language-plaintext highlighter-rouge">no_root_squash</code> should be paired with network-level access control. In production, consider adding a security flavor such as <code class="language-plaintext highlighter-rouge">sec=krb5</code>.</li> </ul> <h3 id="3-restart-and-check">3. Restart and check</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>systemctl restart nfs-server

<span class="nb">cat</span> /proc/fs/nfsd/portlist   <span class="c"># should include "rdma 20049"</span>
<span class="nb">cat</span> /proc/fs/nfsd/threads    <span class="c"># should print 16</span>
nfsconf <span class="nt">--dump</span>               <span class="c"># effective config, nfs.conf + nfs.conf.d merged</span>
</code></pre></div></div> <p>You don’t need to edit the systemd unit. If you ever do have to customize it, use a drop-in (<code class="language-plaintext highlighter-rouge">sudo systemctl edit nfs-server</code>, which writes <code class="language-plaintext highlighter-rouge">/etc/systemd/system/nfs-server.service.d/override.conf</code>) containing only the lines you’re adding. Don’t edit the packaged unit file directly, because package upgrades overwrite it.</p> <p>To add the RDMA listener by hand on a running server, for example for a quick test without touching nfs.conf, run the following. The listener is lost the next time nfsd restarts:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s1">'rdma 20049'</span> | <span class="nb">sudo tee</span> /proc/fs/nfsd/portlist
</code></pre></div></div> <h2 id="client">Client</h2> <h3 id="1-mount-over-rdma">1. Mount over RDMA</h3> <p>Add the export to <code class="language-plaintext highlighter-rouge">/etc/fstab</code>:</p> <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>10.0.0.2:/ /mnt/rdma_test nfs rw,async,noatime,nodiratime,rsize=1048576,wsize=1048576,vers=4.2,rdma,port=20049,_netdev 0 0
</code></pre></div></div> <p><code class="language-plaintext highlighter-rouge">rdma</code> is shorthand for <code class="language-plaintext highlighter-rouge">proto=rdma</code>, and <code class="language-plaintext highlighter-rouge">port=20049</code> matches the server’s <code class="language-plaintext highlighter-rouge">rdma-port</code>. Pinning <code class="language-plaintext highlighter-rouge">vers=4.2</code> makes a misconfigured export fail loudly instead of silently falling back to NFSv3. Without a version, if the NFSv4 path lookup fails (for example by using the full path with an <code class="language-plaintext highlighter-rouge">fsid=0</code> export), <code class="language-plaintext highlighter-rouge">mount.nfs</code> retries with v3.</p> <h3 id="2-apply">2. Apply</h3> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo mkdir</span> <span class="nt">-p</span> /mnt/rdma_test
<span class="nb">sudo </span>systemctl daemon-reload   <span class="c"># regenerate mount units from the edited fstab</span>
<span class="nb">sudo </span>mount <span class="nt">-av</span>
</code></pre></div></div> <p>You don’t need to modify <code class="language-plaintext highlighter-rouge">rpcbind.service</code>. An NFSv4 client connects straight to the given port without asking rpcbind, and the kernel loads <code class="language-plaintext highlighter-rouge">rpcrdma</code> when the mount needs it (or at boot via <code class="language-plaintext highlighter-rouge">modules-load.d</code>).</p> <h2 id="verification-and-troubleshooting">Verification and troubleshooting</h2> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Client: mount options should include proto=rdma,port=20049</span>
nfsstat <span class="nt">-m</span>
<span class="nb">grep </span>rdma /proc/mounts

<span class="c"># Server: confirm the RDMA listener</span>
<span class="nb">cat</span> /proc/fs/nfsd/portlist

<span class="c"># RDMA link state</span>
rdma <span class="nb">link </span>show

<span class="c"># NFS network-layer statistics</span>
nfsstat <span class="nt">-o</span> net
</code></pre></div></div> <p>The original setup was tested on Linux 5.15 LTS (the Ubuntu 22.04 GA kernel) with Mellanox ConnectX NICs.</p> <h2 id="optional-tuning">Optional tuning</h2> <h3 id="sunrpc-tcp-slot-table-tcp-mounts-only">SUNRPC TCP slot table (TCP mounts only)</h3> <p>These <code class="language-plaintext highlighter-rouge">sunrpc</code> parameters configure the <strong>TCP</strong> RPC transport. They have no effect on a <code class="language-plaintext highlighter-rouge">proto=rdma</code> mount, so they’re only worth setting if the same client also mounts NFS over TCP:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo tee</span> <span class="nt">-a</span> /etc/modprobe.d/sunrpc.conf <span class="o">&lt;&lt;</span> <span class="no">EOF</span><span class="sh">
options sunrpc tcp_slot_table_entries=128
options sunrpc tcp_max_slot_table_entries=128
</span><span class="no">EOF
</span><span class="nb">sudo </span>sysctl <span class="nt">-w</span> sunrpc.tcp_slot_table_entries<span class="o">=</span>128
<span class="nb">sudo </span>sysctl <span class="nt">-w</span> sunrpc.tcp_max_slot_table_entries<span class="o">=</span>128
<span class="nb">cat</span> /proc/sys/sunrpc/tcp_slot_table_entries  <span class="c"># check</span>
</code></pre></div></div> <p><code class="language-plaintext highlighter-rouge">tcp_slot_table_entries</code> is the initial number of RPC slots per TCP connection (kernel default 2). The table then grows dynamically up to <code class="language-plaintext highlighter-rouge">tcp_max_slot_table_entries</code> (kernel default 65536). Setting both to 128 therefore caps each TCP connection at 128 in-flight RPCs.</p> <h3 id="rdma-credits-on-the-server">RDMA credits on the server</h3> <p>The RDMA transport’s counterpart is <code class="language-plaintext highlighter-rouge">/proc/sys/sunrpc/svc_rdma/max_requests</code>: the number of credits (concurrent RPC requests) nfsd grants each RDMA connection. The default is 64 on 5.15 and 128 in recent kernels. The value is read when a connection is accepted, so change it before clients mount:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cat</span> /proc/sys/sunrpc/svc_rdma/max_requests
</code></pre></div></div>]]></content><author><name></name></author><category term="IT"/><category term="nfs"/><category term="rdma"/><category term="infiniband"/><category term="IT"/><summary type="html"><![CDATA[Set up an NFS over RDMA server and client on Ubuntu 22.04/24.04 using nfs.conf and an RDMA mount.]]></summary></entry><entry><title type="html">Exposing an Internal SSH Port with FRP and Docker Compose</title><link href="https://alshedivat.github.io/blog/2025/frp-docker-deploy/" rel="alternate" type="text/html" title="Exposing an Internal SSH Port with FRP and Docker Compose"/><published>2025-06-23T00:01:00+00:00</published><updated>2025-06-23T00:01:00+00:00</updated><id>https://alshedivat.github.io/blog/2025/frp-docker-deploy</id><content type="html" xml:base="https://alshedivat.github.io/blog/2025/frp-docker-deploy/"><![CDATA[<p><a href="https://github.com/fatedier/frp">FRP</a> (Fast Reverse Proxy) lets a machine behind NAT or a firewall expose a service through a server that has a public IP. The internal machine runs the client, <code class="language-plaintext highlighter-rouge">frpc</code>, which opens an outbound connection to the server, <code class="language-plaintext highlighter-rouge">frps</code>. The server then forwards traffic arriving on a public port back through that connection. In this setup both sides run in Docker Compose, and the internal machine’s SSH port (22) becomes reachable at port 37843 on the public server.</p> <h2 id="ports">Ports</h2> <table> <thead> <tr> <th>Port</th> <th>Where</th> <th>Purpose</th> </tr> </thead> <tbody> <tr> <td>37000</td> <td>frps</td> <td><code class="language-plaintext highlighter-rouge">bindPort</code>: frpc connects to the server on this port</td> </tr> <tr> <td>7500</td> <td>frps</td> <td>Web dashboard</td> </tr> <tr> <td>37843</td> <td>frps</td> <td><code class="language-plaintext highlighter-rouge">remotePort</code> of the SSH proxy: users connect here to reach SSH</td> </tr> <tr> <td>22</td> <td>frpc host</td> <td>Local SSH daemon that gets exposed</td> </tr> </tbody> </table> <p>Open 37000 and 37843 (and 7500 if you want to use the dashboard remotely) in the public server’s firewall or cloud security group.</p> <h2 id="server-frps">Server (frps)</h2> <p>On the public server, put these two files in the same directory.</p> <p><code class="language-plaintext highlighter-rouge">docker-compose.yml</code>:</p> <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">services</span><span class="pi">:</span>
  <span class="na">frps</span><span class="pi">:</span>
    <span class="na">image</span><span class="pi">:</span> <span class="s">snowdreamtech/frps</span> <span class="c1"># or fatedier/frps, which also needs: command: ["-c", "/etc/frp/frps.toml"]</span>
    <span class="na">container_name</span><span class="pi">:</span> <span class="s">frps</span>
    <span class="na">restart</span><span class="pi">:</span> <span class="s">unless-stopped</span>
    <span class="na">ports</span><span class="pi">:</span>
      <span class="pi">-</span> <span class="s2">"</span><span class="s">37000:37000"</span> <span class="c1"># bindPort (frpc connections)</span>
      <span class="pi">-</span> <span class="s2">"</span><span class="s">7500:7500"</span> <span class="c1"># dashboard</span>
      <span class="pi">-</span> <span class="s2">"</span><span class="s">37843:37843"</span> <span class="c1"># exposed SSH port (remotePort)</span>
    <span class="na">volumes</span><span class="pi">:</span>
      <span class="pi">-</span> <span class="s">./frps.toml:/etc/frp/frps.toml</span>
</code></pre></div></div> <p><code class="language-plaintext highlighter-rouge">frps.toml</code>:</p> <div class="language-toml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">bindPort</span> <span class="o">=</span><span class="w"> </span><span class="mi">37000</span>
<span class="n">auth</span><span class="p">.</span><span class="n">token</span> <span class="o">=</span><span class="w"> </span><span class="s">"&lt;FRP_AUTH_TOKEN&gt;"</span>

<span class="n">webServer</span><span class="p">.</span><span class="n">addr</span> <span class="o">=</span><span class="w"> </span><span class="s">"0.0.0.0"</span>
<span class="n">webServer</span><span class="p">.</span><span class="n">port</span> <span class="o">=</span><span class="w"> </span><span class="mi">7500</span>
<span class="n">webServer</span><span class="p">.</span><span class="n">user</span> <span class="o">=</span><span class="w"> </span><span class="s">"admin"</span>
<span class="n">webServer</span><span class="p">.</span><span class="n">password</span> <span class="o">=</span><span class="w"> </span><span class="s">"&lt;DASHBOARD_PASSWORD&gt;"</span>
</code></pre></div></div> <p>Here’s what the settings do:</p> <ul> <li><code class="language-plaintext highlighter-rouge">bindPort</code> is the port frps listens on for frpc connections. The compose file has to publish it.</li> <li><code class="language-plaintext highlighter-rouge">auth.token</code> is a shared secret, and frpc must send the same value. Token authentication is frp’s default (<code class="language-plaintext highlighter-rouge">auth.method = "token"</code>), so you don’t need to set the method explicitly.</li> <li><code class="language-plaintext highlighter-rouge">webServer.*</code> turns on the dashboard, which shows connected clients, proxies and traffic, protected by basic auth. frp binds the dashboard to <code class="language-plaintext highlighter-rouge">127.0.0.1</code> by default. Inside a container it has to listen on <code class="language-plaintext highlighter-rouge">0.0.0.0</code>, otherwise the published port 7500 can’t reach it. The dashboard is served over plain HTTP. If you don’t need it from outside, don’t publish 7500, or restrict that port in the firewall.</li> <li>Every <code class="language-plaintext highlighter-rouge">remotePort</code> used by a client proxy must also be published by the frps container, which is why <code class="language-plaintext highlighter-rouge">37843:37843</code> appears under <code class="language-plaintext highlighter-rouge">ports</code>. frps opens the listener inside the container, but without the mapping no outside traffic reaches it. Each new proxy needs its own mapping.</li> </ul> <p>The <code class="language-plaintext highlighter-rouge">snowdreamtech/frps</code> image starts <code class="language-plaintext highlighter-rouge">frps -c /etc/frp/frps.toml</code> automatically, so mounting the file there is enough. The official <code class="language-plaintext highlighter-rouge">fatedier/frps</code> image runs plain <code class="language-plaintext highlighter-rouge">frps</code> with no arguments, so you have to pass the config path through <code class="language-plaintext highlighter-rouge">command</code> yourself.</p> <p>Start the server:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker compose up <span class="nt">-d</span>
</code></pre></div></div> <h2 id="client-frpc">Client (frpc)</h2> <p>On the internal machine, create the client files.</p> <p><code class="language-plaintext highlighter-rouge">docker-compose.yml</code>:</p> <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">services</span><span class="pi">:</span>
  <span class="na">frpc</span><span class="pi">:</span>
    <span class="na">image</span><span class="pi">:</span> <span class="s">snowdreamtech/frpc:latest</span>
    <span class="na">container_name</span><span class="pi">:</span> <span class="s">frpc</span>
    <span class="na">restart</span><span class="pi">:</span> <span class="s">unless-stopped</span>
    <span class="na">network_mode</span><span class="pi">:</span> <span class="s">host</span> <span class="c1"># host mode recommended</span>
    <span class="na">volumes</span><span class="pi">:</span>
      <span class="pi">-</span> <span class="s">./frpc.toml:/etc/frp/frpc.toml</span>
</code></pre></div></div> <p><code class="language-plaintext highlighter-rouge">frpc.toml</code>:</p> <div class="language-toml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">serverAddr</span> <span class="o">=</span><span class="w"> </span><span class="s">"&lt;FRPS_PUBLIC_IP&gt;"</span>  <span class="c"># public IP of the frps server</span>
<span class="n">serverPort</span> <span class="o">=</span><span class="w"> </span><span class="mi">37000</span>               <span class="c"># must match bindPort in frps.toml</span>
<span class="n">auth</span><span class="p">.</span><span class="n">token</span> <span class="o">=</span><span class="w"> </span><span class="s">"&lt;FRP_AUTH_TOKEN&gt;"</span>

<span class="k">[[</span><span class="n">proxies</span><span class="k">]]</span>
<span class="n">name</span> <span class="o">=</span><span class="w"> </span><span class="s">"ssh"</span>                     <span class="c"># proxy name (any unique name)</span>
<span class="n">type</span> <span class="o">=</span><span class="w"> </span><span class="s">"tcp"</span>                     <span class="c"># proxy type</span>
<span class="n">localIP</span> <span class="o">=</span><span class="w"> </span><span class="s">"127.0.0.1"</span>            <span class="c"># local service IP (defaults to 127.0.0.1)</span>
<span class="n">localPort</span> <span class="o">=</span><span class="w"> </span><span class="mi">22</span>                   <span class="c"># local SSH port</span>
<span class="n">remotePort</span> <span class="o">=</span><span class="w"> </span><span class="mi">37843</span>               <span class="c"># port opened on frps; users connect here</span>
</code></pre></div></div> <p>Here’s what the settings do:</p> <ul> <li><code class="language-plaintext highlighter-rouge">serverAddr</code> and <code class="language-plaintext highlighter-rouge">serverPort</code> point at frps. The port must match <code class="language-plaintext highlighter-rouge">bindPort</code> on the server.</li> <li><code class="language-plaintext highlighter-rouge">auth.token</code> must be the same as on the server, otherwise frps rejects the login.</li> <li>Each <code class="language-plaintext highlighter-rouge">[[proxies]]</code> entry defines one forwarded service. This <code class="language-plaintext highlighter-rouge">tcp</code> proxy asks frps to listen on <code class="language-plaintext highlighter-rouge">remotePort</code> 37843 and forward every connection to <code class="language-plaintext highlighter-rouge">localIP:localPort</code>, which is the SSH daemon on port 22.</li> <li><code class="language-plaintext highlighter-rouge">network_mode: host</code> is what makes <code class="language-plaintext highlighter-rouge">127.0.0.1</code> refer to the host itself. With the default bridge network, <code class="language-plaintext highlighter-rouge">127.0.0.1</code> would be the frpc container, and port 22 there has nothing listening.</li> </ul> <p>Start the client:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker compose up <span class="nt">-d</span>
</code></pre></div></div> <h2 id="connecting">Connecting</h2> <p>Once frpc logs a successful login and starts the <code class="language-plaintext highlighter-rouge">ssh</code> proxy, you can reach the internal machine through the public server:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh <span class="nt">-p</span> 37843 &lt;USER&gt;@&lt;FRPS_PUBLIC_IP&gt;
</code></pre></div></div>]]></content><author><name></name></author><category term="IT"/><category term="frp"/><category term="docker"/><category term="network"/><category term="ssh"/><category term="IT"/><summary type="html"><![CDATA[Run frps and frpc with Docker Compose to reach an internal machine's SSH port through a public server.]]></summary></entry><entry><title type="html">Setting Up RKE2 on Rocky Linux</title><link href="https://alshedivat.github.io/blog/2024/k8s-rke2-setup/" rel="alternate" type="text/html" title="Setting Up RKE2 on Rocky Linux"/><published>2024-10-29T00:06:00+00:00</published><updated>2024-10-29T00:06:00+00:00</updated><id>https://alshedivat.github.io/blog/2024/k8s-rke2-setup</id><content type="html" xml:base="https://alshedivat.github.io/blog/2024/k8s-rke2-setup/"><![CDATA[<p><a href="https://docs.rke2.io/">RKE2</a> is Rancher’s Kubernetes distribution. These are my notes for setting up an RKE2 cluster on Rocky Linux, using the Rancher China mirror for installation. If the nodes cannot reach Docker Hub, also see <a href="/blog/2024/rke2-snippets/">RKE2 Snippets for Clusters Without Docker Hub Access</a>.</p> <h2 id="prepare-the-base-server">Prepare the base server</h2> <p>This script disables SELinux, enables the CRB and EPEL repositories, installs common tools (including <code class="language-plaintext highlighter-rouge">iscsi-initiator-utils</code> and <code class="language-plaintext highlighter-rouge">nfs-utils</code> for storage systems such as Longhorn), and switches root’s shell to Zsh:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/usr/bin/env bash</span>

<span class="c"># Check if SELinux is enabled</span>
<span class="k">if</span> <span class="o">[</span> <span class="si">$(</span>getenforce<span class="si">)</span> <span class="o">=</span> <span class="s2">"Enforcing"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then
    </span><span class="nb">echo</span> <span class="s2">"SELinux is enabled. Disabling it now..."</span>

    <span class="c"># Disable SELinux</span>
    setenforce 0

    <span class="c"># Make sure the change is persistent</span>
    <span class="nb">sed</span> <span class="nt">-i</span> <span class="s1">'s/SELINUX=enforcing/SELINUX=disabled/g'</span> /etc/selinux/config

    <span class="nb">echo</span> <span class="s2">"SELinux has been disabled."</span>
<span class="k">else
    </span><span class="nb">echo</span> <span class="s2">"SELinux is already disabled."</span>
<span class="k">fi</span>

<span class="c"># Configure DNF</span>
<span class="nb">echo</span> <span class="s2">"Configuring DNF..."</span>
dnf config-manager <span class="nt">--set-enabled</span> crb
dnf <span class="nb">install </span>epel-release <span class="nt">-y</span>
dnf update <span class="nt">-y</span>
dnf <span class="nb">install </span>openssh-server zsh git vim curl wget htop net-tools iftop dnsutils nfs-utils tmux iscsi-initiator-utils <span class="nt">-y</span>

<span class="c"># Change Shell</span>
<span class="nb">echo</span> <span class="s2">"Changing shell to ZSH..."</span>
usermod <span class="nt">--shell</span> /bin/zsh root

<span class="c"># Enable ISCSI</span>
systemctl <span class="nb">enable </span>iscsid
systemctl start iscsid
</code></pre></div></div> <h2 id="install-rke2">Install RKE2</h2> <p>Install the latest stable release from the China mirror:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-sfL</span> https://rancher-mirror.rancher.cn/rke2/install.sh | <span class="nv">INSTALL_RKE2_MIRROR</span><span class="o">=</span>cn sh -
</code></pre></div></div> <p>Or pin a version:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-sfL</span> https://rancher-mirror.rancher.cn/rke2/install.sh | <span class="nv">INSTALL_RKE2_MIRROR</span><span class="o">=</span>cn <span class="nv">INSTALL_RKE2_VERSION</span><span class="o">=</span>v1.30.5+rke2r1 sh -
</code></pre></div></div> <p>Write the configuration described below before starting the service for the first time, then start it:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>systemctl <span class="nb">enable</span> <span class="nt">--now</span> rke2-server
</code></pre></div></div> <p>The kubeconfig is written to <code class="language-plaintext highlighter-rouge">/etc/rancher/rke2/rke2.yaml</code>, and <code class="language-plaintext highlighter-rouge">kubectl</code>, <code class="language-plaintext highlighter-rouge">ctr</code> and <code class="language-plaintext highlighter-rouge">crictl</code> are installed in <code class="language-plaintext highlighter-rouge">/var/lib/rancher/rke2/bin</code>.</p> <h2 id="configure-a-registry-mirror">Configure a registry mirror</h2> <p><code class="language-plaintext highlighter-rouge">/etc/rancher/rke2/registries.yaml</code> tells containerd which mirror to use for each registry:</p> <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">mirrors</span><span class="pi">:</span>
  <span class="na">docker.io</span><span class="pi">:</span>
    <span class="na">endpoint</span><span class="pi">:</span>
      <span class="pi">-</span> <span class="s2">"</span><span class="s">https://registry.example.com:5000"</span>
</code></pre></div></div> <h2 id="create-etcrancherrke2configyaml">Create /etc/rancher/rke2/config.yaml</h2> <p><code class="language-plaintext highlighter-rouge">/etc/rancher/rke2/config.yaml</code> holds the node’s configuration:</p> <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">advertise-address</span><span class="pi">:</span> <span class="s">&lt;node-ip&gt;</span>
<span class="na">node-ip</span><span class="pi">:</span> <span class="s">&lt;node-ip&gt;</span>
<span class="na">service-node-port-range</span><span class="pi">:</span> <span class="s">30000-40000</span>
<span class="na">cni</span><span class="pi">:</span> <span class="s">canal</span>
<span class="na">kubelet-arg</span><span class="pi">:</span>
  <span class="pi">-</span> <span class="s2">"</span><span class="s">--max-pods=200"</span>
<span class="na">system-default-registry</span><span class="pi">:</span> <span class="s2">"</span><span class="s">registry.example.com"</span>
</code></pre></div></div> <h2 id="join-more-nodes">Join more nodes</h2> <p>On the first server, read the cluster token from <code class="language-plaintext highlighter-rouge">/var/lib/rancher/rke2/server/node-token</code>. On each additional node, install RKE2 the same way and point it at the first server in <code class="language-plaintext highlighter-rouge">/etc/rancher/rke2/config.yaml</code>:</p> <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">server</span><span class="pi">:</span> <span class="s">https://10.168.1.100:9345</span>
<span class="na">token</span><span class="pi">:</span> <span class="s">&lt;node-token&gt;</span>
<span class="na">kubelet-arg</span><span class="pi">:</span>
  <span class="pi">-</span> <span class="s2">"</span><span class="s">--max-pods=200"</span>
</code></pre></div></div> <p><code class="language-plaintext highlighter-rouge">10.168.1.100</code> is the first server’s address. Start <code class="language-plaintext highlighter-rouge">rke2-server</code> on additional control-plane nodes, or <code class="language-plaintext highlighter-rouge">rke2-agent</code> on worker nodes. For workers, run the installer with <code class="language-plaintext highlighter-rouge">INSTALL_RKE2_TYPE=agent</code>.</p> <h2 id="ctr-and-crictl">ctr and crictl</h2> <p><code class="language-plaintext highlighter-rouge">ctr</code> needs the containerd socket address and the <code class="language-plaintext highlighter-rouge">k8s.io</code> namespace:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ctr <span class="nt">-n</span> k8s.io <span class="nt">--address</span> /run/k3s/containerd/containerd.sock &lt;your_command&gt;
</code></pre></div></div> <p><code class="language-plaintext highlighter-rouge">crictl</code> reads its endpoints from <code class="language-plaintext highlighter-rouge">/etc/crictl.yaml</code>:</p> <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">runtime-endpoint</span><span class="pi">:</span> <span class="s">unix:///run/k3s/containerd/containerd.sock</span>
<span class="na">image-endpoint</span><span class="pi">:</span> <span class="s">unix:///run/k3s/containerd/containerd.sock</span>
<span class="na">timeout</span><span class="pi">:</span> <span class="m">10</span>
<span class="na">debug</span><span class="pi">:</span> <span class="kc">false</span>
</code></pre></div></div>]]></content><author><name></name></author><category term="IT"/><category term="kubernetes"/><category term="rke2"/><category term="rocky-linux"/><category term="containerd"/><category term="IT"/><summary type="html"><![CDATA[Prepare a Rocky Linux node, install RKE2 from the China mirror, configure registries, join more nodes, and use ctr and crictl.]]></summary></entry><entry><title type="html">Removing a Kubernetes Namespace Stuck in Terminating</title><link href="https://alshedivat.github.io/blog/2024/k8s-remove-ns/" rel="alternate" type="text/html" title="Removing a Kubernetes Namespace Stuck in Terminating"/><published>2024-10-29T00:05:00+00:00</published><updated>2024-10-29T00:05:00+00:00</updated><id>https://alshedivat.github.io/blog/2024/k8s-remove-ns</id><content type="html" xml:base="https://alshedivat.github.io/blog/2024/k8s-remove-ns/"><![CDATA[<p>A namespace can stay in the <code class="language-plaintext highlighter-rouge">Terminating</code> state forever, typically when a resource inside it has a finalizer whose controller is gone, for example after the operator was uninstalled first. The namespace’s own <code class="language-plaintext highlighter-rouge">spec.finalizers</code> cannot be emptied with <code class="language-plaintext highlighter-rouge">kubectl edit</code>. It can only be changed through the namespace’s <code class="language-plaintext highlighter-rouge">finalize</code> subresource.</p> <blockquote> <p>Clearing the finalizers skips whatever cleanup they guard. First check <code class="language-plaintext highlighter-rouge">kubectl get all,pvc -n &lt;namespace&gt;</code> and remove what you can normally.</p> </blockquote> <p>In the first terminal, start an API proxy on <code class="language-plaintext highlighter-rouge">127.0.0.1:8001</code>:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>kubectl proxy
</code></pre></div></div> <p>In a second terminal, write the namespace with an empty finalizer list and <code class="language-plaintext highlighter-rouge">PUT</code> it to the <code class="language-plaintext highlighter-rouge">finalize</code> endpoint:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">namespacename</span><span class="o">=</span>...
<span class="nb">cat</span> <span class="o">&gt;</span> tmp.json <span class="o">&lt;&lt;</span><span class="no">EOF</span><span class="sh">
{
  "apiVersion": "v1",
  "kind": "Namespace",
  "metadata": {
    "name": "</span><span class="nv">$namespacename</span><span class="sh">"
  },
  "spec": {
    "finalizers": []
  }
}
</span><span class="no">EOF

</span>curl <span class="nt">-k</span> <span class="nt">-H</span> <span class="s2">"Content-Type: application/json"</span> <span class="nt">-X</span> PUT <span class="nt">--data-binary</span> @tmp.json http://127.0.0.1:8001/api/v1/namespaces/<span class="nv">$namespacename</span>/finalize
</code></pre></div></div> <p>The namespace disappears right after the request succeeds. Stop <code class="language-plaintext highlighter-rouge">kubectl proxy</code> afterwards.</p>]]></content><author><name></name></author><category term="IT"/><category term="kubernetes"/><category term="IT"/><summary type="html"><![CDATA[Clear the finalizers of a namespace stuck in the Terminating state through the finalize API.]]></summary></entry><entry><title type="html">Installing Longhorn Storage on Kubernetes</title><link href="https://alshedivat.github.io/blog/2024/k8s-longhorn/" rel="alternate" type="text/html" title="Installing Longhorn Storage on Kubernetes"/><published>2024-10-29T00:04:00+00:00</published><updated>2024-10-29T00:04:00+00:00</updated><id>https://alshedivat.github.io/blog/2024/k8s-longhorn</id><content type="html" xml:base="https://alshedivat.github.io/blog/2024/k8s-longhorn/"><![CDATA[<p><a href="https://longhorn.io/docs/">Longhorn</a> is a distributed block storage system for Kubernetes. It replicates volumes across nodes using local disks. These notes cover installation with Helm on RHEL-family nodes such as Rocky Linux.</p> <h2 id="pre-flight">Pre-flight</h2> <p>Install the packages Longhorn needs on every node. iSCSI is used to attach volumes, and NFS is needed for ReadWriteMany volumes and backups:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dnf <span class="nb">install </span>iscsi-initiator-utils jq nfs-utils
systemctl <span class="nb">enable</span> <span class="nt">--now</span> iscsid
</code></pre></div></div> <p>Load the <code class="language-plaintext highlighter-rouge">iscsi_tcp</code> kernel module now and at every boot:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>modprobe iscsi_tcp
<span class="nb">echo </span>iscsi_tcp | <span class="nb">sudo tee</span> /etc/modules-load.d/iscsi_tcp.conf
</code></pre></div></div> <p>Then run Longhorn’s environment check script, which reports any missing dependency:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-sSL</span> https://raw.githubusercontent.com/longhorn/longhorn/refs/tags/v1.7.2/scripts/environment_check.sh | bash
</code></pre></div></div> <h2 id="helm-install">Helm install</h2> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>helm repo add longhorn https://charts.longhorn.io <span class="nt">--force-update</span>
helm <span class="nb">install </span>longhorn longhorn/longhorn <span class="nt">--namespace</span> longhorn-system <span class="nt">--create-namespace</span> <span class="nt">--version</span> 1.7.2
</code></pre></div></div> <h3 id="custom-installation">Custom installation</h3> <p>To change the defaults, download the chart’s <code class="language-plaintext highlighter-rouge">values.yaml</code>, edit it, and install with it:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-Lo</span> values.yaml https://raw.githubusercontent.com/longhorn/charts/master/charts/longhorn/values.yaml
</code></pre></div></div> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>helm <span class="nb">install </span>longhorn longhorn/longhorn <span class="se">\</span>
  <span class="nt">--namespace</span> longhorn-system <span class="se">\</span>
  <span class="nt">--create-namespace</span> <span class="se">\</span>
  <span class="nt">--values</span> values.yaml
</code></pre></div></div> <p>To apply changes to <code class="language-plaintext highlighter-rouge">values.yaml</code> later without changing the Longhorn version, upgrade to the version that is already installed:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>helm upgrade longhorn longhorn/longhorn <span class="nt">--namespace</span> longhorn-system <span class="nt">--values</span> ./values.yaml <span class="nt">--version</span> <span class="sb">`</span>helm list <span class="nt">-n</span> longhorn-system <span class="nt">-o</span> json | jq <span class="nt">-r</span> .<span class="s1">'[0].app_version'</span><span class="sb">`</span>
</code></pre></div></div> <h2 id="storage-class">Storage class</h2> <p>The chart creates a <code class="language-plaintext highlighter-rouge">longhorn</code> StorageClass and makes it the default. To use other settings, such as fewer replicas on a small cluster, create another StorageClass:</p> <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">apiVersion</span><span class="pi">:</span> <span class="s">storage.k8s.io/v1</span>
<span class="na">kind</span><span class="pi">:</span> <span class="s">StorageClass</span>
<span class="na">metadata</span><span class="pi">:</span>
  <span class="na">name</span><span class="pi">:</span> <span class="s">longhorn-single</span>
<span class="na">provisioner</span><span class="pi">:</span> <span class="s">driver.longhorn.io</span>
<span class="na">allowVolumeExpansion</span><span class="pi">:</span> <span class="kc">true</span>
<span class="na">reclaimPolicy</span><span class="pi">:</span> <span class="s">Delete</span>
<span class="na">volumeBindingMode</span><span class="pi">:</span> <span class="s">Immediate</span>
<span class="na">parameters</span><span class="pi">:</span>
  <span class="na">numberOfReplicas</span><span class="pi">:</span> <span class="s2">"</span><span class="s">1"</span>
  <span class="na">staleReplicaTimeout</span><span class="pi">:</span> <span class="s2">"</span><span class="s">2880"</span>
  <span class="na">fsType</span><span class="pi">:</span> <span class="s">ext4</span>
  <span class="na">dataLocality</span><span class="pi">:</span> <span class="s">best-effort</span>
</code></pre></div></div> <p>Reference it from a PersistentVolumeClaim with <code class="language-plaintext highlighter-rouge">storageClassName: longhorn-single</code>.</p>]]></content><author><name></name></author><category term="IT"/><category term="kubernetes"/><category term="helm"/><category term="longhorn"/><category term="storage"/><category term="IT"/><summary type="html"><![CDATA[Prepare nodes for Longhorn, install it with Helm, change its settings, and define a custom StorageClass.]]></summary></entry><entry><title type="html">Installing Helm from the Release Binary</title><link href="https://alshedivat.github.io/blog/2024/k8s-helm/" rel="alternate" type="text/html" title="Installing Helm from the Release Binary"/><published>2024-10-29T00:03:00+00:00</published><updated>2024-10-29T00:03:00+00:00</updated><id>https://alshedivat.github.io/blog/2024/k8s-helm</id><content type="html" xml:base="https://alshedivat.github.io/blog/2024/k8s-helm/"><![CDATA[<p><a href="https://helm.sh/docs/intro/install/">Helm</a> is distributed as a single binary. Installing it from the release tarball lets you pin an exact version. Pick a version from the <a href="https://github.com/helm/helm/releases">Helm releases page</a>. This example uses 3.16.2 on <code class="language-plaintext highlighter-rouge">amd64</code>:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">HELM_VERSION</span><span class="o">=</span>v3.16.2
wget https://get.helm.sh/helm-<span class="k">${</span><span class="nv">HELM_VERSION</span><span class="k">}</span><span class="nt">-linux-amd64</span>.tar.gz
<span class="nb">tar</span> <span class="nt">-zxvf</span> helm-<span class="k">${</span><span class="nv">HELM_VERSION</span><span class="k">}</span><span class="nt">-linux-amd64</span>.tar.gz
<span class="nb">sudo install </span>linux-amd64/helm /usr/local/bin/helm
</code></pre></div></div> <p>Verify the installation:</p> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>helm version
</code></pre></div></div> <p>On ARM machines, replace <code class="language-plaintext highlighter-rouge">linux-amd64</code> with <code class="language-plaintext highlighter-rouge">linux-arm64</code>.</p>]]></content><author><name></name></author><category term="IT"/><category term="kubernetes"/><category term="helm"/><category term="IT"/><summary type="html"><![CDATA[Install a specific Helm version on Linux from the official release tarball.]]></summary></entry><entry><title type="html">cert-manager with Cloudflare DNS-01 on Kubernetes</title><link href="https://alshedivat.github.io/blog/2024/k8s-cert-manager/" rel="alternate" type="text/html" title="cert-manager with Cloudflare DNS-01 on Kubernetes"/><published>2024-10-29T00:02:00+00:00</published><updated>2024-10-29T00:02:00+00:00</updated><id>https://alshedivat.github.io/blog/2024/k8s-cert-manager</id><content type="html" xml:base="https://alshedivat.github.io/blog/2024/k8s-cert-manager/"><![CDATA[<p><a href="https://cert-manager.io/docs/">cert-manager</a> issues and renews TLS certificates for Kubernetes workloads. With the DNS-01 challenge and the Cloudflare API, it can get Let’s Encrypt certificates for any domain hosted on Cloudflare, including wildcard certificates and hosts that are not reachable from the internet.</p> <h2 id="install-with-helm">Install with Helm</h2> <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>helm repo add jetstack https://charts.jetstack.io <span class="nt">--force-update</span>

helm <span class="nb">install</span> <span class="se">\</span>
  cert-manager jetstack/cert-manager <span class="se">\</span>
  <span class="nt">--namespace</span> cert-manager <span class="se">\</span>
  <span class="nt">--create-namespace</span> <span class="se">\</span>
  <span class="nt">--version</span> v1.16.1 <span class="se">\</span>
  <span class="nt">--set</span> crds.enabled<span class="o">=</span><span class="nb">true</span>
</code></pre></div></div> <h2 id="cloudflare-dns-issuer">Cloudflare DNS issuer</h2> <p>First create a Cloudflare API token under <strong>My Profile → API Tokens</strong> with these permissions:</p> <ul> <li>Zone → DNS → Edit</li> <li>Zone → Zone → Read</li> </ul> <p>Store the token in a Secret. A ClusterIssuer reads its secrets from the namespace cert-manager runs in, so the Secret must be in <code class="language-plaintext highlighter-rouge">cert-manager</code>:</p> <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">apiVersion</span><span class="pi">:</span> <span class="s">v1</span>
<span class="na">kind</span><span class="pi">:</span> <span class="s">Secret</span>
<span class="na">metadata</span><span class="pi">:</span>
  <span class="na">name</span><span class="pi">:</span> <span class="s">cloudflare-api-token-secret</span>
  <span class="na">namespace</span><span class="pi">:</span> <span class="s">cert-manager</span>
<span class="na">type</span><span class="pi">:</span> <span class="s">Opaque</span>
<span class="na">stringData</span><span class="pi">:</span>
  <span class="na">api-token</span><span class="pi">:</span> <span class="s">&lt;your_secret&gt;</span>
</code></pre></div></div> <p>Then create the ClusterIssuer:</p> <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">apiVersion</span><span class="pi">:</span> <span class="s">cert-manager.io/v1</span>
<span class="na">kind</span><span class="pi">:</span> <span class="s">ClusterIssuer</span>
<span class="na">metadata</span><span class="pi">:</span>
  <span class="na">name</span><span class="pi">:</span> <span class="s">letsencrypt-cf-dns</span>
<span class="na">spec</span><span class="pi">:</span>
  <span class="na">acme</span><span class="pi">:</span>
    <span class="na">privateKeySecretRef</span><span class="pi">:</span>
      <span class="na">name</span><span class="pi">:</span> <span class="s">letsencrypt-cf-dns</span>
    <span class="na">server</span><span class="pi">:</span> <span class="s">https://acme-v02.api.letsencrypt.org/directory</span>
    <span class="na">solvers</span><span class="pi">:</span>
      <span class="pi">-</span> <span class="na">dns01</span><span class="pi">:</span>
          <span class="na">cloudflare</span><span class="pi">:</span>
            <span class="na">apiTokenSecretRef</span><span class="pi">:</span>
              <span class="na">key</span><span class="pi">:</span> <span class="s">api-token</span>
              <span class="na">name</span><span class="pi">:</span> <span class="s">cloudflare-api-token-secret</span>
</code></pre></div></div> <p>To test without hitting Let’s Encrypt’s rate limits, use the staging server <code class="language-plaintext highlighter-rouge">https://acme-staging-v02.api.letsencrypt.org/directory</code> first.</p> <h2 id="use-it-from-an-ingress">Use it from an Ingress</h2> <p>Add the <code class="language-plaintext highlighter-rouge">cert-manager.io/cluster-issuer</code> annotation and a <code class="language-plaintext highlighter-rouge">tls</code> section. cert-manager then creates a Certificate and stores the result in the named Secret:</p> <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">apiVersion</span><span class="pi">:</span> <span class="s">networking.k8s.io/v1</span>
<span class="na">kind</span><span class="pi">:</span> <span class="s">Ingress</span>
<span class="na">metadata</span><span class="pi">:</span>
  <span class="na">name</span><span class="pi">:</span> <span class="s">example</span>
  <span class="na">annotations</span><span class="pi">:</span>
    <span class="na">cert-manager.io/cluster-issuer</span><span class="pi">:</span> <span class="s">letsencrypt-cf-dns</span>
<span class="na">spec</span><span class="pi">:</span>
  <span class="na">ingressClassName</span><span class="pi">:</span> <span class="s">nginx</span>
  <span class="na">tls</span><span class="pi">:</span>
    <span class="pi">-</span> <span class="na">hosts</span><span class="pi">:</span>
        <span class="pi">-</span> <span class="s">app.example.com</span>
      <span class="na">secretName</span><span class="pi">:</span> <span class="s">app-example-com-tls</span>
  <span class="na">rules</span><span class="pi">:</span>
    <span class="pi">-</span> <span class="na">host</span><span class="pi">:</span> <span class="s">app.example.com</span>
      <span class="na">http</span><span class="pi">:</span>
        <span class="na">paths</span><span class="pi">:</span>
          <span class="pi">-</span> <span class="na">path</span><span class="pi">:</span> <span class="s">/</span>
            <span class="na">pathType</span><span class="pi">:</span> <span class="s">Prefix</span>
            <span class="na">backend</span><span class="pi">:</span>
              <span class="na">service</span><span class="pi">:</span>
                <span class="na">name</span><span class="pi">:</span> <span class="s">example</span>
                <span class="na">port</span><span class="pi">:</span>
                  <span class="na">number</span><span class="pi">:</span> <span class="m">80</span>
</code></pre></div></div> <p>Check progress with <code class="language-plaintext highlighter-rouge">kubectl describe certificate -n &lt;namespace&gt;</code> and <code class="language-plaintext highlighter-rouge">kubectl get challenges -A</code>.</p>]]></content><author><name></name></author><category term="IT"/><category term="kubernetes"/><category term="helm"/><category term="cert-manager"/><category term="cloudflare"/><category term="tls"/><category term="IT"/><summary type="html"><![CDATA[Install cert-manager with Helm and issue Let's Encrypt certificates through Cloudflare DNS validation.]]></summary></entry></feed>