{"id":983,"date":"2020-09-11T02:30:00","date_gmt":"2020-09-10T23:30:00","guid":{"rendered":"https:\/\/blog.andresgomez.org\/?p=983"},"modified":"2020-09-07T23:13:23","modified_gmt":"2020-09-07T20:13:23","slug":"installing-lineageos-in-the-sony-xperia-xz2-compact-dual-in-gnu-linux-5-5-appendixes","status":"publish","type":"post","link":"https:\/\/blog.andresgomez.org\/es\/2020\/09\/11\/installing-lineageos-in-the-sony-xperia-xz2-compact-dual-in-gnu-linux-5-5-appendixes\/","title":{"rendered":"Installing LineageOS in the Sony Xperia XZ2 Compact Dual (in GNU\/Linux) 5\/5: Appendixes"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">WARNING<\/h2>\n\n\n\n<p>I have no responsibility whatsoever if this guideline causes any harm to your device. The intention of these posts are solely as personal notes for myself. Follow them at your own risk.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">WARNING<\/h2>\n\n\n\n<p>Through these steps I will unlock the phone&#8217;s bootloader, erasing all data. This includes the DRM keys stored in the Trim Area (TA) partition. I&#8217;ll attempt backing them up but, as of today, there is no way of restoring them to the previous state nor knowing if the actual backup is usable at all.<\/p>\n\n\n\n<p>Without these DRM keys, several audio and video proprietary functionality provided by Sony <a rel=\"noreferrer noopener\" href=\"https:\/\/developer.sony.com\/develop\/open-devices\/get-started\/unlock-bootloader\" data-type=\"URL\" data-id=\"https:\/\/developer.sony.com\/develop\/open-devices\/get-started\/unlock-bootloader\" target=\"_blank\">won&#8217;t be available<\/a> <strong>including some camera post-processing features<\/strong>, color gamut profiles, white balance, noise reduction, X-Reality Video Enhancement, DSEE HX, ClearAudio+, and Widevine L1 support for HD Netflix.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Appendixes<\/h2>\n\n\n\n<p>Previously, we <a href=\"https:\/\/blog.andresgomez.org\/2020\/09\/07\/installing-lineageos-in-the-sony-xperia-xz2-compact-dual-in-gnu-linux-1-5-downgrading-sonys-stock-firmware\/\" data-type=\"URL\" data-id=\"https:\/\/blog.andresgomez.org\/2020\/09\/07\/installing-lineageos-in-the-sony-xperia-xz2-compact-dual-in-gnu-linux-1-5-downgrading-sonys-stock-firmware\/\" target=\"_blank\" rel=\"noreferrer noopener\">downgraded Sony&#8217;s Stock firmware<\/a>, <a href=\"https:\/\/blog.andresgomez.org\/2020\/09\/08\/installing-lineageos-in-the-sony-xperia-xz2-compact-dual-in-gnu-linux-2-5-backing-up-the-trim-area-ta-partition\/\" data-type=\"URL\" data-id=\"https:\/\/blog.andresgomez.org\/2020\/09\/08\/installing-lineageos-in-the-sony-xperia-xz2-compact-dual-in-gnu-linux-2-5-backing-up-the-trim-area-ta-partition\/\" target=\"_blank\" rel=\"noreferrer noopener\">backed up the Trim Area<\/a>, <a href=\"https:\/\/blog.andresgomez.org\/2020\/09\/09\/installing-lineageos-in-the-sony-xperia-xz2-compact-dual-in-gnu-linux-3-5-installing-lineageos\/\" data-type=\"URL\" data-id=\"https:\/\/blog.andresgomez.org\/2020\/09\/09\/installing-lineageos-in-the-sony-xperia-xz2-compact-dual-in-gnu-linux-3-5-installing-lineageos\/\" target=\"_blank\" rel=\"noreferrer noopener\">installed LineageOS<\/a>, and, finally, <a rel=\"noreferrer noopener\" href=\"https:\/\/blog.andresgomez.org\/2020\/09\/10\/installing-lineageos-in-the-sony-xperia-xz2-compact-dual-in-gnu-linux-4-5-bringing-back-sonys-stock-camera-app\/\" data-type=\"URL\" data-id=\"https:\/\/blog.andresgomez.org\/2020\/09\/10\/installing-lineageos-in-the-sony-xperia-xz2-compact-dual-in-gnu-linux-4-5-bringing-back-sonys-stock-camera-app\/\" target=\"_blank\">bring back Sony&#8217;s stock camera app<\/a>.<\/p>\n\n\n\n<p>The installation had some bumps, so here a list of the things I could comment about &#8230;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing TWRP<\/h2>\n\n\n\n<p>I wanted to install the TWRP recovery tool just because I have experience with it and like it better. I did and used it successfully in the first installation of the LineageOS that I did. However, the LineageOS installation also installed the Lineage Recovery so I lost TWRP and, funnily enough, the steps I followed to install TWRP <a href=\"https:\/\/forum.xda-developers.com\/showpost.php?p=83449855&amp;postcount=14\" data-type=\"URL\" data-id=\"https:\/\/forum.xda-developers.com\/showpost.php?p=83449855&amp;postcount=14\" target=\"_blank\" rel=\"noreferrer noopener\">won&#8217;t work any more<\/a>. Hence, I&#8217;m stack with the Lineage Recovery and that&#8217;s why I explain how to directly install Lineage Recovery in the previous post.<\/p>\n\n\n\n<p>For the curious, these are the steps I followed.<\/p>\n\n\n\n<p>First, we need to download the <a rel=\"noreferrer noopener\" href=\"https:\/\/forum.xda-developers.com\/xperia-xz2\/development\/recovery-twrp-3-3-1-0-t4074305\" data-type=\"URL\" data-id=\"https:\/\/forum.xda-developers.com\/xperia-xz2\/development\/recovery-twrp-3-3-1-0-t4074305\" target=\"_blank\">Unofficial TWRP recovery<\/a> and extract it in a folder. After this I rebooted the device in <em>fastboot mode<\/em> <strong>via software<\/strong>. This is important. <strong>Don&#8217;t do it using the hard keys.<\/strong><\/p>\n\n\n\n<p>Once in <em>fastboot mode<\/em>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root$ fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img\n[...]\nroot$ fastboot boot twrp-apollo.img<\/pre>\n\n\n\n<p>This will boot temporarily into TWRP. Now, we need to do the actual flash of TWRP. First, we need to copy the image:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root$ adb push twrp-apollo.img \/tmp<\/pre>\n\n\n\n<p>And, from TWRP: <em>Advanced menu<\/em> -&gt; <em>Install recovery ramdisk<\/em> -&gt; <em>Choose \/tmp\/twrp-apollo.img<\/em>. After finishing installing TWRP, we can reboot into Recovery using the newly installed TWRP.<\/p>\n\n\n\n<p>From there, you can also wipe the system and data and install LineageOS, Open GApps and Magisk. Interestingly, TWRP provides the possibility of pushing these files and installing without using <code>adb sideload<\/code>. This is interesting because it will make also easier to install a customized Open GApps package using the gapps-config file.<\/p>\n\n\n\n<p>Notice that, more often than not, when booting into TWRP recovery the touchscreen wouldn&#8217;t work. This is a random behavior and rebooting again into Recovery may fix it in the next try.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing the Android System Webview from the Open GApps<\/h2>\n\n\n\n<p>As mentioned, I wanted to customize Open GApps to install the Android System Webview.<\/p>\n\n\n\n<p>I did.<\/p>\n\n\n\n<p>However, choosing this will only install a Google WebView Stub. What this means is that you won&#8217;t really have a WebView and, hence, when booting in the system, anything which makes use of a WebView will just crash (including registering into Google for using Google Play).<\/p>\n\n\n\n<p>In other words, you need to install the real package but you won&#8217;t have an easy way of doing that. You will have to manually download the real APK from some 3rd party site and install it, for example, with <code>adb install<\/code>.<\/p>\n\n\n\n<p>In the end I just reinstalled without it after reading that the WebView used by LineageOS is based in Chromium. So far so good.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Migration from my older phone<\/h2>\n\n\n\n<p>In order to move all my data from my Xiaomi Redmi 2 running LineageOS 14.1 I used the <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/machiav3lli\/oandbackupx\" data-type=\"URL\" data-id=\"https:\/\/github.com\/machiav3lli\/oandbackupx\" target=\"_blank\">OAndBackupX<\/a> application. It needs root rights but, fortunately, I had them in both systems and devices.<\/p>\n\n\n\n<p>Some comments:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Make sure of using the exact same version of OAndBackupX in both devices.<\/li><li>The app suggests to use encryption when creating the backups. I didn&#8217;t use it since it was doing things more complicated.<\/li><li>I only did back ups of the user applications. First I also did back ups of the special cases (user accounts, for example) and after restoring, that <a href=\"https:\/\/github.com\/nextcloud\/android\/issues\/3623#issuecomment-687645261\" data-type=\"URL\" data-id=\"https:\/\/github.com\/nextcloud\/android\/issues\/3623#issuecomment-687645261\" target=\"_blank\" rel=\"noreferrer noopener\">caused me a headache with NextCloud<\/a> and DavX\u2075. Of course, jumping from 14.1 to 17.1 could cause these kind of troubles.<\/li><\/ul>\n\n\n\n<p>I initially used a SD Card to move the back ups. I wouldn&#8217;t recommend it now. If you have limited memory just create the back ups in steps and move them in batches using adb. With both devices plugged with USB cables and in developer mode:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root$ adb devices\nList of devices attached\norigin device\ndestination device\n\nroot$ adb -s origin root\nrestarting adbd as root\nroot$ adb -s destination root\nrestarting adbd as root\nroot$ # Create some backups in the origin device\nroot$ adb -s origin pull \/storage\/emulated\/0\/OABX .\n[...]\nroot$ adb -s destination push OABX\/* \/storage\/emulated\/0\/OABX\/\n[...]\nroot$ # Restore the backups in the destination device\nroot$ adb -s origin shell\norigin:\/ $ rm -rf \/storage\/emulated\/0\/OABX\/*\norigin:\/ $ exit\nroot$ adb -s destination shell\ndestination:\/ $ rm -rf \/storage\/emulated\/0\/OABX\/*\ndestination:\/ $ exit\nroot$ # Create some more backups in the origin device and repeat the process<\/pre>\n\n\n\n<p>Of course, no need to delete the back ups if you don&#8217;t need to.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WARNING I have no responsibility whatsoever if this guideline causes any harm to your device. The intention of these posts are solely as personal notes for myself. Follow them at your own risk. WARNING Through these steps I will unlock &hellip; <a href=\"https:\/\/blog.andresgomez.org\/es\/2020\/09\/11\/installing-lineageos-in-the-sony-xperia-xz2-compact-dual-in-gnu-linux-5-5-appendixes\/\">Sigue leyendo <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6,7,20],"tags":[],"class_list":["post-983","post","type-post","status-publish","format-standard","hentry","category-english","category-free-software","category-general","category-mobile"],"_links":{"self":[{"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/posts\/983"}],"collection":[{"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/comments?post=983"}],"version-history":[{"count":7,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/posts\/983\/revisions"}],"predecessor-version":[{"id":1007,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/posts\/983\/revisions\/1007"}],"wp:attachment":[{"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/media?parent=983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/categories?post=983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/tags?post=983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}