The future is now: opkg vs apk

I know Alpine Linux very well, I have an Alpine Linux home server. Should I just install one of the snapshots for testing? I have an ASUS AX59U. If it's helpful I'll try it when none is home :slight_smile: Don't want angry complaints of why internet is not working haha.

Also I have another router(ASUS RT-N18U) too at work. I'll try to flash it with that too.

I have set up AX59U with snapshot release. Apk works well, tailscale, wireguard, pppoe, vlans, wifi, smb,ftp servers and ddns work well.
Version was this: SNAPSHOT (r28694-730db6b893)

1 Like

I had a self-built snapshot working fine for some weeks. Last week, after I upgraded to a 6.6.77 based main branch, I am unable to install the package prosody. apk search -v|wc -l lists 845 packages, but prosody is not among them. If I download the package file from https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/packages/ and try to install the file with apk add prosody-0.11.13-r1.apk, it will complain about an untrusted signature. If I try to bypass that with --allow-untrusted, there will be further complaints about missing dependencies: libidn, luabitop, luaexpat, luafilesystem, luasec. The previous build, maybe a month or two ago, was able to install the package. apk update currently reports the following:

fetch https://downloads.openwrt.org/snapshots/targets/qualcommax/ipq60xx/packages/packages.adb
fetch https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/base/packages.adb
 [https://downloads.openwrt.org/snapshots/targets/qualcommax/ipq60xx/packages/packages.adb]
 [https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/base/packages.adb]
OK: 1012 distinct packages available

What might I be doing wrong, and is there a way to update the list of packages? Should I have built the sysupgrade.bin image in a different way, with some more packages included in it?

That's very suspicious, it should be more like 11000 packages... It looks like your feeds file is truncated somehow.

$ apk list | wc -l
10984

$ cat /etc/apk/repositories.d/distfeeds.list
https://downloads.openwrt.org/snapshots/targets/x86/64/packages/packages.adb
https://downloads.openwrt.org/snapshots/packages/x86_64/base/packages.adb
https://downloads.openwrt.org/snapshots/targets/x86/64/kmods/6.6.77-1-652c280a9029ed01bfb8175406799366/packages.adb
https://downloads.openwrt.org/snapshots/packages/x86_64/luci/packages.adb
https://downloads.openwrt.org/snapshots/packages/x86_64/packages/packages.adb
https://downloads.openwrt.org/snapshots/packages/x86_64/routing/packages.adb
https://downloads.openwrt.org/snapshots/packages/x86_64/telephony/packages.adb
https://downloads.openwrt.org/snapshots/packages/x86_64/video/packages.adb
1 Like

For some reason, most package sources had been commented out on my system:

# cat /etc/apk/repositories.d/distfeeds.list 
https://downloads.openwrt.org/snapshots/targets/qualcommax/ipq60xx/packages/packages.adb
https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/base/packages.adb
# https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/luci/packages.adb
# https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/packages/packages.adb
# https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/routing/packages.adb

After I enabled all 5 sources, apk update reported 8981 distinct packages available, and apk add prosody worked.

I remember while building my custom image for this currently unsupported device, I didnโ€™t enable telephony or video, or possibly routing. But I donโ€™t remember anything that would explain this.

@efahl I think that your advice would be an excellent addition to https://openwrt.org/docs/guide-user/additional-software/apk#adjust_repositories.

I wrote something to that section of the wiki page. The remaining sections are still empty.

1 Like

Is it going to be possible to specify dependency version requirements in Makefile? Something like >=2.0.3. Right now you're basically stuck with whatever the version of a package is in the current branch, which may or may not be compatible. This includes host packages.

1 Like

Fun with apk...

Install the graphviz package on your workstation (apt/dnf install graphviz, Windows installers available here: https://graphviz.org/download/).

Pick a package, here I'm using nmap, and run apk dot package. Push the resulting .dot file through Graphviz's dot converter, here I'm generating a png.

ssh router "apk dot nmap" | dot -Tpng -o nmap-dependencies.png

Results:

9 Likes

Nice! I was tinkering with a script last year that generates directed graph images with opkg package data but paused when I saw apk in the future. I was looking at scalable vector graphics (svg) images that are produced by the script. Could all be done on an OpenWrt device with posix commands using standard built-in tools like the shell and busybox awk. It also works on my linux pc. An svg file can be easily rasterized to .png, .gif, .bmp etc.

EDIT: An idea I had was to be able to graphically show the dependency tree for a proposed package addition with new vs existing packages color coded with the "installed sizes" and a sum of size needed for the new components.

1 Like

That should be pretty trivial, as the dot format is really quite easy to parse and modify. Years ago I did pretty much that for a Python dependency tool, generating dot output like apk dot does.

You can probably see how to do various things like adding colors with a simple sed/awk pass over the output from the examples here: https://en.wikipedia.org/wiki/DOT_(graph_description_language) and https://graphviz.org/doc/info/attrs.html

$ apk apk dot nmap
digraph "apkindex" {
  rankdir=LR;
  node [shape=box];
  "libc-1.2.5-r4" -> "libgcc1-13.3.0-r4"[arrowhead=inv,label="libgcc",];
  "nmap-7.95-r1" -> "libc-1.2.5-r4"[];
  "libpcap1-1.10.5-r2" -> "libc-1.2.5-r4"[];
  "nmap-7.95-r1" -> "libpcap1-1.10.5-r2"[];
  "libpcre2-10.42-r1" -> "libc-1.2.5-r4"[];
  "nmap-7.95-r1" -> "libpcre2-10.42-r1"[];
  "nmap-7.95-r1" -> "libstdcpp6-13.3.0-r4"[];
  "zlib-1.3.1-r1" -> "libc-1.2.5-r4"[];
  "nmap-7.95-r1" -> "zlib-1.3.1-r1"[];
}

So

... apk apk dot nmap | sed 's/LR/TB/;s/shape=box/shape=hexagon,color=green/' ...

produces

1 Like

Nice.

I feel that libc and libgcc are pretty unnecessary there, as they will be present in any case. They just make the graph look more complex.

1 Like

I'm having an issue with curl ATM.

Is there a walk-though on how to downgrade a particular apk package?

If the old version is still available on the package feeds (it's usually not, as OpenWrt feeds are overwritten and not archived), then it's as simple as apk add curl==<old-version>. Otherwise, you need to rebuild the package by reverting its make file and build it from scratch.

1 Like