本文を読み飛ばす

systemd: enabling a user-unit service

In my experience, setting up a systemd service as a user unit can be trickier than setting it up as a system unit.

You need to pay attention to a few key points to get it working correctly.

TL;DR

At first, here is my service file.

[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

Copy this file to the systemd directory and enable it::

$ mkdir -p ~/.config/systemd/user
$ cp pb-va.service ~/.config/systemd/user
$ systemctl --user daemon-reload
$ systemctl --user enable pb-va.service
$ systemctl --user start pb-va.service
$ loginctl enable-linger $USER

Do not specify the User= and Group= options

In the [Service] section, system units can use the User= and Group= options.

However, user units run under your own user account by default, so adding these options will cause the service to fail on startup.

Use User-Specific Targets like default.target

You might be used to seeing targets like multi-user.target in system-wide services.

Those targets are for system units and won't work for user units. For user services, you should almost always use WantedBy=default.target.

This is the user's equivalent and ensures your service starts after you log in.

Remember to re-enable the service and reload the daemon after changing the serfice file to apply your changes:

$ systemctl --user daemon-reload
$ systemctl --user disable pb-va.service
$ systemctl --user enable pb-va.service

Run Services Even When Logged Out (Enable Linger)

By default, user services stop when you log out.

If you want your service to start at boot and keep running, you must enable linger for your user.

$ loginctl enable-linger your-username

# then confirm the linger status.

$ loginctl list-users
 UID USER   LINGER
1001 your-username yes

gameクリアならず: PS4: Spelunky 2 (実績??%)

  • 2025/10/12 追記 ... 2回目のsunken
  • 2025/09/15 追記 ... コントン クリア
  • 2025/09/07 追記 ... jungleクリア
  • 2025/04/24 追記 ... sparrow quest
  • 2025/01/24 追記
  • 2024/12/20 購入

Winter sale? になっていたので購入。 楽しみでした。

2-3日やった感じ、相変わらずの難度で
やりごたえ十分です。

こうするとこうなるのか...というのが
次々でてくるのが楽しいですね。

  • カーリー様が出してくれるカパラは必須アイテム。

    • 血を集めるとハートが増える超重要
  • 海の面にある死の罠の回避は爆弾の設置方法を覚えるとそこそこ簡単

    • ただし、縄を数もっていて、さらにマントがないと厳しい。
    • ここまで来ると王冠とか取らなくても進めるんじゃないかと思うけど 油断したら死ぬだけだし どこまで諦めなければいいか匙加減がわからないなぁ...
  • ターキーを松明・爆弾で攻撃すると、焼き鳥になる

    • ヤンのお店は泥棒してもそんなに影響ないので必要ならターキーもらっても良い。
    • ヤンのお店は特にお金がたくさんもらえるわけでなし、ターキー返すことない。
  • 地元民のマーケットはすごく安い(洞穴の中にしかない)

    • よく考えると、泥棒しても対して怒られない。
  • ウシャトの目に役割が追加

    • ブラックマーケットが見つかる
    • ドリルが動かせる
  • 今回、ブラックマーケットで売っているのは王冠

    • 何に使う? エクスカリバーが抜ける
  • アンクはボス面にある

    • 爆弾2個で逆から入る技はジャングルルートでは使えない (爆弾ブラザーズがいるので...)
  • トンネルが厳しい...

    • 最後の手前2つ目の労働者を持っていくのがつらい。
      勝手にいなくなるからそんな奥まで連れていけない。
    • 最後の鍵はまぁいいけどずっと持ち物ありはつらそう...
  • ジャングルの爆弾ブラザーズは3人助けると爆弾10個がもらえる

    • 死の罠の手前にもたまにいる。
    • 氷山で出てくる ... なにもないけどなんかありそう?
  • ツノトカゲが虫を食べるのがかわいい

systemd.mount with disk label

here are some points

  1. e2label will not work with the mounted partitions.
  2. the service file name is correspond with the Where option.
  3. check the systemctl status results for the unit file.

here is my procedure and the unit file example.

# label the partition
e2label /dev/sd?? hdd-label1

# create the unit file.
cat > /etc/systemd/system/mnt-aaa.mount <<EOF
[Unit]
Description = mount WesternDigital 1T to /mnt/aaa
After = local-fs.target

[Mount]
#What = /dev/disk/by-label/ts1t-deg
What = LABEL=wd1t-deg
Where = /mnt/aaa
Type = ext4
Options = nofail

[Install]
WantedBy = default.target
EOF

# reload and mount...
systemctl daemon-reload
systemctl status mnt-aaa.mount  # check the errors
systemctl start mnt-aaa.mount

Chromebook: Input Method 2 - qterminal不調

qterminalですが、入力はできるのですが、 BSで入力中の文字を消すと最後の一文字が残ってしまいます。

文字が残ったら一回入力すればいいだけ、とはいえ不便...

![remain character][こんな感じ]

1年半ほどqterminalで快適に過ごしてましたが、
Input Methodが動かなくなりました。

terminal . 24/2/20 25/8/7 25/10/12
標準terminal
st x x x x
terminator o x ? ?
terminus ? ? o ?
qterminal ? o x

crostiniのupgradeが原因と思う。

他にもOpenSCADなどグラフィック系でChromebookが
落ちるようになった。うーん...

apply overlayfs several directories.

how to reduce the access to SD card in Raspberry-Pi OS.

the one method for it, use the overlay filesystem to several paths in SD card.

here is the script sample to mount the overlayfs onto SD card root file system::

mount-overlay-usr-src: /usr/src/f_overlay
mount-overlay-var-log: /var/log/f_overlay

/usr/src/f_overlay: d:=/mnt/storage1/usr-src
/usr/src/f_overlay: l:=lowerdir=/usr/src
/usr/src/f_overlay: u:=$d/usr-src-upper
/usr/src/f_overlay: w:=$d/usr-src-temp
/usr/src/f_overlay:
    mkdir -p $u $w
    mount -t overlay overlay -o $l,upperdir=$u,workdir=$w $(dir $@)
    touch $@

/var/log/f_overlay: d:=/mnt/storage1/var-log
/var/log/f_overlay: l:=lowerdir=/var/log
/var/log/f_overlay: u:=$d/var-log-upper
/var/log/f_overlay: w:=$d/var-log-temp
/var/log/f_overlay:
    mkdir -p $t $w
    mount -t overlay overlay -o $l,upperdir=$u,workdir=$w $(dir $@)
    touch $@

write down above text to Makefile then run them by::

$ make mount-overlay-usr-src
$ make mount-overlay-var-log

make it to the systemd unit file for persistence mount.

create /etc/systemd/system/mount-overlay.service::

$ cat > /etc/systemd/system/mount-overlay.service <<EOF
[Unit]
Description = mount overlay filesystem to reduce SD card access.
After = mnt-storage1.mount

[Mount]
ExecStart = make -C /path/to/script mount-overlay-var-log
ExecStop = umount -f /var/log

[Install]
WantedBy = default.target
EOF

$ systemctl daemon-reload
$ systemctl start mount-overlay
$ systemctl enable mount-overlay

ARM SBC: install mqtt server with rootless podman

install MQTT server to SBC.

  • at this time, this MQTT server does not encrypt the communications. we need the TLS encryption for it.

make the configuration file::

cat >> mqtt.conf <<EOF
allow_anonymous false
listener 1883
listener 9001
protocol websockets
persistence true
password_file        /srv/mqtt/mqtt.pwfile
persistence_file     mqtt.db
persistence_location /srv/mqtt/data/

user root  # for podman rootless
EOF

points:
- persistence_file is the relative path from `persistence_location`
- a rootless podman needs `root user` as the running user,
    containers `mqtt` user does not have any permissions to mounted points.

create the container file::

```bash
mkdir app.mqtt; cd app.mqtt
cat > Containerfile <<EOF
FROM debian:12.11-slim

RUN apt update -y
RUN apt install -y mosquitte

RUN mkdir -p /srv/mqtt
RUN mosquitte_passwd -c -b /root/mqtt.pwfile admin ??????
RUN mosquitte_passwd    -b /root/mqtt.pwfile sensor1 ?????
RUN mosquitte_passwd    -b /root/mqtt.pwfile sensor2 ?????
RUN mosquitte_passwd    -b /root/mqtt.pwfile viewer  ?????

COPY mqtt.conf /srv/mqtt/mqtt.conf
CMD ["mosquitte", "-c", "/srv/mqtt/mqtt.conf"]
EOF

build the container::

podman build -t mqtt-server

up the container::

ext=/mnt/external/mqtt
podman run -v /srv/mqtt/data:$ext/data \
           -v /srv/mqtt/log:$ext/log \
           -p 1883 -p 9001 \
           -d mqtt-server

ARM SBC: podman install

My experience in the debian armhf. To install podman, according to https://wiki.debian.org/Podman.

it is need to enable the registory at search::

sudo apt install podman
echo 'unqualified-search-registries=["quay.io"]' > /tmp/registries.conf
CONTAINERS_REGISTRIES_CONF=/tmp/registries.conf podman search podman

move cache directory to an external drive,

sudo mkdir -o /nmt/external/containers.$USER
sudo chown $USER:$USER /nmt/external/containers.$USER
sudo mount -o bind /mnt/external/containers.$USER ~/.local/share/containers

thanks podman github .

I want to build the application from a debian image.

podman pull debian:12.11-slim

build the application.

mkdir app; cd app
echo "FROM debian:12.11-slim" > Containerfile
podman build

install the network program:

sudo apt install uidmap
sudo apt install slirp4netns

thanks github issue .

then run the container:

podman run
宣伝: