本文を読み飛ばす

hostapd) setup WiFi access point with Raspberry-Pi OS

install the required packages

apt install -y hostapd

create the hostapd settings

interface = wlan0
...

unblock the WiFi interface with rfkill

we need unblocking the WiFi interface before run hostapd. there are several ways to unblock the WiFi interface. I choose the unblock script for 8812au.

there is a sample script to unblock, save it into /root/unblock-rtl8812au.sh::

#! /bin/bash
find_tgt=/sys/class/net/wlan*
find_opt="-q 8812au"

function find_8812au_dev() {
    for i in $find_tgt; do
        if udevadm info -a --path=$i | grep $find_opt; then
            udevadm info -a --path=$i | sed -n 's/[ \t]*KERNEL=="\(.*\)"/\1/p'
            return 0
        fi
    done
    return 1
}


function find_phy_name() {
    n="$(iw dev $1 info | sed -n 's/[ \t]\+wiphy[ \t]\+\([0-9]\+\)/\1/p')"
    wiphy="Wiphy phy$n"
    iw list | grep -e '^\S' | while read l; do
        #cho "$l - $n - $wiphy"
        if [[ "$l" = $wiphy ]]; then
            echo "phy$n"
            return 0
        fi
    done
    return 1
}


function find_rfkill_id() {
    tmp=$(rfkill list | grep $1 | cut -d " " -f 1)
    echo ${tmp%%:}
}


function unblock() {
    sleep 10
    dev=$(find_8812au_dev)
    echo "got device: $dev"
    phy=$(find_phy_name $dev)
    echo "got phy: $phy"
    id=$(find_rfkill_id $phy)
    rfkill unblock $id
}

unblock

modify the systemd settings

to enable the unblock interface, I use the systemd service settings ExecStartPre.

edit the hostapd.conf directly, copy to the new service, or make the override settings by systemctl edit hostapd.service.

[Service]
...
ExecStartPre=/root/unblock-rtl8812au.sh

start and check the service

after modify the settings for systemd, run and confirm the access point service.

systemctl daemon-reload
systemctl start hostapd
systemctl status hostapd

then enable the service:

systemctl enable hostapd

hostapd) tunning the WiFi access point to speed up

Improve the WiFi access speed.

tuning the hostapd.conf to make it from 8Mbps to 60Mbps in my case.

check WiFi interface capability

iw list to get the capability, my USB WiFi results::

$ iw list
...
     Band 1:
         Capabilities: 0x1962
             HT20/HT40
             Static SM Power Save
             RX HT20 SGI
             RX HT40 SGI
             RX STBC 1-stream
             Max AMSDU length: 7935 bytes
             DSSS/CCK HT40
...
     Band 2:
         Capabilities: 0x862
             HT20/HT40
             Static SM Power Save
             RX HT20 SGI
             RX HT40 SGI
             No RX STBC
             Max AMSDU length: 7935 bytes
             No DSSS/CCK HT40
...
         VHT Capabilities (0x03c031a2):
             Max MPDU length: 11454
             Supported Channel Width: neither 160 nor 80+80
             short GI (80 MHz)
             TX STBC
             SU Beamformee
             +HTC-VHT

modify the hostapd.conf

enable enhanced capabilities by ht_capab or vht_capab in hostapd.conf, almost items disabled by defaults.

I can't find the ht_capab options manual, so cut and try will be needed.

```text# interface=wlan0 interface=wlan0 bridge=br0 driver=nl80211

ctrl_interface=/var/run/hostapd ctrl_interface_group=0

ssid=samplesample macaddr_acl=0

country_code=JP ieee80211d=1

hw_mode=a channel=36

auth_algs=1 wpa=2 wpa_psk=1234567890abcdef1234567890abcdef1234567890123456789abcdef1234567 wpa_key_mgmt=WPA-PSK wpa_pairwise=CCMP

wmm_enabled=1 ieee80211w=0 ieee80211ac=1 ieee80211n=1

ht_capab=[HT20-][HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40][MAX-AMSDU-7935] vht_capab=[SHORT-GI-80][TX-STBC-1][+HTC-VHT][MAX-AMSDU-11454] ```


improve for 2.4GHz access point ... failed

I can't get the faster WiFi speed for hw_mode=g as 2.4GHz settings.

ht_capab makes few effects to WiFi speed.

setup the RTL8812AU driver with Raspberry-Pi OS kernel 6.12

This is an experience to build the RTL8812AU driver in Raspberry-Pi OS at 2025/07.

get 8812au driver from github

$ git clone https://github.com/morrownr/8812au-20210820

build

$ sudo apt install -y build-essential
$ sudo apt install -y dkms
$ sudo apt install -y bc
$ cd 8812au-20210820
$ make build

install and use the driver

run the script install-driver.sh to install the modules. the install-driver.sh will also set the modprobe settings.

$ sudo bash install-driver.sh
$ modprobe rtl8812au
$ ip addr
...
wlan1   # <- 8812au

error at build

In my case, Errors were shown in make.log

undefined kasan_hw_tag_enabled

recent Raspberry-Pi OS enable the KASAN but the kernel header package is corrupted. (?)

to fix it, edit the headers to fit the kernel status.

edit the kasan-enable.h in kernel-common/include/linux/kasan.h

static inline bool kasan_hw_tags_enabled(void) {
    return true;
}

WiFi Error or stall after several hours

use the broadcom driver clone: https://github.com/morrownr/8812au-20210820 .

I met the WiFi errors `` after several hours from boot with the community driver https://github.com/lwfinger/rtw88 .

kasan.hの現象は、kernel-header展開中に
overlayfs適用してしまっておかしくなった?

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不調

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

terminal . 24/2/20 25/8/7
標準terminal
st 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

HDD erase in secure with Raspberry Pi

  • no extra install to specific tools: wipe or shred .
  • you can get strong erases like VSITR, but a little bit weak.
## check the partitions
fdisk -l

## erase the partition:
badblocks -wns /dev/sdb6
  • one badblocks takes 2days (49:12:39).
  • my dev/sdb6 is about 600GB,
  • my device is Raspberry Pi 3B+.

refer to VSITR requirement::

0x00 -> 0xFF ->
0x00 -> 0xFF ->
0x00 -> 0xFF -> 0xAA

from badblocks manual::

0xAA -> 0x55 -> 0xFF -> 0x00

log:

- 48:22:50 : 85.11%

+ 14.89% x (2sec/0.01%) => 49:12:39

宣伝: