Owut: OpenWrt Upgrade Tool

yes, I wanted to test the main snapshot for apk. this is proxmox OpenWrt VM.

what command I should use for that?

I tired but it ended with

root@OpenWrt:~# owut upgrade --version-to SNAPSHOT --force
owut - OpenWrt Upgrade Tool 2025.01.29~bced54ad-r1 (/usr/bin/owut)
ASU-Server     https://sysupgrade.openwrt.org
Upstream       https://downloads.openwrt.org
Target         x86/64
Profile        generic
Package-arch   x86_64
Root-FS-type   ext4
Sys-type       combined
Version-from   24.10.0 r28427-6df0e3d02a (kernel 6.6.73)
Version-to     SNAPSHOT r28821-9fb44638ba (kernel 6.6.77)
Build-FS-type  ext4
Build-at       2025-02-14T11:39:17Z (~29 hours ago)
Image-prefix   openwrt-x86-64-generic
Image-URL      https://downloads.openwrt.org/snapshots/targets/x86/64
Image-file     openwrt-x86-64-generic-ext4-combined.img.gz
Installed      203 packages
Top-level       63 packages
Default         44 packages
User-installed  25 packages (top-level only)

Package version changes:
  apk-mbedtls                  not-installed                              3.0.0_pre20241130-r2
  busybox                      1.36.1-r2                                  1.37.0-r4
  e2fsprogs                    1.47.0-r2                                  1.47.2-r1
  fstools                      2024.07.14~408c2cc4-r1                     2024.12.02~49d36ba2-r1
  jansson                      2.14-r3                                    missing to-version
  kmod-acpi-video              6.6.73-r1                                  6.6.77-r1
  kmod-amazon-ena              6.6.73-r1                                  6.6.77-r1
  kmod-amd-xgbe                6.6.73-r1                                  6.6.77-r1
  kmod-backlight               6.6.73-r1                                  6.6.77-r1
  kmod-bnx2                    6.6.73-r1                                  6.6.77-r1
  kmod-button-hotplug          6.6.73-r3                                  6.6.77-r3
  kmod-crypto-acompress        6.6.73-r1                                  6.6.77-r1
  kmod-crypto-crc32c           6.6.73-r1                                  6.6.77-r1
  kmod-crypto-hash             6.6.73-r1                                  6.6.77-r1
  kmod-dma-buf                 6.6.73-r1                                  6.6.77-r1
  kmod-drm                     6.6.73-r1                                  6.6.77-r1
  kmod-drm-buddy               6.6.73-r1                                  6.6.77-r1
  kmod-drm-display-helper      6.6.73-r1                                  6.6.77-r1
  kmod-drm-exec                6.6.73-r1                                  6.6.77-r1
  kmod-drm-i915                6.6.73-r1                                  6.6.77-r1
  kmod-drm-kms-helper          6.6.73-r1                                  6.6.77-r1
  kmod-drm-suballoc-helper     6.6.73-r1                                  6.6.77-r1
  kmod-drm-ttm                 6.6.73-r1                                  6.6.77-r1
  kmod-drm-ttm-helper          6.6.73-r1                                  6.6.77-r1
  kmod-dwmac-intel             6.6.73-r1                                  6.6.77-r1
  kmod-e1000                   6.6.73-r1                                  6.6.77-r1
  kmod-e1000e                  6.6.73-r1                                  6.6.77-r1
  kmod-fb                      6.6.73-r1                                  6.6.77-r1
  kmod-fb-cfb-copyarea         6.6.73-r1                                  6.6.77-r1
  kmod-fb-cfb-fillrect         6.6.73-r1                                  6.6.77-r1
  kmod-fb-cfb-imgblt           6.6.73-r1                                  6.6.77-r1
  kmod-fb-sys-fops             6.6.73-r1                                  6.6.77-r1
  kmod-fb-sys-ram              6.6.73-r1                                  6.6.77-r1
  kmod-forcedeth               6.6.73-r1                                  6.6.77-r1
  kmod-fs-vfat                 6.6.73-r1                                  6.6.77-r1
  kmod-hwmon-core              6.6.73-r1                                  6.6.77-r1
  kmod-i2c-algo-bit            6.6.73-r1                                  6.6.77-r1
  kmod-i2c-core                6.6.73-r1                                  6.6.77-r1
  kmod-igb                     6.6.73-r1                                  6.6.77-r1
  kmod-igc                     6.6.73-r1                                  6.6.77-r1
  kmod-input-core              6.6.73-r1                                  6.6.77-r1
  kmod-ixgbe                   6.6.73-r1                                  6.6.77-r1
  kmod-lib-crc-ccitt           6.6.73-r1                                  6.6.77-r1
  kmod-lib-crc32c              6.6.73-r1                                  6.6.77-r1
  kmod-lib-lzo                 6.6.73-r1                                  6.6.77-r1
  kmod-libphy                  6.6.73-r1                                  6.6.77-r1
  kmod-mdio                    6.6.73-r1                                  6.6.77-r1
  kmod-mdio-devres             6.6.73-r1                                  6.6.77-r1
  kmod-mii                     6.6.73-r1                                  6.6.77-r1
  kmod-nf-conntrack            6.6.73-r1                                  6.6.77-r1
  kmod-nf-conntrack6           6.6.73-r1                                  6.6.77-r1
  kmod-nf-flow                 6.6.73-r1                                  6.6.77-r1
  kmod-nf-log                  6.6.73-r1                                  6.6.77-r1
  kmod-nf-log6                 6.6.73-r1                                  6.6.77-r1
  kmod-nf-nat                  6.6.73-r1                                  6.6.77-r1
  kmod-nf-reject               6.6.73-r1                                  6.6.77-r1
  kmod-nf-reject6              6.6.73-r1                                  6.6.77-r1
  kmod-nfnetlink               6.6.73-r1                                  6.6.77-r1
  kmod-nft-core                6.6.73-r1                                  6.6.77-r1
  kmod-nft-fib                 6.6.73-r1                                  6.6.77-r1
  kmod-nft-nat                 6.6.73-r1                                  6.6.77-r1
  kmod-nft-offload             6.6.73-r1                                  6.6.77-r1
  kmod-nls-base                6.6.73-r1                                  6.6.77-r1
  kmod-nls-cp437               6.6.73-r1                                  6.6.77-r1
  kmod-nls-iso8859-1           6.6.73-r1                                  6.6.77-r1
  kmod-nls-utf8                6.6.73-r1                                  6.6.77-r1
  kmod-pcs-xpcs                6.6.73-r1                                  6.6.77-r1
  kmod-phy-realtek             6.6.73-r1                                  6.6.77-r1
  kmod-phylink                 6.6.73-r1                                  6.6.77-r1
  kmod-ppp                     6.6.73-r1                                  6.6.77-r1
  kmod-pppoe                   6.6.73-r1                                  6.6.77-r1
  kmod-pppox                   6.6.73-r1                                  6.6.77-r1
  kmod-pps                     6.6.73-r1                                  6.6.77-r1
  kmod-ptp                     6.6.73-r1                                  6.6.77-r1
  kmod-r8169                   6.6.73-r1                                  6.6.77-r1
  kmod-slhc                    6.6.73-r1                                  6.6.77-r1
  kmod-stmmac-core             6.6.73-r1                                  6.6.77-r1
  kmod-tg3                     6.6.73-r1                                  6.6.77-r1
  kmod-tun                     6.6.73-r1                                  6.6.77-r1
  libblkid                     2.40.2-r1                                  missing to-version
  libblobmsg-json              2024.03.29~eb9bcb64-r1                     missing to-version
  libcomerr                    1.47.0-r2                                  missing to-version
  libcurl                      8.10.1-r1                                  missing to-version
  libe2p                       1.47.0-r2                                  missing to-version
  libext2fs                    1.47.0-r2                                  missing to-version
  libf2fs                      1.16.0-r3                                  missing to-version
  libiwinfo                    2024.10.20~b94f066e-r1                     missing to-version
  libiwinfo-data               2024.10.20~b94f066e-r1                     2025.02.06~9cec6b4d-r1
  libjson-c                    0.18-r1                                    missing to-version
  libjson-script               2024.03.29~eb9bcb64-r1                     missing to-version
  liblua                       5.1.5-r11                                  missing to-version
  liblucihttp                  2023.03.15~9b5b683f-r1                     missing to-version
  libmbedtls                   3.6.2-r1                                   missing to-version
  libmnl                       1.0.5-r1                                   missing to-version
  libnftnl                     1.2.8-r1                                   missing to-version
  libnghttp2                   1.63.0-r1                                  missing to-version
  libnl-tiny                   2023.12.05~965c4bf4-r1                     missing to-version
  libsmartcols                 2.40.2-r1                                  missing to-version
  libss                        1.47.0-r2                                  missing to-version
  libubox                      2024.03.29~eb9bcb64-r1                     missing to-version
  libubus                      2025.01.02~afa57cce-r1                     missing to-version
  libuci                       2025.01.20~16ff0bad-r1                     missing to-version
  libuclient                   2024.10.22~88ae8f20-r1                     missing to-version
  libucode                     2025.02.10~a8a11aea-r1                     missing to-version
  libustream-mbedtls           2024.07.28~99bd3d2b-r1                     missing to-version
  libuuid                      2.40.2-r1                                  missing to-version
  luci                         25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-app-argon-config        0.9                                        missing to-version
  luci-app-firewall            25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-app-package-manager     25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-base                    25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-compat                  25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-lib-base                25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-lib-ip                  25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-lib-ipkg                25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-lib-jsonc               25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-lib-nixio               25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-light                   25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-lua-runtime             25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-mod-admin-full          25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-mod-network             25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-mod-status              25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-mod-system              25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-proto-ipv6              25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-proto-ppp               25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-ssl                     25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-theme-argon             2.3.2-r20250207                            missing to-version
  luci-theme-bootstrap         25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-theme-material          25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-theme-openwrt           25.044.01357~67d27ad                       25.043.43817~b54b1a2
  luci-theme-openwrt-2020      25.044.01357~67d27ad                       25.043.43817~b54b1a2
  openssh-sftp-server          9.9_p1-r1                                  9.9_p1-r3
  openwrt-keyring              2024.11.01~fbae29d7-r2                     2024.11.01~fbae29d7-r1
  ppp                          2.5.1-r1                                   2.5.2-r1
  ppp-mod-pppoe                2.5.1-r1                                   2.5.2-r1
  procd                        2024.12.22~42d39376-r1                     2025.01.30~7fcb5a27-r1
  procd-seccomp                2024.12.22~42d39376-r1                     2025.01.30~7fcb5a27-r1
  procd-ujail                  2024.12.22~42d39376-r1                     2025.01.30~7fcb5a27-r1
  rpcd                         2024.09.17~9f4b86e7-r1                     2024.12.02~cc9a471c-r1
  rpcd-mod-file                2024.09.17~9f4b86e7-r1                     2024.12.02~cc9a471c-r1
  rpcd-mod-iwinfo              2024.09.17~9f4b86e7-r1                     2024.12.02~cc9a471c-r1
  rpcd-mod-rpcsys              2024.09.17~9f4b86e7-r1                     2024.12.02~cc9a471c-r1
  rpcd-mod-ucode               2024.09.17~9f4b86e7-r1                     2024.12.02~cc9a471c-r1
29 packages missing in target version, cannot upgrade
24 packages were downgraded
143 packages are out-of-date

Automatic package replacements/removals:
  Package                      Replaced-by
  opkg                         apk-mbedtls
Details at https://sysupgrade.openwrt.org/json/v1/overview.json

ERROR: Update checks reveal errors, can't proceed

Yeah, crossing the release-to-snapshot boundary with owut is going to be hard until we get the apk stuff sorted. You can usually use something like this, to ignore all those ABI-versioned libraries, which since they are dependencies don't really play a role in the build itself:

$ missing=$(owut check --verbose -V snapshot | awk '/missing to-version/ {print $1}')
$ echo $missing
jansson libatomic libblkid libblobmsg-json libbpf libbz2 libcomerr libcurl libe2p libelf libext2fs libf2fs libfdisk libgmp libip4tc libip6tc libiptext libiptext6 libiwinfo libjson-c libjson-script libltdl liblua liblucihttp libmbedtls libmnl libmount libncurses libnetfilter-conntrack libnetfilter-cthelper libnetfilter-cttimeout libnetfilter-queue libnettle libnfnetlink libnftnl libnghttp2 libnl-tiny libopenssl libpcap libreadline libsmartcols libss libstdcpp libubox libubus libuci libuclient libucode libunwind libusb-1.0 libustream-openssl libuuid libuv libxtables

$ owut check -V snapshot -r "$missing"
WARNING: Package 'jansson' is a dependency, removal will have no effect on the build
WARNING: Package 'libatomic' is a dependency, removal will have no effect on the build
... about 50 more times ...

If the check comes back ok with only a ton of warnings and no errors, you should be able to use upgrade and get the snapshot installed fairly easily.

Going back from snapshot to release is pretty much the same process, with the list of missing libraries being the ABI-versioned ones, so jansson4 libatomic1 ...

1 Like

Is anyone here interested in running their own local ASU server? aparcar just merged a bunch of stuff we've been working on for some months to make local setup and configuration much simpler and smoother.

If anyone is interested, I'll start another thread and we can talk about it there...

1 Like

Thank you for pointing me in the right direction - SD card was indeed corrupted...

2 Likes

Tried on a couple of different devices, worked seamlessly from 24.20-SNAPSHOT to SNAPSHOT. Thank you!

1 Like

First of all, thank you for your work.

could you kindly tell me if there is the possibility of downloading the firmware by running the script "/etc/owut.d/pre-install.sh"

I tried this,
but it only downloads and doesn't run the script ...

owut download --force --pre-install /etc/owut.d/pre-install.sh

I would like understand if possible ...

and create a text file containing the packages added to the official image ...

I tried to add the following command to the file "/etc/owut.d/pre-install.sh" but it gives me an error

owut list | sed 's/ /\n/g' | sort >> "${backup_dir}/list-add-package-${stamp}.txt" || exit 1

is there anything i can do ?

I'm not clear on what you're asking here. owut download downloads the firmware, that's the sole reason it exists, no need for another script to accomplish that.

Right, the "pre-install" part means it's a hook between the download and install phases, when you do for example owut upgrade (which is shorthand for owut download followed by owut install).

What was the error? I suspect running owut while it's already running is probably not a good idea, I never designed it to be recursively reentrant.

Does the /tmp/firmware-manifest.json contain whatever you are looking for? If you don't want to save the whole thing, you could run jsonfilter on it and extract the bits of interest.

jsonfilter -i /tmp/firmware-manifest.json -e '$.request'
1 Like

sorry if the question might be stupid but how can i get the same output of the "owut list --format fs-user --verbose" command with the "jsonfilter" command ...

I noticed it because it gave me an error (unfortunately I didn't save it anywhere),

now the "owut list" command doesn't produce any output (I don't know why) but "owut list --verbose" show list (don't know why)

root@LTE5398-M904:~# owut list

root@LTE5398-M904:~# owut list --format fs-user

root@LTE5398-M904:~# owut list --verbose 
luci-proto-wireguard kmod-usb-storage-uas diffutils lsof luci-app-https-dns-proxy openssh-client-utils adb coreutils-base64 luci-app-uhttpd usbutils qrencode procps-ng-watch kmod-usb-net-cdc-mbim block-mount sed tcpdump kmod-fs-ext4 luci-ssl flock curl luci-proto-qmi mdio-tools e2fsprogs smartmontools lslocks luci-proto-mbim htop sms-tool pingcheck at qmi-utils luci owut fdisk openssh-client kmod-button-hotplug picocom mount-utils wget-ssl -nftables

There's no easy way to replicate the list output, because that's designed for use with the Firmware Selector and thus has a different list than what owut uses internally. (Specifically, the list output contains exclusions of the form -dnsmasq when it sees that a default package has been replaced or removed, and owut doesn't use that mechanism for defining the package list used by the ASU server.)

You can get a list of what is installed (without any mention of the removed packages) by extracting what owut sent to the server in the request. You can format it with printf and sort it like this:

$ eval $(jsonfilter -i /tmp/firmware-manifest.json -e 'pkgs=$.request.packages[*]') && printf "%s\n" $pkgs | sort
base-files
bind-dig
btop
busybox
conntrack
coreutils-od
curl
...

Oops, looks like I messed up the verbosity levels when reworking the default recently. For now just make sure to use --verbose (or edit /etc/config/attendedsysupgrade and set verbosity to '1').

1 Like

sorry to have discovered this...

thanks for your support :grinning:

so there is a simple and current way to find a list of installed packages faster than this script:

#! /bin/sh
if test ! -s /tmp/my-def-pkgs 
 then 
   echo " /tmp/my-def-pkgs was not found or is empty."
   echo " Please add list of default packages there and re-run this script."
   echo
   exit
 fi

opkg list-installed >/tmp/my-wd-input

echo "made temp file for what-depends list at /tmp/my-wd-input"
echo "generating list of packages and what depends on each to file /tmp/my-wd-output..."

for i in $( cat /tmp/my-wd-input | cut -d\  -f 1 | sort -u )
  do 
    #echo $i
    printf "."
    k=$( opkg whatdepends $i | grep  "^\t" | sed 's/^\t//g' | cut -d\  -f1 | sed 's/\n/ /g' )
    j=$( echo "$k" | wc -w )
    printf "$j\t$i\t $( echo $k )\n" >>/tmp/my-wd-output
    # printf "$j\t$i\t $( echo $k )\n"
    printf "."
done
echo ""

echo "preparing input list for user installed list..."
cat /tmp/my-wd-output | grep "^0" | cut -f2 >/tmp/my-user-inst-input

echo "The list of user installed packages is being written to /tmp/my-user-installed-packages"
echo "as well as on screen..."

for i in $( cat /tmp/my-user-inst-input)
  do
    if !(grep -Fqw $i /tmp/my-def-pkgs)
     then 
       echo $i >>/tmp/my-user-installed-packages
       echo $i
    fi
  done

echo
echo Done
echo "Clean up temp files /tmp/my-wd-output and /tmp/my-user-installed-packages in /tmp/ before re-running script."
echo

without calling "owut list" inside "owut"

And ubus call rpc-sys packagelist gets you all the top-level packages, too. If you want all installed just make it ubus call rpc-sys packagelist '{"all":true}'...

1 Like

Update on the situation. Owut still works with rockchip device, ath79 and ramips devices are still broken. However, the culprit is not libgcc package anymore. There are now 5 problematic packages on both devices (i. e. missing-to-version): libmnl0, libnftnl11, nftables-json, ppp, ppp-mod-pppoe. This is very strange.

It's being worked on. The builds will take a while to filter through with the fixes, this particular one should be fixed in a day or two.

I am running the main snapshot on my MX4300 but I would like to switch to 24.10-snapshot (and later stay on 24.10.x branch). When I try upgrading (or is it downgrading?) with owut, it returns missing package errors. Presumably, this is because 24.10-snapshot uses opkg rather than apk.

I am guessing that for most packages I can remove and re-add the needed packages with -r and -a switches. Is this the way to go? If so, how do I make sure that I install all the required/useful opkg related packages?
Alternatively, what is the best way to do this?

can you post the code from terminal?

The post above should work, with a swap of versions (replace snapshot with 24.10 and vice versa): Owut: OpenWrt Upgrade Tool - #572 by efahl

$ missing=$(owut check -V 24.10 | awk '/missing to-version/ {print $1}')

$ echo $missing
... apk-mbedtls jansson4 ...

$ owut download -V 24.10 -r "$missing"
...

Read through the output on the screen, then edit /tmp/firmware-manifest.com and make sure that things like busybox, dropbear, uclient-fetch and opkg were installed properly. If something is missing, rerun the download with --add missing-pkg1,missing-pkg2,... until you like it, then just do owut install.

1 Like

Here are the snippets

Package version changes:
  apk-openssl                         3.0.0_pre20241130-r2                       missing to-version
  banip                               1.0.1-r2                                   1.5.3-r2
  block-mount                         2024.12.02~49d36ba2-r1                     2024.07.14~408c2cc4-r1
  blockd                              2024.12.02~49d36ba2-r1                     2024.07.14~408c2cc4-r1
  btrfs-progs                         6.11-r2                                    6.11-r1
  busybox                             1.37.0-r4                                  1.36.1-r2
  ddns-scripts                        2.8.2-r53                                  2.8.2-r64
  ddns-scripts-services               2.8.2-r53                                  2.8.2-r64
  dnsmasq-full                        2.90-r3                                    2.90-r4
....
41 packages missing in target version, cannot upgrade
17 packages were downgraded
196 packages are out-of-date

I think @efahl's answer should work for me, I think I need to run his commands, then make sure that basic packages are included and, if not, add them.

Thanks, this worked. (Somehow it worked right away on one router but I had to replace spaces by commas on another one.)

1 Like

Ah, that would be because you had an older version of owut on the "comma only" router (https://github.com/efahl/owut/commit/05f3bbef7905762575b55ce57b215644781f9337). After the upgrade, they'll both accept commas, spaces, newlines, tabs etc for delimiters.