Package feeds and China mirrors: keep apk and opkg separate
First: the difference between apk and opkg starts with the firmware release, not “which mirror is faster”. 25.12 uses apk; 24.10 uses opkg. Package format, feed paths and verification differ and are not interchangeable.
Outcome
Section titled “Outcome”- Know whether the firmware uses
apkoropkg, and where its feed files live. - Match release, target, architecture and the kmods kernel hash.
- Know which part of the URL a China mirror replaces, and which paths must stay exact.
- Understand why “after changing the mirror, packages will not install”, and how to recover.
- Know why
apk upgrade/opkg upgradeis not a firmware upgrade.
Identify the package manager and feeds
Section titled “Identify the package manager and feeds”ubus call system boardcat /etc/openwrt_releaseuname -mcat /etc/apk/arch 2>/dev/nullopkg print-architecture 2>/dev/nullKey fields: release.version, release.target, DISTRIB_ARCH, release.revision. They must match the mirror path.
ExpectedYou can write the full release/target/arch combination.
OpenWrt 25.12 (apk):
cat /etc/apk/repositories.d/distfeeds.listOpenWrt 24.10 (opkg):
cat /etc/opkg/distfeeds.confcat /etc/opkg/customfeeds.confBack up before editing:
cp /etc/apk/repositories.d/distfeeds.list /etc/apk/repositories.d/distfeeds.list.bak.$(date +%F) 2>/dev/null || truecp /etc/opkg/distfeeds.conf /etc/opkg/distfeeds.conf.bak.$(date +%F) 2>/dev/null || trueExpectedYou know where each feed points and whether it is apk or opkg.
The apk layout in 25.12
Section titled “The apk layout in 25.12”OpenWrt 25.12 uses apk; indexes are .adb, packages are .apk. Typical feeds:
targets/<target>/packages/packages.adb: target-specific packages;packages/<arch>/base/packages.adb: base;packages/<arch>/luci/packages.adb: LuCI;packages/<arch>/packages/packages.adb: general packages;packages/<arch>/routing|telephony|video/packages.adb: category feeds;targets/<target>/kmods/<kernel-hash>/packages.adb: kernel modules; the hash must match the running kernel.
Commands:
apk updateapk search <name>apk add <name>apk info -e <name>Do not use opkg, and do not rename a 24.10 .ipk to .apk.
The opkg layout in 24.10
Section titled “The opkg layout in 24.10”OpenWrt 24.10 uses opkg; indexes are Packages.gz, packages are .ipk:
opkg updateopkg list | grep <name>opkg install <name>opkg list-installed | grep <name>Do not use apk, and do not feed a 25.12 .apk to opkg.
Rewriting to a China mirror
Section titled “Rewriting to a China mirror”For the TUNA mirror, the root is:
https://mirrors.tuna.tsinghua.edu.cn/openwrt/Replace only https://downloads.openwrt.org with that root and keep the entire path:
https://downloads.openwrt.org/releases/25.12.6/targets/x86/64/packages/packages.adb→ https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/25.12.6/targets/x86/64/packages/packages.adbDo not stop at .../openwrt/ or drop releases/25.12.6/targets/x86/64/...; an incomplete path returns 404.
curl -I https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/25.12.6/targets/x86/64/packages/packages.adbReplace the URL with your release/target; for kmods, verify the kernel hash too. If the mirror lacks the path, do not force it.
Expectedcurl returns 200 and the path matches the current release/target.
apk update# oropkg updateUse apk search/opkg list to confirm the feed is readable, then install only what you need. Do not treat apk upgrade/opkg upgrade as a firmware upgrade; use sysupgrade/ASU/owut for firmware.
Expectedapk/opkg update succeeds without bulk-upgrading packages.
Common failures
Section titled “Common failures”- Wrong release (25.12.6 vs 24.10.8);
- Wrong target (
x86/64, not anx86_64directory); - Wrong architecture (
x86_64,aarch64); - Mirror has not synced that path;
packagesandtargetsdirectories mixed up.
Signature/verification failures
Section titled “Signature/verification failures”- Corrupt index or a different release;
- Wrong system time/certificates;
- Another feed was mixed in;
- Do not rely on
--allow-untrusted; fix the feed/verification instead.
Dependency/ABI mismatch
Section titled “Dependency/ABI mismatch”- kmods kernel hash does not match;
- package built for another target/architecture;
- official and ImmortalWrt/iStoreOS feeds mixed;
- You need the same source, release and architecture, or a rebuild.
Command not found
Section titled “Command not found”- 25.12 has no
opkg; 24.10 has noapk; - Do not install a package manager just to run a command; identify the firmware/source first.
Package installed but LuCI does not show it
Section titled “Package installed but LuCI does not show it”- Only the core package was installed; the
luci-app-*package is missing; - Language pack missing;
- Browser cache/refresh;
- Package version does not match LuCI.
Recovery
Section titled “Recovery”# apkcp /etc/apk/repositories.d/distfeeds.list.bak.YYYY-MM-DD /etc/apk/repositories.d/distfeeds.listapk update
# opkgcp /etc/opkg/distfeeds.conf.bak.YYYY-MM-DD /etc/opkg/distfeeds.confopkg updateIf updates stop working after a mirror change, restore the official feed first, verify DNS/time/certificates, then try the mirror again. Do not hop between many mirrors.
E2 lab run (2026-10-20)
Section titled “E2 lab run (2026-10-20)”- Environment: OpenWrt 25.12.6 x86 VM 200;
apk; official feed and TUNA mirror. - Official
apk update:OK: 11220 distinct packages available;apk search -x sqm-scriptsfoundsqm-scripts-1.7.2-r1. - Switch to TUNA:
apk updatealso 11220;apk add sqm-scriptsinstalled1.7.2-r1. - Restore official feed:
apk updateworked; final feed is back ondownloads.openwrt.org. - Not tested: 24.10
opkg, signature errors, mixed/ABI mismatch, corrupt mirror index. - Recipe:
tests/recipes/package-sources.md.
E2 status and sources
Section titled “E2 status and sources”- This is E2 partial: the 25.12
apkofficial/TUNA/install/restore path was tested;opkgand bad-feed branches remain documentation. - Mirror paths change with releases; rerun
update/searchon the target release/target/arch before publishing. - Do not mix official, ImmortalWrt or iStoreOS feeds; ABI/kernel/signatures can all mismatch.
Sources
Independent OpenWrt notes. Every page states the firmware, device, package manager and way back.
Icons: Solar by 480 Design, CC BY 4.0