The future is now: opkg vs apk

I noticed that the APK pkg filenames do not contain the ARCH unlike OPKG pkg filenames which do contain the ARCH. Why is that?

For example:

OPKG

https://downloads.openwrt.org/releases/24.10.5/packages/aarch64_cortex-a53/base/busybox_1.36.1-r2_aarch64_cortex-a53.ipk

https://downloads.openwrt.org/releases/24.10.5/packages/aarch64_cortex-a53/packages/sqm-scripts_1.6.0-r1_all.ipk

VS

APK

https://downloads.openwrt.org/releases/25.12.0-rc5/packages/aarch64_cortex-a53/base/busybox-1.37.0-r6.apk

https://downloads.openwrt.org/releases/25.12.0-rc5/packages/aarch64_cortex-a53/packages/sqm-scripts-1.7.2-r1.apk

Did you add that directory to your PATH? This is what the script is trying to suggest in the output.

1 Like

I got it now added this is my $PATH:

developer@DESKTOP-BELHTS7:~/openwrt$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/snap/bin:/home/developer/openwrt/staging_dir/host/bin

however now I'm getting other issues plus the ghn map becomes empty for me.

full output:

click
developer@DESKTOP-BELHTS7:~/openwrt$ ./scripts/devolo-extract-ghn-packages ~/openwrt/devolo.bin ghn/
~/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root ~/openwrt

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             Flattened device tree, size: 21804024 bytes, version: 17
24244         0x5EB4          Flattened device tree, size: 3426812 bytes, version: 17
24472         0x5F98          gzip compressed data, maximum compression, has original file name: "Image", from Unix, last modified: 2023-09-06 18:08:40
3047320       0x2E7F98        Flattened device tree, size: 18620 bytes, version: 17
3066220       0x2EC96C        Flattened device tree, size: 18305 bytes, version: 17
3084808       0x2F1208        Flattened device tree, size: 30438 bytes, version: 17
3115528       0x2F8A08        Flattened device tree, size: 21482 bytes, version: 17
3137292       0x2FDF0C        Flattened device tree, size: 24695 bytes, version: 17
3162268       0x30409C        Flattened device tree, size: 18353 bytes, version: 17
3180904       0x308968        Flattened device tree, size: 24687 bytes, version: 17
3205872       0x30EAF0        Flattened device tree, size: 18197 bytes, version: 17
3224352       0x313320        Flattened device tree, size: 21422 bytes, version: 17
3246056       0x3187E8        Flattened device tree, size: 21691 bytes, version: 17
3268028       0x31DDBC        Flattened device tree, size: 24855 bytes, version: 17
3293164       0x323FEC        Flattened device tree, size: 18620 bytes, version: 17
3312064       0x3289C0        Flattened device tree, size: 24818 bytes, version: 17
3337164       0x32EBCC        Flattened device tree, size: 27315 bytes, version: 17
3364760       0x335798        Flattened device tree, size: 24830 bytes, version: 17
3389872       0x33B9B0        Flattened device tree, size: 19144 bytes, version: 17
3409304       0x340598        Flattened device tree, size: 19028 bytes, version: 17
3428608       0x345100        Flattened device tree, size: 19148 bytes, version: 17

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root-0/var -> /tmp; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root-0/www/cgi-bin/config-backup -> /usr/libexec/base-cgi; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root-0/www/cgi-bin/data-upload -> /usr/libexec/base-cgi; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root-0/etc/fstab -> /tmp/fstab; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root-0/etc/mtab -> /proc/797447/mounts; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root-0/etc/TZ -> /tmp/TZ; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root-0/etc/resolv.conf -> /tmp/resolv.conf; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root-0/etc/ssl/cert.pem -> /etc/ssl/certs/ca-certificates.crt; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root-0/usr/sbin/cfg80211tool_mesh -> /usr/sbin/cfg80211tool; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root/var -> /tmp; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root/www/cgi-bin/config-backup -> /usr/libexec/base-cgi; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root/www/cgi-bin/data-upload -> /usr/libexec/base-cgi; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root/etc/fstab -> /tmp/fstab; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root/etc/mtab -> /proc/797447/mounts; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root/etc/TZ -> /tmp/TZ; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root/etc/resolv.conf -> /tmp/resolv.conf; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root/etc/ssl/cert.pem -> /etc/ssl/certs/ca-certificates.crt; changing link target to /dev/null for security purposes.

WARNING: Symlink points outside of the extraction directory: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root/usr/sbin/cfg80211tool_mesh -> /usr/sbin/cfg80211tool; changing link target to /dev/null for security purposes.
3451288       0x34A998        Squashfs filesystem, little endian, version 4.0, compression:xz, size: 18101442 bytes, 2469 inodes, blocksize: 262144 bytes, created: 2023-09-06 18:10:39

basename: missing operand
Try 'basename --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
No libubox.so.* found below /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root
No libubus.so.* found below /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root
No libuci.so.* found below /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root
No libblobmsg_json.so.* found below /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root/_devolo.bin.extracted/squashfs-root
~/openwrt/ghn/devolo-extract-ghn-packages.797440 ~/openwrt/ghn/devolo-extract-ghn-packages.797440/openwrt-root ~/openwrt

General Error: Cannot open file  (CWD: /home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440) : [Errno 2] No such file or directory: ''

realpath: '/home/developer/openwrt/ghn/devolo-extract-ghn-packages.797440/*/squashfs-root': No such file or directory
realpath: /usr/lib/opkg/info/delos-base-files: No such file or directory
dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
Please use the OpenWRT package
Enable  in 'make menuconfig'
realpath: /usr/lib/opkg/info/delos-device-name: No such file or directory
dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
Please use the OpenWRT package
Enable  in 'make menuconfig'
realpath: /usr/lib/opkg/info/devolo-shared-configlayer: No such file or directory
dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
Please use the OpenWRT package
Enable  in 'make menuconfig'
realpath: '/usr/lib/opkg/info/dlan2-fw-flashless-*': No such file or directory
dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
Please use the OpenWRT package
Enable  in 'make menuconfig'
realpath: /usr/lib/opkg/info/dlan2-tools: No such file or directory
dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
Please use the OpenWRT package
Enable  in 'make menuconfig'
realpath: /usr/lib/opkg/info/ghn-flashless: No such file or directory
dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
Please use the OpenWRT package
Enable  in 'make menuconfig'
realpath: /usr/lib/opkg/info/ghn-host: No such file or directory
dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
Please use the OpenWRT package
Enable  in 'make menuconfig'
realpath: /usr/lib/opkg/info/libssp: No such file or directory
dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
Please use the OpenWRT package
Enable  in 'make menuconfig'
realpath: /usr/lib/opkg/info/posix-timezone-db: No such file or directory
dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information.
Please use the OpenWRT package
Enable  in 'make menuconfig'

I think I still miss something :slight_smile:

Hmm, seems I might need to do some more testing when not specifying the OpenWrt sysimage. I thought I had that working on Sunday. For now, could you try adding the path to the OpenWrt sysimage to the arguments as well? That is probably more stable.

Strange, I have tried a couple of combinations but it fails.

Then tried using direct paths and see this:

developer@DESKTOP-BELHTS7:~/openwrt$ ./scripts/devolo-extract-ghn-packages ~/openwrt/devolo.bin /home/openwrt/bin/targets/ipq40xx/generic/openwrt-ipq40xx-generic-devolo_magic-2-wifi-next-squashfs-sysupgrade.bin

realpath: /home/openwrt/bin/targets/ipq40xx/generic/openwrt-ipq40xx-generic-devolo_magic-2-wifi-next-squashfs-sysupgrade.bin: Permission denied

/home/openwrt/bin/targets/ipq40xx/generic/openwrt-ipq40xx-generic-devolo_magic-2-wifi-next-squashfs-sysupgrade.bin does not exist!

My PATH is now:

developer@DESKTOP-BELHTS7:~/openwrt$ echo ${PATH}
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/developer/openwrt/staging_dir/host/bin:/home/developer/openwrt/bin/targets/ipq40xx/generic :/home/developer/openwrt:/openwrt/bin/targets/ipq40xx/generic/openwrt-ipq40xx-generic-devolo_magic-2-wifi-next-squashfs-sysupgrade.bin

Likely wrong but I have tried them per step I think the last entry is wrong anyway.

It appears you renamed the devolo image. I had missed that earlier, but that won’t work as the script searches for delos to figure out which file to use as the devolo image. (See line 35 in the script.)

Adding /home/developer/openwrt/staging_dir/host/bin to your PATH, should work I guess. Can you run apk with that in place?

I should add some extra checks for these things :slight_smile:

1 Like

Now it works :+1:

1 Like

In apk that info is inside the package itself, and validated during installation of the package.

$ wget https://mirror-03.infra.openwrt.org/releases/25.12.0-rc5/packages/aarch64_cortex-a53/base/busybox-1.37.0-r6.apk

$ apk adbdump busybox-1.37.0-r6.apk | grep arch
  arch: aarch64_cortex-a53

EDIT
Should have also mentioned /etc/apk/arch

1 Like

@aparcar saw this commit today: package: drop apk cheatsheet from base-files

… and got the idea: Wait! It’s is too early to remove the cheatsheet. :open_mouth:

Why?
After 25.12 codefreeze and as soon as final 25.12 images are in the wild many people may be lost. For this audience the cheatsheet may be of huge value. (… because some of them may not have participated/worked with snapshot releases and therefore may not be aware of the new apk commands.)

(my assumtion is: this cheatsheet is’nt available in 25.12 release - pls ignore this post if I’m wrong)

Thanks :slight_smile:

1 Like

Hi @nextgen-networks, thanks for your interest in keeping OpenWrt user-friendly! The notification will stay in 25.12, however was removed in snapshots only. Developers had plenty of time to notice that

3 Likes

You got me thinking, so...

2 Likes

Just to let you know, I added this part to the documentation, I hope there are no errors or anything else:

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

@efahl

1 Like

Might want to format it a little prettier with code blocks and such:

<code>
literal code cut'n'pasted from term
</code>

Also might want to mention root cause of those cache warnings, i.e., that the apk indexes are either out-of-date or missing and a simple apk update usually resolves them (assumes of course that you have internet access).

1 Like

Since you liked it, I modified it... :grinning_face:

===== Notes =====

You may occasionally see warnings such as:

WARNING: opening from cache … No such file or directory

These warnings usually occur when the local apk repository indexes are missing
or outdated. In most cases they can be resolved by refreshing the package
indexes:

apk update

If the warnings persist but do not affect package installation, they are
generally harmless.

Advanced users who prefer to hide these warnings can use a shell alias, for example:

alias apk='apk 2>/dev/null'

or, to keep real errors visible:

alias apk='apk 2> >(grep -v "WARNING: opening from cache")'
2 Likes

Apk error on 7490 AVM router

apk update
ERROR: wget: exited with error 1
WARNING: updating and opening ``https://downloads.openwrt.org/releases/25.12.0/targets/lantiq/xrx200/packages/packages.adb:`` unexpected end of file
ERROR: wget: exited with error 1
WARNING: updating and opening ``https://downloads.openwrt.org/releases/25.12.0/packages/mips_24kc/base/packages.adb:`` unexpected end of file
ERROR: wget: exited with error 1
WARNING: updating and opening ``https://downloads.openwrt.org/releases/25.12.0/targets/lantiq/xrx200/kmods/6.12.71-1-85faff7027ce66bb21945fd8402545f6/packages.adb:`` unexpected end of file
ERROR: wget: exited with error 1
WARNING: updating and opening ``https://downloads.openwrt.org/releases/25.12.0/packages/mips_24kc/luci/packages.adb:`` unexpected end of file
ERROR: wget: exited with error 1
WARNING: updating and opening ``https://downloads.openwrt.org/releases/25.12.0/packages/mips_24kc/packages/packages.adb:`` unexpected end of file
ERROR: wget: exited with error 1
WARNING: updating and opening ``https://downloads.openwrt.org/releases/25.12.0/packages/mips_24kc/routing/packages.adb:`` unexpected end of file
ERROR: wget: exited with error 1
WARNING: updating and opening ``https://downloads.openwrt.org/releases/25.12.0/packages/mips_24kc/telephony/packages.adb:`` unexpected end of file
ERROR: wget: exited with error 1
WARNING: updating and opening ``https://downloads.openwrt.org/releases/25.12.0/packages/mips_24kc/video/packages.adb:`` unexpected end of file
8 unavailable, 0 stale; 159 distinct packages available

wget https://downloads.openwrt.org/releases/25.12.0/targets/lantiq/xrx200/packages/packages.adb
https://downloads.openwrt.org/releases/25.12.0/targets/lantiq/xrx200/packages/packages.adb: HTTPS support not compiled in.


:expressionless:

Solved, removed wget (or better, install wget-ssl), now works.

1 Like