Installing Xposed in Android on Chrome OS

UPDATEAt present, for the latest Chrome OS versions (69, 70+), the following method seems to be the most reliable:

1. Ensure that your Android container is rooted, and that the rootfs is writable.

(If you've already used the rooting script, but you find the Android rootfs still isn't writeable, this may help).

2.  Download the Xposed framework installer app (to ~/Downloads).

3. Install the app via the Chrome OS shell (as root), e.g. :
sudo su -
setenforce 0
printf "pm install /storage/emulated/0/Download/XposedInstaller_3.1.5.apk" | android-sh 
printf reboot | android-sh
4. Assuming the installation was successful, open the Xposed installer app from the Chrome OS Launcher, click on 'Install/Update' then, in the next menu, click on 'Install'.

NB: If the prompt to grant root access doesn't show up at this point, see step 2. of the older instructions further down this page.

5. Once the framework installer app indicates it is 'Done', then reboot. 

The above steps should work on current Chrome OS versions. If you find it doesn't work for you, feel free to leave a comment on this post.

The original blog post is below...





Just a short post to note that it is now possible to successfully install and use Xposed in Android in Chrome OS. It works for me on CrOS version 67.0.3390.0 canary (arm), but it may be possible on some earlier builds, too.* 





I created a shell script that copies over Xposed's files some time ago, just as an experiment to see if it worked, but did not have success booting Android after modifying the rootfs with the script. I decided to take another look recently, and realised that it had a couple of bugs. Once those were fixed, I was able to successfully install Xposed with my script. 

 After success with a script based approach, I thought I'd try using the official installer app, and found that it actually isn't necessary to copy the files manually/with a script. Given a writeable Android rootfs, the installer app was able to install the framework successfully, as long as I allowed the app to gain root (which, on at least one CrOS version, necessitated temporarily setting 'Default Access' in SuperSU to grant root automatically, since the regular pop-up root request prompt didn't appear for this app). 

Here are the exact steps I took to install Xposed from its installer app.

1. After creating a rooted writeable Android rootfs with the rooting script, I downloaded the latest Xposed installer app from the Xposed announcement thread on xda.  

2. Next, I had to open the SuperSU app, go into its settings and temporarily set 'Default Access' to 'Grant'.

3.  After this, I simply clicked on 'Install/Update' in the Xposed installer, and then 'Install' again in the following menu. 

Following this, Xposed was installed, and all that was left to do now was reboot Android. To reboot Android without having to reboot Chrome OS, in a root CrOS shell, I entered 

printf reboot | android-sh

Just like on regular Android devices, the first boot after installing Xposed takes some time. To check on the progress (and to ensure that the Android container wasn't bootlooping, as had been the case when I'd previously attempted to install Xposed manually, without success, some time ago), I entered 

printf logcat  android-sh

into the CrOS root shell.  Happily, unlike my previous attempts in the past, this time I could see the boot proceeding as expected. 

After Android had loaded up, I went into the Xposed installer again, and added a few modules. Everything seems to be working as expected, as far as I can see, within certain limitations, mostly related to running in a container environment.

For example: adding shortcuts and actions to screen tap areas with 'Xposed Edge' works, but the shortcuts/actions only function when Android apps are actually on the screen. Also, the lack of 'parallel running of tasks' in the CrOS version I'm currently running could possibly be an issue.

In any case, now I actually have Xposed working, I can't seem to see much use for it at present. However, I guess it could possibly be useful for something in future.

*It seems not to be easily possible currently to install Xposed via the installer app on CrOS version 65 at present, due to a (temporary) issue mounting the Android rootfs as writeable at runtime. Installing files (manually, or via a script) into the container image while it is mounted elsewhere does still work. The writeable mount issue is also present on v66 but can be fixed by editing the container config.json (deleting the string "dev", from the "rootfs/root" section under "mounts". 

31 comments:

  1. After installing Xposed apk, I can't do step 3 "Install/Update". When I click on that, it just shows 'Download is waiting". Is there a way to do it manually or flash the zip file?

    ReplyDelete
    Replies
    1. Does the Xposed apk correctly list your device and CPU arch. info at the bottom?

      Which device and CrOS version do you have? If it's CrOS v65 or 66, it could be due to a container mount config issue preventing the Android filesystem root directory from being mounted writeable. You could double check for this issue by trying to write to /system in an Android terminal emulator, or by entering something like the following into a Chrome OS root shell and seeing if it says ro or rw

      printf "mount | grep 'loop1 '" | android-sh

      Either way, you should be able to add the files for Xposed manually as well. I have a script for that which I could probably share if you want, it worked fine for me although I have only tested on arm.

      Delete
    2. Yes, xposed list my device and info. I have Asus Flip C100 which is arm. The CrOS is v67 and when I enter the command it says rw:

      /dev/loop1 on / type ext4 (rw,seclabel,nodev,relatime)

      I'm not sure if I have a problem with the internet as it seems Xposed can't download the install file. But I can download the file manually with no issue. I appreciate if you can share with me your script or if you have any idea on how to fix it.

      Delete
    3. I think a found the problem. I use DNS66 ad blocker which was blocking Xposed from downloading the install file. I think it was also blocking your script from downloading BusyBox. Do I need to rerun your script "RootandSEpatch.sh" to install BusyBox or is there an easier way to install it. I've seen BusyBox apk in the appstore but not sure I can just go ahead and install it like that. Thanks for the guide and I appreciate your help.

      Delete
    4. No problem, yes on v67 you should be able to just go ahead and install BusyBox from a play store apk (e.g. Stericson's).

      I probably need to edit out some parts of my script or simplify it a little I think, before I post it up, but in any case it sounds like maybe you have it sorted now anyway..

      Delete
  2. https://photos.app.goo.gl/3Z9re4q36TMD21WW8
    https://photos.app.goo.gl/ee5RSyNKDMbq5Nny7
    CrOS 69, Samsung chromebook plus
    ROOTED, and have SU ->grant,
    Step 3->mount :Can't find system... as the picture shown
    ==============
    Any suggestion? Or what am I doing wrong?

    ReplyDelete
    Replies
    1. I wonder if you might be running into the read-only mount bug/issue that some people have been experiencing on some recent Chrome OS builds on some devices.

      Can you open a root Chrome OS shell and enter

      printf "mount | grep loop1" | android-sh

      to see if the Android rootfs is mounted as rw or ro?

      After running the rooting script, it's supposed to be rw. If it's ro, the xposed install won't be able to proceed.

      Delete
    2. crosh> shell
      chronos@localhost / $ sudo su
      localhost / # printf "mount | grep loop1" | android-sh
      /dev/loop1 on / type ext4 (ro,seclabel,nodev,relatime,block_validity,delalloc,barrier,user_xattr,acl)
      ====================================
      Thank you for your relay, but still no luck.
      Look like it's RO.

      Delete
    3. Try this to fix the RO issue:

      In a root CrOS shell, enter the following (all one line), then reboot.

      sed -i.old 's|mount rootfs rootfs / remount bind ro.*$|mount rootfs rootfs / remount bind ro|g' /opt/google/containers/android/rootfs/root/init.rc

      Delete
    4. localhost / # sed -i.old 's|mount rootfs rootfs / remount bind ro.*$|mount rootfs rootfs / remount bind ro|g' /opt/google/containers/android/rootfs/root/init.rc

      localhost / # printf "mount | grep loop1" | android-sh
      /dev/loop1 on / type ext4 (ro,seclabel,nodev,relatime,block_validity,delalloc,barrier,user_xattr,acl)

      ================================
      after the fix and reboot, look like it still be mounted as RO, and xposed can't be installed.
      Thank you for your reply.

      Delete
    5. Can you double check what that line in init.rc is saying now? By entering the following (all one line) and posting the output here...

      grep rootfs /opt/google/containers/android/rootfs/root/init.rc

      Delete
    6. crosh> shell
      chronos@localhost / $ sudo su
      localhost / # grep rootfs /opt/google/containers/android/rootfs/root/init.rc
      mount rootfs rootfs / remount bind ro
      mount rootfs rootfs / shared rec
      localhost / # crosh> shell
      ===============================
      Hi Nolirium,
      Thanks for your patient, you are so kind.

      Delete
    7. Sure, no problem. There's one more command to try, which is this (all one line):

      sed -i 's|mount rootfs rootfs / remount bind ro|mount rootfs rootfs / remount bind rw|g' /opt/google/containers/android/rootfs/root/init.rc

      Just to explain these last two commands - on my Flip, after an update to v69 canary, I could replicate the R/O issue, and on examining the differences between the older Android /system and the newly-updated one, I noticed that an extra argument, "nodev", had been added to the mount options for the rootfs in init.rc. When I removed "nodev", it would mount as R/W again.

      So the previous command I gave does the following: it makes a backup of init.rc, and then removes the rest of the line immediately following the string

      mount rootfs rootfs / remount bind ro

      i.e. that line is supposed to change from

      mount rootfs rootfs / remount bind ro nodev

      to

      mount rootfs rootfs / remount bind ro

      Although this works on my Flip, it looks like it's not working on your Chromebook Plus. I have found that, on my device, it is also possible to get the Android rootfs to mount RW again by actually changing, on the same line, the RO argument (which, I understand, previously would be overridden by Chrome OS) to RW.

      So let's try that. The command I gave in this post should change

      mount rootfs rootfs / remount bind ro

      to

      mount rootfs rootfs / remount bind rw

      I suggest trying this (and rebooting).

      Otherwise, I might need to have a look at the system.raw.img for the Chromebook Plus on Chrome OS v69, in order to try and see what, if any difference there is between that and the Flip's system.raw.img. I have booted the Chromebook Plus's Android system, extracted from a recent recovery image, on my Flip, and it mounts R/W, and I can install Xposed etc, with no problem, but the recovery image is at Chrome OS version 67, so it's quite out of date now, and not really useful in trying to solve this issue.

      I also have a working install script for Xposed, so, if it comes to it, I could probably share that, but it's quite inelegant and requires (temporarily) a lot of disk space as it makes another copy of /system temporarily in order to avoid file corruption issues due to changing inodes while mounted. I'm sure there's a more elegant way to do it than what I currently have, which is why I haven't uploaded any scripts for this as of yet.

      Delete
  3. Looks like we success to cahge to RW after the command be
    sed -i 's|mount rootfs rootfs / remount bind ro|mount rootfs rootfs / remount bind rw|g' /opt/google/containers/android/rootfs/root/init.rc
    =>reboot
    =====================
    crosh> shell
    chronos@localhost / $ sudo su
    localhost / # printf "mount | grep loop1" | android-sh
    /dev/loop1 on / type ext4 (rw,seclabel,nodev,relatime,block_validity,delalloc,barrier,user_xattr,acl)
    ==============
    Xposed now chould be installed.
    Your are master. Thank you.

    ReplyDelete
  4. 07-23 23:01:32.638 E/Xposed ( 24): Errors during Xposed initialization
    07-23 23:01:32.638 E/Xposed ( 24): java.io.IOException: Failed to create a superclass for XResources
    =========================================

    There is a error message:
    mount can't find system in /proc mounts

    the pictures:
    https://photos.app.goo.gl/xi5YxxzyTkxqPN168
    https://photos.app.goo.gl/3VnaAJjKCF49ztFz5
    https://photos.app.goo.gl/3VnaAJjKCF49ztFz5

    I have try

    printf reboot | android-sh

    to rebooting the andoird(killed) same times, but the same result.

    ReplyDelete
    Replies
    1. Interesting... So my Chromebook has updated to version 70.0.3499.0, and after the update, I initially experienced the same problem (framework installed but not active). I got it to work after a bit of trial and error. It looks like the install might possibly have to be done a little differently now.

      From your situation (framework installed but not active), I suggest trying the following now:

      Beforehand: Make sure that you have the XposedInstaller_3.1.5.apk file stored in your ~/Downloads folder. Then:

      1. Uninstall the Xposed installer app (e.g. by long press/double tap in the Chrome OS launcher)

      2. Reboot Chrome OS

      3. After the reboot, in a root Chrome OS shell, set SELinux to permissive, then reinstall the XposedInstaller_3.1.5.apk, this time manually via package manager, then reboot Android.

      So, for this part, in a root Chrome OS shell, you would enter the following three commands:

      setenforce 0

      printf "pm install /storage/emulated/0/Download/XposedInstaller_3.1.5.apk" | android-sh

      printf reboot | android-sh

      4. Then open the Xposed installer app again, and hopefully now you will see the green colour and the message saying the framework is active.

      Incidentally, don't worry about the message "mount can't find system in /proc mounts". This is just due to running in a container - the successful install will also display this message and proceed anyway.

      Delete
    2. It work after following your instruction above!
      I reply late due to my android got bootloop after I tried to install busybox with root and system RW.

      Just powerwash ->update CrOS->ROOTED-> install suceed one hour ago. :)

      Delete
    3. Glad you got it working, and thanks for following up.

      I think I'll update the instructions in my blog post per my previous comment, as this method seems to be the most reliable way to get the framework installed at the moment.

      Delete
    4. Tried after the latest update and it failed "sed: Couldn't open temporary file /opt/google/containers/android/rootfs/root/sed2o7AxI: Red-only file system"

      Any ideas?

      Delete
    5. If I go back to the beta channel (70.x) the above instructions all work. Broken in 71.x

      Delete
    6. Apologies for the delay in response. Due to a couple of recent minor changes in CrOS, the container is getting mounted RO again. Please see the following comment for further details and a potential fix.

      https://github.com/nolirium/aroc/issues/9#issuecomment-435646344

      A new version of the rooting script with the fix included will be uploaded presently.

      Delete
  5. I am having the same problem as above (on 71.x):

    "sed: Couldn't open temporary file /opt/google/containers/android/rootfs/root/sed2o7AxI: Read-only file system"

    Any insight on this Nolirium?

    ReplyDelete
    Replies
    1. me too, Root works, but can't install the Xposed framework as Read only.

      Delete
    2. Apologies for the delayed response. Due to a couple of recent changes in CrOS, the container is again getting mounted RO. Please see the following comment for further details and a potential fix.

      https://github.com/nolirium/aroc/issues/9#issuecomment-435646344

      A new version of the rooting script with the fix included will be uploaded presently.

      Delete
  6. Nice info by the way. Visit our website for more games apps & photo video apps.

    ReplyDelete
  7. i know this is a super old thread and i doubt anyone is watching this but can we root chrome book os v 97?

    ReplyDelete
  8. I installed Fyde OS 14.1, and my xposed shows "it seems like your device is not unsupported"

    ReplyDelete