In short, opkg on OpenWrt is intended to add a limited number of end-user packages to a ROM-based device. As outlined in those threads, because of its intended use and the resource constraints of all-in-one routers, opkg does not provide ABI-compatibility "guarantees" that you might find on desktop/server distros' tools like apt. Kernel modules must always be from the same kernel as that you have in the ROM. The kernel and base system may not be upgraded without re-flashing a newer ROM.
What is the reason you need a specific version?
Building your own ROM, from source, would be an approach if you truly needed that specific version.
The reason I need a specific version of a certain package is that I have OpenWrt 18.06.2 that gives me 4.14.98 of Linux. The package I need has a version for this kernel and works just fine. But the latest version of this same package is for 4.14.105 and obviously can't be installed on 4.14.98 with which I flashed a newly bought router. I guess I'll be able to find a newer fw, flash my router and that will give me 4.14.105. But I thought there was a simpler path - telling opkg I need an older version of a certain package.
To install a specific version, couldn't you just wget the specific version into /tmp and then opkg install /tmp/pkg_name.ipk?
No it's not a built in solution, but i think it will achieve what you want.
Looks like I managed to solve it, though. I was very lucky to have one router with 4.14.98 up and running and I just used opkg files kmod-usb-serial-cp210x to list the files and then copied them to the new router with 4.14.98 but without cp210x driver installed.
Wrong -- meaning that it is not consistent with your build, resulting in
* satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-usb-serial-cp210x:
* kernel (= 4.14.105-1-dcab2363a3f36331ab9d464c48f19c1d)
for a system running 4.14.98
jow suggested that the "matching" repo might be that associated with 18.06.2, rather than that for the nightly snapshots.
Edit: Did you install 18.06.2, a snapshot, or a self-built ROM?
And how come I'm using a snapshot that gives me 4.14.98 and opkg update && opkg install kmod-usb-serial-cp210x is looking for a version compiled with kernel 4.14.105?
It’s not looking for that specific version. It’s looking for that package, and then evaluates if the version is correct. It always takes the latest version from my understanding.
Yes you have the persistent link (#2 in the list), but you also have the generic link (#1) providing the updated (and incompatible version).
So you still could have used the wget method, you were just looking in the wrong URL.
opkg instal seems not support specify ipk version.
but we can install from file/url.
opkg install $url_of_ipk
and, I wrote a function to find the ipk url, if they in current opkg repo:
usage:
find_pkg tree
found 9.9.9-1 @chen_test.txt
http://www.example.com/path/to/file?xxx/aaa/bbb/aa_tree_9.9.9-1_mips_24kc.ipk
found 1.7.0-2 @test_30
http://10.1.1.30/ipk/tree_1.7.0-2_ramips_24kec.ipk
found 1.8.0-1 @packages
http://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/packages/tree_1.8.0-1_mipsel_24kc.ipk
the shell function:
find_pkg(){
local name=$1
awk '$1 ~ /^src/' /etc/opkg.conf /etc/opkg/*.conf | while read type repo url pad; do
local f=/var/opkg-lists/$repo
{
[ $type == "src/gz" ] && zcat $f || cat $f;
} | {
awk -vname="$name" '$1=="Package:" && $2==name {f=1;r=1} $0=="" {f=0} f {print} END{exit 1-r}'
} | while read key val pad; do
[ "$key" == "Version:" ] && ver=$val
[ "$key" == "Filename:" ] && {
echo found $ver @$repo
echo $url/$val
}
done
done
}