2026/2/16

手動修改 partition content, enable ssh , wifi for headless raspberry pi OS.

 在沒有顯示器與鍵盤的情況下(Headless 模式),可以透過在 SD 卡的 boot 分割區中建立或編輯特定檔案,來完成系統初始化設定。

適用版本:Raspberry Pi OS Trixie (2025-12-04 以後的映像檔)。此版本改用 cloud-init 取代舊版的 userconf.txt 方式。

1. 啟用 SSH 服務

在 boot 分割區的根目錄下,建立一個檔名為 ssh 的空白檔案(不含任何副檔名)。系統在開機過程中由 sshswitch.service 偵測到此檔案後,會自動啟動 OpenSSH 服務並移除該檔案。

touch /media/你的使用者/bootfs/ssh

注意:僅在 cloud-init 的 user-data 中設定 ssh_pwauth: true 是不夠的,該設定只控制 SSH 是否允許密碼登入,並不會啟動 SSH 服務本身。必須建立 ssh 檔案才能啟動服務。

2. 設定使用者帳號與密碼(cloud-init)

自 Trixie 版本起,Raspberry Pi OS 改用 cloud-init 進行首次開機設定。舊版的 userconf.txt 方式已不再支援。使用者帳號需透過 boot 分割區中的 user-data 檔案來設定。

首先產生加密密碼字串:

openssl passwd -6 "你的密碼"

編輯 boot 分割區中的 user-data 檔案,內容如下:

#cloud-config

hostname: raspberrypi

users:
- name: charles-chang
  gecos: Charles Chang
  groups: users,adm,dialout,audio,netdev,video,plugdev,cdrom,games,input,gpio,spi,i2c,render,sudo
  shell: /bin/bash
  lock_passwd: false
  passwd: 此處填入上面指令產生的加密密碼字串
  sudo: ALL=(ALL) NOPASSWD:ALL

ssh_pwauth: true

runcmd:
- nmcli radio wifi on

說明:最後的 runcmd 區段是用來在首次開機時啟用 WiFi radio,原因見下節說明。

3. 設定 WiFi 無線連線

編輯 boot 分割區中的 network-config 檔案。此檔案使用 netplan 格式(YAML),cloud-init 會在首次開機時讀取並套用。

network:
  version: 2

  ethernets:
    eth0:
      dhcp4: true
      optional: true

  wifis:
    wlan0:
      dhcp4: true
      optional: false
      access-points:
        你的WiFi名稱:
          password: "你的WiFi密碼"

注意 YAML 縮排:此檔案對空白字元敏感,請使用空格而非 Tab。

WiFi radio 預設為停用:Raspberry Pi OS Trixie 的 NetworkManager 預設將 WiFi radio 設為軟體停用狀態(WIFI: disabled)。即使 network-config 中已正確設定 WiFi 連線資訊,WiFi 仍無法連線。解決方法是在 user-data 的 runcmd 中加入 nmcli radio wifi on,讓系統在首次開機時自動啟用 WiFi radio。

4. 開機與連線

將設定完成的 SD 卡插入樹莓派後送電開機。Cloud-init 首次開機約需 2-3 分鐘完成設定。完成後即可透過 SSH 連線:

ssh charles-chang@樹莓派的IP位址

可透過路由器的 DHCP 用戶端清單查詢樹莓派的 IP 位址。若已在 user-data 中安裝 avahi-daemon,亦可使用:

ssh charles-chang@raspberrypi.local

5. 安全建議

首次登入後,建議立即執行 passwd 指令更換初始密碼,以確保系統安全性。

設定檔案總覽

檔案位置用途
sshboot 分割區根目錄啟用 SSH 服務(空白檔案)
user-databoot 分割區根目錄設定使用者帳號、密碼、runcmd
network-configboot 分割區根目錄設定 WiFi 和乙太網路連線
meta-databoot 分割區根目錄cloud-init 中繼資料(通常不需修改)

2026/1/30

install choco on windows (for ripgrep, for cursor cli agent)

要安裝 ripgrep 到windows,說要choco.. 依照這一篇才成功: 用 powershell安裝 choco
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
然後就可以用 choco 安裝..
choco install ripgrep
其實這是為了要裝 cursor 的 cli:
irm 'https://cursor.com/install?win32=true' | iex
ref:

2026/1/17

codex-cli 使用自己的 ollama server.

codex-cli 可以用 --oss 來指定它使用 localhost 的 ollama server。 (default model: gpt-oss:20b)
但是(0.87.0)因為它hard coding provider: ollama 就是用 localhost,所以在 ~/.codex/.config.toml 寫了 provider.ollama 的 base_url 也是沒效。
所以不能用 ollama 這個 名子做 provder,要用其他的。例如:
[model_providers.ollama-remote]
name = "ollama"
base_url = "http://192.168.145.70:11434/v1"
wire_api = "responses"
這樣,用 ollama-remote 作為 provider 的 name。

另外,設定 default provider 用 ollama-remote,然後 model 是 gpt-oss:20b 是
model_provider = "ollama-remote"
model = "gpt-oss:20b"
model_reasoning_effort = "medium"
oss_provider = "ollama-remote"
這樣,直接啟動 codex 後,就會用這個自己的 ollama server 的 gpt-oss:20b 作為 model 了。

ollama server 版本要大於0.13.4 才 support responses API



claude-code 要用 local 的 ollama 的話,用環境變數就可以了。
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_BASE_URL=http://192.168.145.70:11434
然後在啟動的時候指定 model:
claude --model gpt-oss:120b
ollama 要新版的才有支援 claude 的 api 格式.

2026/1/14

Problem and Solve : some sections are mssing when VLM ocr pdf file

 

Problem

When converting 5.1.3. Tutorial for Large Language Models.pdf to Markdown, shell script sections were missing in the output. These sections had light gray text on light gray background (low contrast).

Root Cause

The VLM prompt didn't explicitly instruct the model to look for low-contrast code blocks. While the VLM could recognize the text, recognition was inconsistent.

Changes Made

1. Enhanced VLM Prompt (
ollama_client.py
)

Added explicit instructions to detect low-contrast code:

  • "Pay special attention to CODE BLOCKS and SHELL COMMANDS that may appear in LIGHT GRAY BOXES"
  • "These low-contrast code sections are VERY IMPORTANT and MUST NOT be skipped"
  • Specific examples: $ bash script.sh$ ./compile.sh$ adb push

2. Added VLM Output Cleanup (
ollama_client.py
)

New 

_clean_vlm_output() method removes VLM thinking noise:

  • Patterns like "Wait, no...", "Let me think...", "So final Markdown:"
  • Markdown code block wrappers
  • Multiple consecutive blank lines

2026/1/10

web ui for vlm : live-vlm-webui

live-vlm-webui 是給 vlm 的 web 界面。
安裝就用 pip
pip install live-vlm-webui
然後啟動:
$ live-vlm-webui
2026-01-10 22:02:23,010 - live_vlm_webui.server - INFO - No model/API specified, auto-detecting local services...
2026-01-10 22:02:23,016 - live_vlm_webui.server - INFO - ✅ Auto-detected Ollama at http://localhost:11434/v1
2026-01-10 22:02:23,016 - live_vlm_webui.server - INFO -    Selected model: llama3.2-vision:latest
2026-01-10 22:02:23,047 - live_vlm_webui.server - INFO - Initialized VLM service:
2026-01-10 22:02:23,047 - live_vlm_webui.server - INFO -   Model: llama3.2-vision:latest
2026-01-10 22:02:23,047 - live_vlm_webui.server - INFO -   API: http://localhost:11434/v1 (Local)
2026-01-10 22:02:23,047 - live_vlm_webui.server - INFO -   Prompt: Describe what you see in this image in one sentence.
2026-01-10 22:02:23,047 - live_vlm_webui.server - INFO - Serving static files from: /home/charles-chang/livevlmwebui/venv/lib/python3.12/site-packages/live_vlm_webui/static/images
2026-01-10 22:02:23,047 - live_vlm_webui.server - INFO - Serving favicon files from: /home/charles-chang/livevlmwebui/venv/lib/python3.12/site-packages/live_vlm_webui/static/favicon
2026-01-10 22:02:23,048 - live_vlm_webui.server - INFO - SSL enabled - using HTTPS
2026-01-10 22:02:23,048 - live_vlm_webui.server - INFO - Starting server on 0.0.0.0:8090
2026-01-10 22:02:23,048 - live_vlm_webui.server - INFO - 
2026-01-10 22:02:23,048 - live_vlm_webui.server - INFO - ======================================================================
2026-01-10 22:02:23,048 - live_vlm_webui.server - INFO - Access the server at:
2026-01-10 22:02:23,048 - live_vlm_webui.server - INFO -   Local:   https://localhost:8090
2026-01-10 22:02:23,049 - live_vlm_webui.server - INFO -   Network: https://192.168.145.77:8090
2026-01-10 22:02:23,049 - live_vlm_webui.server - INFO -   Network: https://172.20.0.1:8090
...
2026-01-10 22:02:23,050 - live_vlm_webui.server - INFO -   Network: https://192.168.94.37:8090
2026-01-10 22:02:23,050 - live_vlm_webui.server - INFO - ======================================================================
2026-01-10 22:02:23,050 - live_vlm_webui.server - INFO - 
2026-01-10 22:02:23,050 - live_vlm_webui.server - INFO - Press Ctrl+C to stop
2026-01-10 22:02:23,069 - live_vlm_webui.gpu_monitor - INFO - Auto-detected NVIDIA GPU (NVML available)
2026-01-10 22:02:23,069 - live_vlm_webui.gpu_monitor - INFO - Detected system: ASUS EX-B760M-V5
2026-01-10 22:02:23,076 - live_vlm_webui.gpu_monitor - INFO - NVML initialized for GPU: NVIDIA TITAN RTX
2026-01-10 22:02:23,076 - live_vlm_webui.server - INFO - GPU monitor initialized
2026-01-10 22:02:23,076 - live_vlm_webui.server - INFO - GPU monitoring task started
2026-01-10 22:02:23,076 - live_vlm_webui.server - INFO - GPU monitoring loop started
======== Running on https://0.0.0.0:8090 ========
(Press CTRL+C to quit)
然後在browsser 上開啟 https://localhost:8090 就可以。
API BASE URL 填入 ollama 的或是 sglang .. 都可以。
然後選 vlm model,開啟 camera,就會開始依照 prompt 內容對 video 做敘述...

2026/1/8

Yolo-World, VLM use yolo as image encoder

因為想知道 VLM 的 image encoder 是否都是 ViT,有沒有 YOLO base,結果搜尋出 有使用 YOLO 作為 Image Encoder.

其中 YOLO-World 又有 demo,所以就在 DGX Spark 上 setup 起來試試看。
GB10 的Cuda 有些限制,所以做了些修改才能 run,所以記錄在 GB10_SETUP.md 上。

demo 是用 gradio,上傳照片,promt 寫要偵測的東西,result 就是 object bounding box.