Opkg-extras does not restore packages

I know there is a threat allready with the same name/question/problem, but all suggested is not working, or I'm not doing it properly. :wink:
link same problem

I'm running Openwrt on an Raspberry Pi 4B
with OpenWrt 21.02.2 r16495-bf0c965af0 / LuCI openwrt-21.02 branch git-22.046.85957-59c3392

for the test I trying to start mc, (not found offcourse) so installed and did a opkg save;

root@Router:~# mc
-ash: mc: not found
root@Router:~# clear
root@Router:~# mc
-ash: mc: not found
root@Router:~# opgkg install mc
-ash: opgkg: not found
root@Router:~# clear
root@Router:~# mc
-ash: mc: not found
root@Router:~# opkg update
Downloading https://downloads.openwrt.org/releases/21.02.2/targets/bcm27xx/bcm2711/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_core
Downloading https://downloads.openwrt.org/releases/21.02.2/targets/bcm27xx/bcm2711/packages/Packages.sig
Signature check passed.
Downloading ...etc etc

root@Router:~# opkg install mc
Installing mc (4.8.27-2) to root...
Downloading https://downloads.openwrt.org/releases/21.02.2/packages/aarch64_cortex-a72/packages/mc_4.8.27-2_aarch64_cortex-a72.ipk
Configuring mc.
root@Router:~# opkg save
root@Router:~# opkg remove mc
Removing package mc from root...
root@Router:~# opkg restore
root@Router:~# mc
-ash: mc: not found
root@Router:~#

cat /etc/config/opkg

root@Router:~# cat /etc/config/opkg

config opkg 'defaults'
        option import '/etc/backup/installed_packages.txt'
        option save 'auto'
        option restore 'auto'
        option rollback 'auto'
        option upgr 'ai'
        option export 'ai'
        option proc '--force-depends'
        option reinstall '--force-reinstall'
        option newconf '/etc'

config opkg 'auto'
        list ipkg 'htop'

md5sum /etc/profile.d/opkg.sh

root@Router:~# md5sum /etc/profile.d/opkg.sh
f8d172aa4a6ed2f4dd170bf4a1dee25e  /etc/profile.d/opkg.sh
root@Router:~#

cat /etc/backup/installed_packages.txt

root@Router:~# cat /etc/backup/installed_packages.txt
cat: can't open '/etc/backup/installed_packages.txt': No such file or directory
root@Router:~#

ls -1 /etc/hotplug.d/online/

root@Router:~# ls -1 /etc/hotplug.d/online/
50-opkg-restore
root@Router:~#

logread -e opkg (nothing to find)

root@Router:~# logread -e opkg
root@Router:~#

mount

root@Router:~# mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/loop0 on /overlay type ext4 (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
/dev/mmcblk0p1 on /boot type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)
root@Router:~#

@anon50098793 did posted the solution for the problem, but it does not work in my case. don't know why.

uci set opkg.defaults.import='/etc/backup/installed_packages.txt'
uci set opkg.defaults.save='auto'
uci set opkg.defaults.restore='auto'
uci set opkg.defaults.rollback='auto'
uci set opkg.defaults.upgr='ai'
uci set opkg.defaults.export='ai'
uci set opkg.defaults.proc='--force-depends'
uci set opkg.defaults.reinstall='--force-reinstall'
uci set opkg.defaults.newconf='/etc'
uci commit opkg
root@Router:~# uci set opkg.defaults.import='/etc/backup/installed_packages.txt'
uci set opkg.defaults.proc='--force-depends'
uci set opkg.defaults.reinstall='--force-reinstall'
uci set opkg.defaults.newconf='/etc'
uci commit opkgroot@Router:~# uci set opkg.defaults.save='auto'
root@Router:~# uci set opkg.defaults.restore='auto'
root@Router:~# uci set opkg.defaults.rollback='auto'
root@Router:~# uci set opkg.defaults.upgr='ai'
root@Router:~# uci set opkg.defaults.export='ai'
root@Router:~# uci set opkg.defaults.proc='--force-depends'
root@Router:~# uci set opkg.defaults.reinstall='--force-reinstall'
root@Router:~# uci set opkg.defaults.newconf='/etc'
root@Router:~# uci commit opkg
root@Router:~#

Hmm after posting this, I noticed that only "htop" whas in the list. That is correct all other packages are in my imagebuild..

So if I'm correct, the opkg-extras are only working for the added packages that where not allready in my build. Is this the case?

Working for added package

root@Router:~# htop
root@Router:~# opkg remove htop
Removing package htop from root...
root@Router:~# opkg restore
Installing htop (3.1.2-1) to root...
Downloading https://downloads.openwrt.org/releases/21.02.2/packages/aarch64_cort   ex-a72/packages/htop_3.1.2-1_aarch64_cortex-a72.ipk
Configuring htop.
root@Router:~#

See the opkg extras docs on what it does...

2 Likes

you may wish to ask this user for some fixes as they expressed interest in maintaining the functionality...

1 Like

vgaetera hasn't been here since January 26th.