Apk equivalent to opkg --force-reinstall, apk fix is not working?

Hello may I know what's the equivalent for --force-reinstall for apk? I tried apk fix <package> but it errors out with the following. APK unavailable, skipped. I checked the cheat sheet too, I couldn't find it https://openwrt.org/docs/guide-user/additional-software/opkg-to-apk-cheatsheet?s[]=apk

$ apk fix docker
fetch https://downloads.openwrt.org/snapshots/targets/x86/64/packages/packages.adb
fetch https://downloads.openwrt.org/snapshots/packages/x86_64/base/packages.adb
fetch https://downloads.openwrt.org/snapshots/packages/x86_64/luci/packages.adb
fetch https://downloads.openwrt.org/snapshots/packages/x86_64/packages/packages.adb
fetch https://downloads.openwrt.org/snapshots/packages/x86_64/routing/packages.adb
fetch https://downloads.openwrt.org/snapshots/packages/x86_64/telephony/packages.adb
(1/1) [APK unavailable, skipped] Reinstalling docker (27.3.1-r1)
OK: 532 MiB in 654 packages

There was a recent bug where apk wasn't included in the images.

2 Likes

I just had to do this on Monday, https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/10651

apk fix --reinstall package

I believe the bit saying [APK unavailable, skipped] means that that the package-blah.apk is not cached locally, so it will re-download from the repo for the fix.

1 Like

it doesn't re-download it like what you say or expected, for example, I will delete nano from /usr/bin/nano then when i run apk fix --reinstall nano the nano binary file is still not reinstalled by apk. It totally skipped it just like what the error message says

might be a different scenario if nano apk is in apk cache?

There's definitely something funky going on. I tried some experiments, doing what you did, deleting the binary from a package and then apk fix --reinstall didn't bring it back, but apk fix (no --reinstall) did. Weird, but whatever.

Then I tried it again, and both with and without --reinstall worked and restored the missing binary. wtf? Now I can't reproduce the "doesn't restore" behavior at all.

And there's no .apk cached locally, just the indexes.

$ find / -iname '*.apk'
$ find /tmp/cache/
/tmp/cache/
/tmp/cache/apk
/tmp/cache/apk/APKINDEX.af2c9fd1.tar.gz
/tmp/cache/apk/APKINDEX.3725f6be.tar.gz
/tmp/cache/apk/APKINDEX.e5fa5325.tar.gz
/tmp/cache/apk/APKINDEX.6697b83a.tar.gz
/tmp/cache/apk/APKINDEX.e7bb3bfa.tar.gz
/tmp/cache/apk/APKINDEX.af0f1c9d.tar.gz
/tmp/cache/apk/APKINDEX.873c8963.tar.gz
/tmp/cache/apk/APKINDEX.af8e2c78.tar.gz