<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nurlan</title>
    <description>The latest articles on DEV Community by Nurlan (@redrum_yot).</description>
    <link>https://dev.to/redrum_yot</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3146815%2Faf6c9584-283a-4fb8-a8ee-b2ede8bd591a.png</url>
      <title>DEV Community: Nurlan</title>
      <link>https://dev.to/redrum_yot</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/redrum_yot"/>
    <language>en</language>
    <item>
      <title>How to Find and Clean Up Unowned `__pycache__` Directories on Arch Linux</title>
      <dc:creator>Nurlan</dc:creator>
      <pubDate>Mon, 02 Jun 2025 06:08:02 +0000</pubDate>
      <link>https://dev.to/redrum_yot/how-to-find-and-clean-up-unowned-pycache-directories-on-arch-linux-206n</link>
      <guid>https://dev.to/redrum_yot/how-to-find-and-clean-up-unowned-pycache-directories-on-arch-linux-206n</guid>
      <description>&lt;p&gt;When you install or run Python-based tools on Arch Linux — especially from the AUR — you might notice that your system accumulates a lot of &lt;code&gt;__pycache__&lt;/code&gt; directories. These are generated when Python byte-compiles modules, but they aren’t always removed when you uninstall a package.&lt;/p&gt;

&lt;p&gt;In this short guide, we’ll walk through how to identify and optionally clean up those &lt;code&gt;__pycache__&lt;/code&gt; directories — &lt;strong&gt;specifically the ones not owned by any package&lt;/strong&gt; — and &lt;strong&gt;exclude system paths like Flatpak&lt;/strong&gt; while we're at it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Does This Happen?
&lt;/h2&gt;

&lt;p&gt;Tools installed via the AUR (like &lt;code&gt;waydroid-scripts-git&lt;/code&gt;, for example) might drop files under &lt;code&gt;/opt&lt;/code&gt;, &lt;code&gt;/usr/local&lt;/code&gt;, or other places. These files (especially &lt;code&gt;.py&lt;/code&gt; and &lt;code&gt;__pycache__&lt;/code&gt;) might not be tracked by &lt;code&gt;pacman&lt;/code&gt;, so even after uninstalling the tool, leftover Python cache directories can remain.&lt;/p&gt;




&lt;h2&gt;
  
  
  Finding Unowned &lt;code&gt;__pycache__&lt;/code&gt; Directories
&lt;/h2&gt;

&lt;p&gt;Here’s a one-liner that will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Search your system for all &lt;code&gt;__pycache__&lt;/code&gt; directories&lt;/li&gt;
&lt;li&gt;Skip the Flatpak directory (&lt;code&gt;/var/lib/flatpak&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Check whether each is owned by any package&lt;/li&gt;
&lt;li&gt;Print only the ones that are &lt;strong&gt;not owned&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find / &lt;span class="nt"&gt;-type&lt;/span&gt; d &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s1"&gt;'__pycache__'&lt;/span&gt; &lt;span class="nt"&gt;-not&lt;/span&gt; &lt;span class="nt"&gt;-path&lt;/span&gt; &lt;span class="s1"&gt;'/var/lib/flatpak/*'&lt;/span&gt; 2&amp;gt;/dev/null | &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="nb"&gt;read dir&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  &lt;/span&gt;pacman &lt;span class="nt"&gt;-Qo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$dir&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &amp;amp;&amp;gt;/dev/null &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Not owned: &lt;/span&gt;&lt;span class="nv"&gt;$dir&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Output Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Not owned: /opt/waydroid-scripts/tools/__pycache__
Not owned: /usr/local/lib/python3.11/site-packages/some_tool/__pycache__
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;__pycache__&lt;/code&gt; directories aren't dangerous, but they can accumulate and clutter your system — especially in directories that aren’t cleaned by package managers. With a few commands, you can find and clean up these leftovers safely, keeping your system neat and under control.&lt;/p&gt;

&lt;p&gt;Have your own cleanup tricks? Share them in the comments! &lt;/p&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>Fingerprint Not Working After Sleep?</title>
      <dc:creator>Nurlan</dc:creator>
      <pubDate>Sat, 10 May 2025 19:05:57 +0000</pubDate>
      <link>https://dev.to/redrum_yot/fingerprint-not-working-after-sleep-2nje</link>
      <guid>https://dev.to/redrum_yot/fingerprint-not-working-after-sleep-2nje</guid>
      <description>&lt;p&gt;If you're using &lt;code&gt;fprintd&lt;/code&gt; for fingerprint authentication on Linux and encounter this error after waking your system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Device reported an error during identify: Cannot run while suspended.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;…it likely means the fingerprint device fails to recover correctly after suspend or hibernate.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Quick Fix
&lt;/h3&gt;

&lt;p&gt;You can fix this by restarting the &lt;code&gt;fprintd&lt;/code&gt; service automatically after resume. Here's how:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Create a systemd service
&lt;/h3&gt;

&lt;p&gt;Create a file at &lt;code&gt;/etc/systemd/system/restart-fprintd-after-suspend.service&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="nn"&gt;[Unit]&lt;/span&gt;
&lt;span class="py"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;Restart fprintd after suspend&lt;/span&gt;
&lt;span class="py"&gt;After&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target&lt;/span&gt;

&lt;span class="nn"&gt;[Service]&lt;/span&gt;
&lt;span class="py"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;oneshot&lt;/span&gt;
&lt;span class="py"&gt;ExecStart&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/bin/systemctl restart fprintd.service&lt;/span&gt;

&lt;span class="nn"&gt;[Install]&lt;/span&gt;
&lt;span class="py"&gt;WantedBy&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Enable the service
&lt;/h3&gt;

&lt;p&gt;Enable the service running this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;--now&lt;/span&gt; restart-fprintd-after-suspend.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now &lt;code&gt;fprintd&lt;/code&gt; will restart automatically after suspend or hibernate, and your fingerprint sensor should work reliably again.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
    </item>
    <item>
      <title>Understanding Drop-in Overrides in systemd: When Parameters Accumulate vs Override</title>
      <dc:creator>Nurlan</dc:creator>
      <pubDate>Sat, 10 May 2025 11:54:37 +0000</pubDate>
      <link>https://dev.to/redrum_yot/understanding-drop-in-overrides-in-systemd-when-parameters-accumulate-vs-override-3noi</link>
      <guid>https://dev.to/redrum_yot/understanding-drop-in-overrides-in-systemd-when-parameters-accumulate-vs-override-3noi</guid>
      <description>&lt;p&gt;When working with &lt;strong&gt;systemd&lt;/strong&gt; units, you often want to override or tweak an existing unit file without rewriting it entirely. That's where &lt;strong&gt;drop-in overrides&lt;/strong&gt; come in.&lt;/p&gt;

&lt;p&gt;But there's a subtle behavior many people miss: &lt;strong&gt;not all parameters behave the same way when overridden!&lt;/strong&gt; Some get completely replaced; others accumulate values.&lt;/p&gt;

&lt;p&gt;This article explains this behavior, especially for those dealing with &lt;code&gt;.timer&lt;/code&gt; or &lt;code&gt;.service&lt;/code&gt; files.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 What are drop-in overrides?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;drop-in override&lt;/strong&gt; is an additional configuration file placed under &lt;code&gt;/etc/systemd/system/&amp;lt;unit&amp;gt;.d/*.conf&lt;/code&gt; that supplements or overrides the main unit definition.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/etc/systemd/system/pkgfile-update.timer.d/override.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Contents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="nn"&gt;[Timer]&lt;/span&gt;
&lt;span class="py"&gt;OnCalendar&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;weekly&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It lets you modify behavior without touching &lt;code&gt;/usr/lib/systemd/system/pkgfile-update.timer&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Another way to do this is to run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl edit unit &lt;span class="nt"&gt;--drop-in&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;drop_in_name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This opens the file &lt;code&gt;/etc/systemd/system/unit.d/drop_in_name.conf&lt;/code&gt; in your text editor (creating it if necessary) and automatically reloads the unit when you are done editing. Omitting &lt;code&gt;--drop-in=&lt;/code&gt; option will result in systemd using the default file name override.conf.&lt;/p&gt;




&lt;h2&gt;
  
  
  But here's the catch: &lt;code&gt;OnCalendar&lt;/code&gt; doesn't override, it &lt;strong&gt;adds&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If the original timer file contains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="nn"&gt;[Timer]&lt;/span&gt;
&lt;span class="py"&gt;OnCalendar&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;daily&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And your drop-in contains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="nn"&gt;[Timer]&lt;/span&gt;
&lt;span class="py"&gt;OnCalendar&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;weekly&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then &lt;strong&gt;both&lt;/strong&gt; schedules will be active: &lt;code&gt;daily&lt;/code&gt; &lt;strong&gt;and&lt;/strong&gt; &lt;code&gt;weekly&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is because &lt;code&gt;OnCalendar&lt;/code&gt; supports &lt;strong&gt;multiple entries&lt;/strong&gt;; adding a new one doesn't replace the old.&lt;/p&gt;

&lt;p&gt;You can verify this with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl show pkgfile-update.timer | &lt;span class="nb"&gt;grep &lt;/span&gt;OnCalendar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ✅ How to truly override &lt;code&gt;OnCalendar&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;To replace existing values, you must explicitly reset the field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="nn"&gt;[Timer]&lt;/span&gt;
&lt;span class="py"&gt;OnCalendar&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;
&lt;span class="py"&gt;OnCalendar&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;weekly&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first &lt;code&gt;OnCalendar=&lt;/code&gt; clears all previous values. The second sets the new one.&lt;/p&gt;

&lt;p&gt;Then reload and restart:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl daemon-reload
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart pkgfile-update.timer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Key takeaway
&lt;/h2&gt;

&lt;p&gt;If you override parameters in systemd drop-ins, be aware:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Some parameters stack up (accumulate)&lt;/strong&gt; → use an empty assignment to clear.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Others overwrite directly.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This small difference can save hours debugging why your override didn't "take effect".&lt;/p&gt;

&lt;p&gt;Happy systemd hacking!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>archlinux</category>
    </item>
  </channel>
</rss>
