opkg install downgrades ipk packages

655 views
Skip to first unread message

Jermain Horsman

unread,
Dec 23, 2021, 6:12:52 AM12/23/21
to opkg-...@googlegroups.com

There seems to be an issue with opkg (tested with 0.4.2) when installing ipk packages.

I’ve noticed that “opkg install” will downgrade/overwrite packages if the new ipk version is lower than the installed version, however it will not install the same version and it does mention an upgrade when installing a newer version.

The packages were built using a yocto recipe “upgrade-test_1.3.2.bb” which I then renamed to “upgrade-test_1.3.3.bb”, then I tried to install 1.3.2 > 1.3.3 > 1.3.2 > 1.3.2 giving the following result:

 

# opkg install /tmp/packages/upgrade-test_1.3.2-r1_arch.ipk

Installing upgrade-test (1.3.2) on root

Configuring upgrade-test.

# opkg install /tmp/packages/upgrade-test_1.3.3-r1_arch.ipk

Upgrading upgrade-test from 1.3.2-r1 to 1.3.3 on root

Configuring upgrade-test.

# opkg install /tmp/packages/upgrade-test_1.3.2-r1_arch.ipk

Installing upgrade-test (1.3.2) on root

Configuring upgrade-test.

# opkg install /tmp/packages/upgrade-test_1.3.2-r1_arch.ipk

Collected errors:

* opkg_prepare_file_for_install: Refusing to load file '/tmp/packages/upgrade-test_1.3.2-r1_arch.ipk' as it matches the installed version of upgrade-test (1.3.2-r1).

 

To me this seems unintended behaviour, especially since the option “—force-downgrade” exists, unless I’m missing something.

 

Sincerely,

 

Jermain Horsman

Alex Stewart

unread,
Jan 3, 2022, 11:03:45 AM1/3/22
to opkg-...@googlegroups.com, Jermain Horsman
Hey Jermain,
Seems like the new_pkg being exactly the same version as the old_pkg is
a special case that is intentionally disallowed - unless you have
enabled the `force_reinstall` option [1].

> |
> /* Disallow a reinstall of the same package version if force_reinstall
> * is not set. This is because in this case orphaned files may be left
> * behind.
> */|

And from commit 17b2f97d, which added that check...

>     Reinstalling an existing package version by specifying a filename
> or URL instead
>     of the package name is now blocked unless the force_reinstall flag
> is set as it
>     will just cause problems.
>
>     Signed-off-by: Paul Barker <pa...@paulbarker.me.uk>

So it seems to be an attempt to avoid the user accidentally creating
orphaned files; which seems like a reasonable argument.

If you'd like to push back on that reasoning: I'd start by checking how
dpkg handles the same situation. We try to keep compatibility where
possible.

Otherwise, does setting `force_reinstall` work for your use case?

[1]
https://git.yoctoproject.org/opkg/tree/libopkg/opkg_download.c?h=v0.4.2&id=179b60088ad681e4109633bffa5b0790d04eb6c9#n393


Hope that helps,

--
Alex Stewart
Software Engineer - NI Real-Time OS
NI (National Instruments)

alex.s...@ni.com

Jermain Horsman

unread,
Jan 12, 2022, 10:53:10 AM1/12/22
to Alex Stewart, opkg-...@googlegroups.com
Hello Alex,

First of all thank you for your time and your suggestion, I looked into dpkg and it seems --force-downgrade is forced by default for dpkg.
This would mean the current behaviour is as expected and instead I'd need a --no-force-downgrade/--refuse-downgrade for the behaviour I wanted.
It seems I'll have to resolve it using some manual checks, since, at least as far as I can tell, that is not an option that is implemented for opkg.

Sincerely,

Jermain Horsman
Reply all
Reply to author
Forward
0 new messages