Zahkc 45 Posted April 21, 2021 Share Posted April 21, 2021 Alright, after toying with it for a few days I have cracked dual booting and decided to write up the steps myself. YOU WILL LOSE YOUR DATA DOING THIS. Credit to @order#10248 for proving the concept. First thing you will want to do is re-flash stock android on your phone. There isn't an official repo for this yet but @Waxberry has kindly provided one on this post. Download and extract the files from there and run the script fastboot_all.bat or you can download my modified linux version flash_all.sh. While that is flashing, download the latest version of Lineage here. You will need the recovery and the nightly. Once downloaded and the flash_all script is finished, navigate to the folder with the lineage os stuff in it and run the following commands: fastboot set_active a fastboot flash boot_a ./lineage-18.1-xxxxxxxxx-recovery-pro1.img fastboot erase userdata It is important the recovery is installed on the a slot as it will install it to the b slot. Once that is done boot into recovery, select "Apply Update -> Apply from ADB" then run this command: adb sideload lineage-18.1-xxxxxxxx-nightly-pro1-signed.zip Once that finishes go back to the main menu and select "Reboot system now". Once booted don't bother setting it up cause we are gonna reset it later. reboot back into the boot loader and run these commands: fastboot erase userdata fastboot set_active a Now you can run the UBports installer. Make sure that "Wipe personal data" and "Flash system partitions using fastboot" are both checked. Once again when the device installs you will get to the set up screen, don't configure anything yet cause were wiping it again. Boot back into your boot loader and run the following commands: fastboot erase userdata fastboot set_active b Then start the system. Hopefully you will get into Lineage and now you can set stuff up. You will need to root it thou to use Swap my Slot. You can download the magisk apk and my patched version of the boot image for lineage-18.1-20210419-magisk-22.1 and skip the below steps. To do so you are going to want to download the script Payload Dumper. Set it up as instructed on the git and do the following: Extract the file payload.bin from lineage-18.1-xxxxxxxx-nightly-pro1-signed.zip to the same path as payload dumper. Rrun python3 payload_dumper.py ./payload.bin Navigate to the folder output and copy boot.img to your phones storage, sd or usb (in android mode) Now you have the boot img on your phone you are going to want to download and install the magisk_manager apk. Open the Magisk app and click install. It will ask you to provide the boot.img to patch. Now move the patched magisk_patched-xxxx_xxxxx.img file from your phones Downloads folder to your computer again. Now you have a rooted version of the Lineage boot image on your pc. To flash it run the following command: fastboot set_active b fastboot flash boot_b ./magisk_patched-xxxxx_xxxxx.img Now start your phone again. Open Magisk to confirm it is rooted. Now we can install the Switch my State app. Firstly you will need to download the bootctl-binary module and install it through magisk. (The jigsaw piece on the bottom of the app). After it reboots you can now install the Switch My Slot.apk on android. After installing, simply open it and press the green button to switch to ubuntu. Once back in ubuntu you can install the Switch My Slot.click or simply download it off the OpenStore. Now you can easily switch between the Hope this help. I don't check this forum too much but I will try answer questions you may have. Important note: Lineage dose not reset the Bluetooth chip to the right RF state and UBTouch isn't able to resolve it for whatever reason. You will need to ensure Bluetooth is off in lineage before switching to UBTouch. 5 16 Quote Link to post Share on other sites
7rozen_7ear_ 3 Posted April 22, 2021 Share Posted April 22, 2021 Will you have to reflash Ubuntu Touch or Lineage after an update? It was mentioned on an UBTalk that the slot switching method of dual booting is rather hacky and could give rise to issues upon updating. I'd say this is only for those that are brave of heart or like to thinker, not necessarily for usages as a daily driver. Has anyone had issues with a similar setup? I find this solution to dual booting cool, but would also like to figure out the limits of this setup. 🙂 Quote Link to post Share on other sites
_DW_ 628 Posted April 22, 2021 Share Posted April 22, 2021 1 hour ago, 7rozen_7ear_ said: Will you have to reflash Ubuntu Touch or Lineage after an update? It was mentioned on an UBTalk that the slot switching method of dual booting is rather hacky and could give rise to issues upon updating. I'd say this is only for those that are brave of heart or like to thinker, not necessarily for usages as a daily driver. Has anyone had issues with a similar setup? I find this solution to dual booting cool, but would also like to figure out the limits of this setup. 🙂 This is an assumption but I presume you need to side load the updates each time to the correct slot instead of using auto updates. (Also assume auto update needs to be turned off) 1 Quote Link to post Share on other sites
order#10248 65 Posted April 22, 2021 Share Posted April 22, 2021 (edited) Congratulations Zahkc for getting it done and a very big Thank You for writing this up! Excellent work, I was about to share the notes I have made while dressing up my Pro1 to get famous, but that were already some meters to scroll (thats how it felt 😉 ) ... and you nailed it down. My way to get to dual booting was slightly different in details. But all in all the same. Still I want to paste some additional notes here. ****************************************************************************************************************** Basic things I learned, that might enlight the guide from above a bit: - Always use a proper USB cable to connect your phone. There are lost of cheap ones around that are only capable of charging. Check before you start if you can transfer data (i.e. a picture) from the phone. - All fastboot commands have to be fired on a pc and with the phone connected via USB and beeing in "Bootloader Mode" - The adb sideload commands on pc need to have the phone connected via USB and in "Recovery Mode" - AND sideloading needs to be supported by the phone's installed recovery image. Pro1 Bootloader Mode: see "pro1_bootloader.jpg" attached While the phone beeing switched off - press and hold "volume DOWN" and "power" simultaneously until you see a green START in the phones display. --> I recommend to unplug USB cable (when switching off) because phone "wakes up" while charging after a while (this ) --> I recommend concentrate on the finger on the power and only release that in the moment the START appears. That might save you from unwanted system starts ... The other finger might than trigger other menu items, but you still beeing in "Bootloader Mode" . Then play with the volume buttons to cycle the available menu items. The one currently to be seen can executed with power switch. But thats not needed here. Unfortunately there is no menu item offering to switch the slot, so you need to do that with other tools: During setup (and whenever you want) from your pc (with fastboot commands) and finally with apps from within the OSes. The Bootloader Mode is provided by the phones "hardware". So it is always accessable, even when you did something wrong while flashing or sideloading. So don't be afraid, you can always start from here. Pro1 Recovery Mode: see "pro1_ubuntu_touch_recovery.jpg" and "pro1_lineageos_recovery.jpg" attached While the phone beeing switched off - press and hold "volume UP" and "power" simultanously until you see something in the phones display. Within 30 secs (longest wait) the recovery mode should be reached, otherwise the recovery image is broken --> goto Bootloader Mode and flash a working one. To get into recovery mode there needs to be a proper recovery image flashed. So this can possibly fail if something went worng before, but then you still have the bootloader mode for flashing the right recovery image. There are different recovery images available, I have seen one for Ubuntu touch, stock android, LineageOS and TWRP. As a thumb rule: The image files are between 24MB and 67Mb in size and even though they are sometimes named "boot...img", they usually bring data for the boot partition AND recovery mode ... For setting up dual boot Ubuntu Touch and LineageOS we only need recovery mode for the adb sideload for LineageOS...zip. All the rest is done in bootloader mode or while booted in one of the OSes. Befor sideloading files check with command "adb devices" if there is something like List of devices attached b7****08 sideload <--- With these recovery images the slot-story comes into play. For me it was sufficient to know that either slot keeps some of the partitions important for the boot process. So each slot can have its own recovery mode. Other partitions (and there are more than 50) are not separated by the slots. For example, there aren't two different partitions keeping the boot splash image ... (so that we can not have different early boot logos [a.k.a. "splash.img"] for the two OSes 😞 ) . Usually, when installing a single OS on the phone, both slots (more correct: the separate partitions for each slot) are getting written equally. It doesn't matter which slot is active and used for booting up. I and possibly most of us never even noticed, that during an system update/upgrade the slots (precise: the other slot) become filled with different data and the curently active slot changes. From then on you boot with the other slot, until the next upgrade ... Here we manually decide to write the slots differently so that each OS can boot up with the data from its slot partition(s) to a stage where it is able to find and load everything needed from the other partitions. In the consequence we have to say good bye to convinient ways of do system upgrades. I am preety sure that more experienced users will find out how to do that anyway ... Helpfull command: How to check for current active slot (with fastboot and phone in Bootloader Mode) fastboot getvar all 2>&1 | grep slot #(--> current-slot:X) Ubuntu Touch has a lot of mountpoints to subdirs below /userdata (the userdata-image/-partition for android), see /etc/fstab . As the subdirs are different from Android default dirs, they can coexist. All this above might be more or less incorrect description, but it's not needed to know better for setting up dual boot. ****************************************************************************************************************** Okay, MY installation process differs from the Zahkc's way in the point, that I "started" with Ubuntu Touch installed as a/the single OS. I wonder if the procedure to flash stock android with ext4_QX1000_user_20200825231445_dd49dd0dd1.7z is really needed. Maybe stock android has to bring a basic partition structure to the phone. If I had to start again, I would try without. The stock android file is hard to handle, it is 1GB big itself, it extracts 3GB of files additionally and forces you to have 7zip capable software ... Helpful command if you only want to extract single files from that 7z (example splash.img): 7z e '/path/to/ext4_QX1000_user_20200825231445_dd49dd0dd1.7z' -o/which/dir/the/file/should/be/extracted/to/ splash.img -r Actually I had Ubuntu Touch installed as single OS AFTER my tries with stock android ... and then startet with sideloading LineageOS ... In case you are looking for the boot/recovery-image for Ubuntu Touch, get it from here: https://cdimage.ubports.com/devices/pro1/boot.img The link ist taken from the UBports installer config file for pro1: https://github.com/ubports/installer-configs/raw/master/v2/devices/pro1.yml (look for the lines with "url:") The recovery mode of Ubuntu Touch does not have the functionality to receive/install sideloads. So I flashed the LineageOS-recovery into slot A , set A active , then booted into slot A recovery (LineageOS recovery) , sideload the LOS...nightly...zip, just the same commands as Zahkc did.Remember: The command "fastboot erase userdata" allways includes the removal of all individual/personal data you had on the phone. Maybe even for both OSes! As I already had Ubuntu Touch installed before, I did not need to install it again. But, the original Ubuntu Touch boot/recovery partitions (in slot A) where overwritten/flashed with the LOS-recovery by me before, so this had to be corrected: Just fastboot flash boot_a /path/to/downloaded/ubuntu-touch/boot.img. Before booting into LineageOS the very first time I decided to integrate GoogleApps via this instructionhttps://wiki.lineageos.org/devices/pro1/install#installing-lineageos-from-recovery (I took MindTheGapps arm64) I never used Magisk before, but it is needed for root access (for app "switch my slot") in LineageOS. I installed MagisK after I had used my new LineageOS already for some time. So installation can, but has not to be done during LineageOS setup ... I downloaded version 21.4 zip (last version available as zip) see https://github.com/topjohnwu/Magisk/releases Direct link https://github.com/topjohnwu/Magisk/releases/download/v21.4/Magisk-v21.4.zip Magisk installation - boot again into LinageOS recovery (yes, this is slot b 😉 ) - --> Advanced --> Enable ADB and --> Apply Update --> Apply from ADB - then sideload Magisk zip file adb sideload /path/to/Magisk-v21.4.zip After booting into full LineageOS there will Magisk appear between the installed apps. The app "Switch My Slot" now can get root access but still needs the bootctl module for Magisk. See https://github.com/roihershberg/bootctl-binary/releases Direct link v2.0: https://github.com/roihershberg/bootctl-binary/releases/download/v2.0/bootctl-binary-v2.0.zip Download or copy it to the phone (into LineageOS). Im Magisk tap on the "jigsaw"-icon in the lower area and then "install from storage", then install bootctl...zip. Reboot. Done! Cheers, order#10148 Edited April 23, 2021 by order#10248 2 6 Quote Link to post Share on other sites
Zahkc 45 Posted April 23, 2021 Author Share Posted April 23, 2021 (edited) 18 hours ago, order#10248 said: - then sideload Magisk zip file Well thats a much easier way to do it 🙂 Thanks for the write up mate. Edited April 23, 2021 by Zahkc 2 Quote Link to post Share on other sites
Zahkc 45 Posted April 23, 2021 Author Share Posted April 23, 2021 21 hours ago, 7rozen_7ear_ said: Will you have to reflash Ubuntu Touch or Lineage after an update? It was mentioned on an UBTalk that the slot switching method of dual booting is rather hacky and could give rise to issues upon updating. I'd say this is only for those that are brave of heart or like to thinker, not necessarily for usages as a daily driver. Has anyone had issues with a similar setup? I find this solution to dual booting cool, but would also like to figure out the limits of this setup. 🙂 I havent tested it yet but i think updating may be possiable but not exactly easy. In theory, if you keep the lineage recovery in slot a you should be able to sideload "OTA" updates to it without loosing data but this is of course much more tedious. Additionally i would think that UBTouch would do live updates and wouldnt require a second slot. Not to sure but the update scheduale for the pro 1 isnt particulary often so ill let you know more once ive tested it. Additionally, I have been using ubtouch as my daily driver and find with a little tweaking it is pretty stable. Once you patch the LTE dns issue the only real problem is the bluetooth. Im gonna dive through the source and see if theres a "shitty quick fix" i can discover and make a script to patch as many issues as I can. 2 Quote Link to post Share on other sites
Zahkc 45 Posted April 23, 2021 Author Share Posted April 23, 2021 Lineage dose not reset the Bluetooth chip to the right RF state and UBTouch isn't able to resolve it for whatever reason. You will need to ensure Bluetooth is off in lineage before switching to UBTouch. 1 1 Quote Link to post Share on other sites
order#10248 65 Posted April 23, 2021 Share Posted April 23, 2021 (edited) 2 hours ago, Zahkc said: In theory, if you keep the lineage recovery in slot a you should be able to sideload "OTA" updates to it without loosing data but this is of course much more tedious. With my understanding the "recovery image" for Pro1 comes together with "boot image". The "boot" is only missing in the naming of the recovery-file offered for LineageOS. The fastboot command flashes the "recovery" into "boot(_a)". That means, as long the LineageOS-recovery.img is flashed into slot A, the boot-img-part is not the right one for Ubuntu Touch (that also resides in slot A) and Ubutnu Touch wont boot up fully. It needs to have its boot.img (re)flashed into slot A. So instead of "keeping" I suggest temporarely flashing the LineageOS-recovery-image to slot A, boot into that slot A recovery, sideload the OTA.zip (remember: sideloading writes into tho other slot --> so slot B), and afterwards reflash the Ubuntu Touch boot.img into slot A again. Cheers, order#10148 Edited April 23, 2021 by order#10248 2 2 Quote Link to post Share on other sites
order#10248 65 Posted April 23, 2021 Share Posted April 23, 2021 1 hour ago, Zahkc said: Lineage dose not reset the Bluetooth chip to the right RF state and UBTouch isn't able to resolve it for whatever reason. You will need to ensure Bluetooth is off in lineage before switching to UBTouch. Thanks for the hint! But that rises again the question for a wiki or something alike to keep this kind of info easy accessable. Cheers, order#10148 2 Quote Link to post Share on other sites
Zahkc 45 Posted April 24, 2021 Author Share Posted April 24, 2021 (edited) I think that's a great idea @order#10248, I just made this post and I have already "patched" two major bugs with ubuntu touch. Edited April 24, 2021 by Zahkc Formatting Quote Link to post Share on other sites
benoitjeffrey 66 Posted April 25, 2021 Share Posted April 25, 2021 He, I'm gonna try it soon enough but I have a few questions about this, 1: does the user data partition will be shared between both OS or will we have to reboot to get access to some files (ex. Access pics taken from LOS while in Ubuntu) 2: is there any possible backup in this setup or it's still a no go? Quote Link to post Share on other sites
Zahkc 45 Posted April 27, 2021 Author Share Posted April 27, 2021 Hey @benoitjeffrey, 1 : The data partition is accessiable through both os's but not by default. You will need to change the ownership permissions in UBTouch and use a root browser on android. 2 : As for backup i know twrp offers a great solution but I havent tested. If you do give it a go, let me know how it goes and if you need any assistacnce. ~Zahkc 1 Quote Link to post Share on other sites
brunoais 334 Posted April 27, 2021 Share Posted April 27, 2021 (edited) Why a root browser? Why not just make a symlink or a bind mount? Ultimately, the only requirement would be that the uids and gids match in both installs. Edited April 27, 2021 by brunoais 1 Quote Link to post Share on other sites
claude0001 1,329 Posted April 27, 2021 Share Posted April 27, 2021 1 hour ago, brunoais said: Ultimately, the only requirement would be that the uids and gids match in both installs. Android uses a very complex scheme of virtual mount points that, in combination with SELinux, restrict access to partitions beyond what one would expect from rights management on the filesystem level. I honestly do not understand them but I have run into those security systems multiple times in the context of running my GNU/Linux chroot aside of LineageOS. I can well imagine that also in the case under discussion here, rooting is the only way for Android Apps to access file systems touched by both OS's. 1 1 Quote Link to post Share on other sites
brunoais 334 Posted April 28, 2021 Share Posted April 28, 2021 (edited) I think you need to root at the android level. However, why root at the browser app? In other words, why the need to run the browser app with root permissions? Edited April 28, 2021 by brunoais Quote Link to post Share on other sites
claude0001 1,329 Posted April 28, 2021 Share Posted April 28, 2021 (edited) 21 hours ago, brunoais said: I think you need to root at the android level. However, why root at the browser app? In other words, why the need to run the browser app with root permissions? I honestly cannot give a qualified answer, but I will try. Hopefully someone with more knowledge of Android will correct me and I will learn in the process: On Android, every app runs under a separate UID. This is to ensure any specific app cannot access files written by any other app unless that other app explicitly grants system-wide access. In a world where you expect every program on your device to spy on your data, this is supposed to enhance security. Effectively, this alone makes something like a file browser impossible: on Android, these have access only to files that belong to the GID 1023 "media_rw". For all other files, the browser needs root privilege. On top of that, SELinux enforces further access restrictions which I did not try to understand. My experience from sharing a partition between LineageOS and a GNU/Linux chroot is that root access is necessary on the Android side to write to that file system. Edited April 29, 2021 by claude0001 3 Quote Link to post Share on other sites
brunoais 334 Posted April 29, 2021 Share Posted April 29, 2021 Yes. You need root permissions on the OS side to set the permission values and, for example, set the same UID and GID to the same app for the equivalent app of the other OS (So both have the same UID and GID). Wait... File browser? I thought we were talking about web browser (the usual meaning for "browser"). If it's the file browser, then consider what I mentioned moot. A proper file browser does need root privileges on android. Quote Link to post Share on other sites
claude0001 1,329 Posted April 30, 2021 Share Posted April 30, 2021 16 hours ago, brunoais said: Wait... File browser? As the discussion was about shared data storage I can only imagine that a file browser was meant. Running a web browser as root would make no sense to me either. 1 Quote Link to post Share on other sites
benoitjeffrey 66 Posted July 26, 2021 Share Posted July 26, 2021 (edited) Hi, i tried the dualboot flash without flashing back to stock but I ereased the userdata partition as often as asked and i ended with a non working UBTouch and a broken LOS. The second time I did as the guide from stock rom and it worked well. I flashed magisk.zip and gapps at the end of the process instead of getting in the payload.bin project and done! Now I'm in process of making a shared folder between both OS cause as you said earlier there ain't none for now Edited July 26, 2021 by benoitjeffrey Quote Link to post Share on other sites
order#10248 65 Posted June 13, 2022 Share Posted June 13, 2022 Hello again, I can confirm that dual boot with Ubuntu Touch and current LineageOS 19.1 is working. Some small things have changed over the year: Magisk (needed to get root access in LineageOS) can not be used as version 21.4 (last version available as zip) in Android12 (it does not turn up as installed app), so sideloading that doesn't make sense. Instead the way with patching boot.img is needed. But it turns out to be quite easy: The file "boot.img" has not to be extracted from full nightly build img, the file is exactly the same as the recovery-pro1.img . Just download lineage-19.1-202xxxxx-recovery-pro1.img to LineageOS, install Magisk v25.0 apk (or higher, at least v24.0 to support Android 12) from here (Magisk releases). Then open Magisk, click on Install and present the downloaded recovry-pro1.img . Copy the resulting magisk_patched-xxxxx_xxxxx.img to your PC and fastboot flash that file to the slot where your LineageOS resides. On next reboot LineageOS/Magisk has root access. Next thing to note is the bootctl module for Magisk (needed to run the app "Switch My Slot" in LineageOS), current v2.1 https://github.com/roihershberg/bootctl-binary/releases . Magisk refuses to install it as a module due to API version conflict (current 32 , maximum allowed 31) ... To circumvent this , just edit the file customize.sh within bootctl-binary-v2.1.zip and set MAXAPI to a higher value (I used MAXAPI=50) , repack the zip and install it in Magisk as new module. Cheers, order#10148 3 Quote Link to post Share on other sites
Wunder Wungiel 9 Posted May 25, 2023 Share Posted May 25, 2023 This method works just nice. I'm happy with this setup and your Ubuntu fixes. Thanks again Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.