The future is now: opkg vs apk

:+1:t3: All of the changes that OpenWrt devs have submitted upstream to the apk-tools project are on the master branch and hence v3-only. Backporting them to v2 would be a huge task and a real waste of time.

Correct again, stable Alpine (3.20) is still on apk-tools 2.14. I've been running it on one of my laptops for a while and keep it up-to-date on a weekly basis, so I can see when things are upgraded. I think if you were to use "edge" (their equivalent of OpenWrt's "snapshot") you'd get apk-tools v3.

1 Like

Even in alpine edge, apk v2 is still used. Check these links:

https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/alpine-sdk-1.1-r0.apk

Would this be enough for most people?

2 Likes

Personally not a fan of it, people should run a simple "apk --help" command like one would do on every single CLI program Linux wide.

1 Like

I think there are a lot of different people here with different backgrounds. I like the assumption, but not everyone thinks like that. Or considers using a websearch or even a LLM to answer most of their questions.

The question would be: who are you trying to cater to? Who is your user?

If the APK package manager is installed, perhaps (for a while) display a notice that points to the documentation for introductory material and commands needed to perform common tasks (that they may already know how to do with OPKG)?

The audience for this would probably be people who already have a little experience with installing/using OpenWrt, but are not new users or very experienced users.

The documentation could contain introductory material on the topic, how to perform common tasks, and then a full reference section (if appropriate).

FWIW, as a person who has several decades of IT experience, including years of writing documentation and knowledge base articles, I personally find MAN pages and --help text to be fairly unhelpful for me because what I often need is introductory/primer information, not reference information (which may use unfamiliar terminology on top of that). And web searches can be rather time consuming to find the useful gem that I actually need to read. :grinning:

The first time I encountered APK on a SNAPSHOT upgrade, I mostly needed to know what commands to use to get my router upgraded and running again. I seem to recall that it took a router swap and about 45 minutes of research and tinkering to get OpenWrt up again.

1 Like

If the APK package manager is installed, perhaps (for a while) display a notice that points to the documentation for introductory material and commands needed to perform common tasks (that they may already know how to do with OPKG)?

:white_check_mark: https://github.com/openwrt/openwrt/commit/c19c31f7aa6f9952b5d5e1b313eca79d4e7ed59c

1 Like

Is it correct that with apk, the "Available" tab shows the installed packages? With opkg it didn't show anything.

That may be due to the ongoing issue with ABI-versioned names. Is it all packages, or just some like jansson4 vs jansson, libgcc1 vs libgcc and so on?

We have new wiki cheatsheet and reference pages (thanks, @ynezz!). If you have even the tiniest urge to do so, please flesh them out and fix any errors in fact or presentation...

https://openwrt.org/docs/guide-user/additional-software/opkg-to-apk-cheatsheet
https://openwrt.org/docs/guide-user/additional-software/apk

4 Likes

This is what I see in the package manager without clicking update lists.

After updating the lists

Well we are only talking about main snapshots until 25.x since even 24.10 won't have it? These development builds, any user installing those instead of stable should know better and can easily run apk --help (I would hope).

I think that's working as expected. The "Available/Disponible" tab is selected, so before you update the manager will only know about the existing packages on the device, and the "Instalado" button on the right of each will be grayed out. Once you update, you get a whole bunch of new packages and the install button becomes active for the new ones.

1 Like

Out of curiosity, do the buttons for the installed packages like acpid on the "Disponible" tab change from grayed-out "Instalado" to something like active "Mejora" (or whatever LuCI's translation of "Upgrade" is)? That's the behavior I see on mine.

Without updating the lists

After updating the lists

1 Like

I'm wondering if with apk it is possible to install a package in a destination other than the root filesystem "/" ?

in opkg it is possible in this mode:
https://openwrt.org/docs/guide-user/additional-software/opkg#non-standard_installation_destinations

1 Like

The Cheatsheet mentions an two "interesting" command variants, the first of which is apk list --installed --orphaned.

If I use the command as suggested, I seem to get all of my installed packages including the "orphaned" ones. That is installed OR orphaned rather than installed AND orphaned (raising the question as to whether an orphaned package is not by definition installed).

If instead I enter apk list --orphaned, I get a verbose list of three packages (base files, kernel & libc) which I can simplify with apk list -orphaned --manifest per the second example. Resulting in:

~# apk list --orphan --manifest
base-files 1641~5a4eb56a7b
kernel 6.6.63~f66b18bc4db9edcbb693b9a104f95be0-r1
libc 1.2.5-r4

I presume these are the three "root" packages that are installed for their own sake not because of any downstream dependency.

Therefore the explanatory text "shows any dependencies that have been orphaned, i.e., unused packages that may be safely deleted" could be misleading at best & dangerous at worst.

3 Likes

I'm confused. I'm reading that OPKG is not being maintained, or is dead, yet there looks to be regular releases: https://git.yoctoproject.org/opkg/

One major problem with opkg was that we had been patching it so much for OpenWrt features, that moving to newer opkg versions was almost impossible. So, we were sticking to year 2011 opkg with 100+ OpenWrt-only patches/commits.

That's one reason why aparcar has been opposing using OpenWrt-only patches with APK, and our few changes have been upstreamed to APK itself.

13 Likes