if [ ! -f /etc/config/fstab ]; then
	block detect > /etc/config/fstab

	# `block detect` enumerates the internal squashfs and rootfs_data along
	# with any external disk, and this build enables every entry it emits.
	# preinit has already mounted both long before fstab is read, so the
	# entries buy nothing — but their UUIDs are regenerated by sysupgrade,
	# after which the /overlay entry names a device that no longer exists.
	# block then treats it as an extroot, waits delay_root seconds for it to
	# appear and falls back, on every boot. Keep only real external mounts.
	while :; do
		section=$(uci show fstab 2>/dev/null | \
			grep -E "^fstab\.@mount\[[0-9]+\]\.target='/(overlay|rom)'\$" | \
			cut -d. -f2 | head -n1)
		[ -n "$section" ] || break
		uci -q delete "fstab.$section" || break
	done
	uci -q commit fstab
fi
exit 0
