<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>にゅーステレオ天国 (AI-assistedについての記事)</title><link>https://kuri65536.bitbucket.io/</link><description></description><atom:link href="https://kuri65536.bitbucket.io/tags/ai-assisted.xml" rel="self" type="application/rss+xml"></atom:link><language>ja</language><copyright>Contents © 2026 &lt;a href="mailto:kuri65536@hotmail.com"&gt;Shimoda&lt;/a&gt; </copyright><lastBuildDate>Wed, 08 Jul 2026 03:54:14 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>systemd: Setup Overlay-Filesystem on Debian 12</title><link>https://kuri65536.bitbucket.io/posts/id03012/</link><dc:creator>Shimoda</dc:creator><description>&lt;div&gt;&lt;p&gt;An Overlay-Filesystem is useful to reduce read/write access to the root-filesystem.
Minimizing root filesystem access extends
the lifespan of the main SD card or flash memory device
in SBC (Single Board Computer) environments.&lt;/p&gt;
&lt;p&gt;This article describes how to set it up with systemd and
its mount or service units.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://kuri65536.bitbucket.io/posts/id03012/"&gt;続きを読む…&lt;/a&gt; (残りを読むのに必要な時間は1分)&lt;/p&gt;&lt;/div&gt;</description><category>AI-assisted</category><category>hack</category><category>linux</category><guid>https://kuri65536.bitbucket.io/posts/id03012/</guid><pubDate>Wed, 08 Jul 2026 03:00:00 GMT</pubDate></item><item><title>hostapd: Speed up Linux WiFi Access Point</title><link>https://kuri65536.bitbucket.io/posts/id03005/</link><dc:creator>Shimoda</dc:creator><description>&lt;div&gt;&lt;ul&gt;
&lt;li&gt;Update (June 2026): Re-tested 2.4GHz AP setup and performed benchmark analysis.&lt;/li&gt;
&lt;li&gt;Update (August 2025): Initial 5GHz AP setup.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is possible to build a custom WiFi Access Point (AP) using
Single Board Computer (SBC) Linux servers.
This article outlines the tuning parameters required to
optimize AP performance.
Through these adjustments, I was able to improve throughput from
8 Mbps to 60 Mbps.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://kuri65536.bitbucket.io/posts/id03005/"&gt;続きを読む…&lt;/a&gt; (残りを読むのに必要な時間は4分)&lt;/p&gt;&lt;/div&gt;</description><category>AI-assisted</category><category>hack</category><category>linux</category><category>SBC</category><guid>https://kuri65536.bitbucket.io/posts/id03005/</guid><pubDate>Sun, 14 Jun 2026 21:00:00 GMT</pubDate></item><item><title>ARM SBC: MQTT Server Install with Rootless Podman</title><link>https://kuri65536.bitbucket.io/posts/id00836/</link><dc:creator>Shimoda</dc:creator><description>&lt;div&gt;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; In this article, MQTT server does not encrypt the communications.
Please setup the TLS encryption for production use.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://kuri65536.bitbucket.io/posts/id00836/"&gt;続きを読む…&lt;/a&gt; (残りを読むのに必要な時間は1分)&lt;/p&gt;&lt;/div&gt;</description><category>AI-assisted</category><category>hack</category><category>linux</category><category>SBC</category><guid>https://kuri65536.bitbucket.io/posts/id00836/</guid><pubDate>Tue, 02 Jun 2026 04:00:00 GMT</pubDate></item><item><title>nim: Build nim application deb package in GitHub Actions (2026/02)</title><link>https://kuri65536.bitbucket.io/posts/id03008/</link><dc:creator>Shimoda</dc:creator><description>&lt;div&gt;&lt;p&gt;We can make applications with nim language
on debian-like operating systems.
And if you want to share the application,
making it into package is a nice idea.&lt;/p&gt;
&lt;p&gt;When you want to automate the packaging with GitHub Actions,
building and packaging in GitHub Actions
are not easy for nim application in my case.&lt;/p&gt;
&lt;p&gt;This article explains the build and package method
with GitHub Actions environment&lt;/p&gt;
&lt;p&gt;TL;DR&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If you use the OS shipment nim version, it is easier than nim specific version.&lt;/li&gt;
&lt;li&gt;Debian packaging is complex and hard to find its method,
  but the automate is easy with this article.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://kuri65536.bitbucket.io/posts/id03008/"&gt;続きを読む…&lt;/a&gt; (残りを読むのに必要な時間は2分)&lt;/p&gt;&lt;/div&gt;</description><category>AI-assisted</category><category>nim</category><guid>https://kuri65536.bitbucket.io/posts/id03008/</guid><pubDate>Tue, 17 Feb 2026 23:00:00 GMT</pubDate></item><item><title>hostapd: How to Set Up a WiFi Access Point with hostapd on Raspberry Pi OS</title><link>https://kuri65536.bitbucket.io/posts/id03002/</link><dc:creator>Shimoda</dc:creator><description>&lt;div&gt;&lt;p&gt;You can easily turn a Raspberry Pi into a WiFi access point
using the hostapd software package.&lt;/p&gt;
&lt;p&gt;However, if you're using an external USB WiFi adapter,
you may need a helper script to reliably unblock the interface at boot.&lt;/p&gt;
&lt;p&gt;This guide provides step-by-step instructions to get it set up
correctly.&lt;/p&gt;
&lt;h3&gt;Install the required packages&lt;/h3&gt;
&lt;p&gt;First, install hostapd:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;apt&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;-y&lt;span class="w"&gt; &lt;/span&gt;hostapd
&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;Create the hostapd Configuration file&lt;/h3&gt;
&lt;p&gt;Next, create the hostapd configuration file at /etc/hostapd.conf
with the following content.&lt;/p&gt;
&lt;p&gt;Be sure to change the ssid and wpa_passphrase to your liking.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;interface=wlan0
bridge=br0
driver=nl80211

logger_syslog=-1
logger_syslog_level=3
logger_stdout=-1
logger_stdout_level=3

ctrl_interface=/var/run/hostapd
ctrl_interface_group=0

ssid=test-test
macaddr_acl=0

country_code=JP
ieee80211d=1

hw_mode=a
ieee80211n=1
ieee80211ac=1
channel=40      # 40: 5200MHz, see: iw phy

auth_algs=1
wpa=2
wpa_passphrase=strong-pw-a
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP

wmm_enabled=1
wme_enabled=0
&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;Unblock the WiFi Interface with rfkill&lt;/h3&gt;
&lt;p&gt;Before hostapd can run,
the WiFi interface must be unblocked using rfkill.&lt;/p&gt;
&lt;p&gt;The challenge is that the rfkill ID is not fixed for removable hardware
like USB WiFi adapters; it can change each time you reboot.&lt;/p&gt;
&lt;p&gt;To solve this, I wrote a script that automatically finds
the correct device and unblocks it.&lt;/p&gt;
&lt;p&gt;This example is for a device using the 8812au driver.
Save the following script as &lt;code&gt;/root/unblock-rtl8812au.sh&lt;/code&gt;:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="ch"&gt;#! /bin/bash&lt;/span&gt;
&lt;span class="nv"&gt;find_tgt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/sys/class/net/wlan*
&lt;span class="nv"&gt;find_opt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"-q 8812au"&lt;/span&gt;

&lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;find_8812au_dev&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;i&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$find_tgt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;do&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;udevadm&lt;span class="w"&gt; &lt;/span&gt;info&lt;span class="w"&gt; &lt;/span&gt;-a&lt;span class="w"&gt; &lt;/span&gt;--path&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$find_opt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;udevadm&lt;span class="w"&gt; &lt;/span&gt;info&lt;span class="w"&gt; &lt;/span&gt;-a&lt;span class="w"&gt; &lt;/span&gt;--path&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;sed&lt;span class="w"&gt; &lt;/span&gt;-n&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'s/[ \t]*KERNEL=="\(.*\)"/\1/p'&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;done&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;find_phy_name&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;n&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;iw&lt;span class="w"&gt; &lt;/span&gt;dev&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;info&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;sed&lt;span class="w"&gt; &lt;/span&gt;-n&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'s/[ \t]\+wiphy[ \t]\+\([0-9]\+\)/\1/p'&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;wiphy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Wiphy phy&lt;/span&gt;&lt;span class="nv"&gt;$n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;iw&lt;span class="w"&gt; &lt;/span&gt;list&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'^\S'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;read&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;l&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;do&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;#cho "$l - $n - $wiphy"&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$l&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$wiphy&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"phy&lt;/span&gt;&lt;span class="nv"&gt;$n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;done&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;find_rfkill_id&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;rfkill&lt;span class="w"&gt; &lt;/span&gt;list&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;cut&lt;span class="w"&gt; &lt;/span&gt;-d&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;" "&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-f&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;tmp&lt;/span&gt;&lt;span class="p"&gt;%%:&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;


&lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;unblock&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;sleep&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;dev&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;find_8812au_dev&lt;span class="k"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"got device: &lt;/span&gt;&lt;span class="nv"&gt;$dev&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;phy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;find_phy_name&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$dev&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"got phy: &lt;/span&gt;&lt;span class="nv"&gt;$phy&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;find_rfkill_id&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$phy&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;rfkill&lt;span class="w"&gt; &lt;/span&gt;unblock&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$id&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

unblock
&lt;/pre&gt;&lt;/div&gt;

&lt;hr&gt;
&lt;h3&gt;Modify the systemd Service&lt;/h3&gt;
&lt;p&gt;To run the script created above,
we will modify the hostapd systemd service.&lt;/p&gt;
&lt;p&gt;We'll use the &lt;code&gt;ExecStartPre&lt;/code&gt; directive,
which runs a command before the main service starts.&lt;/p&gt;
&lt;p&gt;You can either edit the service file directly or,
preferably, create an override file using
&lt;code&gt;systemctl edit hostapd.service&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Add the following lines:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;[Service]
...
ExecStartPre=/root/unblock-rtl8812au.sh
&lt;/pre&gt;&lt;/div&gt;

&lt;h3&gt;Start and Enable the Service&lt;/h3&gt;
&lt;p&gt;After modifying the systemd settings,
reload the daemon,
start the service,
and then check its status to confirm it's running without errors:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;daemon-reload
systemctl&lt;span class="w"&gt; &lt;/span&gt;start&lt;span class="w"&gt; &lt;/span&gt;hostapd
systemctl&lt;span class="w"&gt; &lt;/span&gt;status&lt;span class="w"&gt; &lt;/span&gt;hostapd
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;If everything looks good,
enable the service to start automatically on boot:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;enable&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;hostapd
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Your Raspberry Pi should now be functioning as
a WiFi access point! 🎉&lt;/p&gt;
&lt;p&gt;&lt;a href="https://kuri65536.bitbucket.io/posts/id03002/"&gt;続きを読む…&lt;/a&gt; (残りを読むのに必要な時間は1分)&lt;/p&gt;&lt;/div&gt;</description><category>AI-assisted</category><category>hack</category><category>linux</category><category>SBC</category><guid>https://kuri65536.bitbucket.io/posts/id03002/</guid><pubDate>Wed, 15 Oct 2025 11:00:00 GMT</pubDate></item><item><title>systemd: enabling a user-unit service</title><link>https://kuri65536.bitbucket.io/posts/id03006/</link><dc:creator>Shimoda</dc:creator><description>&lt;div&gt;&lt;p&gt;In my experience,
setting up a systemd service as a user unit can be trickier
than setting it up as a system unit.&lt;/p&gt;
&lt;p&gt;You need to pay attention to a few key points
to get it working correctly.&lt;/p&gt;
&lt;h4&gt;TL;DR&lt;/h4&gt;
&lt;p&gt;At first, here is my service file.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;[Unit]
Description=voice from pushbullet
#Wants=default.target
After=network.target

[Service]
Type=simple
WorkingDirectory=%h/src/pb-va
ExecStart=%h/bin/pb_va some options...
ExecStop=pkill pb-va
Restart=always

[Install]
WantedBy=default.target
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Copy this file to the systemd directory and enable it::&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;$&lt;span class="w"&gt; &lt;/span&gt;mkdir&lt;span class="w"&gt; &lt;/span&gt;-p&lt;span class="w"&gt; &lt;/span&gt;~/.config/systemd/user
$&lt;span class="w"&gt; &lt;/span&gt;cp&lt;span class="w"&gt; &lt;/span&gt;pb-va.service&lt;span class="w"&gt; &lt;/span&gt;~/.config/systemd/user
$&lt;span class="w"&gt; &lt;/span&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;--user&lt;span class="w"&gt; &lt;/span&gt;daemon-reload
$&lt;span class="w"&gt; &lt;/span&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;--user&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;enable&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;pb-va.service
$&lt;span class="w"&gt; &lt;/span&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;--user&lt;span class="w"&gt; &lt;/span&gt;start&lt;span class="w"&gt; &lt;/span&gt;pb-va.service
$&lt;span class="w"&gt; &lt;/span&gt;loginctl&lt;span class="w"&gt; &lt;/span&gt;enable-linger&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$USER&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;h4&gt;Do not specify the &lt;code&gt;User=&lt;/code&gt; and &lt;code&gt;Group=&lt;/code&gt; options&lt;/h4&gt;
&lt;p&gt;In the &lt;code&gt;[Service]&lt;/code&gt; section,
system units can use the &lt;code&gt;User=&lt;/code&gt; and &lt;code&gt;Group=&lt;/code&gt; options.&lt;/p&gt;
&lt;p&gt;However, user units run under your own user account by default,
so adding these options will cause the service to fail
on startup.&lt;/p&gt;
&lt;h4&gt;Use User-Specific Targets like default.target&lt;/h4&gt;
&lt;p&gt;You might be used to seeing targets like multi-user.target
in system-wide services.&lt;/p&gt;
&lt;p&gt;Those targets are for system units and won't work for user units.
For user services, you should almost always use WantedBy=default.target.&lt;/p&gt;
&lt;p&gt;This is the user's equivalent and
ensures your service starts after you log in.&lt;/p&gt;
&lt;p&gt;Remember to re-enable the service and reload the daemon
after changing the serfice file to
apply your changes:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;$&lt;span class="w"&gt; &lt;/span&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;--user&lt;span class="w"&gt; &lt;/span&gt;daemon-reload
$&lt;span class="w"&gt; &lt;/span&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;--user&lt;span class="w"&gt; &lt;/span&gt;disable&lt;span class="w"&gt; &lt;/span&gt;pb-va.service
$&lt;span class="w"&gt; &lt;/span&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;--user&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;enable&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;pb-va.service
&lt;/pre&gt;&lt;/div&gt;

&lt;h4&gt;Run Services Even When Logged Out (Enable Linger)&lt;/h4&gt;
&lt;p&gt;By default, user services stop when you log out.&lt;/p&gt;
&lt;p&gt;If you want your service to start at boot and keep running,
you must enable linger for your user.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;$&lt;span class="w"&gt; &lt;/span&gt;loginctl&lt;span class="w"&gt; &lt;/span&gt;enable-linger&lt;span class="w"&gt; &lt;/span&gt;your-username

&lt;span class="c1"&gt;# then confirm the linger status.&lt;/span&gt;

$&lt;span class="w"&gt; &lt;/span&gt;loginctl&lt;span class="w"&gt; &lt;/span&gt;list-users
&lt;span class="w"&gt; &lt;/span&gt;UID&lt;span class="w"&gt; &lt;/span&gt;USER&lt;span class="w"&gt;   &lt;/span&gt;LINGER
&lt;span class="m"&gt;1001&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;your-username&lt;span class="w"&gt; &lt;/span&gt;yes
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://kuri65536.bitbucket.io/posts/id03006/"&gt;続きを読む…&lt;/a&gt; (残りを読むのに必要な時間は1分)&lt;/p&gt;&lt;/div&gt;</description><category>AI-assisted</category><category>hack</category><category>linux</category><guid>https://kuri65536.bitbucket.io/posts/id03006/</guid><pubDate>Tue, 14 Oct 2025 23:00:00 GMT</pubDate></item><item><title>The ssh error: failed remote commands by stty in login shell</title><link>https://kuri65536.bitbucket.io/posts/id03004/</link><dc:creator>Shimoda</dc:creator><description>&lt;div&gt;&lt;p&gt;I used the &lt;code&gt;stty&lt;/code&gt; command in .bashrc,
it cause &lt;code&gt;ssh&lt;/code&gt; errors with no-console.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="c1"&gt;# nothing for the output&lt;/span&gt;

$&lt;span class="w"&gt; &lt;/span&gt;ssh&lt;span class="w"&gt; &lt;/span&gt;host&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1234&lt;/span&gt;

&lt;span class="c1"&gt;# you can check the warning with `-v` option&lt;/span&gt;

$&lt;span class="w"&gt; &lt;/span&gt;ssh&lt;span class="w"&gt; &lt;/span&gt;-vv&lt;span class="w"&gt; &lt;/span&gt;host&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1234&lt;/span&gt;

Pseudo-terminal&lt;span class="w"&gt; &lt;/span&gt;will&lt;span class="w"&gt; &lt;/span&gt;not&lt;span class="w"&gt; &lt;/span&gt;be&lt;span class="w"&gt; &lt;/span&gt;allocated&lt;span class="w"&gt; &lt;/span&gt;because&lt;span class="w"&gt; &lt;/span&gt;stdin&lt;span class="w"&gt; &lt;/span&gt;is&lt;span class="w"&gt; &lt;/span&gt;not&lt;span class="w"&gt; &lt;/span&gt;a&lt;span class="w"&gt; &lt;/span&gt;terminal.
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The stty command is used to change terminal settings,
so it requires a TTY to function.&lt;/p&gt;
&lt;p&gt;When it runs in a non-interactive shell without a TTY,
it fails and can cause the entire script or SSH
session to exit unexpectedly.&lt;/p&gt;
&lt;p&gt;To fix this, I commented out the &lt;code&gt;stty&lt;/code&gt; commands in my bash::&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;if false; then
    stty ...
fi
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Please check your login script files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.profile&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.bash_login&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.bashrc&lt;/code&gt; or etc&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Finally, I add the follow line before &lt;code&gt;stty&lt;/code&gt; command to
avoid the this problem.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;[[ $- != *i* ]] &amp;amp;&amp;amp; return
stty ...
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;According to man bash:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;PS1 is set and $- includes i if bash is interactive,
allowing a shell script or a startup file to
test this state.
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://kuri65536.bitbucket.io/posts/id03004/"&gt;続きを読む…&lt;/a&gt; (残りを読むのに必要な時間は1分)&lt;/p&gt;&lt;/div&gt;</description><category>AI-assisted</category><category>hack</category><category>linux</category><category>SBC</category><guid>https://kuri65536.bitbucket.io/posts/id03004/</guid><pubDate>Mon, 13 Oct 2025 23:00:00 GMT</pubDate></item><item><title>systemd: Reducing SD Card Wear with OverlayFS and Systemd</title><link>https://kuri65536.bitbucket.io/posts/id00844/</link><dc:creator>Shimoda</dc:creator><description>&lt;div&gt;&lt;p&gt;SD cards have a limited number of write cycles, making them a common failure point for SBCs like
the Raspberry Pi. One of the most effective ways to prolong the life of your SD card is to use an
OverlayFS to redirect write-heavy operations to a different storage medium (or RAM).&lt;/p&gt;
&lt;p&gt;In this article, I will demonstrate how to set up persistent OverlayFS mounts using systemd and
Makefile.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://kuri65536.bitbucket.io/posts/id00844/"&gt;続きを読む…&lt;/a&gt; (残りを読むのに必要な時間は1分)&lt;/p&gt;&lt;/div&gt;</description><category>AI-assisted</category><category>hack</category><category>linux</category><category>SBC</category><guid>https://kuri65536.bitbucket.io/posts/id00844/</guid><pubDate>Thu, 31 Jul 2025 00:00:00 GMT</pubDate></item><item><title>Securely Erasing an HDD with Raspberry Pi</title><link>https://kuri65536.bitbucket.io/posts/id03001/</link><dc:creator>Shimoda</dc:creator><description>&lt;div&gt;&lt;p&gt;I wanted to securely erase an old HDD using a Raspberry Pi without installing
additional tools like &lt;code&gt;wipe&lt;/code&gt; or &lt;code&gt;shred&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I found that badblocks is a convenient
alternative already available on most Linux systems.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://kuri65536.bitbucket.io/posts/id03001/"&gt;続きを読む…&lt;/a&gt; (残りを読むのに必要な時間は1分)&lt;/p&gt;&lt;/div&gt;</description><category>AI-assisted</category><category>hack</category><category>linux</category><guid>https://kuri65536.bitbucket.io/posts/id03001/</guid><pubDate>Mon, 28 Jul 2025 10:00:00 GMT</pubDate></item></channel></rss>