[G4 Android Development] MorganXYZ:
Thanks @steadfasterX Hmm...

Morning walk sounds v good (better than my day...)

This feels like it's similar to the link in #285 not the ilapo problem, but I've got nowhere following those instructions. Here's what I did:

$ adb shell
~ # whoami
root
~ # cd data
/data # cd system
/data/system # ls -laS
-rw-rw---- 1 system system 3842048 Aug 27 2022 notification_log.db
-rwxrwxr-- 1 system system 2385954 Aug 26 2022 uiderrors.txt
-rw-rw---- 1 system system 839649 Aug 26 2022 packages.xml
-rw------- 1 system system 524288 Aug 27 2022 notification_log.db-wal
-rw------- 1 system system 489448 Aug 26 2022 batterystats-checkin.bin
-rw------- 1 system system 141026 Aug 27 2022 appops.xml
drwx------ 2 system system 102400 Aug 26 2022 dropbox
-rw------- 1 system system 78337 Aug 27 2022 notification_policy.xml
-rw------- 1 system system 51476 Aug 26 2022 batterystats.bin
-rw-rw---- 1 system system 45056 Jun 24 2021 recoverablekeystore.db
-rw-rw---- 1 system system 32768 Aug 27 2022 notification_log.db-shm
-rw-rw---- 1 system system 32768 Aug 26 2022 watchlist_report.db-shm
-rw------- 1 system system 31940 Aug 27 2022 batterystats-daily.xml
-rw-r----- 1 system package_info 25595 Aug 26 2022 packages.list
-rw-rw---- 1 system system 20480 Oct 27 2021 locksettings.db
-rw-rw---- 1 system system 16384 Jun 24 2021 watchlist_report.db
-rw------- 1 system system 15105 Aug 27 2022 package-dex-usage.list
-rw------- 1 system system 13355 Aug 27 2022 package-cstats.list
-rw-r----- 1 system package_info 13234 Aug 27 2022 package-usage.list
-rw------- 1 system system 11619 Aug 26 2022 diskstats_cache.json
drwxrwxr-x 21 system system 4096 Aug 26 2022 .
drwxrwx--x 46 system system 4096 Jan 11 2015 ..
drwx------ 2 system system 4096 Jun 8 2021 battery-saver
drwx------ 6 system system 4096 Aug 27 2022 graphicsstats
drwx------ 2 system system 4096 Jan 11 2015 heapdump
drwx------ 2 system system 4096 Jan 11 2015 ifw
drwx------ 2 system system 4096 Aug 27 2022 inputmethod
drwx------ 2 system system 4096 Jan 11 2015 install_sessions
drwx------ 2 system system 4096 Aug 27 2022 job
drwx------ 2 system system 4096 Aug 27 2022 netstats
drwx------ 3 system system 4096 Feb 10 2022 package_cache
drwxrws--- 2 root system 4096 Jan 11 2015 perfd
drwx------ 2 system system 4096 Aug 27 2022 procstats
drwxrwx--- 2 radio radio 4096 Jan 11 2015 qcril
drwx------ 2 system system 4096 Jan 11 2015 sensor_service
drwx------ 2 system system 4096 Jun 8 2021 slice
drwx------ 2 system system 4096 Aug 27 2022 sync
drwx------ 2 system system 4096 Aug 26 2022 syncmanager-log
drwx------ 3 system system 4096 Oct 27 2021 usagestats
drwxrwxr-x 5 system system 4096 Aug 27 2022 users
-rw------- 1 system system 4031 Aug 27 2022 log-files.xml
-rw------- 1 system system 3795 Aug 26 2022 overlays.xml
-rw------- 1 system system 3161 Aug 27 2022 profiles.xml
-rw------- 1 system system 2240 Aug 27 2022 cachequota.xml
-rw------- 1 system system 840 Aug 18 2021 urigrants.xml
-rw------- 1 system system 730 Aug 27 2022 install_sessions.xml
-rw------- 1 system system 512 Aug 26 2022 entropy.dat
-rw------- 1 system system 431 Aug 27 2022 netpolicy.xml
-rw------- 1 system system 369 Jan 11 2015 display-manager-state.xml
-rw------- 1 system system 345 Aug 22 2022 device_policies.xml
-rw------- 1 system system 281 Aug 7 2022 deviceidle.xml
-rw------- 1 system system 248 Aug 21 2022 packages-warnings.xml
-rw------- 1 system system 238 Jun 8 2021 watchlist_settings.xml
-rw------- 1 system system 114 Aug 27 2022 shortcut_service.xml
-rw------- 1 system system 23 Aug 27 2022 screen_on_time
-rw------- 1 system system 0 Aug 27 2022 last-fstrim
-rw------- 1 system system 0 Aug 27 2022 last-header.txt
srwxrwxrwx 1 system system 0 Aug 27 2022 ndebugsocket
-rw-rw---- 1 system system 0 Aug 26 2022 watchlist_report.db-wal
/data/system # cd ../
/data # cp -a system system_copy
/data # cd system
/data/system # mv last-header.txt last-header.txt.bak
/data/system # mv last-fstrim last-fstrim.bak
/data/system # mv ndebugsocket ndebugsocket.bak
/data/system # mv watchlist_report.db-wal watchlist_report.db-wal.bak
/data/system # mv packages.list packages.list.bak
/data/system # mv packages.xml packages.xml.bak
/data/system # mv profiles.xml profiles.xml.bak
/data/system # mv netpolicy.xml netpolicy.xml.bak
/data/system # mv notification_policy.xml notification_policy.xml.bak
/data/system # ls -laS *.bak
-rw-rw---- 1 system system 839649 Aug 26 2022 packages.xml.bak
-rw------- 1 system system 78337 Aug 27 2022 notification_policy.xml.bak
-rw-r----- 1 system package_info 25595 Aug 26 2022 packages.list.bak
-rw------- 1 system system 3161 Aug 27 2022 profiles.xml.bak
-rw------- 1 system system 431 Aug 27 2022 netpolicy.xml.bak
-rw------- 1 system system 0 Aug 27 2022 last-fstrim.bak
-rw------- 1 system system 0 Aug 27 2022 last-header.txt.bak
srwxrwxrwx 1 system system 0 Aug 27 2022 ndebugsocket.bak
-rw-rw---- 1 system system 0 Aug 26 2022 watchlist_report.db-wal.bak
/data/system # cd ../
/data # cp ./data ./data.bak
cp: omitting directory './data'

So, I did the copy of /data/data to /data/data.bak in twrp graphic and rebooted into system. But, it behaved the same - long boot with bouncing ball followed by reboot into recovery. This is what I found had happened:

$ adb shell
~ # cd /data/
/data # ls
adb audio data media ota_package system_ce usf
anr backup data.bak mediadrm property system_copy vendor
app bootchart dpm misc resource-cache system_de vendor_ce
app-asec cache drm misc_ce shared time vendor_de
app-ephemeral camera lineageos_updates misc_de ss tombstones
app-lib connectivity local nfc ssh user
app-private dalvik-cache lost+found ota system user_de
/data # system
/sbin/sh: system: not found
/data # cd system
/data/system # ls -laS *.bak
-rw-rw---- 1 system system 839649 Aug 26 2022 packages.xml.bak
-rw-r----- 1 system package_info 25595 Aug 26 2022 packages.list.bak
-rw------- 1 system system 3161 Aug 27 2022 profiles.xml.bak
-rw------- 1 system system 431 Aug 27 2022 netpolicy.xml.bak
-rw------- 1 system system 0 Aug 27 2022 last-fstrim.bak
-rw------- 1 system system 0 Aug 27 2022 last-header.txt.bak
srwxrwxrwx 1 system system 0 Aug 27 2022 ndebugsocket.bak
-rw-rw---- 1 system system 0 Aug 26 2022 watchlist_report.db-wal.bak
/data/system # ls -laS packages.xml*
-rw-rw---- 1 system system 839649 Aug 26 2022 packages.xml.bak
-rw-rw---- 1 system system 505058 Aug 26 2022 packages.xml
/data/system # ls -laS packages.list*
-rw-r----- 1 system package_info 25595 Aug 26 2022 packages.list.bak
-rw-r----- 1 system package_info 15940 Aug 26 2022 packages.list
/data/system # ls -laS profiles.xml*
-rw------- 1 system system 3161 Aug 27 2022 profiles.xml.bak
/data/system # ls -laS netpolicy.xml*
-rw------- 1 system system 431 Aug 27 2022 netpolicy.xml.bak
/data/system # ls -laS last-fstrim*
-rw------- 1 system system 0 Aug 26 2022 last-fstrim
-rw------- 1 system system 0 Aug 27 2022 last-fstrim.bak
/data/system # ls -laS last-header.txt*
-rw------- 1 system system 0 Aug 27 2022 last-header.txt.bak
/data/system # ls -laS ndebugsocket*
srwxrwxrwx 1 system system 0 Aug 27 2022 ndebugsocket.bak
/data/system # ls -laS watchlist_report.db-wal*
-rw-rw---- 1 system system 0 Aug 26 2022 watchlist_report.db-wal
-rw-rw---- 1 system system 0 Aug 26 2022 watchlist_report.db-wal.bak
/data/system #

So, /data/data was recreated. As were the following in /data/system:

packages.xml, packages.list, last-fstrim, watchlist_report.db-wal

What's the process to back up 'storage' (i.e. media, d/l, files etc)? twrp says a backup of 'Date' excludes storage? What's the difference between /sdcard and /data/media ? I guess Android combines those. I guess I'm going to have to trash what I've got, reformat and clean flash a new system, as you say - which is okay so long as I can get my media, files etc off?

Many thanks.