Opkg-extras Restore Finished but Does Not Reboot

My device is D-Team Newifi-D2 running offical OpenWRT 22.03.5 firmware

I have both setup opkg-extra and hotplug-extra (both of them are up-to-date with wiki), and confirm they will auto restore my previous installed package after the sysupgrade. But in this time, when I upgrade OpenWRT firmware via wireguard VPN back home. After the sysupgrade, I notice that I was no longer able to connect my home network via wireguard VPN. After telling my family to reboot the router. I was able to connect back again.

Upon further investigation in /etc/hotplug.d/online/50-opkg-restore. I found out that opkg actually restored my main profile but it did not create /etc/opkg-restore-main file, instead it stuck at logger -t opkg process and did not proceed to reboot the router. Cause some service are not running, especially for wireguard VPN service.

root@Newifi3:~# ps | grep opkg
 3600 root      1316 S    lock -n /var/lock/opkg-restore
 3688 root      1316 S    logger -t opkg
 8722 root      1312 R    grep opkg
root@Newifi3:~#

After manually end/kill logger -t opkg process, my router indeed create /etc/opkg-restore-main file and reboot. And all of my services are up and running.

To mitigate this problem, I have done the following step:

  • Create init profile in opkg extras
    • Set opkg.init="opkg" entry
  • Add essential package into init profile
    • Add package (such as wireguard vpn package) in opkg.init.ipkg entry

After the mitigation, I can confirm that my router reboot itself after opkg restored init profile (Because I can reconnect my router via wireguard VPN). But when opkg finished restore main profile, my router still stuck at logger -t opkg. Which required me to manually end/kill that process or reboot the router(At-least I can reconnect my router back).

Here is /etc/config/opkg configuration file


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

config opkg 'init'
        list ipkg '6to4'
        list ipkg 'luci-app-wireguard'
        list ipkg 'luci-proto-wireguard'
        list ipkg 'wireguard-tools'

config opkg 'main'
        list ipkg '6to4'
        list ipkg 'adblock'
        list ipkg 'coreutils'
        list ipkg 'coreutils-sort'
        list ipkg 'curl'
        list ipkg 'ddns-scripts'
        list ipkg 'ddns-scripts-noip'
        list ipkg 'ddns-scripts-services'
        list ipkg 'diffutils'
        list ipkg 'etherwake'
        list ipkg 'htop'
        list ipkg 'iftop'
        list ipkg 'kmod-crypto-kpp'
        list ipkg 'kmod-crypto-lib-chacha20'
        list ipkg 'kmod-crypto-lib-chacha20poly1305'
        list ipkg 'kmod-crypto-lib-curve25519'
        list ipkg 'kmod-crypto-lib-poly1305'
        list ipkg 'kmod-iptunnel'
        list ipkg 'kmod-iptunnel4'
        list ipkg 'kmod-sit'
        list ipkg 'kmod-udptunnel4'
        list ipkg 'kmod-udptunnel6'
        list ipkg 'kmod-wireguard'
        list ipkg 'libcurl4'
        list ipkg 'libevent2-core7'
        list ipkg 'libmbedtls12'
        list ipkg 'libncurses6'
        list ipkg 'libnghttp2-14'
        list ipkg 'libpcap1'
        list ipkg 'libqrencode'
        list ipkg 'librt'
        list ipkg 'libuci-lua'
        list ipkg 'luci-app-adblock'
        list ipkg 'luci-app-ddns'
        list ipkg 'luci-app-wireguard'
        list ipkg 'luci-app-wol'
        list ipkg 'luci-lib-ipkg'
        list ipkg 'luci-proto-wireguard'
        list ipkg 'luci-theme-material'
        list ipkg 'luci-theme-openwrt'
        list ipkg 'luci-theme-openwrt-2020'
        list ipkg 'procps-ng'
        list ipkg 'procps-ng-watch'
        list ipkg 'qrencode'
        list ipkg 'tcpdump-mini'
        list ipkg 'terminfo'
        list ipkg 'tmux'
        list ipkg 'wireguard-tools'

Here is opkg main profile restoration log

root@Newifi3:~# logread -e opkg
Wed May 17 03:26:17 2023 user.notice opkg: Installing adblock (4.1.5-7) to root...
Wed May 17 03:26:26 2023 user.notice opkg: Collected errors:
Wed May 17 03:26:26 2023 user.notice opkg:  * resolve_conffiles: Existing conffile /etc/adblock/adblock.whitelist is different from the conffile in the new package. The new conffile will be placed at /etc/adblock/adblock.whitelist-opkg.
Wed May 17 03:26:26 2023 user.notice opkg:  * resolve_conffiles: Existing conffile /etc/config/adblock is different from the conffile in the new package. The new conffile will be placed at /etc/config/adblock-opkg.
Wed May 17 03:26:26 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/adblock_4.1.5-7_all.ipk
Wed May 17 03:26:26 2023 user.notice opkg: Installing coreutils (9.0-2) to root...
Wed May 17 03:26:26 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/coreutils_9.0-2_mipsel_24kc.ipk
Wed May 17 03:26:26 2023 user.notice opkg: Installing coreutils-sort (9.0-2) to root...
Wed May 17 03:26:26 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/coreutils-sort_9.0-2_mipsel_24kc.ipk
Wed May 17 03:26:26 2023 user.notice opkg: Configuring coreutils.
Wed May 17 03:26:26 2023 user.notice opkg: Configuring coreutils-sort.
Wed May 17 03:26:26 2023 user.notice opkg: Configuring adblock.
Wed May 17 03:26:36 2023 user.notice opkg: Package coreutils (9.0-2) installed in root is up to date.
Wed May 17 03:26:46 2023 user.notice opkg: Package coreutils-sort (9.0-2) installed in root is up to date.
Wed May 17 03:26:55 2023 user.notice opkg: Installing curl (8.0.1-1) to root...
Wed May 17 03:27:14 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/curl_8.0.1-1_mipsel_24kc.ipk
Wed May 17 03:27:14 2023 user.notice opkg: Installing libmbedtls12 (2.28.2-1) to root...
Wed May 17 03:27:14 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/base/libmbedtls12_2.28.2-1_mipsel_24kc.ipk
Wed May 17 03:27:14 2023 user.notice opkg: Installing libnghttp2-14 (1.44.0-1) to root...
Wed May 17 03:27:14 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/libnghttp2-14_1.44.0-1_mipsel_24kc.ipk
Wed May 17 03:27:14 2023 user.notice opkg: Installing libcurl4 (8.0.1-1) to root...
Wed May 17 03:27:14 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/libcurl4_8.0.1-1_mipsel_24kc.ipk
Wed May 17 03:27:14 2023 user.notice opkg: Configuring libmbedtls12.
Wed May 17 03:27:14 2023 user.notice opkg: Configuring libnghttp2-14.
Wed May 17 03:27:14 2023 user.notice opkg: Configuring libcurl4.
Wed May 17 03:27:14 2023 user.notice opkg: Configuring curl.
Wed May 17 03:27:19 2023 user.notice opkg: Installing ddns-scripts (2.8.2-25) to root...
Wed May 17 03:27:29 2023 user.notice opkg: Collected errors:
Wed May 17 03:27:29 2023 user.notice opkg:  * resolve_conffiles: Existing conffile /etc/config/ddns is different from the conffile in the new package. The new conffile will be placed at /etc/config/ddns-opkg.
Wed May 17 03:27:29 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/ddns-scripts_2.8.2-25_all.ipk
Wed May 17 03:27:29 2023 user.notice opkg: Installing ddns-scripts-services (2.8.2-25) to root...
Wed May 17 03:27:29 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/ddns-scripts-services_2.8.2-25_all.ipk
Wed May 17 03:27:29 2023 user.notice opkg: Configuring ddns-scripts-services.
Wed May 17 03:27:29 2023 user.notice opkg: Configuring ddns-scripts.
Wed May 17 03:27:30 2023 user.notice opkg:  032730  WARN : Service section disabled! - TERMINATE
Wed May 17 03:27:30 2023 user.notice opkg:  032730  WARN : Service section disabled! - TERMINATE
Wed May 17 03:27:30 2023 user.notice opkg:  032730  WARN : Service section disabled! - TERMINATE
Wed May 17 03:27:32 2023 user.notice opkg:  032732  WARN : Service section disabled! - TERMINATE
Wed May 17 03:27:33 2023 user.notice opkg:  032733  WARN : Service section disabled! - TERMINATE
Wed May 17 03:27:33 2023 user.notice opkg:  032733  WARN : Service section disabled! - TERMINATE
Wed May 17 03:27:39 2023 user.notice opkg: Installing ddns-scripts-noip (2.8.2-25) to root...
Wed May 17 03:27:42 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/ddns-scripts-noip_2.8.2-25_all.ipk
Wed May 17 03:27:42 2023 user.notice opkg: Configuring ddns-scripts-noip.
Wed May 17 03:27:47 2023 user.notice opkg: Package ddns-scripts-services (2.8.2-25) installed in root is up to date.
Wed May 17 03:27:51 2023 user.notice opkg: Installing diffutils (3.8-1) to root...
Wed May 17 03:27:56 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/diffutils_3.8-1_mipsel_24kc.ipk
Wed May 17 03:27:56 2023 user.notice opkg: Configuring diffutils.
Wed May 17 03:28:00 2023 user.notice opkg: Installing etherwake (1.09-5) to root...
Wed May 17 03:28:03 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/etherwake_1.09-5_mipsel_24kc.ipk
Wed May 17 03:28:03 2023 user.notice opkg: Configuring etherwake.
Wed May 17 03:28:08 2023 user.notice opkg: Installing htop (3.2.2-1) to root...
Wed May 17 03:28:28 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/htop_3.2.2-1_mipsel_24kc.ipk
Wed May 17 03:28:28 2023 user.notice opkg: Installing terminfo (6.3-2) to root...
Wed May 17 03:28:28 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/base/terminfo_6.3-2_mipsel_24kc.ipk
Wed May 17 03:28:28 2023 user.notice opkg: Installing libncurses6 (6.3-2) to root...
Wed May 17 03:28:28 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/base/libncurses6_6.3-2_mipsel_24kc.ipk
Wed May 17 03:28:28 2023 user.notice opkg: Configuring terminfo.
Wed May 17 03:28:28 2023 user.notice opkg: Configuring libncurses6.
Wed May 17 03:28:28 2023 user.notice opkg: Configuring htop.
Wed May 17 03:28:32 2023 user.notice opkg: Installing iftop (2018-10-03-77901c8c-2) to root...
Wed May 17 03:28:39 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/iftop_2018-10-03-77901c8c-2_mipsel_24kc.ipk
Wed May 17 03:28:39 2023 user.notice opkg: Installing libpcap1 (1.10.1-3) to root...
Wed May 17 03:28:39 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/base/libpcap1_1.10.1-3_mipsel_24kc.ipk
Wed May 17 03:28:39 2023 user.notice opkg: Configuring libpcap1.
Wed May 17 03:28:39 2023 user.notice opkg: Configuring iftop.
Wed May 17 03:28:43 2023 user.notice opkg: Package libcurl4 (8.0.1-1) installed in root is up to date.
Wed May 17 03:28:48 2023 user.notice opkg: Installing libevent2-core7 (2.1.12-1) to root...
Wed May 17 03:28:51 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/base/libevent2-core7_2.1.12-1_mipsel_24kc.ipk
Wed May 17 03:28:51 2023 user.notice opkg: Configuring libevent2-core7.
Wed May 17 03:28:56 2023 user.notice opkg: Package libmbedtls12 (2.28.2-1) installed in root is up to date.
Wed May 17 03:29:00 2023 user.notice opkg: Package libncurses6 (6.3-2) installed in root is up to date.
Wed May 17 03:29:05 2023 user.notice opkg: Package libnghttp2-14 (1.44.0-1) installed in root is up to date.
Wed May 17 03:29:10 2023 user.notice opkg: Package libpcap1 (1.10.1-3) installed in root is up to date.
Wed May 17 03:29:14 2023 user.notice opkg: Installing libqrencode (4.1.1-1) to root...
Wed May 17 03:29:18 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/libqrencode_4.1.1-1_mipsel_24kc.ipk
Wed May 17 03:29:18 2023 user.notice opkg: Configuring libqrencode.
Wed May 17 03:29:22 2023 user.notice opkg: Installing librt (1.2.3-4) to root...
Wed May 17 03:29:25 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/targets/ramips/mt7621/packages/librt_1.2.3-4_mipsel_24kc.ipk
Wed May 17 03:29:25 2023 user.notice opkg: Configuring librt.
Wed May 17 03:29:29 2023 user.notice opkg: Installing luci-app-adblock (git-23.049.70484-d2c0e80) to root...
Wed May 17 03:29:32 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/luci/luci-app-adblock_git-23.049.70484-d2c0e80_all.ipk
Wed May 17 03:29:32 2023 user.notice opkg: Configuring luci-app-adblock.
Wed May 17 03:29:36 2023 user.notice opkg: Installing luci-app-ddns (git-23.118.79498-4390b4d) to root...
Wed May 17 03:29:39 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/luci/luci-app-ddns_git-23.118.79498-4390b4d_all.ipk
Wed May 17 03:29:39 2023 user.notice opkg: Configuring luci-app-ddns.
Wed May 17 03:29:44 2023 user.notice opkg: Installing luci-app-wol (git-21.154.28269-c7b7b42) to root...
Wed May 17 03:29:47 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/luci/luci-app-wol_git-21.154.28269-c7b7b42_all.ipk
Wed May 17 03:29:47 2023 user.notice opkg: Configuring luci-app-wol.
Wed May 17 03:29:51 2023 user.notice opkg: Installing luci-lib-ipkg (git-18.318.71164-4bbe325) to root...
Wed May 17 03:29:54 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/luci/luci-lib-ipkg_git-18.318.71164-4bbe325_all.ipk
Wed May 17 03:29:54 2023 user.notice opkg: Configuring luci-lib-ipkg.
Wed May 17 03:29:58 2023 user.notice opkg: Installing luci-theme-material (git-23.093.42303-f4d5a1a) to root...
Wed May 17 03:30:01 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/luci/luci-theme-material_git-23.093.42303-f4d5a1a_all.ipk
Wed May 17 03:30:01 2023 user.notice opkg: Configuring luci-theme-material.
Wed May 17 03:30:06 2023 user.notice opkg: Installing luci-theme-openwrt (git-23.093.42303-f4d5a1a) to root...
Wed May 17 03:30:09 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/luci/luci-theme-openwrt_git-23.093.42303-f4d5a1a_all.ipk
Wed May 17 03:30:09 2023 user.notice opkg: Configuring luci-theme-openwrt.
Wed May 17 03:30:13 2023 user.notice opkg: Installing luci-theme-openwrt-2020 (git-23.093.42303-f4d5a1a) to root...
Wed May 17 03:30:17 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/luci/luci-theme-openwrt-2020_git-23.093.42303-f4d5a1a_all.ipk
Wed May 17 03:30:17 2023 user.notice opkg: Configuring luci-theme-openwrt-2020.
Wed May 17 03:30:21 2023 user.notice opkg: Installing procps-ng (3.3.16-3) to root...
Wed May 17 03:30:24 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/procps-ng_3.3.16-3_mipsel_24kc.ipk
Wed May 17 03:30:24 2023 user.notice opkg: Configuring procps-ng.
Wed May 17 03:30:29 2023 user.notice opkg: Installing procps-ng-watch (3.3.16-3) to root...
Wed May 17 03:30:32 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/procps-ng-watch_3.3.16-3_mipsel_24kc.ipk
Wed May 17 03:30:32 2023 user.notice opkg: Configuring procps-ng-watch.
Wed May 17 03:30:36 2023 user.notice opkg: Installing qrencode (4.1.1-1) to root...
Wed May 17 03:30:39 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/qrencode_4.1.1-1_mipsel_24kc.ipk
Wed May 17 03:30:39 2023 user.notice opkg: Configuring qrencode.
Wed May 17 03:30:44 2023 user.notice opkg: Installing tcpdump-mini (4.9.3-4) to root...
Wed May 17 03:30:48 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/base/tcpdump-mini_4.9.3-4_mipsel_24kc.ipk
Wed May 17 03:30:48 2023 user.notice opkg: Configuring tcpdump-mini.
Wed May 17 03:30:52 2023 user.notice opkg: Package terminfo (6.3-2) installed in root is up to date.
Wed May 17 03:30:57 2023 user.notice opkg: Installing tmux (3.2a-1) to root...
Wed May 17 03:31:03 2023 user.notice opkg: Downloading https://downloads.openwrt.org/releases/22.03.5/packages/mipsel_24kc/packages/tmux_3.2a-1_mipsel_24kc.ipk
Wed May 17 03:31:03 2023 user.notice opkg: Configuring tmux.
root@Newifi3:~#

Since I have the up-to-date version of opkg-extras and hotplug-extras, I suspect the problem that stuck on logger -t opkg might be "Collected errors" during package restoration.

1 Like

FYI attended-sysupgrade can create a custom image with the packages built in. Not sure if that may work better. It's solid for me.

3 Likes

If you can reproduce the issue, try replacing the logger with a redirection like this:

opkg restore "${OPKG_CONF}" &> /var/log/opkg-restore-"${OPKG_CONF}"

File conflicts in "Collected errors" should not be a problem in this case.

1 Like

Sorry for late reply.

After modify the /etc/hotplug.d/online/50-opkg-restore by following your solution to replace the logger. My router indeed automatic reboot after the main profile restoration.

Yes, I think that it should not be a big problem. The actual problem is logger -t opkg which did not exit after the main profile restoration is completed.

But during restoring init profile, logger -t opkg actually exited after init profile restoration.

Right now. I don't know what cause logger -t opkg not to exit after the opkg restoration

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.