Opkg: install a specific package version

Hi, all.

A follow-up question on this old topic: Opkg: install a specific package version

I use openwrt-snapshot and persistent kmods repository, as described here: https://openwrt.org/faq/cannot_satisfy_dependencies, Persistent kmods for snapshots

# uname -a
Linux sweeney 5.10.82 #0 SMP Sat Dec 11 12:52:39 2021 aarch64 GNU/Linux

# cat /etc/opkg/distfeeds.conf 
src/gz openwrt_core https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/packages
src/gz openwrt_base https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/base
src/gz openwrt_kmods https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/kmods/5.10.82-1-a14ddae0ad293746650050c8a01f3bf8
src/gz openwrt_luci https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/luci
src/gz openwrt_packages https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/packages
src/gz openwrt_routing https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/routing
src/gz openwrt_telephony https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/telephony

Trying to install a package:

# opkg install strongswan
Installing strongswan (5.9.4-1) to root...
Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/packages/strongswan_5.9.4-1_aarch64_cortex-a53.ipk
Collected errors:
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-crypto-aead
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-crypto-authenc
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-crypto-cbc
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-lib-zlib-inflate
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-lib-zlib-deflate
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-crypto-deflate
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-crypto-des
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-crypto-echainiv
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-crypto-hmac
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-crypto-md5
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-crypto-sha1
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-nf-reject
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-nf-ipt
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-ipt-core
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-ipt-ipsec
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for strongswan:
 * 	kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5)
 * opkg_install_cmd: Cannot install package strongswan.

Looking at some package from conflicting dependencies:

# opkg info kmod-ipt-ipsec
Package: kmod-ipt-ipsec
Version: 5.10.87-1
Depends: kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5), kmod-ipt-core
Status: unknown ok not-installed
Section: kernel
Architecture: aarch64_cortex-a53
Size: 3716
Filename: kmod-ipt-ipsec_5.10.87-1_aarch64_cortex-a53.ipk
Description: Netfilter (IPv4) modules for matching IPSec packets
 Includes:
 - ah
 - esp
 - policy

Package: kmod-ipt-ipsec
Version: 5.10.82-1
Depends: kernel (= 5.10.82-1-a14ddae0ad293746650050c8a01f3bf8), kmod-ipt-core
Status: unknown ok not-installed
Section: kernel
Architecture: aarch64_cortex-a53
Size: 3719
Filename: kmod-ipt-ipsec_5.10.82-1_aarch64_cortex-a53.ipk
Description: Netfilter (IPv4) modules for matching IPSec packets
 Includes:
 - ah
 - esp
 - policy

# opkg depends -A kmod-ipt-ipsec
kmod-ipt-ipsec depends on:
	kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5)
	kmod-ipt-core
kmod-ipt-ipsec depends on:
	kernel (= 5.10.82-1-a14ddae0ad293746650050c8a01f3bf8)
	kmod-ipt-core

There are two package versions: from persistent kmods repository and from mainstream snapshot repository. opkg selects the largest version.

Ok, downloading the .ipk and installing a package manually from file:

# cd /tmp
# wget https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/kmods/5.10.82-1-a14ddae0ad293746650050c
8a01f3bf8/kmod-ipt-ipsec_5.10.82-1_aarch64_cortex-a53.ipk
Downloading 'https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/kmods/5.10.82-1-a14ddae0ad293746650050c8a01f3bf8/kmod-ipt-ipsec_5.10.82-1_aarch64_cortex-a53.ipk'
Connecting to 2a01:4f8:251:321::2:443
Writing to 'kmod-ipt-ipsec_5.10.82-1_aarch64_cortex-a53.ipk'

# opkg install kmod-ipt-ipsec_5.10.82-1_aarch64_cortex-a53.ipk 
Installing kmod-ipt-ipsec (5.10.87-1) to root...
Downloading https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/packages/kmod-ipt-ipsec_5.10.87-1_aarch64_cortex-a53.ipk
Collected errors:
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-nf-reject
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-nf-ipt
 * pkg_hash_check_unresolved: cannot find dependency kernel (= 5.10.87-1-b4c5fcb81c91860987588859984a94c5) for kmod-ipt-core
 * opkg_install_pkg: Checksum or size mismatch for package kmod-ipt-ipsec. Either the opkg or the package index are corrupt. Try 'opkg update'.
 * opkg_install_cmd: Cannot install package kmod-ipt-ipsec.

Why does he goes to repository anyway and trying to install wrong version, if there was a command to install from a given file?

How to install a specific package version?
How to use correctly a persistent kmods repository?

you can only install the current snapshot version of any package, the current file(s) are overwritten by the new ones, on a daily basis.

mostly kernel modules are affected.

installing from local file would be opkg install file.ipk

But why did they come up with persistent kmods repository? Does it not work anymore? Has it ever worked?

it's persistent for stable releases, not for snapshots.

if you want to stay on a specific snapshot date, you need to make your own local copy of the package repository.

Okay. But the links I gave above say the opposite.

When you get the message “Cannot satisfy the following dependencies for…” it is most likely because you installed a snapshot version of OpenWrt.
Read here for possible solutions.

what exactly contradicts my statement ?

I gave this link at the very beginning of my post and wrote that it was the solution described in it that I was trying to practice. But it doesn't work.

"I'm using a snapshot image" -- Solution #4.

"Persistent kmods for snapshots"

However, I found a workaround:

  1. Remove (or comment) openwrt_core repo in /etc/opkg/distfeeds.conf
  2. opkg update
  3. Install a package. If there are not enough packages from openwrt_core, install their manually and try again. Kmods will installed correctly from persistent kmods repository.

This is acceptable, but I would like to believe that there is a more correct way.

1 Like

The best way will be to find a version which is compatible with the rest of the installation. Version mismatches may cause device malfunctions and are risky.