yashsingh1/xdaforums huggingface dataset:
[Xperia Z3 Tablet Compact Original Android Developm] ccgx:
I freaking did it! I did some research on the error messages I found in the log and found this site: https://vogelchr.blogspot.de/2015/08/full-disk-encryption-with-cyanogenmod.html

The Problem was a to large filesystem on the data partition, so the encryption couldnt insert the encryption header (or footer, since the info is inserted behind the filesystem).

I booted up TWRP and did some commandline magic in the Terminal to resize the filesystem a tiny bit. After that the encryption worked flawlessly. I had previously installed the stock rom and used encryption, thats why I thought it wouldnt be a problem.

For all having the same problem a quick overview what I did:

Boot into TWRP

Go to Advanced > Terminal

check that you resize the right partition, type

cat /proc/partitions

the data partition should have the highest number in this list and should start with mmcblk0, mine was mmcblk0p26

recheck that it's really the right partition with this command:

tune2fs -l /dev/block/mmcblk0p26

You should see "Last mounted on: /data" on the 3rd line. If yes, continue, if no, search again for the right partition.

look for the line "Block count:" and write the number down. Mine was 2991611. Take a look at "Block size:", it should be 4096.

Apparently you need only 16KB for the encryption header (or 4 Blocks), but I played it safe and used 11. Subtract the needed blocks from the number you wrote down. My new block count will be 2991600.

Now to resize the partition type this:

resize2fs /dev/block/mmcblk0p26 2991600

It should be done fairly quickly.

Now reboot. Encryption should be working. It took more "restarts" for me than I anticipated, but it worked at the end.
[Xperia Z3 Tablet Compact Original Android Developm] shrek42:
Amazing work. Glad you solved the problem. And many thanks for publishing it.

Indeed in my case the initial "tune2fs -l /dev/block/mmcblk0p26" "Block count:" is 2991607 and not 2991611 as in your case. So it seems that I have those 4 blocks extra space required for setting up encryption by default. When I re-format the data partition with TWRP, the file system block count stays at 2991607.

So here is maybe the main difference in the history of the devices: I never encrypted the device with stock firmware, but you did. So maybe (just speculative) when switching from an encrypted stock device to lineage, lineage creates a 4 blocks larger file system for some reason. Or (another possibility) I've re-formated /data with TWRP (I did this several times - don't remember the first time) and you never did?

EDIT: Which TWRP version did you use when you first switched away from stock? I started with TWRP-3.0.3 (which obviously creates a file system 4 blocks smaller than possible). If you did start with an earlier (pre-encryption-time) version of TWRP, it might have created a larger file system (as large as possible).
[Xperia Z3 Tablet Compact Original Android Developm] ccgx:
I flashed lineage straight after unlocking the bootloader yesterday. I did not reformat /data, since unlocking automatically wipes the device. Maybe that was the problem.

Edit:

I'm using the same TWRP as you are.
[Xperia Z3 Tablet Compact Original Android Developm] shrek42:
Maybe that's good enough as explanation. So advice would be to re-format /data (losing all data, apps, images, etc) with TWRP-3.0.3 (at least once) before switching on encryption. Or one could use your method instead of re-formating (hopefully not losing anything). Well, creating a backup before encrypting anything is always mandatory, if you want to be sure.

Let's hope that koron393 helps to get TWRP mounting encrypted partitions. Without that I won't be able to use encryption on the tablet.
[Xperia Z3 Tablet Compact Original Android Developm] celestialz:
can you help to reupload FOTAKernel? i cannot find it anywhere..

---------- Post added at 02:33 AM ---------- Previous post was at 02:19 AM ----------

one more thing, after i flash lineage, i cannot flash back to stock rom, im stuck at the moving loading screen....
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
FOTAKernel with lineage is just the TWRP recovery. If you want to flash back to stock you need to do a complete wipe with flash tool, as stock is not compatible with 7.1.1 data format.
[Xperia Z3 Tablet Compact Original Android Developm] JKWR:
I'm new to this. I'm on stock 6.01, once I have recovery can I flash straight to version 3? Thanks
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
If your bootloader is unlocked and you have a working recovery, you can flash it with no problem. You need to do a complete data wipe beforehand though.
[Xperia Z3 Tablet Compact Original Android Developm] celestialz:
In which option can I choose complete wipe in flashtools?
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
If you flash the FTF there is a wipe section in the upper right hand corner in the flashtool dialog. There you select all possible options (wipe data, wipe cache, wipe apps log,...) and continue the flashing process.
[Xperia Z3 Tablet Compact Original Android Developm] prefect472:
Ok so I found this and that boot image works like described here, e.g. I get to recovery by pressing Vol+ during the Sony logo. But it still refuses to flash since that TWRP sets the device name to either empty or just ".".

Can TWRP be configured to ignore the device name check somehow?

Edit: Nevermind, figured out I can just remove the assert from the script in the zip files :)

Edit: OK, so the flash went fine except for some red lines ("E: unknown command [log]") and I flashed Open GApps straight after - but my tablet doesn't boot, it vibrates and that's it. Screen doesn't even turn on. :( The boot image in this zip simply does not work on my SGP621. Do I need to start with a particular stock software version? Am I required to have a particular TWRP for this to work?

I've also tried this and this but they don't boot either.
[Xperia Z3 Tablet Compact Original Android Developm] Lightheaded:
I've tried to update, but it keeps failing for me too. Here's what happens: https://goo.gl/photos/ZUzRCUap2j7itsVp7
[Xperia Z3 Tablet Compact Original Android Developm] SteveJobt:
You can't install the zip file from recovery directly. Extract the zip file and copy the files to system/etc from recovery. (use the filemanager)

---------- Post added at 05:53 PM ---------- Previous post was at 05:49 PM ----------

Download TWRP for SGP621 from here: https://xdaforums.com/devdb/project/dl/?id=23103

This works for me. You can install it with flashtool but after installing CM 14 you will lose the recovery. Install with fastboot in FOTAKernel will keep the recovery after installing CM14.
[Xperia Z3 Tablet Compact Original Android Developm] Lightheaded:
What do you mean can't install from recovery? The first post says to sideload. How does it gets installed? Copying by itself is not enough, is it?
[Xperia Z3 Tablet Compact Original Android Developm] SteveJobt:
Unzip the update.zip file and copy the two files to system/etc.
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
V4 is here :)

V4 arrived, hot from the presses.

Changelog:

05.03.2017 - V4:

- Newest Lineage, Sony and Android Sources

- Android February security patches

- Updated to newest Sony and QCom blobs (crash fixes for Adreno etc.)

- FM and Bluetooth now work independent of each other and can be on at the same time (still some glitches)

- Sleep improvements and kernel simplification (less log clutter and removal of unneeded drivers)

- Fixed NFC glitch that was introduced in V3
[Xperia Z3 Tablet Compact Original Android Developm] Lightheaded:
Which two files? I have more:

META-INF

file_contexts.bin

system

system.patch.dat

boot.img

install

system.new.dat

system.transfer.list

Trying to understand – what's wrong with installing from a zip?
[Xperia Z3 Tablet Compact Original Android Developm] prefect472:
Are you saying that if I come from stock, I should fastboot flash it to something other than FOTAKernel (like boot, or recovery)? Because I've tried the TWRP image from AICP and it doesn't start, whereas the official (windy) TWRP starts just fine if flashed to FOTAKernel, by holding down Volume- while starting, just like the TWRP instructions say.

Is there something new in TWRP 3.0.3 that is required by this LineageOS ROM?
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
I think you two are misunderstanding each other. [MENTION=5715851]Lightheaded[/MENTION] wants to install the ROM as far as I understand. For this you should:

1. Download the latest zip

2. Download the latest TWRP from [MENTION=5688409]koron393[/MENTION]'s thread

3. Unzip the ROM download (which contains the boot.img)

4. Boot into fastboot and fastboot flash boot.img to boot and TWRP to FOTAKernel

5. Fastboot reboot

6. On purple LED press VolUp until LED turns orange

7. Now entering TWRP you need to go to advanced and side load the ROM zip

What [MENTION=5847593]SteveJobt[/MENTION] was trying to tell you (I guess) is how to fix the NFC bug with the files from the zip a few posts earlier. (If you use v4 you do not need to do this anymore anyways)
[Xperia Z3 Tablet Compact Original Android Developm] Lightheaded:
Thanks a bunch lowtraxx. Although I now bricked my tablet so it's stuck at Sony logo.. Will try to wait until the battery runs empty and try to flash TWRP again. I guess I had ZXDualRecovery when flashing the boot.img from this package and maybe that messed it up?
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
But you should be able to boot into fastboot anyways? Just hold power and VolUp until it vibrates three times and turns off (must not be plugged in!). If that does not work, plug it into the computer and press and hold power and VolUp. Once it restarts let go of the power button. It should go straight to fastboot mode.
[Xperia Z3 Tablet Compact Original Android Developm] Lightheaded:
Nope, tried holding the power button, holding the power button plus either volume buttons, to no avail. The Sony logo is stupidly persistent. Hoping that the battery I have is not very good and it will run out of juice soon. Will then try booting into fastboot with VolUp + inserting the cable..
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
That is very strange, as pressing those is normally hardwired into the firmware. I just bricked mine on purpose to test and here it works. Holding both for five seconds turns off the tablet. Have you tried the hardware reset inside the SD card slot. Press the little yellow button in there with a toothpick for five seconds. Should do the trick and turn off the device.
[Xperia Z3 Tablet Compact Original Android Developm] Lightheaded:
Yay! It did help. Thanks a lot! flashed TWRP and got into recovery. Great success! Now though I am trying to install the .zip on it but it seems that my tablet is deeply screwed up.. It goes:

could not detect filesystem for /dev/block/bootdevice/by-name/system, assuming ext4
mount: failed to mount /dev/block/bootdevice/by-name
system at /system: No such file or directory
...

Should I try to get help regarding this in a separate thread or..? Don't want to hijack this one.
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
You could try erasing the partitions via fastboot like:

fastboot erase boot
fastboot erase FOTAKernel
fastboot erase userdata
fastboot erase system
fastboot format system

If that fails, something with the partitioning scheme or your eMMC are probably broken. If they all succeed you can try flashing boot and FOTAKernel and then the zip again. If that still does not work, private msg me and I send you the system image to directly flash via fastboot.
[Xperia Z3 Tablet Compact Original Android Developm] hb15:
V4 on SGP611 (WiFi only / "Scorpion Windy") - working :) - THX

Hi!

Just upgraded my SGP611 from V3 to V4 - works well. Kudos to lowtraxx - good job!

Regards

hb15
[Xperia Z3 Tablet Compact Original Android Developm] belrik:
Try an advanced wipe of system and then reboot into twrp again. It's just an error with twrp not seeing & mounting /system when it starts up. You can manually locate the partition and run make_ext4 inside twrp too.
[Xperia Z3 Tablet Compact Original Android Developm] b8drf:
lowtraxx - I am just about to come over to V4 from stock 6.0.1 rooted (SGP621 with locked bootloader) - I was about to search back thru the threads to determine my steps, and saw your reply above ...

Can I check that the above steps are correct for my use case, with the addtion of unlocking my bootloder before I embark on this journey ;)

Thanks!
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
Yes, the procedure above is the way to go for you after unlocking the bootloader. The only thing you need to do adding to that are:

- Between 6 and 7 do a complete wipe to be safe

- If you want GApps, sideload them directly after completing Step 7, do not reboot between
[Xperia Z3 Tablet Compact Original Android Developm] b8drf:
Thanks - is there a recommended source for GApps?
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
Yes, OpenGApps from here in the ARM nano variant for Android 7.1
[Xperia Z3 Tablet Compact Original Android Developm] b8drf:
OK, so I am runniong thru the steps, I have downloaded all of the relevant files and have unlocked my bootloader ...

I have successfully flashed the boot.img extracted from the V4 ROM but on the TWRP flash I get the following error ...

fastboot flash fotakernel TWRP_multirom_scorpion_3.0.3.0_3.10_201701.img

sending 'fotakernel' (15126 KB)...

OKAY [ 0.476s]

writing 'fotakernel'...

FAILED (remote: Command not allowed)

finished. total time: 0.480s

Any ideas ?
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
It is FOTAKernel not fotakernel ;) caps matter!
[Xperia Z3 Tablet Compact Original Android Developm] ravle:
Hello! I got a small problem here when flashing this: the device boots up, but it says "Encryption unsuccessful" and gives me the (only) option to "Reset tablet". Which reboots the tablet to the exact same state...

I also cannot boot into recovery mode (I press the "Vol Up" button, the led light turns yellow, then the device just reboots) and adb is not working ("device not found", although I can see it in lsusb).

Device: scorpion_windy, bootloader unlocked, coming from CM12 (nightly). No GApps. I did a factory reset before flashing.

Do you have any tips on how to get it back to work?

Thanks
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
How long were you using CM12 for? Is your bootloader and other prop stuff up to date with the latest stock?

I would suggest:

- Flashtool flash the latest stock for your device and factory wipe it with Flashtool as well

- Get korons TWRP recovery from the AICP thread and fastboot flash it to FOTAKernel

- Get the v4 zip for your device, unpack it and fastboot flash the boot.img contained to boot

- fastboot reboot, once LED turns purple press VolUp and in recovery start Advanced->Sideload

- adb sideload the v4 zip you downloaded

- reboot (and hopefully enjoy ;))
[Xperia Z3 Tablet Compact Original Android Developm] b8drf:
Thanks lowtraxx, I hadn't realised it was case sensitive :good:

Coming from Stock 6.0.1 - this was a very smooth install and having run this ROM for quite a few hours, I am very impressed with both the speed and hardware compatibility - no major glitches so far and the speed is as least as good as stock 6.x imo ...

The only thing I found (which is cosmetic) is the Build date text (see attached) ...

This ROM has really given this great little tablet a new lease of life which has now been forgotten by Sony in terms of firmware updates etc - and the added bonus is that adopted storage now works correctly - using a decent speed 128gb MicroSD card the system is very responsive and is reporting a total of 132gb of storage - you no longer need to worry about moving apps2SD to free up space - it is handled for you by Android 7.x ...

Excellent Job on theis ROM lowtraxx (and others who have helped) - I only hope you keep your Z3c Tablet for quite a while - we really can't afford to loose you as a developer ;)

For those coming from the same stock base, I have summarised my steps below, hopefully it will help someone ...

If rooted ...

- Backup TA partition (optional step, I don't plan on going back to an outdated Sony stock ROM, but it only took a few minutes!)

- Backup Apps using Titanium Backup (or similar) and copy the backup directory to offline storage (include user data, app settings etc)

1. Unlock bootloader (this wipes your device)

https://developer.sonymobile.com/unlockbootloader/

2. Download the latest ROM zip for your model from the OP in this thread

3. Download the latest TWRP for your model from koron393's thread

https://xdaforums.com/devdb/project/?id=17990#downloads

4. Download the latest GApps (ARM nano for Android 7.1)

http://opengapps.org/

5. Unzip the downloaded ROM and extract boot.img

6. Boot into fastboot and flash boot.img & TWRP to the FOTAKernel partition

% adb reboot bootloader

% fastboot flash boot <boot.img>

% fastboot flash FOTAKernel <twrp.img>

% fastboot reboot

7. When the LED turns purple, press Volume Up until the LED turns orange

8. from the TWRP Install menu

> add ROM zip

> add GApps zip

> re-boot

BINGO!
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
Yeah, the date is in German format (my native tounge), and Ubuntu (albeit being set to use english language and UK date format setting) will take the date format from the set keymap language for some reason. Maybe my Ubuntu VM is borked somehow. We'll see.

I also plan to support the Tab for quite a time to come, as I love the device and there still is none on the market that can compete.

You also need to give huge props to Sony. Qualcomm and Google dropped support for the Chipset used in the Z3TC for Nougat and Sony still tries very hard to support the older devices through their Open Devices Program.
[Xperia Z3 Tablet Compact Original Android Developm] finalista:
That's why I sold my Samsung tablet and went for a Sony :p

PS. You can also use the official TWRP recovery from http://TWRP.me. I used it without problem
[Xperia Z3 Tablet Compact Original Android Developm] b8drf:
OK, great - I guess a lower priority for you, but it would good if it could get fixed at some point when you have time to investigate ...

Good to hear and I couldn't agree more - I am hoping for a new range of Sony tablets sometime this year, but I suspect they will focus on a 10"+ model which is where most of the competition is focused ... as smartphone screens get larger, the need for an 8" tablet becomes less viable ...

Good point, I didn't realise that - so Sony haven't deserted us entirely :good:

Cheers!
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
Yep, but sadly only for SGP611 (scorpion_windy). You can flash it on SGP621 as well, but then the ROM zip will not apply (until you edit out the check in the updater script ;))
[Xperia Z3 Tablet Compact Original Android Developm] ccgx:
Ok, I got a little problem with updating from v3 to v4. After flashing v4 over v3 I was stuck on the boot animation. Then I read you should reflash the gapps you had flashed. I did that, it booted, but now all google apps wont start, play store has connection problems.

I reflashed v4 and gapps directly afterwards without rebooting, same problem, cleaned cache of play store, data of play services, removed google account, rebooted and readded the account (needed 2 trys for this), still the same problem. is there any help?
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
Please attach a logcat, so I can have a look.
[Xperia Z3 Tablet Compact Original Android Developm] ccgx:
Just captured a view minutes with me trying to use the play store, reinstalling youtube and using youtube. Man, these logs are getting quite big fast.
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
There seems to be a major permission f..ckup. It seems all the Google Apps are getting their Google related permissions denied.

03-07 16:36:21.604 17345 17345 E AndroidRuntime: java.lang.SecurityException: Permission Denial: opening provider com.google.android.gsf.gservices.GservicesProvider from ProcessRecord{1dfb6a7 17345:com.google.android.apps.plus/u0a159} (pid=17345, uid=10159) requires com.google.android.providers.gsf.permission.READ_GSERVICES or com.google.android.providers.gsf.permission.WRITE_GSERVICES

Do you have Privacy Guard enabled?
[Xperia Z3 Tablet Compact Original Android Developm] ccgx:
Yes, since it was activated automatically after the initial flash. I checked, it is deactivated for all google apps (minus the youtube app, but I changed this and its working now)
[Xperia Z3 Tablet Compact Original Android Developm] finalista:
[MENTION=615507]lowtraxx[/MENTION]: could you add this to your wonderful Rom? https://xdaforums.com/oneplus-3/themes/mod-aptx-codec-t3521228
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
I certainly can try ;)
[Xperia Z3 Tablet Compact Original Android Developm] ccgx:
Ok, most stuff works, but google play services still crash now and then and I still get these security warnings in logcat, despite deactivating Privacy Guard:

03-07 17:33:37.753 10192 10192 W Finsky : [1] com.google.android.finsky.x.l.a(102): No permission to get location. java.lang.SecurityException: Client must have ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to perform any location operations.
03-07 17:33:38.238 19284 19303 E DeviceDoctorHandler: java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission.
03-07 17:33:38.817 19340 19369 E LocationManagerCompat: java.lang.SecurityException: "passive" location provider requires ACCESS_FINE_LOCATION permission.
03-07 17:33:38.818 19340 19369 E LocationManagerCompat: java.lang.SecurityException: "passive" location provider requires ACCESS_FINE_LOCATION permission.

Could installing newer gapps help?
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
I think I know what happened... :( The GApps core got updated and updated its data as well. Once you flashed the old GApps core back, it could not read its newly formatted data. So I think installing the latest GApps could well be the solution to your problem. I certainly did not think of that (I will remove the tip to flash the old GApps, as it is no longer needed now that all releases already have selinux enabled).
[Xperia Z3 Tablet Compact Original Android Developm] ccgx:
Ok, I'll try it when I'm home tonight. But I still had the Problem of being stuck at the boot Animation after flashing v4. So the tip should be to flash the newest gapps after updating when stuck on the boot animation? As I said, I'll try later and report then.
[Xperia Z3 Tablet Compact Original Android Developm] lowtraxx:
Yeah, I don't know what happened there. How long did you wait on the boot animation? When there is a bigger Android security update, first boot can take a while. As far as I heard, you are the first to report this particular problem for the update. I hope the new Gapps fix it for you!
[Xperia Z3 Tablet Compact Original Android Developm] torben5247:
I am running v3 and i just love this rom!

Can i dirty flash v4? Just flash the zip in twrp without deleting anything?

Thanks lowtraxx, love your work!
[Moto Z Play Questions & Answers] rfameli:
Hi, I've been trying to find a solution for the problem of null IMEI I'm having after wiping EFS partition on the Chinese TWRP, maybe it's not that and it is because I've erased modemst1, modemst2 and flashed modem+fsg.

I'm pretty sure it had to do with one of those procedures, when I wiped the EFS I've got some error saying it couldn't be done but something went missing.

I've got a more direct question now, my brother just bought a Moto Z Play yesterday, if I backup his EFS on my phone (he already asked if I want to do that) will both of us would be able to use our phone normally?
[Moto Z Play Questions & Answers] flashallthetime:
No way, like you already now, each phone has an individual IMEI. Your phone is unfortunately unusable.

What did you attempt to do? Flash another firmware package ?