Jump to content

How to backup before upgrading LineageOS?

Recommended Posts

I have a Pro¹X and I successfully got LineageOS 20230127 along with GApps installed and the phone has been working great!

Now I want to understand the upgrade process to get to 20230130 as this is my first time upgrading. From an XDA comment, I think I just have to run:

1. Reboot into recovery but DO NOT select factory reset
2. Select Apply update
3. Select Apply from ADB
4. adb sideload lineage-20.0-20230130-UNOFFICIAL-pro1x.zip
5. Reboot

I have a few questions:

A. How do I do a backup of my data in case there are problems? I searched for "backup" in the forums but couldn't find a good result.

B. If the installation fails, how do I fall back to 20230127? Do I just sideload the 20230127 build? Do I need to restore my user backup or is that only if my SD card goes bad?

C. Since I'm using GApps, do I need to sideload MindTheGapps again?

  • Like 1
Link to post
Share on other sites

I don't have a Pro1x, but I believe the process of updating Lineage is the same as for the Pro1 and I will answer your questions from that assumption.

Your steps 1-5 are correct except that, after you do the adb sideload, you need to reboot to recovery.  This is because the update (which is actually the full installation with the updates) is installed to the inactive slot. Rebooting to recovery makes the inactive slot active.  Now when you do step 5, you will be actually booting up the update. 

A. There is no formal backup for either the Pro1 or Pro1x.  No TWRP.  You can backup your own data manually, but otherwise there are cloud backups such as Google backup.  There is a backup option I've heard referred to using ADB, but I know nothing about it. 

B. I've never had to do this, so I shouldn't make suggestions. See what others say.  I would think the previous version is still available on the inactive sot and, once in recovery, rebooting to recovery to change the active slot would allow you to boot into the previous version.  However, in my experience with even test versions of Lineage OS, needing to do this never arose.

C. You shouldn't have to reinstall MTG when flashing an update, The update won't affect it.  That said, it doesn't hurt to reflash MTG and I always do, but it's just superstition.  😄

  • Like 2
  • Thanks 1
Link to post
Share on other sites
22 hours ago, Hook said:

C. You shouldn't have to reinstall MTG when flashing an update, The update won't affect it.  That said, it doesn't hurt to reflash MTG and I always do, but it's just superstition.  😄

I do the same. Mostly because I made a batchfile-logic to do the whole process. So I have a common base file, and then Just call e.g.

FlashPro1_Lineage200_MTG   20230130


 I have attached an example set of my usage (renamed from .bat to .txt), I have the roms, recovery zips and gapps in a subdir I called "Pro1_ROM".

FlashBase.txt FlashBase_MindTheGapps130.txt FlashPro1_Lineage200_MTG.txt

  • Like 2
Link to post
Share on other sites

Here are the steps I took:

1. Root the device (to do full backups): https://community.fxtec.com/topic/3690-pro1-x-rooting-with-magisk/
    1. Unzip the previous lineage*.zip that was used to flash the phone
    1. Extract boot.img from payload.bin: https://wiki.lineageos.org/extracting_blobs_from_zips#extracting-proprietary-blobs-from-payload-based-otas
        1. sudo dnf install python-protobuf
        1. git clone https://github.com/LineageOS/scripts
        1. python ./scripts/update-payload-extractor/extract.py payload.bin --output_dir ./
    1. adb push boot.img /sdcard/
    1. F-Droid: Search and install Magisk
    1. Install
    1. Open Magisk
    1. Press Install to the right of Magisk
    1. Select and Patch a File
    1. Hamburger Menu } Fxtec Pro1-X
    1. Select boot.img
    1. Select Let's Go
    1. Wait for "output file is written to:"
    1. adb pull $(adb shell ls /sdcard/Download/magisk_patched*.img) .
    1. adb reboot bootloader
    1. On START screen, run from computer:
       fastboot flash boot ./magisk_patched*.img
    1. fastboot reboot
    1. Open Magisk app
    1. If Superuser tab at the bottom is not greyed out, then rooting was successful
    1. Android } Settings } About phone } Tap "Build number" 7 times
    1. Android } Settings } System } Developer options } Check "USB debugging" and "Rooted debugging"
    1. Computer (note that this does not need to be done with the root account on the computer):
       adb root
    1. adb shell rm /sdcard/boot.img
1. Backup the device (a lot of this is redundant but better to have something if it might help)
    1. adb pull /sdcard/
    1. Backup /data/data (iteratively to avoid transient per-app issues)
       adb pull /data/data/
       mkdir data_$(date +%Y%m%d)
       for app in $(adb shell ls /data/data/); do echo "Downloading ${app}"; if [ ! -d "data_$(date +%Y%m%d)/${app}" ]; then mkdir data_$(date +%Y%m%d)/${app}; adb pull /data/data/${app} data_$(date +%Y%m%d)/; fi; done
       If any directory hangs for a while, just Ctrl^C to skip it (note for potential further investigation) and re-run
    1. Confirm text messages:
       sqlite3 -header data*/com.android.providers.telephony/databases/mmssms.db 'select count(*) from sms'
    1. Try adb backup in case it's helpful:
       adb backup -f android.$(date +%Y%m%d).backup -all -apk
       Press "Back up my data" on the phone and wait until the "Backup finished" toast
    1. Note: if restore needed, re-install the apps and then (untested):
       APP_OWNERSHIP=$(adb shell stat --format "%U:%G" "/data/data/${APP_ID}")
       adb shell mv "/data/data/${APP_ID}" "/data/data/${APP_ID}_backup"
       adb push "./${APP_ID}" "/data/data/${APP_ID}"
       adb shell restorecon "/data/data/${APP_ID}"
       adb shell chown -R "${APP_OWNERSHIP}" "/data/data/${APP_ID}"
1. Double check you have the latest MindTheGapps*zip for Google Apps
    1. Download ARM64 build of GApps for Android 13 for Mobile (*not* Android TV): https://wiki.lineageos.org/gapps#mobile
1. Download latest lineage*zip build from https://mega.nz/folder/FPkRxSqA#vNCQ1vrKv1QRbPqtV-YS8g
1. adb reboot bootloader
1. On START screen, from computer:
   fastboot reboot recovery
1. Select Apply update
1. Select Apply from ADB
1. adb sideload lineage-...-pro1x.zip
1. Might get stuck at 47%, this is okay and just wait until it completes (see https://wiki.lineageos.org/devices/pro1/install#installing-lineageos-from-recovery)
1. Advanced
1. Reboot to Recovery (This is needed whether or not MIngTheGapps will be sideloaded to switch the active boot slot)
1. Apply Update
1. Apply from ADB
1. adb sideload MindTheGapps*.zip
1. Might get stuck at 47%, this is okay and just wait until it completes
1. Reboot system now
1. All previous apps and settings should hopefully still be there
1. Re-root with Magisk if desired (remember to extract the new boot.img)
1. Note down which lineage-...-pro1x.zip build you applied in some notes for future reference

  • Thanks 2
Link to post
Share on other sites
5 hours ago, kevg said:

Might get stuck at 47%, this

(It always does, it is a two part process, where they for some reason denote the first part's end as 47% and no progress during second step at all - and after the 47% you might be asked on the phone to accept lacking signing.)

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information