After sysupgrade to any new compiled firmware, TF card extroot partition uuid become invalid. kernel will not auto mount extroot anymore.
[ 11.570000] jffs2: notice: (465) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[ 11.600000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[ 11.680000] block: extroot: UUID mismatch (root: 57a0acc6-ecc0a5e7-2ea71070-845539a7, overlay: d578bcbf-510a3603-823f14c1-4e16d34e)
[ 11.880000] jffs2: notice: (462) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[ 12.100000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[ 12.180000] block: extroot: UUID mismatch (root: 57a0acc6-ecc0a5e7-2ea71070-845539a7, overlay: d578bcbf-510a3603-823f14c1-4e16d34e)
[ 12.320000] mount_root: switching to jffs2 overlay
But block info says its uuid unchanged. Only the uuid of partition extroot to /overlay will be damaged, other partiiton like /srv /opt work well.
And I tried change /etc/config/fstab the /overlay extroot uuid option to device name option, failed with the same kernel log error info.
But ssh into router, cmd line 'mount -t f2fs /dev/mmcblk0p1 /overlay' still work.
Reformat and redo extroot doc steps it work again with new uuid.
Hardware find this problem: ramips MT7621 with sd card interface.
After read target-mipsel_24kc_musl/fstools-2017-05-09-c43ae11e/block.c, I find the reason of this uuid issue.
The uuid report by block.c on kernel log, is not extroot /overlay partition's uuid, it is the uuid of read only mtd rootfs.
A new firmware have different rootfs with different uuid. balock.c will check a hidden file at extroot /overlay/etc/.extroot-uuid, if the uuid value in that file not equal with current rootfs uuid. block.c will refuse to mount extroot /overlay.
Solution: Create an alias script for sysupgrade, delete .extroot-uuid before burning firmware.
cat /etc/profile.d/alias.sh
alias sysupgrade='if [ $(mount | grep "/overlay type" | grep -v "mtd" | wc -l) -gt "0" ]; then rm -f /overlay/etc/.extroot-uuid; echo "extroot: reset uuid"; fi;/sbin/sysupgrade'
after sysupgrade done and router reboot, the first boot up still not mount extroot, kernel log shows jffs2 filesystem need rebuild and block fail to load /etc/config/fstab on first boot up:
# dmesg | grep block
[ 11.510000] jffs2_scan_eraseblock(): End of filesystem marker found at 0x20000
[ 11.540000] jffs2_build_filesystem(): erasing all blocks after the end marker...
[ 24.680000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[ 24.700000] block: unable to load configuration (fstab: Entry not found)
[ 24.710000] block: attempting to load /tmp/jffs_cfg/etc/config/fstab
[ 24.720000] block: unable to load configuration (fstab: Entry not found)
[ 24.740000] block: attempting to load /etc/config/fstab
[ 24.750000] block: unable to load configuration (fstab: Entry not found)
[ 24.760000] block: no usable configuration
[ 25.180000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[ 25.190000] block: unable to load configuration (fstab: Entry not found)
[ 25.200000] block: attempting to load /tmp/jffs_cfg/etc/config/fstab
[ 25.220000] block: unable to load configuration (fstab: Entry not found)
[ 25.230000] block: attempting to load /etc/config/fstab
[ 25.240000] block: unable to load configuration (fstab: Entry not found)
[ 25.250000] block: no usable configuration
Don't worry let us reboot the router again:
# mount | grep f2fs
/dev/mmcblk0p1 on /overlay type f2fs (rw,lazytime,relatime,background_gc=on,user_xattr,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6)
# dmesg | grep fstab
[ 11.770000] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
extroot partition back to work!