Opkg: install a specific package version

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.

You are right: Installing specific package versions?

1 Like

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.

Thanks everyone for the help.

If you truly "need the latest", building your own firmware from master (or a select point on that branch) would be an appropriate approach.

1 Like

BTW, no - he's referencing, the forum's search feature:

Screenshot%20from%202019-03-12%2010-33-53

https://forum.openwrt.org/search

And is it possible to download the ipk-file for a previous version of a package and then install it manually? Opkg sees both versions:

~# opkg find kmod-usb-serial-cp210x
kmod-usb-serial-cp210x - 4.14.105-1 - Kernel support for Silicon Labs cp210x USB-to-Serial converters
kmod-usb-serial-cp210x - 4.14.98-1 - Kernel support for Silicon Labs cp210x

so I thought maybe it's somehow possible to do this.

Thx!

Unlikely.

Kernel modules only should be expected to work with the exact kernel they were compiled with. Those two are from different kernel versions.

What you are probably seeing is the current, installed version, and a version from the repo.

Do not upgrade it.

I guess I didn't make myself clear.

My desire is to use 4.14.98 and install kmod-usb-serial-cp210x on it.

I made a fresh install of 4.14.98 on my router:

root@OpenWrt:~# uname -a
Linux OpenWrt 4.14.98 #0 SMP Wed Feb 13 09:37:36 2019 armv7l GNU/Linux

root@OpenWrt:~# opkg list-installed | grep usb
kmod-phy-bcm-ns-usb2 - 4.14.98-1
kmod-phy-bcm-ns-usb3 - 4.14.98-1
kmod-usb-bcma - 4.14.98-1
kmod-usb-core - 4.14.98-1
kmod-usb-ehci - 4.14.98-1
kmod-usb-ledtrig-usbport - 4.14.98-1
kmod-usb-ohci - 4.14.98-1
kmod-usb2 - 4.14.98-1
kmod-usb3 - 4.14.98-1

root@OpenWrt:~# opkg find kmod-usb-serial-cp210x
kmod-usb-serial-cp210x - 4.14.105-1 - Kernel support for Silicon Labs cp210x USB-to-Serial converters
kmod-usb-serial-cp210x - 4.14.98-1 - Kernel support for Silicon Labs cp210x USB-to-Serial converters

I guess it really means that both versions of kmod-usb-serial-cp210x exist in the repo, so maybe there's a way of getting the version for 4.14.98?

Thanks again for the help.

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.

That's exactly what I want to do! I just don't know the url of the previous version.

The url for the latest one is http://downloads.openwrt.org/snapshots/targets/bcm53xx/generic/packages/kmod-usb-serial-cp210x_4.14.105-1_arm_cortex-a9.ipk but if I replace 105 with 98 I get HTTP 404.

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.

This is the wrong repository url for 18.06.2. Should be http://downloads.openwrt.org/releases/18.06.2/targets/bcm53xx/generic/packages/

1 Like

What do you mean "wrong"?

root@OpenWrt:~# uname -a
Linux OpenWrt 4.14.98 #0 SMP Wed Feb 13 09:37:36 2019 armv7l GNU/Linux

root@OpenWrt:~# opkg install kmod-usb-serial-cp210x
Installing kmod-usb-serial-cp210x (4.14.105-1) to root...
Downloading http://downloads.openwrt.org/snapshots/targets/bcm53xx/generic/packages/kmod-usb-serial-cp210x_4.14.105-1_arm_cortex-a9.ipk
Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-usb-serial-cp210x:
 * 	kernel (= 4.14.105-1-dcab2363a3f36331ab9d464c48f19c1d)
 * opkg_install_cmd: Cannot install package kmod-usb-serial-cp210x.

I know this is a snapshot, but for some reason, I can't remember right now, I needed 4.14.98. Is there a stable build with 4.14.98?

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?

1 Like

Eh... I see. But I just downloaded a firmware file from my router page at openwrt.org.

Wasn't that enough?

Edit: I installed a snapshot.

Ah, OK, snapshot package repos are "moment in time". Tomorrow's snapshot's packages generally can't be used with today's snapshot.

There might be some relief (that I have never tried) based on

1 Like

Oh, I see.

Well, I'm using a snapshot with a persistent repository:

root@OpenWrt:~# cat /etc/opkg/distfeeds.conf
src/gz openwrt_core http://downloads.openwrt.org/snapshots/targets/bcm53xx/generic/packages
src/gz openwrt_kmods http://downloads.openwrt.org/snapshots/targets/bcm53xx/generic/kmods/4.14.98-1-8880200db9c13596328f3d6e96dbeabe
src/gz openwrt_base http://downloads.openwrt.org/snapshots/packages/arm_cortex-a9/base
src/gz openwrt_luci http://downloads.openwrt.org/snapshots/packages/arm_cortex-a9/luci
src/gz openwrt_packages http://downloads.openwrt.org/snapshots/packages/arm_cortex-a9/packages
src/gz openwrt_routing http://downloads.openwrt.org/snapshots/packages/arm_cortex-a9/routing
src/gz openwrt_telephony http://downloads.openwrt.org/snapshots/packages/arm_cortex-a9/telephony

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
}
1 Like

Thanks a lot for answering :slight_smile: .

I solved my problem by ysing the release version of OpenWrt.

среда, 10 апреля 2019г., 06:59 +03:00 от yurenchen via OpenWrt Forum mail@forum.openwrt.org:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.