Broke opkg during an upgrade

Hi,

At one location I was running an OpenWRT router which I have basically left alone for years.
Then at some point I thought that I will upgrade some packages, and started it by upgrading opkg itself.
However, probably because of some dependency issues, opkg itself is now broken.

This is what I did in detail:

root@routerr:~# opkg update

Downloading http://downloads.openwrt.org/snapshots/targets/ipq40xx/generic/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_core
Downloading http://downloads.openwrt.org/snapshots/targets/ipq40xx/generic/packages/Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/snapshots/targets/ipq40xx/generic/kmods/4.14.82-1-f4f08d5b9b221bce62bcbb7c899b197d/Packages.gz
*** Failed to download the package list from http://downloads.openwrt.org/snapshots/targets/ipq40xx/generic/kmods/4.14.82-1-f4f08d5b9b221bce62bcbb7c899b197d/Packages.gz

Downloading http://downloads.openwrt.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/base/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_base
Downloading http://downloads.openwrt.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/base/Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_luci
Downloading http://downloads.openwrt.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/luci/Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_packages
Downloading http://downloads.openwrt.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/packages/Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/routing/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_routing
Downloading http://downloads.openwrt.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/routing/Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/telephony/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_telephony
Downloading http://downloads.openwrt.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/telephony/Packages.sig
Signature check passed.
Collected errors:
 * opkg_download: Failed to download http://downloads.openwrt.org/snapshots/targets/ipq40xx/generic/kmods/4.14.82-1-f4f08d5b9b221bce62bcbb7c899b197d/Packages.gz, wget returned 8.

root@routerr:~# opkg upgrade opkg

Upgrading opkg on root from 2017-12-07-3b417b9f-3 to 2022-02-24-d038e5b6-1...
Downloading http://downloads.openwrt.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/base/opkg_2022-02-24-d038e5b6-1_arm_cortex-a7_neon-vfpv4.ipk
Multiple packages (libpthread and libpthread) providing same name marked HOLD or PREFER. Using latest.
Installing libubox20220927 (2022-09-27-ea560134-1) to root...
Downloading http://downloads.openwrt.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/base/libubox20220927_2022-09-27-ea560134-1_arm_cortex-a7_neon-vfpv4.ipk
Configuring libubox20220927.
Configuring opkg.

root@router:~# opkg upgrade wireless-regdb

Error relocating /lib/libubox.so.20220927: __clock_gettime64: symbol not found
Error relocating /bin/opkg: __stat_time64: symbol not found
Error relocating /bin/opkg: __time64: symbol not found
Error relocating /bin/opkg: __lstat_time64: symbol not found
Error relocating /bin/opkg: __utime64: symbol not found
Error relocating /bin/opkg: __ctime64: symbol not found

root@router:~# opkg

Error relocating /lib/libubox.so.20220927: __clock_gettime64: symbol not found
Error relocating /bin/opkg: __stat_time64: symbol not found
Error relocating /bin/opkg: __time64: symbol not found
Error relocating /bin/opkg: __lstat_time64: symbol not found
Error relocating /bin/opkg: __utime64: symbol not found
Error relocating /bin/opkg: __ctime64: symbol not found

Being familiar with other package management systems, I assumed that there will be versioned dependency information embedded in all packages, so it's impossible to install a combination of packages that are incompatible... or at least I will get a warning or something, but apparently that is not the case.

So my question is: can you help me un-breaking it? Obviously I will need to install some packages, but I can't do it via opkg, so it will be manual. But

  1. How can I find out which packages to upgrade/downgrade, without a working opkg?
  2. How do I actually install downloaded package files, without opkg?

Thank you for your help.

Upgrading packages (via the CLI opkg upgrade command or the LuCI Upgrade... button) can result in major problems. It is generally highly discouraged, unless you know what you are doing or if there is specific instruction to do so.

You have a snapshot installed on that device. Unlike a stable release version, the snapshots and their packages change rapidly. Attempting to install or upgrade packages more than 24 hours after the download of the snapshot image will not always work properly... often it will error out before doing any damage, but with an upgrade command, that may not happen until it is too late.

You probably need to install a fresh version of the firmware -- I recommend installing the latest stable release (assuming your router supports it) -- 22.03.2 as of right now.

2 Likes

You apparently tried to upgrade packages in a year 2017 firmware...
Since then so much has changed, including the underlying musl C library (64 bit time handling etc.), that packages are largely incompatible.

OpenWrt development snapshots (that you seem to use) have compatibility lifetime of a few days/weeks, but not five years. They are not meant to be long-term stable regarding package management.

You need to either reset the firmware so that your changes on overlay/ get deleted (and you lose your settings), or alternatively, reflash a new firmware.

Alternative 1:

  • make a settings backup if you can
  • "firstboot" command will delete your installed packages and settings.
  • restore settings
    Note that the same package versions fvrom five years ago that you now have, can't be reinstalled.

Alternative 2:

  • download and flash a new firmware, and
  • preferably re-configure by hand, as so much has changed since 2017
2 Likes