OpenWrt/LEDE Project

  • Status Unconfirmed
  • Percent Complete
  • Task Type Bug Report
  • Category Base system
  • Assigned To No-one
  • Operating System All
  • Severity Medium
  • Priority Very Low
  • Reported Version Trunk
  • Due in Version Undecided
  • Due Date Undecided
  • Private
Attached to Project: OpenWrt/LEDE Project
Opened by John - 08.12.2020

FS#3492 - sysupgrade from CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y loses settings where image has BLOCKSIZE:=64k

Test device: ath79 mikrotik wap-g on snapshot r15165-66d12ce667


  1. sysupgrade
  2. change settings
  3. sysupgrade: settings lost


  • settings are found and restored on sysupgrade (after the initial 4K_SECTORS=y to 4K_SECTORS=n upgrade)
  • lose write access for routerboot soft_config (which explicitly requires CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y, as Openwrt partial erase target/linux/generic/pending-5.4/411-mtd-partial_eraseblock_write.patch had a merge error which was rendering devices unbootable at the time.)
  • faster sysupgrade erase/write time: 45s → 26s

target/linux/generic/pending-5.4/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch stopped functioning with linux 4.19
Now all partitions have a 4K erase block if CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
This causes mount_root to fail to find upgrade settings where the image is expecting 64K blocksize.

grep --binary-files=text -E 'overlay|upgrade|reboot|mount' ath79_mikrotik_wap-g_sysupgrade_loses_settings 
[    8.892059] mount_root: switching to jffs2 overlay
[    8.899647] overlayfs: upper fs does not support tmpfile.
Mon Dec  7 13:25:31 UTC 2020 upgrade: Sending TERM to remaining processes ... logd hostapd wpa_supplicant netifd odhcpd ntpd dnsmasq ubusd askfirst urngd
Mon Dec  7 13:25:34 UTC 2020 upgrade: Sending KILL to remaining processes ...
Mon Dec  7 13:25:35 UTC 2020 upgrade: Switching to ramdisk...
Mon Dec  7 13:25:38 UTC 2020 upgrade: Performing system upgrade...
Appending jffs2 data from /tmp/sysupgrade.tgz to firmware..
Mon Dec  7 13:26:21 UTC 2020 upgrade: Upgrade completed
Mon Dec  7 13:26:22 UTC 2020 upgrade: Rebooting system...
umount: can't unmount /dev: Resource busy
umount: can't unmount /tmp: Resource busy
[  175.677595] reboot: Restarting system
[    8.611437] mount_root: no usable overlay filesystem found, using tmpfs overlay
[  117.356605] overlayfs: upper fs does not support tmpfile.

./package/base-files/files/lib/preinit/80_mount_root:do_mount_root() {

do_mount_root() {
        boot_run_hook preinit_mount_root
        [ -f /sysupgrade.tgz ] && {
                echo "- config restore -"
                cp /etc/passwd /etc/group /etc/shadow /tmp
                cd /
                tar xzf /sysupgrade.tgz
                missing_lines /tmp/passwd /etc/passwd >> /etc/passwd
                missing_lines /tmp/group /etc/group >> /etc/group
                missing_lines /tmp/shadow /etc/shadow >> /etc/shadow
                rm /tmp/passwd /tmp/group /tmp/shadow
                # Prevent configuration corruption on a power loss

  61         case FS_NONE:
  62                 ULOG_WARN("no usable overlay filesystem found, using tmpfs overlay\n");
  63                 return ramoverlay();


Available keyboard shortcuts


Task Details

Task Editing