Will this create a restorable list?

Hi,

Used the code from the sys-upgrade page like so:

sysupgrade -k /etc/backup/installed_packages.txt \
| awk -e '/\s(overlay|unknown)$/{print $1}'

However, it outputs it such as
odhcp6c rom
odhcpd-ipv6only rom
openwrt-keyring rom
opkg rom
ppp-mod-pppoe rom
ppp rom
procd-seccomp rom
procd-ujail rom
procd rom
px5g-wolfssl rom
rpcd-mod-file rom
rpcd-mod-iwinfo rom
rpcd-mod-luci rom
rpcd-mod-rrdns rom
rpcd rom
ubi-utils rom
uboot-envtools rom
ubox rom
ubus rom
ubusd rom
uci rom
uclient-fetch rom
ucode-mod-fs rom
ucode-mod-ubus rom
ucode-mod-uci rom
ucode rom
uhttpd-mod-ubus rom
uhttpd rom
urandom-seed rom
urngd rom
usign rom
wireless-regdb rom
wpad-basic-wolfssl rom
rpcd-mod-rpcsys overlay
attendedsysupgrade-common overlay
luci-app-attendedsysupgrade overlay
relayd overlay
luci-proto-relay overlay
etherwake overlay
luci-app-wol overlay
terminfo overlay
libncurses6 overlay
nano overlay

Is the second colunm such as rom, overlay, etc suppose to be in the output file?

Thanks,

Aaron

depends on what you mean by restorable.

…and in the sense of long term maintenance, you better sanitize your list down to the packages (names) you'd actually install - excluding their indirect dependencies.

Creating a list of installed programs to reinstall after a system upgrade

then you only want the names, sanitized, as @slh pointed out.

1 Like

How would I do that?

I wrote a little script that should do it: The OpenWrt Firmware Selector - #621 by efahl See bottom example.

4 Likes

Would that list user install packages too?

With the --list option, it will list only user installed packages, hence the comment on the example "append this to the existing package list in the Firmware Selector". If you want all of the top-level packages, user + defaults, use --list --defaults (in which case "replace the whole list in FS" would be appropriate).

Ah, I was thinking those packages in the example were the default packages. Sorry!

root@OpenWrt:~# ./pkg-scan.sh --check --version-to 23.05.2
Board-name    bananapi_bpi-r64
Target        mediatek/mt7622
Package-arch  aarch64_cortex-a53
Version-from  22.03.3 r20028-43d71ad93e (kernel 5.10.161)
Version-to    23.05.2 r23630-842932a63d (kernel 5.15.137)
Image-prefix  openwrt-23.05.2-mediatek-mt7622-bananapi_bpi-r64
Root-FS-type  squashfs
Sys-type      sysupgrade
Image-file    openwrt-23.05.2-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb
Build-at      2023-11-14T13:38:11.000000Z

Default package analysis:
  kmod-mt7622-firmware     - Warning: default package is not present
  libgcc                   - default package replaced/provided by libgcc1
  libustream-mbedtls       - Warning: default package is not present
  nftables                 - default package replaced/provided by nftables-json
  wpad-basic-mbedtls       - Warning: default package is not present

There are currently package build failures for 23.05.2 aarch64_cortex-a53:
  shared-mime-info - Package not installed locally, you should be ok
Details at https://downloads.openwrt.org/releases/faillogs-23.05/aarch64_cortex-a53/packages/

Installed packages replaced in 23.05.2:
  wpad-basic-wolfssl -> wpad-basic-mbedtls

Installed packages not available in 23.05.2:
  No issues, all packages present.

Done, logged 38 of 176 entries in ./pkg-scan-installed.txt
root@OpenWrt:~# ./pkg-scan.sh --list
ERROR: Could not download platform json.  Checking that version-to is correct.

Valid version-to values from https://sysupgrade.openwrt.org/json/v1/overview.json:
- 21.02-SNAPSHOT
- 21.02.6
- 21.02.7
- 22.03-SNAPSHOT
- 22.03.5
- 22.03.6
- 23.05-SNAPSHOT
- 23.05.0
- 23.05.2
- SNAPSHOT
Your selected version-to '22.03.3' is invalid.

Why is it saying the selected version is wrong?

This is the OpenWrt version I have installed:

|Firmware Version|OpenWrt 22.03.3 r20028-43d71ad93e / LuCI openwrt-22.03 branch git-22.361.69894-438c598|
|---|---|
|Kernel Version|5.10.161|

Bah! That's a limitation of the sysupgrade server, which has a limited collection of available releases. If you go the overview.json you'll see where pkg-scan.sh is getting its data; I will look into how the Firmware Selector is building its list and see what I can do here. Thanks for pointing this out, I had completely missed it.

In the meantime, you can specify --version-to 22.03.5 (or .6) and get the correct package list for 22.03 (the package list doesn't change on a major release branch).

Aha! https://firmware-selector.openwrt.org/config.js (as built by https://gitlab.com/openwrt/web/firmware-selector-openwrt-org/-/blob/master/misc/collect.py).

Is there a new download?

./pkg-scan.sh --check --version-to 22.03.6
ERROR: Could not access BOM for 22.03.6, kernel version cannot be determined
Board-name bananapi_bpi-r64
Target mediatek/mt7622
Package-arch aarch64_cortex-a53
Version-from 22.03.3 r20028-43d71ad93e (kernel 5.10.161)
Version-to 22.03.6 r20265-f85a79bcb4 (kernel unknown)
Image-prefix openwrt-22.03.6-mediatek-mt7622-bananapi_bpi-r64
Root-FS-type squashfs
Sys-type sysupgrade
Image-file openwrt-22.03.6-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb
Build-at 2023-11-25T18:18:57.000000Z

Default package analysis:
libgcc - default package replaced/provided by libgcc1
libustream-wolfssl - default package replaced/provided by libustream-wolfssl20201210
nftables - default package replaced/provided by nftables-json

There are currently package build failures for 22.03.6 aarch64_cortex-a53:
wifidog - Package not installed locally, you should be ok
Details at https://downloads.openwrt.org/releases/faillogs-22.03/aarch64_cortex-a53/packages/

Installed packages replaced in 22.03.6:
No changes detected.

ERROR: Could not access https://sysupgrade.openwrt.org/json/v1/releases/22.03.6/packages/aarch64_cortex-a53-index.json (server down?)
ERROR: Could not access https://sysupgrade.openwrt.org/json/v1/releases/22.03.6/targets/mediatek/mt7622/index.json (server down?)
ERROR: Cannot verify platform packages due to missing json.

Edit:

Apart from the above error it saves a list of installed programs to the sd card.

Yeah, I just rewrote pkg-scan.sh to utilize the FS config file to derive its list of valid release numbers. (And fixed a couple of other things.)

Hmm, my notion of "ERROR" is not exactly correct, is it? Those could probably just be warnings, as they're only for validity checking and the resulting list is identical to what it would be without them.