How can I tell opkg to prioritize a repo when a package if found in multiple repos?

So, I recently found myself in a sort of annoying situation related to installing a package that required new kmods on a custom firmware buil;t against snapshot.

For this package (mwan3) I had built all the required kmod packages when I built the firmware, and I had added them to opkg via /etc/opkg/customfeeds.conf. However, I hadnt built a required (non-kmod) package that needed to be grabbed from the openwrt_core repo.

Unfortunately, whenever the openwrt_core repo was active, opkg tried to install the kmods from that repo instead of mine and errored out. If I disabled the openwrt_core repo opkg errored out because it couldnt find the package I hadnt built.

I eventually figured out how to solve this - disable the openwrt_core repo, grab the missing package with wget, then install it with opkg using the local downloaded .ipk file, then install mwan3. But this was...well...a pain in the ass. Is there a better way?

It seems like as of 2 years ago there was no way to prioritize source repos, but im hoping wither that has changed or that someone has a clever solutiuon to this issue without source repo prioritization.

Just off the top of my head, maybe opkg scans the package list files in lexical order? So if you named your feed "aaa", it would be picked up first?

You can turn on the verbose output on opkg with -V3 (or even 4), and pick through the output of what it's doing, which might help figure it out. You'll definitely want to redirect the output to a file so you can search it, as it's extremely verbose at those high verbosity levels.

There's a very easy answer to this, you can't<fullstop>.

opkg is a very simple package manager, it's predominant feature is being small. Limited features come with the territory. As far as opkg goes, there mustn't be package/ version conflicts in the configured repositories, if there are, the result is undefined and you get to keep both pieces.

1 Like

I already tried with -V4. It basically says "package already scanned, skipping". I tried a few ways to get it to scan the one from my repo first -- by naming it differently, by moving it to the start/end of the distrofeeds.conf file (instead of the customfeeds.conf file). Every way i tried it still picked up the openwrt repo one first and then skipped the one from my repo.

If anyone familiar with opkg internals knows how to get it to scan some repo before the official openwrt ones please do share. But I couldnt figure out how to make it do this...

In this case, perhaps it would be reasonable to request that all the kmods (and other packages that are explicitly kernel-version-locked) be moved into their own repo that ONLY contains explicitly kernel-version-locked packages?

This would basically split the openwrt_core repo into two...one containing all the kmod packages and one containing everything else.

Id guess that, for people like myself who share custom openwrt firmware built off of snapshot with the openwrt community, it is a fairly common practice to build most of the kmods that you (or anyone else using your firmware) might want/need, since you cant build those later, and then have people install everything else from the official repos. Having all the kmods in a single exclusive repo means that people doing this can "replace" a single kmod-only repo to link to ones with kmods built for their kernel without losing access to all the rest of the stuff in the openwrt_core repo.

Unlikely to happen, http://lists.infradead.org/pipermail/openwrt-devel/2024-June/042951.html.

2 Likes

8 posts were split to a new topic: OpenWrt development directions