<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>nuc on Daan Geijs</title>
    <link>https://www.daangeijs.nl/tags/nuc/</link>
    <description>Recent content in nuc on Daan Geijs</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 06 Mar 2025 12:48:00 +0100</lastBuildDate><atom:link href="https://www.daangeijs.nl/tags/nuc/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Fixing ASPM and Deep C-States on Intel NUC 7th gen</title>
      <link>https://www.daangeijs.nl/posts/cstates-nuc/</link>
      <pubDate>Thu, 06 Mar 2025 12:48:00 +0100</pubDate>
      
      <guid>https://www.daangeijs.nl/posts/cstates-nuc/</guid>
      <description>If you own an Intel NUC and are struggling to reach deep power-saving states like C8 or C9, your issue might be related to PCIe Active State Power Management (ASPM). I recently ran into this problem with my Intel NUC 7th Gen, where the system was stuck at C3 states despite my best efforts to tweak Linux power settings.</description>
      <content:encoded><![CDATA[<h3 id="introduction">Introduction</h3>
<p>If you own an Intel NUC and are struggling to reach deep power-saving states like C8 or C9, your issue might be related to PCIe Active State Power Management (ASPM). I recently ran into this problem with my Intel NUC 7th Gen, where the system was stuck at C3 states despite my best efforts to tweak Linux power settings. Through trial and error, I discovered that an outdated BIOS was blocking ASPM on my NVMe SSD, preventing the system from reaching deeper C-states. A BIOS update ultimately resolved the issue! If you&rsquo;re facing a similar problem, this guide will walk you through the solution.</p>
<h3 id="the-problem-why-was-my-intel-nuc-stuck-at-c3">The Problem: Why Was My Intel NUC Stuck at C3?</h3>
<p>I started with PowerTOP, an essential diagnostic tool for Linux power management. To install it on most Linux distributions, use one of these commands:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo apt-get install powertop
</span></span></code></pre></div><p>After installation, you can run PowerTOP with privileges:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo powertop
</span></span></code></pre></div><h3 id="checking-power-states-with-powertop">Checking Power States with PowerTOP</h3>
<p>After running PowerTOP and going to the &lsquo;Idle Stats&rsquo; tab, I noticed that my system was only reaching C3 states, instead of the deeper C8-C10 states that Intel CPUs support. So clearly, something was blocking my system from reaching deeper states. The first thing that I tried was to run auto-tune. PowerTOP includes this feature that applies various power-saving settings:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo powertop --auto-tune
</span></span></code></pre></div><p>This command applies recommended settings for all power management features. However, in my case, even after running auto-tune, the system remained stuck at C3 states, indicating a deeper issue.</p>
<h3 id="investigating-pcie-aspm-with-lspci">Investigating PCIe ASPM with <code>lspci</code></h3>
<p>Since NVMe SSDs and PCIe devices can block deep C-states, I checked their ASPM support, and I easily found one device not being ASPM enabled.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo lspci -vv <span class="p">|</span> awk <span class="s1">&#39;/ASPM/{print $0}&#39;</span> <span class="nv">RS</span><span class="o">=</span> <span class="p">|</span> grep --color -P <span class="s1">&#39;(^[a-z0-9:.]+|ASPM )&#39;</span>
</span></span></code></pre></div><p>I noticed multiple things:</p>
<ul>
<li>My Samsung SM961 NVMe SSD (3a:00.0) supports ASPM L1, but it was disabled.</li>
<li>The PCIe Root Port (00:1d.0) did not support ASPM.</li>
<li>Another PCIe Root Port (00:1c.0) did support ASPM, but nothing was connected to it.</li>
</ul>
<p>This suggested that my NVMe SSD was stuck on a PCIe port that does not support ASPM, blocking deep sleep states.</p>
<h3 id="forcing-aspm-enable">Forcing ASPM Enable</h3>
<p>Before diving into BIOS updates, I tried a helpful script from GitHub called AutoASPM, which attempts to enable ASPM for all devices, hoping this would enable ASPM.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Clone the repository</span>
</span></span><span class="line"><span class="cl">git clone https://github.com/notthebee/AutoASPM
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> AutoASPM
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Run the script (requires sudo)</span>
</span></span><span class="line"><span class="cl">sudo python3 autoaspm.py
</span></span></code></pre></div><p>This script tries to enable ASPM across all PCI devices by writing to the appropriate kernel interface files. However, in my case, since the BIOS had disabled ASPM at a hardware level, the script couldn&rsquo;t overcome this limitation. After running again:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo lspci -vv <span class="p">|</span> awk <span class="s1">&#39;/ASPM/{print $0}&#39;</span> <span class="nv">RS</span><span class="o">=</span> <span class="p">|</span> grep --color -P <span class="s1">&#39;(^[a-z0-9:.]+|ASPM )&#39;</span>
</span></span></code></pre></div><p>I still noticed that my ASPM was disabled for the NVMe.</p>
<p>If you&rsquo;re facing similar issues, try this script first—it may solve your problem without requiring a BIOS update.</p>
<h3 id="checking-bios-configuration-for-aspm">Checking BIOS Configuration for ASPM</h3>
<p>After trying software solutions without success, I decided to check if my BIOS was configured correctly for ASPM. I confirmed that <strong>PCIe ASPM Support</strong> was enabled in the BIOS.</p>
<figure>
    <img loading="lazy" src="image_bios.jpg"/> 
</figure>

<p>Despite this correct configuration in the BIOS, my system still could not reach deeper C-states. This led me to conclude that either the port my NVMe SSD was using did not allow lower power states. However, this conclusion did not make sense to me—why would an Intel NUC engineer design it this way? So the next day, I decided to give it one last try and check if this was an issue that was solved by a BIOS update.</p>
<h3 id="the-fix-updating-my-bios">The Fix: Updating My BIOS</h3>
<p>As a last resort, I checked Intel&rsquo;s website for a newer BIOS version (which is now moved to ASUS) for my NUC model (NUC7i5BNK). I found a BIOS update <a href="https://www.asus.com/supportonly/nuc7i5bnk/helpdesk_bios/">here</a> on the ASUS website.</p>
<p>I followed the instructions:</p>
<ul>
<li>Downloaded the ZIP file.</li>
<li>Unzipped and added the <code>.bio</code> file to a USB flash drive.</li>
<li>Booted my NUC with the USB flash drive while spamming <code>F7</code>.</li>
<li>Selected the <code>.bio</code> file from the menu and let the system update itself.</li>
</ul>
<p>Once the BIOS update was complete, I quickly verified that my BIOS settings were still untouched— PCIe ASPM Support was still enabled. After rebooting, I ran the same power state checks:</p>
<p>Now I was able to run AutoASPM and verify that it was working with:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo lspci -vv <span class="p">|</span> awk <span class="s1">&#39;/ASPM/{print $0}&#39;</span> <span class="nv">RS</span><span class="o">=</span> <span class="p">|</span> grep --color -P <span class="s1">&#39;(^[a-z0-9:.]+|ASPM )&#39;</span>
</span></span></code></pre></div><p>And after running:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo powertop
</span></span></code></pre></div><p>I noticed that the output now showed C8 and even C9 states, with 20% less power consumption! Okay, I&rsquo;ll be honest with you— 3 watts saved. But hey, free energy savings!</p>
<h3 id="bonus-enabling-aspm-for-other-devices">Bonus: Enabling ASPM for Other Devices</h3>
<p>Through this process, I became faster in checking the ASPM states of all devices, which really helped me in another project. For example, there I immediately identified one device that was not ASPM-enabled. Back then enabled it manually with:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> <span class="m">1</span> <span class="p">|</span> sudo tee /sys/bus/pci/drivers/r8169/0000:01:00.0/link/l1_aspm
</span></span></code></pre></div><p>However, by going all the way on this NUC, I now discovered this useful Python script. I think for each system, you could run AutoASPM, along with <code>powertop --auto-tune</code>, and verify with the regex <code>lspci</code> command to get a very high success rate of reaching deep C-states.</p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
