MediaTek MT7925 Bluetooth stops working / turning on on Ubuntu 26.04 LTS

MediaTek MT7925 is an M.2 Wi-Fi 7 and Bluetooth 5.4 wireless network card which Wireless and BlueTooth are both supported by the latest Linux Kernel.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$ uname -r
7.0.0-22-generic

$ lspci -k | grep -i -A3 network
01:00.0 Network controller: MEDIATEK Corp. MT7925 802.11be 160MHz 2x2 PCIe Wireless Network Adapter [Filogic 360]
Subsystem: MEDIATEK Corp. MT7925 802.11be 160MHz 2x2 PCIe Wireless Network Adapter [Filogic 360]
Kernel driver in use: mt7925e
Kernel modules: mt7925e
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 0c)

$ lsusb | grep -i mediatek
Bus 003 Device 002: ID 0e8d:7925 MediaTek Inc. Wireless_Device

$ rfkill list
0: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
1: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no

$ ls -al /lib/firmware/mediatek/mt7925/
...
-rw-r--r-- 1 root root 459528 Mar 19 23:32 BT_RAM_CODE_MT7925_1_1_hdr.bin.zst
-rw-r--r-- 1 root root 197811 Mar 19 23:32 WIFI_MT7925_PATCH_MCU_1_1_hdr.bin.zst
-rw-r--r-- 1 root root 1152702 Mar 19 23:32 WIFI_RAM_CODE_MT7925_1_1.bin.zst

MT7925 BlueTooth is usually exposed via USB (even though WiFi is PCIe).

1
2
3
4
$ dmesg | grep -i -E "bluetooth|mt7925|btmtk|firmware"
...
Bluetooth: hci0: Failed to get device id (-108) [ 11.847463]
...

Failed to get device id (-108) is an ENOTUNIQ error from the USB/MMIO ID lookup in btusb/btmtk, often a known issue with MT7925 where the BlueTooth function doesn’t enumerate correctly or there’s a race during probe. This is a fairly common bug on MT7925 / 7925e cards on newer kernels.

The -108 error sometimes is caused by the BT USB device not being reset properly at boot. Try a full module reload in correct order:

1
2
3
4
5
6
7
8
9
10
11
$ sudo systemctl stop bluetooth

$ sudo lsof /dev/rfkill 2>/dev/null

$ sudo modprobe -r btusb
$ sudo modprobe -r btmtk

$ sudo modprobe btmtk
$ sudo modprobe btusb

$ sudo systemctl start bluetooth

Quick way convert Copilot skill/prompt to work with Kilo Code

Kilo Codedoesn't natively read **.github-based** Copilot skill/prompt/workflow/convention files — that format is specific toGitHub Copilot`’s custom instructions/prompts system.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
$ tree .github
.github
├── conventions
│   ├── component-test-patterns.md
│   ├── test-anti-patterns.md
│   └── unit-test-conventions.md
├── prompts
│   ├── gen-it-tests.prompt.md
│   ├── gen-unit-tests.prompt.md
│   ├── it-coverage-gap-analysis.prompt.md
│   ├── unit-test-coverage-gap-analysis.prompt.md
│   └── uplift-unit-tests.prompt.md
└── skills
├── integration-test-coverage-analysis
│   ├── integration-test-coverage-classifier.md
│   ├── integration-test-dependency-extractor.md
│   ├── integration-test-evidence-collector.md
│   ├── integration-test-freshness-checker.md
│   ├── integration-test-gap-report-writer.md
│   ├── integration-test-gateway-scanner.md
│   ├── integration-test-scope-validator.md
│   ├── SKILL.md
│   └── templates
│   ├── Component-test-analysis.md
│   └── IT-analysis.md
├── integration-test-generator
│   ├── integration-test-code-generator.md
│   ├── integration-test-gap-discoverer.md
│   ├── integration-test-option-selector.md
│   ├── integration-test-plan-builder.md
│   └── SKILL.md
├── shared
│   ├── diff-analysis-ci.md
│   ├── diff-analysis-ide.md
│   ├── test-quality-rules.md
│   └── tiered-model-strategy.md
├── unit-test-coverage-analysis
│   ├── SKILL.md
│   ├── templates
│   │   └── unit-test-coverage-analysis-report.md
│   ├── unit-test-codebase-analysis.md
│   ├── unit-test-coverage-analysis-preflight.md
│   ├── unit-test-diff-scope-analysis.md
│   ├── unit-test-project-discovery.md
│   └── unit-test-report-synthesis.md
└── unit-test-generator
├── SKILL.md
├── unit-test-code-generator.md
├── unit-test-diff-coverage-resolver.md
├── unit-test-infrastructure-setup.md
├── unit-test-post-generation-verification.md
└── unit-test-refactor-specialist.md

11 directories, 40 files

A quick way to convert to Kilo Code custom way:

  • Add Kilo Code directory structure
1
$ ln -s .github .kilo
  • Convert prompt to Kilo Code custom slash command
1
2
3
$ cd .github

$ ln -s prompts commands

In Kilo Code chat window, then can find and run command e.g. /gen-unit-tests.

Running remote X Window applications locally on Mac

On Mac, install XQuartz from https://www.xquartz.org/

On remote Linux host Aorus.local, make sure:

  • $DISPLAY
1
2
$ echo $DISPLAY
localhost:10.0
  • $XAUTHORITY
1
2
3
4
5
$ echo $XAUTHORITY
/home/terrence/.Xauthority

$ ls -al /home/terrence/.Xauthority
-rw------- 1 terrence terrence 51 Jun 13 20:11 /home/terrence/.Xauthority
  • sshd_config
1
2
3
4
5
$ grep -iE 'X11Forwarding|X11UseLocalhost|XAuthLocation' /etc/ssh/sshd_config
X11Forwarding yes
X11UseLocalhost yes

$ sudo systemctl restart sshd
  • xauth
1
2
3
4
5
6
7
$ which xauth
/usr/bin/xauth

$ xauth list
Aorus/unix:10 MIT-MAGIC-COOKIE-1 27e55a1edf7347d27957e71637f99ab2

$ xauth add localhost:10 MIT-MAGIC-COOKIE-1 27e55a1edf7347d27957e71637f99ab2

Then on Mac run:

1
$ ssh -Y Aorus.local

On Aorus.local:

1
$ firefox

Gnome Remote Desktop on Ubuntu 26.04

Latest Ubuntu 26.04 LTS has dropped the support of X11 Server and xRDP and moved to the adoption of Wayland Display Server. Old approach with xRDP doesn’t work anymore. The solution / fix is the new Gnome Remote Desktop.

Gnome Remote Desktop

Generate Remote Desktop Server self-signed certificate:

1
2
3
4
$ sudo openssl req -newkey rsa:2048 -nodes -keyout /var/lib/gnome-remote-desktop/rdp-tls.key -x509 -days 3650 -out /var/lib/gnome-remote-desktop/rdp-tls.crt -subj "/CN=$(hostname)"

$ sudo chown gnome-remote-desktop:gnome-remote-desktop /var/lib/gnome-remote-desktop/rdp-tls.key
$ sudo chown gnome-remote-desktop:gnome-remote-desktop /var/lib/gnome-remote-desktop/rdp-tls.crt

Register self-signed certificate with the system daemon:

1
2
3
4
5
6
7
$ sudo grdctl --system rdp set-tls-key /var/lib/gnome-remote-desktop/rdp-tls.key
$ sudo grdctl --system rdp set-tls-cert /var/lib/gnome-remote-desktop/rdp-tls.crt

$ sudo grdctl --system rdp set-credentials $(whoami) rdp-user-password

$ sudo grdctl --system rdp enable
$ sudo systemctl restart gnome-remote-desktop.service

After Gnome Remote Desktop restarted, in the log:

1
2
3
4
5
6
7
$ sudo journalctl -u gnome-remote-desktop.service -f
...
Jun 06 22:21:17 Aorus systemd[1]: Starting gnome-remote-desktop.service - GNOME Remote Desktop...
Jun 06 22:21:17 Aorus gnome-remote-desktop-daemon[24618]: Init TPM credentials failed because Failed to initialize transmission interface context: tcti:IO failure, using GKeyFile as fallback
Jun 06 22:21:17 Aorus systemd[1]: Started gnome-remote-desktop.service - GNOME Remote Desktop.
Jun 06 22:21:17 Aorus gnome-remote-desktop-daemon[24618]: RDP server started

Show Remote Desktop Server status:

1
2
3
4
5
6
7
8
9
10
11
12
13
$ sudo grdctl --system status --show-credentials
Overall:
Unit status: active
RDP:
Status: enabled
Port: 3389
Authentication methods: credentials
TLS certificate: /var/lib/gnome-remote-desktop/rdp-tls.crt
TLS fingerprint: 71:f1:20:64:fe:e3:58:97:95:8d
TLS key: /var/lib/gnome-remote-desktop/rdp-tls.key
Kerberos keytab: (null)
Username: terrence
Password: rdp-user-password

When connect from Windows App (Microsoft Remote Desktop), error thrown in log:

1
2
3
4
5
$ sudo journalctl -u gnome-remote-desktop.service -f
...
Jun 02 12:40:22 NucBox gnome-remote-desktop-daemon[58071]: [RDP] Sending server redirection
Jun 02 12:40:22 NucBox gnome-remote-desktop-daemon[58071]: [12:40:22:884] [58071:0004752e] [ERROR][com.freerdp.core.peer] - [rdp_set_error_info]: ERRINFO_LOGOFF_BY_USER [0x0001000C]
Jun 02 12:40:22 NucBox gnome-remote-desktop-daemon[58071]: [RDP] Network or intentional disconnect, stopping session

NOTE: According to A.I., GNOME Remote Desktop –system mode uses Server Redirection — after you authenticate at the system level, it redirects the RDP client to your actual user session on a different internal port. Microsoft Remote Desktop on Mac sometimes rejects this redirection for self-signed certificates because the certificate on the redirected session doesn’t match what it expects. And use user-level approach instead.

However, choose a different Remote Desktop Client like Royal TSX https://royalapps.com/ts/mac/features, works fine.

References

Fast and Furious way to import and export AWS DynamoDB table

Extract data from the production tables and prepare JSON files for the test environment

1
2
3
4
5
6
7
8
for table in dashboard-tile-publisher-prod-group dashboard-tile-publisher-prod-tile dashboard-tile-publisher-prod-tile-event; do
aws --profile production dynamodb scan \
--table-name $table \
--output json \
--max-items 10000 \
| jq --arg t "$table" '{ ($t): [ .Items[] | { "PutRequest": { "Item": . } } ] }' \
> $table.json
done

Copy and modify the JSON files for the test environment

1
2
3
4
for suffix in group tile tile-event; do
cp "dashboard-tile-publisher-prod-${suffix}.json" "dashboard-tile-publisher-ptest-${suffix}.json"
sed -i '' "s/dashboard-tile-publisher-prod-${suffix}/dashboard-tile-publisher-ptest-${suffix}/g" "dashboard-tile-publisher-ptest-${suffix}.json"
done

Update the content in the JSON files for the test environment

1
2
3
for suffix in tile tile-event; do
sed -i '' 's/dashboard-tile-publisher-images-prod/dashboard-tile-publisher-images-ptest/g' "dashboard-tile-publisher-ptest-${suffix}.json"
done

Import the modified JSON files into the test environment DynamoDB tables

1
2
3
4
5
6
7
8
9
for table in dashboard-tile-publisher-ptest-group dashboard-tile-publisher-ptest-tile dashboard-tile-publisher-ptest-tile-event; do
jq -c --arg t "$table" '.[$t] | _nwise(25) | {($t): .}' "${table}.json" \
| while IFS='' read -r chunk; do
aws --profile test dynamodb batch-write-item \
--no-cli-pager \
--request-items "$chunk"; \
sleep 10; # Add a small delay to avoid throttling
done
done

References

  • A.I.

Microsoft Power Automate - Last day of the month notification

Setting up a scheduled cloud flow in Microsoft Power Automate, to send notification to Microsoft Teams group chat on every last day of the month.

Power Automate - Workflow

For example, at 10:30am AEST, on April 30th 2006:

  • Compose (get today’s day number) expression
1
formatDateTime(convertTimeZone(utcNow(), 'UTC', 'AUS Eastern Standard Time'), 'dd')

The output of above compose is: “30”

  • Compose (calculate last day of current month) expression
1
formatDateTime(addDays(startOfMonth(addToTime(convertTimeZone(utcNow(), 'UTC', 'AUS Eastern Standard Time'), 1, 'Month')), -1, 'yyyy-MM-dd'), 'dd')
  1. utcNow(): Grabs the current date and time in UTC (e.g., 2026-04-30T00:30:00Z).
  2. addToTime(…, 1, ‘Month’): Jumps forward exactly one month into the future (e.g., May 30th, 2026).
  3. startOfMonth(…): Takes that future date and rewinds it to the very first day of that month (e.g., May 1st, 2026).
  4. addDays(…, -1, ‘yyyy-MM-dd’): Subtracts exactly one day from the first of next month, landing perfectly on the last day of the current month. The ‘yyyy-MM-dd’ at the end formats the output neatly (e.g., 2026-04-30).
  5. formatDateTime(…, ‘dd’): Extract just the day

The output of above compose is: “30”

  • Compose (get today’s weekday number) expression
1
dayOfWeek(convertTimeZone(utcNow(), 'UTC', 'AUS Eastern Standard Time'))

The output of above compose is: 4

  • Condition

Power Automate - Condition

  1. Output of Compose (get today’s day number) is equal to Compose (calculate last day of current month)
  2. Output of Compose (get today’s weekday number) is greater or equal to 1 (Monday)
  3. Output of Compose (get today’s weekday number) is less or equal to 5 (Friday)
  • Notification

Power Automate - Notification

Qwen 3.6 27B,多种优化方式,从 20 t/s 飙到 184 t/s

Local AI should be a default, not a privilege: private data, no per-token bill, no vendor lock-in. The hardware to run capable models already sits on desks. The software to run those chips well doesn’t.

Qwen 3.6 27B 推理速度优化技术文档

一、背景与目标

  • 模型:Qwen 3.6 27B(稠密模型,FP8 精度)
  • 硬件:单卡 RTX 4090(48GB 显存,无 P2P 通信);双卡 RTX 4090
  • 初始性能:单卡 RTX 4090 裸跑 FP8 精度,输出速度仅 20 tokens/s
  • 目标:通过多种优化手段,将单卡 RTX 4090 推理速度提升至 184 tokens/s(峰值),实现最少 5 倍、最多 10 倍的速度提升

二、量化优化(第一阶优化)

2.1 原理

  • 模型参数的位宽从 FP16 降至 4bit,体积缩小 4 倍
  • 显存带宽不变时,每次搬运的数据量减半,从而突破显存访问瓶颈,速度翻倍
  • 适用于显存受限的场景(如 RTX 4090 非高带宽显存)

2.2 量化方案对比

方案 框架 精度 速度(单卡 RTX 4090) 特点
GGUF Q4_K_M llama.cpp 4bit ~45 token/s 适合单人使用,可 offload 到内存
AWQ VLLM 4bit ~48 token/s 适合高并发场景

2.3 精度损失评估

  • 测试工具:ToolCall15 https://github.com/stevibe/ToolCall-15 + 数据提取 + 指令遵循(共 45 场景)
  • 结论:大部分场景损失可忽略,仅增加少量错误与纠错 token,但速度提升 2 倍以上,可接受。

三、投机解码 – MTP(Multi Token Prediction)

3.1 原理

  • 在模型主头之外增加多个预测头,一次并行预测后续 N 个 token
  • 大模型验证时一次通过,命中则跳过单步生成,利用 GPU 闲置算力
  • 参数 n 控制预测窗口大小(n = 1,3,5)

3.2 测试结果(单卡 RTX 4090)

配置 速度(tokens/s) 提升幅度
VLLM AWQ 无 MTP 48 基准
VLLM AWQ + MTP n = 1 71 +49%
VLLM AWQ + MTP n = 3 99 +106%
VLLM AWQ + MTP n = 5 108 +124%
FP8 无 MTP 20 基准
FP8 + MTP n = 1 38 +90%
FP8 + MTP n = 3 60 +200%
FP8 + MTP n = 5 72 +260%
  • 联合量化 + MTP 可达 5 倍提升:FP8 (20) → AWQ + MTP n = 5 (108)

3.3 llama.cpp 的投机解码

  • 采用 n-gram 方式,实测提升不明显(可能因实验场景为每次全新上下文,不适合连续多轮调用)

四、双卡并行方案

4.1 单并发性能

  • 双卡 FP8 + MTP n = 5:单并发 120 tokens/s(仅比单卡 108 tokens/s 提升 11%)
  • 瓶颈:两张 RTX 4090 间无 P2P 直连,通信需经过 CPU 内存,损耗大

4.2 多并发优势

  • 双卡在多请求场景下优势显著:10 并发时可提供更高总吞吐
  • 类比:单车道→四车道,单请求速度不变但总容量大幅提升

五、高级投机解码 – DFlash 与 DDTree

5.1 DFlash(扩散式投机解码)

  • 借鉴图像扩散模型思想:一次性生成整块模糊候选文本,再逐步去噪精炼
  • 本质是并行路径,但默认仍是单条路径验证,一错全废

5.2 DDTree(Diffusion Draft Tree)

  • 先用扩散模型生成多个备选路径(参数 22 条),同时探索
  • 任意一条路径通过即成功,大幅提升命中率
  • 实现项目:lucebox https://github.com/Luce-Org/lucebox-hub

5.3 性能表现(单卡 RTX 4090,Q4 + DFlash/DDTree)

配置 平均速度 峰值速度
本机 4090 141 tokens/s 184 token/s
参考:lucebox 3090 207 tokens/s(Qwen 3.5 27B) -

5.4 速度依赖因素

  • 任务类型:数学题(逻辑死板)→ 150 tokens/s;代码(变量灵活)→ 125 tokens/s;创意写作(自由度最高)→ 效果差
  • 适用场景:多 agent、Claude Code 等写代码场景最适合推测解码

六、KV Cache 量化 – TurboQuant

6.1 原理

  • 将 KV cache 从 FP16 压缩至 3~4 bit,压缩比约 4 倍
  • 非权重量化,为第首次实现几乎无精度损失的 KV cache 量化

6.2 效果

  • 24G 显存(如 RTX 3090)搭配 Q4 模型,可支持 200K 上下文长度
  • 已获 VLLM 0.20 及 lucebox 支持

七、生产环境推荐方案

需求 推荐配置 性能
最高精度 + 多并发 FP8 + VLLM + MTP n = 5 10 并发 ~500 tokens/s
极致单请求速度 Q4 + DFlash / DDTree(lucebox) 峰值 184 tokens/s(但暂不支持多并发、工具调用不稳定)

八、技术限制与展望

  • DFlash / DDTree 当前限制:不支持多并发、未合入 llama.cpp 主线、Claude Code 工具调用易断
  • 软件层潜力:CUDA 驱动能效比低于 Apple M5,通过 kernel 融合、降功率等优化可大幅提升能效(实验显示 RTX 3090 降功率后能效比追平 M5 Max)
  • 未来方向:更多内核级优化 + 框架原生支持,本地算力将持续升值

九、结论

通过 量化(GGUF / AWQ)MTPDFlash/DDTreeTurboQuant 的递进优化,单卡 RTX 4090 上 Qwen 3.6 27B 的推理速度从 20 tokens/s 提升至 184 tokens/s(峰值),提升超 9 倍。该路线为本地大模型从“玩具”迈向“核弹级生产力工具”提供了已验证的技术路径。

References

DNS_PROBE_FINISHED_NXDOMAIN error

From time to time, not always, getting DNS_PROBE_FINISHED_NXDOMAIN error in browser especially when visit Chinese AI sites e.g. https://chat.qwen.ai/ and https://chat.z.ai/

The root reason is because some ISPs have slower or inconsistent DNS resolution.

The fix is switching to a faster public resolver like Google (8.8.8.8/8.8.4.4) or Cloudflare (1.1.1.1/1.0.0.1) in network settings.

This is how to change DNS settings in OpenWRT.

How to fix 'unknown terminal type' error when Ghostty logon AWS EC2

Popular Ghostty Terminal https://ghostty.org/ from it to logon AWS EC2 instance, “unknown terminal type“ thrown on EC2.

On Ghostty Terminal host:

1
$ infocmp -x > /tmp/ghostty.terminfo

Then copy Ghostty terminal info file across over to EC2 instance:

1
$ scp ghostty.terminfo ec2-user@i-0012f794e5fabcdef:/tmp

Logon EC2 instance, and run:

1
2
3
4
5
6
7
8
9
10
11
12
[ec2-user@ip-10-215-240-19 ~]$ tic -x /tmp/ghostty.terminfo
"/tmp/ghostty.terminfo", line 2, col 31, terminal 'xterm-ghostty': older tic versions may treat the description field as an alias

[ec2-user@ip-10-215-240-19 ~]$ pwd
/home/ec2-user

[ec2-user@ip-10-215-240-19 ~]$ find .terminfo/
.terminfo/
.terminfo/x
.terminfo/x/xterm-ghostty
.terminfo/g
.terminfo/g/ghostty

Why This Happens

Ghostty uses TERM=xterm-ghostty which requires a terminfo entry on the remote system. Older Linux servers/macOS servers simply don’t have that entry in their terminfo database, so the other terminal utilities throw this “unknown terminal type“ error.

SAME issue also happens when run asitop in Ghostty. Error thrown:

1
2
'xterm-ghostty': unknown terminal type.
/opt/homebrew/Cellar/asitop/0.0.24/libexec/lib/python3.14/site-packages/blessed/terminal.py:186: UserWarning: Failed to setupterm(kind='xterm-ghostty'): setupterm: could not find terminal

This is because asitop (via the blessed library) doesn’t recognize Ghostty‘s terminal type xterm-ghostty.

Either run as:

1
TERM=xterm-256color sudo asitop

or, add an alias to the shell config (~/.zshrc or ~/.bashrc):

1
alias asitop='TERM=xterm-256color sudo asitop'

Ghostty uses xterm-ghostty as its $TERM value, which isn’t in the terminfo database that blessed checks against. Falling back to xterm-256color gives it a fully compatible terminal description while keeping all the color/formatting support asitop needs.

Proxmox over Bluetooth

With Proxmox latest version 8.4.1 which has WiFi 7 / Bluetooth 5.4 support. A Intel® Wi-Fi 7 BE200 network adapter https://www.intel.com/content/www/us/en/products/sku/230078/intel-wifi-7-be200/specifications.html is in action.

On Proxmox host, USB devices:

1
2
3
4
5
6
7
8
root@mini:~# lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 006: ID 8087:0036 Intel Corp.
Bus 003 Device 003: ID 0461:4e04 Primax Electronics, Ltd Lenovo Keyboard KB1021
Bus 003 Device 002: ID 17ef:600e Lenovo Optical Mouse
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Proxmox Bluetooth - USB mapping

Proxmox Bluetooth - Resource Mappings

Proxmox Bluetooth - USB Device

Proxmox Bluetooth - Add Device