[RECOVERY] TWRP 3.3.1-0 (lilac) [UPDATE: 2019-09-16]

Search This thread

Nakopa

Member
Dec 26, 2016
10
1
Works just fine if you decrypt your /data partition where this information is stored.
True, my bad. I forgot that part.
Funnily enough I found out you can edit the default.prop in the recovery image to authorize it even with encryption on. Almost feels like you shouldnt be able to do that.
 

Alefello

Senior Member
Nov 28, 2007
170
12
Is it backward compatible? I mean, I'm on stock Oreo cound i flash the "Android 10.0" recovery or I've to stay on twrp-3.2 "Android 8.1"?
 

Flamefire

Senior Member
Jul 26, 2013
213
476
Sony Xperia XZ1 Compact
I just tried this after flashing your LineageOs 17.1 build and setting everything up via "fastboot boot". It got to the decryption dialog, entered my pin, then device restarted and hung in the SONY screen. After hitting VOL UP+DOWN+POWER to reboot the device the system was reset :/
 

michalsmerf

Senior Member
Apr 1, 2012
104
4
Wola Radziszowska
Hi
I Update LineageOS 16 to 17 but i don't know why it wipe all my data.
So i want restore LineageOS16 backup but when it restore "Data" i got 255 error and can't restore it.
Any solutions ?
 

asdf2345

Senior Member
Feb 3, 2018
155
15
Hi
I Update LineageOS 16 to 17 but i don't know why it wipe all my data.
So i want restore LineageOS16 backup but when it restore "Data" i got 255 error and can't restore it.
Any solutions ?

The backup probably failed, I've had this happen sometimes with TWRP too

---------- Post added at 07:13 PM ---------- Previous post was at 07:11 PM ----------

Why is there three different versions for different versions of Android?

Why not just one version for all? I've been able to flash many different Android versions with the same recovery, but why not with this phone?
 

Deadman001

Member
Jul 22, 2013
17
0
Hi
I Update LineageOS 16 to 17 but i don't know why it wipe all my data.
So i want restore LineageOS16 backup but when it restore "Data" i got 255 error and can't restore it.
Any solutions ?

I've been struggling with this issue and similar ones all night. From what I've been able to derive so far is that the TWRP isn't properly formatting the data Partition and you need to check "rm -rf instead of formatting" in the options
 

foresto

Senior Member
Feb 13, 2010
152
51
How to build from source?

The readme at your github link looks like it's only for building LineageOS. Are there instructions someplace for building TWRP instead?

Thanks!
 

foresto

Senior Member
Feb 13, 2010
152
51
still unable to build twrp

I'm having a terrible time trying to build this from source.

I followed the readme in the source repo linked in the first post, and although it seemed to build lineage, running fastboot boot recovery.img didn't work; the phone got stuck at a white screen with the Sony logo.

I tried starting with other people's twrp build instructions and adding the roomservice.xml from this project's repo, and I eventually got a build to complete, but again, fastboot boot recovery.img just led to a white screen with the Sony logo.

@modpunk I could really use some help here. Can you write up some twrp build instructions?

In case it helps, if I get this working, I could format the procedure and submit it as a PR for the README.
 
Last edited:
  • Like
Reactions: nussbaum

knerlington

Member
Aug 29, 2013
18
3
In need of help here. Used twrp 3.2.x.x for my xz1 compact yesterday to make a complete backup of my stock pie rom. Installed LineageOS 17.1 for this phone and upgraded twrp to 3.3.x since LOS 17.1 is using android 10. So far so good, but LOS doesn't have a working network service (I can't even find mobile networks with it) so I gave up and tried to restore my backup. TWRP 3.3 restored successfully, but after rebooting I get stuck at the sony logo. If I enter twrp now I'm back to twrp 3.2.x.x so it obviously restored at least the recovery partition. What should I do? I initially upgraded only because android pie doesn't have properly working OTG which worked perfectly with LOS.
 

foresto

Senior Member
Feb 13, 2010
152
51
finally got a twrp build & workaround for the fastboot boot failure

It took quite a lot of time to figure this out with no help, but I finally got twrp to build using current versions of modpunk's sources. (Hint: Ignore the OP. The source code link there is the wrong branch and contains incorrect instructions for TWRP.) Here's what worked for me:

These steps assume an ubuntu 18.04.4 system with openjdk-8 and all other necessary development packages already installed.

Warning: I am not covering build signing here; these instructions will use default (insecure) signing keys. (I'm also not sure a properly signed twrp image would be any better than an unsigned one, given that the bootloader must be unlocked to use it, but I figure it's worth mentioning.)

Start in an empty directory.

Prepare the vendor blobs, so the extract-files step will work:
  • Retrieve and unpack the latest vendor firmware (47.2.A.11.228) using a tool like XperiFirm.
  • Convert the system_*.sin and vendor_*.sin files to system_*.ext4 and vendor_*.ext4 using a tool like UnSIN.
  • Create a new directory (I called mine "vendor-files") with two empty subdirectories named system and vendor.
  • Mount the .ext4 files over those subdirectories, with commands like: mount -o loop system_*.ext4 system
  • Remember the full path of the vendor-files directory.

Set up the project manifests, sync the code, and configure and run the build:

Code:
repo init -u git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-9.0

mkdir .repo/local_manifests

cat > .repo/local_manifests/twrp.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <!-- SONY -->
  <project name="cryptomilk/android_kernel_sony_msm8998" path="kernel/sony/msm8998" remote="github" revision="lineage-17.1" />
  <project name="cryptomilk/android_device_sony_common-treble" path="device/sony/common-treble" remote="github" revision="twrp-9.0" />
  <project name="cryptomilk/android_device_sony_yoshino" path="device/sony/yoshino" remote="github" revision="twrp-9.0" />
  <project name="cryptomilk/android_device_sony_lilac" path="device/sony/lilac" remote="github" revision="twrp-9.0" />
  <project name="cryptomilk/android_vendor_sony_lilac" path="vendor/sony/lilac" remote="github" revision="lineage-16.0" />
  <!-- QCOM -->
  <project name="android_device_qcom_caf-sepolicy" path="device/qcom/sepolicy" remote="omnirom" revision="android-9.0" />
  <project name="android_vendor_qcom_opensource_commonsys" path="vendor/qcom/opensource/commonsys" remote="omnirom" revision="android-9.0" />
  <!-- TWRP -->
  <remove-project name="android_bootable_recovery" />
  <project name="TeamWin/android_bootable_recovery" path="bootable/recovery" remote="github" revision="android-9.0" />
</manifest>
EOF

repo sync  # this will take a long time

cd device/sony/lilac
./extract-files.sh /path/to/vendor-files
cd -

export WITH_TWRP=true
export ALLOW_MISSING_DEPENDENCIES=true  # required by minimal-manifest-twrp

. build/envsetup.sh
lunch omni_lilac-eng
mka -j5 recoveryimage   # 5 is the number of parallel tasks to run. CPU cores + 1 is a good choice.

When the build finishes, the twrp image will be out/target/product/lilac/recovery.img

A few notes about the repositories used here:
  • I used the minimal-manifest-twrp (twrp-9.0 branch) base manifests, because both the full omnirom manifests and the LineageOS manifests currently seem to be incompatible with modpunk's lilac repos. I tried around twenty repo combinations hoping to get those to work, and they all failed to build.
  • I used the lineage-17.1 branch of android_kernel_sony_msm8998, because the lineage-16.0 branch referenced by OP failed on illegal/unsupported C code. (Probably due to differences between clang and other compiler front-ends.)
  • I used the twrp-9.0 branches of android_device_sony_*, rather than the lineage-16.0 branch referenced by OP.
  • I added the android_device_qcom_caf-sepolicy and android_vendor_qcom_opensource_commonsys projects, neither of which is mentioned in OP or its linked repo, because I found them buried in the comments of another thread.
  • I used the TeamWin/android_bootable_recovery project, rather than omnirom/android_bootable_recovery as suggested by the official twrp build instructions, because the latter contains a build-breaking bug. A twrp developer recommended ignoring the instructions and using the TeamWin one instead. Apparently all their instructions and links to them are out of date.
  • I did not name my local manifest roomservice.xml as suggested by the readme at OP's link, because that file will be overwritten by the build system if it detects a conflict with omni.dependencies. Anything you put in roomservice.xml is at risk of being lost when you run lunch. Instead, I named my local manifest twrp.xml.

Regarding fastboot:

I wanted to test my twrp build before flashing it to a phone, so I put the phone in bootloader mode (blue LED) and ran fastboot boot recovery.img. That brought up the black Sony logo on a white background, but the phone remained stuck on that logo screen. I don't know why. There were no logs to examine and nothing responding to adb over usb, so I'm in the dark on this one.

There's a workaround, though: Put the phone in bootloader (fastboot) mode, and then run fastboot reboot-bootloader, to make it enter bootloader mode a second time. Then run fastboot boot recovery.img. I have no idea why this works. If someone else knows what's going on here, please share the details.

Once I was satisfied that this twrp build worked, I flashed it with fastboot flash recovery recovery.img . Rebooting to recovery mode worked on the first try.
 
Last edited:

Barium

Member
Apr 2, 2014
26
5
- 'Weird' restore procedure TWRP Android 10.0 (twrp-3.3.1-0-lilac-android10-1.img) -

I experienced difficulties when restoring a backup from my phone with 'lineage-17.1-20200714-UNOFFICIAL-v1.3-lilac' installed. In the first place I did not understand what to backup, since there is next to the system and vender partition also the system image and vender image in the TWRP backup menu. Anyhow...

I found out I had to back up the following partitions:
- Boot
- System Image
- Vendor Image
- OEM
- Data

After wiping all the data via 'Advaned Wipe' with 'Use rm -rf instead of formating' enabled in settings, reboot recovery.
When TWRP is rebooted and after again enabling 'Use rm -rf instead of formating' I try to restore the backup.

Problem: if I try to restore all the above mentioned partitions in one go, I get the createTarFork() process ended with ERROR=255 error when TWRP tries to restore the Data partition.

Solution: reboot system (TWRP mentions there is no OS installed), LineageOS is booted and the installation menu is showed, because the Data partition is not restored obviously. Reboot back into TWRP, restore the data partition, reboot system and the restore is finally complete.

Took me some time and fustration to figure out... I did not see this mentioned somewhere (correct me if I am wrong) ??
Are there others experiencing the same issue? Or is my backup method incorrect??
Either way I find this a little sketchy, and does not create a lot of confidence in the phone's backup, because I don't know what going on.
 
Last edited:

Barium

Member
Apr 2, 2014
26
5
- 'Weird' restore procedure TWRP Android 10.0 (twrp-3.3.1-0-lilac-android10-1.img) -

I experienced difficulties when restoring a backup from my phone with 'lineage-17.1-20200714-UNOFFICIAL-v1.3-lilac' installed. In the first place I did not understand what to backup, since there is next to the system and vender partition also the system image and vender image in the TWRP backup menu. Anyhow...

I found out I had to back up the following partitions:
- Boot
- System Image
- Vendor Image
- OEM
- Data

After wiping all the data via 'Advaned Wipe' with 'Use rm -rf instead of formating' enabled in settings, reboot recovery.
When TWRP is rebooted and after again enabling 'Use rm -rf instead of formating' I try to restore the backup.

Problem: if I try to restore all the above mentioned partitions in one go, I get the createTarFork() process ended with ERROR=255 error when TWRP tries to restore the Data partition.

Solution: reboot system (TWRP mentions there is no OS installed), LineageOS is booted and the installation menu is showed, because the Data partition is not restored obviously. Reboot back into TWRP, restore the data partition, reboot system and the restore is finally complete.

Took me some time and fustration to figure out... I did not see this mentioned somewhere (correct me if I am wrong) ??
Are there others experiencing the same issue? Or is my backup method incorrect??
Either way I find this a little sketchy, and does not create a lot of confidence in the phone's backup, because I don't know what going on.

After restoring Lineage apps (Dropbox, camera, Firefox) complained that there was insufficient storage, while there was 19GB free space left. I could though install other apps...

Now I went back to TWRP wiped and restored my phone again with the quoted procedure, but this ended up in a bootloop...

I never experienced such weird and unreliable behaviour of TRWP before. Appreciate the hard work though @modpunk!
Does someone have a clue how to get a reliable backup?
 
  • Like
Reactions: Fisuxcel

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    I want to return to Lineage OS again but I can no longer flash the TWRP recovery; the terminal just hangs on the fastboot flash
    Did you find any solution?
    Not sure why this is happening, perhaps an insufficient or incompatible power supply issue, but the solution is to try different computers/USB ports. Also, in my case it only worked with Linux, EndeavourOS to be specific, but should work on Ubuntu or any other "complete" Linux OS/distro.

    Will there be a TWRP update for 11?
    Any ideas on why is failing to boot with the flashed recovery? Could this be related with the fact that there's no TWRP for Android 11 for the XZ1 Compact? Is there any alternative to TWRP?
    Don't wait on TWRP updates in this thread, get the latest version from the source and reflash it, it works for me on ROMs with Android 11 and 12: https://twrp.me/sony/sonyxperiaxz1compact.html

    Is there any alternative to TWRP?
    I'm using Pie 9 TWRp 3310. It work fine. But after the reboot, I tried to flash something and all folder suddenly showing weird name, probably encrypted?
    I am also in trouble. (Lineage 19.1)
    It's because of the encryption. Files on LineageOS 19 are encrypted if accessed via TWRP recovery, LineageOS 19 (maybe 18 also) has its own alternative recovery that can be installed during the first boot, perhaps the files are not encrypted if accessed from there. Either way, it's a security measure against unauthorized access to files. I'm pretty sure I've read somewhere that it's a default feature in Android 12.

    How do I resolve TWRP error 255?
    The error 255 is caused due to insufficient space. One solution is to backup or restore one or several partitions at a time instead of all at once, alternative solution is to back up to external memory card.
    1
    But error 255 means low storage space
    Thank you.
    If you back up by excluding only data, it will finish without error.
    Perhaps there is something wrong with the data?
    I formatted the 32gb sd card and tried backing up only the data.
    But the result is the same with an error.
    When I backed up the data with adb, it was 20.8gb.

    postscript
    With Havoc-OS 4.6, I was able to back up without any problems.
    I think it's probably a problem with LOS 19.1.
  • 57
    TWRP

    This project provides the TWRP recovery for for the Sony Xperia XZ1 Compact (lilac).

    twrp-lilac.jpg


    FEATURES

    • File-Based Encryption (FBE) support
    • EXT4 support
    • F2FS support
    • EXFAT support
    • Provides unzip
    • Additional languages

    This recovery will use the security patch level from the system partition to decrypt data. It should not be tied to a security patch level anymore.

    DOWNLOAD

    Make sure you download the .img and corresponding .asc.txt file (see INTEGRITY)!

    You can always find the latest version of the recovery HERE.

    INTEGRETY

    The recovery images also come with an GPG armor file (.asc). With that file you verify that the image I created hasn't been altered.

    How do you do that?

    1. Download my gpg keyring here: https://cryptomilk.org/gpgkey-8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D.gpg.
    2. Download the recovery.img and recovery.img.asc.txt file
    3. Rename the recovery.img.asc.txt file to recovery.img.asc
    4. Verfiy the signature using the following command:
      Code:
      gpg --keyring ./gpgkey-8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D.gpg --verify recovery.img.asc

    A good tutorial is: How to verify signatures for packages from the Tor Project.

    SECURITY ADVICE

    Don't flash ROMs or Magisk modules which set SELinux to permissive or you welcome malware on your device!

    XDA:DevDB Information
    recovery_twrp_sony_lilac, Tool/Utility for the Sony Xperia XZ1 Compact

    Contributors
    modpunk, Dees_Troy
    Source Code: https://github.com/cryptomilk/android_device_sony_lilac


    Version Information
    Status: Stable
    Current Stable Version: 3.3.1-0
    Stable Release Date: 2019-09-16

    Created 2017-11-18
    Last Updated 2019-09-16
    13
    I've uploaded a new recovery. This should not be tied to the security patch level anymore. It reads the values from the system partition and uses that.
    13
    I've uploaded a new TWRP recovery version 3.2.3-0

    • enable md5sum digest verification
    • adb backup fixes
    • OTA style update zips will now install automatically without prompting for decrypt
    • minor tweaks to handling date/time on Qualcomm devices
    • updates to some language translations
    13
    New recovery released.
    13
    I've uploaded a TWRP for Android 9.0 (Pie).