The future is now: opkg vs apk

And then if you really want to use a package manager, you could repackage the contents as apks, but that requires the build host version of apk (the device version, as I mention a few posts above, has the mkpkg applet left out, as that seemed very unlikely to be used on-device).

Looking at how buildroot uses apk mkpkg is a good starting point to see how that would be done:

EDIT
Hmm, maybe we should have apk-full-* packages, like vim-full and dnsmasq-full...

4 Likes

8/64, yes, for now - 4/32, no, that time has passed over half a decade ago.

Removing luci and package manager won't make it fit into 4 MB flash, not that the system would still boot with 32 MB RAM anyways. That easy (plus some less easy ones) way out ceased to work in late 2019/ early 2020 - with both limits becoming a hard problem. See Can't connect to router page - #17 by slh.

Super useful info. This should be prominently featured in every wiki page for devices which have 8MiB flash.

I just documented using owut for this: Owut: OpenWrt Upgrade Tool - #968 by efahl

5 Likes

@efahl

apk bug or firmware selector bug?

I just used the Firmware Selector to make a custom build for a gl-b1300 (ath10k).
A snapshot build today, 2025-12-26

Part of the customisation is to change from -ct drivers to non-ct.
I expect to end up with ath10k-board, ath10k-firmware and kmod-ath10k installed

But instead I get:

root@OpenWrt:~# apk -I list | grep "ath10k"
ath10k-board-qca4019-20251125-r1 arm_cortex-a7_neon-vfpv4 {feeds/base/firmware/linux-firmware} () [installed]
ath10k-firmware-qca4019-20251125-r1 arm_cortex-a7_neon-vfpv4 {feeds/base/firmware/linux-firmware} () [installed]
kmod-ath10k-ct-6.12.62.2025.12.01~bb84e159-r1 arm_cortex-a7_neon-vfpv4 {feeds/base/kernel/ath10k-ct} (GPLv2) [installed]
root@OpenWrt:~# 


I see kmod-ath10k exists in the feeds...

Could this be a problem with apk?

This is the first time I have tried this for an ath10k device since apk was introduced last year.

EDIT: I think defo. a bug:

root@OpenWrt:~# apk -I list | grep "ath10k"
ath10k-board-qca4019-20251125-r1 arm_cortex-a7_neon-vfpv4 {feeds/base/firmware/linux-firmware} () [installed]
ath10k-firmware-qca4019-20251125-r1 arm_cortex-a7_neon-vfpv4 {feeds/base/firmware/linux-firmware} () [installed]
kmod-ath10k-ct-6.12.62.2025.12.01~bb84e159-r1 arm_cortex-a7_neon-vfpv4 {feeds/base/kernel/ath10k-ct} (GPLv2) [installed]
root@OpenWrt:~# 
root@OpenWrt:~# 
root@OpenWrt:~# apk del kmod-ath10k
( 1/25) Purging kmod-ath10k-ct (6.12.62.2025.12.01~bb84e159-r1)
  Executing kmod-ath10k-ct-6.12.62.2025.12.01~bb84e159-r1.pre-deinstall
( 2/25) Purging kmod-ath (6.12.62.6.18-r1)
  Executing kmod-ath-6.12.62.6.18-r1.pre-deinstall
( 3/25) Purging kmod-hwmon-core (6.12.62-r1)
  Executing kmod-hwmon-core-6.12.62-r1.pre-deinstall
( 4/25) Purging kmod-i2c-core (6.12.62-r1)
  Executing kmod-i2c-core-6.12.62-r1.pre-deinstall
( 5/25) Purging kmod-mac80211 (6.12.62.6.18-r1)
  Executing kmod-mac80211-6.12.62.6.18-r1.pre-deinstall
( 6/25) Purging kmod-cfg80211 (6.12.62.6.18-r1)
  Executing kmod-cfg80211-6.12.62.6.18-r1.pre-deinstall
( 7/25) Purging wifi-scripts (1.0-r1)
  Executing wifi-scripts-1.0-r1.pre-deinstall
( 8/25) Purging ucode-mod-digest (2025.12.01~f7c2b97a-r1)
  Executing ucode-mod-digest-2025.12.01~f7c2b97a-r1.pre-deinstall
( 9/25) Purging wireless-regdb (2025.10.07-r1)
  Executing wireless-regdb-2025.10.07-r1.pre-deinstall
(10/25) Purging kmod-crypto-ccm (6.12.62-r1)
  Executing kmod-crypto-ccm-6.12.62-r1.pre-deinstall
(11/25) Purging kmod-crypto-cmac (6.12.62-r1)
  Executing kmod-crypto-cmac-6.12.62-r1.pre-deinstall
(12/25) Purging kmod-crypto-gcm (6.12.62-r1)
  Executing kmod-crypto-gcm-6.12.62-r1.pre-deinstall
(13/25) Purging kmod-crypto-ctr (6.12.62-r1)
  Executing kmod-crypto-ctr-6.12.62-r1.pre-deinstall
(14/25) Purging kmod-crypto-seqiv (6.12.62-r1)
  Executing kmod-crypto-seqiv-6.12.62-r1.pre-deinstall
(15/25) Purging kmod-crypto-geniv (6.12.62-r1)
  Executing kmod-crypto-geniv-6.12.62-r1.pre-deinstall
(16/25) Purging kmod-crypto-rng (6.12.62-r1)
  Executing kmod-crypto-rng-6.12.62-r1.pre-deinstall
(17/25) Purging kmod-crypto-hmac (6.12.62-r1)
  Executing kmod-crypto-hmac-6.12.62-r1.pre-deinstall
(18/25) Purging kmod-crypto-manager (6.12.62-r1)
  Executing kmod-crypto-manager-6.12.62-r1.pre-deinstall
(19/25) Purging kmod-crypto-aead (6.12.62-r1)
  Executing kmod-crypto-aead-6.12.62-r1.pre-deinstall
(20/25) Purging kmod-crypto-sha3 (6.12.62-r1)
  Executing kmod-crypto-sha3-6.12.62-r1.pre-deinstall
(21/25) Purging kmod-crypto-sha512 (6.12.62-r1)
  Executing kmod-crypto-sha512-6.12.62-r1.pre-deinstall
(22/25) Purging kmod-crypto-ghash (6.12.62-r1)
  Executing kmod-crypto-ghash-6.12.62-r1.pre-deinstall
(23/25) Purging kmod-crypto-gf128 (6.12.62-r1)
  Executing kmod-crypto-gf128-6.12.62-r1.pre-deinstall
(24/25) Purging kmod-crypto-null (6.12.62-r1)
  Executing kmod-crypto-null-6.12.62-r1.pre-deinstall
(25/25) Purging iw-full (6.17-r1)
  Executing iw-full-6.17-r1.pre-deinstall
OK: 14.9 MiB in 143 packages
root@OpenWrt:~# apk add kmod-ath10k
( 1/25) Installing iw-full (6.17-r1)
  Executing iw-full-6.17-r1.post-install
( 2/25) Installing ucode-mod-digest (2025.12.01~f7c2b97a-r1)
  Executing ucode-mod-digest-2025.12.01~f7c2b97a-r1.post-install
( 3/25) Installing wifi-scripts (1.0-r1)
  Executing wifi-scripts-1.0-r1.post-install
( 4/25) Installing wireless-regdb (2025.10.07-r1)
  Executing wireless-regdb-2025.10.07-r1.post-install
( 5/25) Installing kmod-cfg80211 (6.12.62.6.18-r1)
  Executing kmod-cfg80211-6.12.62.6.18-r1.post-install
( 6/25) Installing kmod-crypto-null (6.12.62-r1)
  Executing kmod-crypto-null-6.12.62-r1.post-install
( 7/25) Installing kmod-crypto-aead (6.12.62-r1)
  Executing kmod-crypto-aead-6.12.62-r1.post-install
( 8/25) Installing kmod-crypto-manager (6.12.62-r1)
  Executing kmod-crypto-manager-6.12.62-r1.post-install
( 9/25) Installing kmod-crypto-hmac (6.12.62-r1)
  Executing kmod-crypto-hmac-6.12.62-r1.post-install
(10/25) Installing kmod-crypto-sha3 (6.12.62-r1)
  Executing kmod-crypto-sha3-6.12.62-r1.post-install
(11/25) Installing kmod-crypto-sha512 (6.12.62-r1)
  Executing kmod-crypto-sha512-6.12.62-r1.post-install
(12/25) Installing kmod-crypto-rng (6.12.62-r1)
  Executing kmod-crypto-rng-6.12.62-r1.post-install
(13/25) Installing kmod-crypto-geniv (6.12.62-r1)
  Executing kmod-crypto-geniv-6.12.62-r1.post-install
(14/25) Installing kmod-crypto-seqiv (6.12.62-r1)
  Executing kmod-crypto-seqiv-6.12.62-r1.post-install
(15/25) Installing kmod-crypto-ctr (6.12.62-r1)
  Executing kmod-crypto-ctr-6.12.62-r1.post-install
(16/25) Installing kmod-crypto-ccm (6.12.62-r1)
  Executing kmod-crypto-ccm-6.12.62-r1.post-install
(17/25) Installing kmod-crypto-cmac (6.12.62-r1)
  Executing kmod-crypto-cmac-6.12.62-r1.post-install
(18/25) Installing kmod-crypto-gf128 (6.12.62-r1)
  Executing kmod-crypto-gf128-6.12.62-r1.post-install
(19/25) Installing kmod-crypto-ghash (6.12.62-r1)
  Executing kmod-crypto-ghash-6.12.62-r1.post-install
(20/25) Installing kmod-crypto-gcm (6.12.62-r1)
  Executing kmod-crypto-gcm-6.12.62-r1.post-install
(21/25) Installing kmod-mac80211 (6.12.62.6.18-r1)
  Executing kmod-mac80211-6.12.62.6.18-r1.post-install
(22/25) Installing kmod-ath (6.12.62.6.18-r1)
  Executing kmod-ath-6.12.62.6.18-r1.post-install
(23/25) Installing kmod-i2c-core (6.12.62-r1)
  Executing kmod-i2c-core-6.12.62-r1.post-install
(24/25) Installing kmod-hwmon-core (6.12.62-r1)
  Executing kmod-hwmon-core-6.12.62-r1.post-install
(25/25) Installing kmod-ath10k-ct (6.12.62.2025.12.01~bb84e159-r1)
  Executing kmod-ath10k-ct-6.12.62.2025.12.01~bb84e159-r1.post-install
OK: 17.2 MiB in 168 packages
root@OpenWrt:~# 

As you can see above, I removed kmod-ath10k and re-added it. No mention of "ct", but I end up with the ct version reinstalled. I guess this is similar to what happens in the firmware selector.

EDIT2 for completness:

root@OpenWrt:~# apk del kmod-ath10k-ct
World updated, but the following packages are not removed due to:
  kmod-ath10k-ct: kmod-ath10k

OK: 17.2 MiB in 168 packages
root@OpenWrt:~# 

That's a packaging bug due to ongoing work on snapshot. My example that's similar to yours does this:

apk add kmod-r8169
... installs kmod-r8127

Still trying to figure out what the magic incantation in the package definitions is that causes this... https://github.com/openwrt/openwrt/issues/21257#issuecomment-3691917881

1 Like

@tofurky has identified the root cause of the various "ADB x error" issues that are seen sporadically across platforms and hosts (including the buildbots, imagebuilder, ASU and on-device). Turns out to be two bugs in apk 3.0:

First one has a fix in upstream, and has been backported, so will be available probably tomorrow in snapshot and 25.12-snapshot, and in the next 25.12.0-rc (it will be in apk 3.0.2-r3 or newer).

The second issue deals with byte/word alignment during parsing of file streams and a solution is in process. Lots of details in this github issue, including links to the upstream MR. And for those with the affected platforms, @tofurky gives a workaround in the linked comment:

5 Likes

Why do I have to add outside packages with apk add --allow-untrusted?

Because they're unsigned or signed with keys that are not on the keychain.

Yes I know but on opkg you just can install them through web interface. At most it should ask me to install or not maybe?

apk isn't a new and fancy name for opkg. While it serves a similar purpose, it's its own project, with a different feature set, semantics and syntax. It's actively developed by alpine linux for the modern day, while opkg's development ceased over 15 years ago.

2 Likes

The point is opkg let us install those "unsecure" packages. After confirming.

So does apk, if you instruct it to.

AFAIR apk file has signature within package itself while ipk (opkg) normally doesn't (it is an option though).

As explained above, you need the keys. To make a foreign feed work seamlessly, you would add both the url and the keys to your device, after which apk add package works the same as upstream OpenWrt feeds.

echo 'https://dev.melmac.net/apk/packages.adb' >> /etc/apk/repositories.d/customfeeds.list
wget https://dev.melmac.net/apk/apk.openwrt.melmac.net.pem -P /etc/apk/keys/

EDIT
Make sure to add the key file to sysupgrade.conf so it's retained across backups (don't add that whole directory, though, or you'll overwrite updates to the OpenWrt keys).

echo '/etc/apk/keys/apk.openwrt.melmac.net.pem' >> /etc/sysupgrade.conf
3 Likes

Feature request: Add package size display like opkg

Add it where? apk already has multiple ways to show package size, e.g. via info, query or adbdump.