UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    UBports "quick" and "simple" install on Xiaomi Mi A2

    Scheduled Pinned Locked Moved Xiaomi Mi A2
    26 Posts 13 Posters 6.7k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • S Offline
        scream314
        last edited by

        Sorry for starting a new thread, but I struggled a lot finding the right steps, so this might help someone (or at least the future me).

        Preparations

        I was using MacOS something (should not matter).
        I already had some old-ish version of platform-tools (adb, fastboot & co), the version should not matter, as long as it is from this decade. (See the note later about mke2fs on MacOS.)

        Stuff downloaded:

        • vendor.img (https://github.com/ubports-xiaomi-sdm660/artifacts/releases/download/v0.1/vendor.img; a newer one gave me checksum error)
        • TWRP (https://eu.dl.twrp.me/jasmine_sprout/twrp-3.5.2_9-0-jasmine_sprout.img.html; I tried different versions, but this one worked fine; also tried the stock recovery, but it was complaining about the new build being older)
        • Android 9 stock image (https://github.com/ubports-xiaomi-sdm660/artifacts/releases/download/v0.1/jasmine_sprout_stock_android9.zip; as I was starting from 10)
        • installer (https://devices.ubuntu-touch.io/installer/dmg)

        Steps

        Unlocked bootloader by becoming "a developer", enabled USB debug and OEM unlock, then booted in Fastboot, then

        ./fastboot flashing unlock
        ./fastboot flashing unlock_critical
        

        If if gets locked again (it dod for me somehow), just check status with ./fastboot oem device-info and unlock what is locked...

        Booted in TWRP from Fastboot

        ./fastboot boot ~/Downloads/twrp-3.5.2_9-0-jasmine_sprout.img
        

        TWRP asks about mounting stuff read-only, I just went with "no".
        Not sure about wiping any cache/data, as my phone was empty, I just wiped everything if I got stuck, might not be necessary.
        The phone has 2 "slots" (A & B). I had to install Android 9 on both. (You can check the active slot with ./fastboot getvar current-slot, and select a slot with ./fastboot --set-active=<a|b>, but as TWRP installs the new image on the passive slot and makes it active after, I just repeated the steps again to install Android 9 on the other slot.)
        Then in the TWRP menu I went with "Advanced">"ADB Sideload", then

        ./adb sideload ./jasmine_sprout_stock_android9.zip
        

        Wait.
        Reboot into Fastboot, then TWRP.
        Repeat.
        Thanks to Apple's "security" at this point I had to do a ./fastboot -w to run mke2fs and get it blocked by MacOS, then allow it from "System Preferences">"Security and Privacy", otherwise the UBports installer might fail.

        Finally on stock Android 9, I started the UBports installer, followed the steps exactly, and got UBports installed.

        Misc notes

        • Neither "Mi Unlock Tool", nor "rooting" was necessary.
        • For some reason after a point the device was detected as jasmine, I did not care, just selected "Xiaomi Mi A2" from the list.
        • I tried to use vendor.img from the latest stable artifacts (https://github.com/ubports-xiaomi-sdm660/artifacts/releases/tag/20211023), it gave me a checksum error, but as I was retrying a few times after using the vendor.img the installer says, idk if it would work or not.
        • If the phone bootloops/etc. don't panic, just go back to Fastboot and repeat.
        • At one point my PC did not detect the phone in Fastboot, but doing a random combination of "phone restart", "USB unplug/plug" and factory reset using the stock recovery fixed it, idk...
        • Getting into the menu of the stock recovery is tricky, I do not have any good advice. My technique is to press power+vol up/down furiously until the menu appears 😄

        Devices:
        UBports@Xiaomi Mi A2
        Android@Nexus 5X

        D E M 4 Replies Last reply Reply Quote 4
        • S Offline
          scream314
          last edited by scream314

          Experience (after a half day)

          • Much better than the Plasma Phone version I tried some time ago.
          • Speed is ok.
          • Fingerprint reader is working, surprisingly accurate and fast.
          • Camera is not working for me, I was able to open the app once, but after trying to take a photo it froze and I cannot even open it anymore (not even after reboot). (Edit: it seems to be an AppArmor permission issue: ****** ****** kernel: [ ******] audit: type=1400 audit(******): apparmor="DENIED" operation="open" profile="com.ubuntu.camera_camera_3.2.3" name="/proc/******/mountinfo" pid=****** comm="camera-app" requested_mask="r" denied_mask="r" fsuid=****** ouid=******)
          • Setting up a Libertine container takes forever (idk how long, it is still installing). (Edit: eventually it was done, but all the few apps I tried to launch in it are not working.)
          • Anbox: no luck yet (***** anbox: Failed to mount "/home/phablet/anbox-data/rootfs": No such device)

          Devices:
          UBports@Xiaomi Mi A2
          Android@Nexus 5X

          LakotaubpL messayistoM S 3 Replies Last reply Reply Quote 0
          • LakotaubpL Offline
            Lakotaubp @scream314
            last edited by

            @scream314 Libertine last time I tried took about 10 -15 mins. Make sure your screen is set to not sleep during the install. System Settings, Battery, Sleep when idle-Never or something like that.

            1 Reply Last reply Reply Quote 1
            • messayistoM Offline
              messayisto @scream314
              last edited by

              @scream314 Hi there an congartulations to the install! 🙂
              It is interesting that the fingerprint reader works for you - is that offered as an option in the settings to lock/unlock the phone?
              On my Mi A2 this option is grayed out, and I'm on dev channel...

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                scream314 @messayisto
                last edited by scream314

                @messayisto
                What I did to get it working:

                • System Settings>Security & Privacy>Fingerprint ID
                • recorded my fingerprint(s, actually 2, both working)
                • System Settings>Security & Privacy>Lock security>choose "Fingerprint"

                I'm using the "stable" channel, OTA-19, UBports 20210910-30030, Device image 20210910-14383, Device build lineage_halium_arm64-userdebug 9 PQ3A.190801.002 278 test-keys.

                Devices:
                UBports@Xiaomi Mi A2
                Android@Nexus 5X

                messayistoM 1 Reply Last reply Reply Quote 0
                • messayistoM Offline
                  messayisto @scream314
                  last edited by

                  @scream314 Thank you, I gonna give this a try the next days...

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    scream314 @scream314
                    last edited by

                    @scream314 said in UBports "quick" and "simple" install on Xiaomi Mi A2:

                    • Camera is not working for me, I was able to open the app once, but after trying to take a photo it froze and I cannot even open it anymore (not even after reboot). (Edit: it seems to be an AppArmor permission issue: ****** ****** kernel: [ ******] audit: type=1400 audit(******): apparmor="DENIED" operation="open" profile="com.ubuntu.camera_camera_3.2.3" name="/proc/******/mountinfo" pid=****** comm="camera-app" requested_mask="r" denied_mask="r" fsuid=****** ouid=******)

                    I listened to my instincts, after uninstalling, then reinstalling the app I can take pictures with both cameras.
                    Video is still not working, if I start the recording the timer starts to count, but the screen is frozen. After hitting stop, the timer stops, but nothing happens, the whole app freezes, and the video si not saved.

                    Devices:
                    UBports@Xiaomi Mi A2
                    Android@Nexus 5X

                    M 1 Reply Last reply Reply Quote 0
                    • D Offline
                      danilo748 @scream314
                      last edited by

                      @scream314 the BLUETOOTH work fine for you?
                      I have problem with it

                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        scream314 @danilo748
                        last edited by scream314

                        @danilo748
                        Did not test it excessively, but works fine with my Xiaomi Mi Basic 2 BT earbuds and the range is surprisingly good, it was playing music without any glitch 2 rooms away (~10 meters and 2 walls) from the phone.
                        I have an Android head unit in my car, the phone was able to connect to it, but did not try anything else yet.

                        Devices:
                        UBports@Xiaomi Mi A2
                        Android@Nexus 5X

                        D 1 Reply Last reply Reply Quote 0
                        • D Offline
                          danilo748 @scream314
                          last edited by

                          @scream314 Thanks

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            danilo748 @scream314
                            last edited by

                            Hi @scream314 ,
                            the links to download vendor.img and Android 9 stock image do not work, "404 page not found".
                            Are they no longer active?

                            Thanks

                            S 1 Reply Last reply Reply Quote 0
                            • R rosenfeldpj referenced this topic on
                            • S Offline
                              scream314 @danilo748
                              last edited by scream314

                              @danilo748
                              Try opening it from here: https://github.com/ubports-xiaomi-sdm660/artifacts/releases/tag/v0.1
                              (Note: download was extremely slow for me.)

                              Devices:
                              UBports@Xiaomi Mi A2
                              Android@Nexus 5X

                              1 Reply Last reply Reply Quote 0
                              • R Rafa referenced this topic on
                              • R Rafa referenced this topic on
                              • M Offline
                                mkarpicki
                                last edited by

                                This guide worked well for me.
                                Unfortunately I could not install Ubuntu at the end ( installer was getting <waiting for device> error due to fastboot crashing after downgrade to Andreoid 9). On some other articles people were suggesting it could be USB Port issue, that may be true actually. As I had no other idea I installed "installer" on other laptop (switched from Ubuntu to Mac) and there it worked..

                                1 Reply Last reply Reply Quote 1
                                • M mkarpicki referenced this topic on
                                • M mkarpicki referenced this topic on
                                • E Offline
                                  embeddedmz
                                  last edited by embeddedmz

                                  After booting TWRP :
                                  ./fastboot boot ~/Downloads/twrp-3.5.2_9-0-jasmine_sprout.img

                                  I have a black screen. I tried also with the 3.6.0 version and I still have the same issue 😞

                                  Tested all the 9 available images and I always have a black screen 😢

                                  E 1 Reply Last reply Reply Quote 0
                                  • E Offline
                                    embeddedmz @embeddedmz
                                    last edited by

                                    I reinstalled Android 10 from a Xiaomi image and now I can boot TWRP.

                                    1 Reply Last reply Reply Quote 2
                                    • E Offline
                                      embeddedmz @scream314
                                      last edited by

                                      @scream314 Thank you very much ! No more google's tracking device on my smartphone !

                                      I will donate money to Ubports !

                                      1 Reply Last reply Reply Quote 2
                                      • Josele13J Offline
                                        Josele13
                                        last edited by

                                        UBports is the foundation, Ubuntu touch is the operating system.
                                        Regards...

                                        Xiaomi Redmi Note 9 pro
                                        Oneplus Nord 100
                                        Xiaomi Redmi Note 7
                                        Nexus 5
                                        Bq E4.5 Ubuntu edition .... is dead

                                        1 Reply Last reply Reply Quote 0
                                        • M Offline
                                          mschmids @scream314
                                          last edited by

                                          @scream314 In reply to the starting post, I confirm the initial steps, i.e. becoming "a developer", enabled USB debug and OEM unlock from the Android interface and the two fastboot commands from the PC cmd prompt, being straight forward. Contrary to other resources no further complications or tools were required.

                                          For the downgrade and occasional reversal of the same, I downloaded TWRP 3.6.0 img from the same location and each latest Android 9 and 10 zip and tgz file from https://xiaomifirmwareupdater.com/archive/miui/jasmine/.

                                          However, no matter whether I changed the active slot with fastboot or TWRP, rebooted to the active slot prior to installation, verified again the active slot with fastboot or TWRP and contrary to the TWRP output, indicating the installation to the inactive slot, I had the impression from multiple reboots to either slot, that the installation always ended up in slot B.

                                          Therefore I unzipped and untared the tgz file and simply installed with flash_all.bat. Since booting slot B then went into a bootloop before defaulting back to and booting slot A, I changed flash_all.bat to also install system.img instead of system_other.img to slot B and the downgrade was finally successful.

                                          For the UT installation on W7 pro 64bit I downloaded the ADB driver from https://flashxiaomi.com/xiaomi-mi-a2-usb-driver/ respectively https://dl-ssl.google.com/android/repository/latest_usb_driver_windows.zip and appended in android_winusb.inf file to Google.NTamd64 section the following lines (the end justifies the means?):

                                          ;Xiaomi Mi A2
                                          %SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_0000
                                          %CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_0000&MI_01

                                          1 Reply Last reply Reply Quote 0
                                          • M Offline
                                            mschmids @scream314
                                            last edited by

                                            @scream314 In reply to the video recording freezing, I initially observed the exactly same issue. After flipping to and recording with the front camera, I can now also record with the back camera. The nice thing, unlike with my previous Nexus 5, where I had to use the video player app, the play back can be launched from the gallery with the standard media player.

                                            S 1 Reply Last reply Reply Quote 0
                                            • R Offline
                                              Ravi
                                              last edited by

                                              First of all thanks for this beautiful post. I followed all the instructions mentioned here and managed to install Ubuntu Touch OS (stable) almost effortlessly on my Xiaomi Mi A2. Here are a few things I need to put here for any to whom this would be helpful.

                                              Error while flashing TWRP recovery:

                                              ./fastboot boot twrp-3.5.2_9-0-jasmine_sprout.img
                                              

                                              FAILED (command write failed (No error)) finished. total time: 0.029s

                                              After this, you will be asked(in the top left corner or somewhere in small letters) on your phone to press any button to shut down, which will simply reboot your phone.

                                              I faced this error while I was trying to flash the TWRP recovery on my Laptop. I have a laptop that has an AMD Ryzen processor which for some reason is known to have similar issues. Although I must add that it is not uncommon to have the same error on Intel-based laptops.

                                              SOLUTION

                                              1. Try different USB ports and preferably USB 2.0
                                              2. If you are on windows try updating your drivers. I use Linux but updating the driver has known to solve the issue.
                                              3. Use a different PC or laptop. This is the one which is you should try without wasting any more time on finding the fix for that. You will be wasting your time and will get frustrated over the issue over which have no control. I faced the same issue and lots of ways to make it work eventually I tried on a different Linux PC and it was a breeze thereafter.

                                              I tried on a windows PC as well but it was not recognizing my device in fast boot. I tried installing a few drivers but eventually, it was way too much hassle for simple stuff

                                              BONUS TIP:
                                              This is a tip that might work or might not like it worked partially for me. If a similar error like the above occurs while looking for fast boot devices or even during TWRP recovery, try the following.

                                              1. Put your phone in fastboot but do not connect via USB right now.
                                              2. On your PC/Laptop write the command which you would have done while the phone was connected. The command will say, Waiting for any device
                                              3. Now plug your phone via USB and "hopefully" it will work. If this doesn't work, go for the tested method above.

                                              Finally thanks again for this post and I didn't need to follow any other sources to flash the Ubuntu Touch.

                                              1 Reply Last reply Reply Quote 0
                                              • First post
                                                Last post