Jump to content

OS virtualization and emulation on Android

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Aceing Winter Snows Harsh Cold (talk | contribs) at 01:18, 20 November 2019 (added stuff to draft.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Just like in computers, Android (operating system) devices have the ability to run virtual machines or emulate other operating systems. It does this either via platform virtualization or emulation via compatibility layer.


Platform virtualization

Platform based virtualization allows more leverage to the developer as anything that relates to the guest operating system only afects the guest operating system, and not the host operating system. Due to this it is possible for the guest operating system to be rooted, where as the host operating system remains unrooted.

Emulation


Emulation of other Operating Systems


Terminal Emulation of Internal Operating System

Terminal emulation of the Android device itself is done via either an actual local loopback to the device, or an emulation that seems to be a local loopback. Most of these terminal emulation of the device itself utilize the native terminal Toybox library and functions that come with every android device. However due to the fact that the majority of the functions that are readily available without utilizing a compatibility layer, means that Toybox functions can only be utilized. In order for a user to add any other functions or libraries would require the user to root their own device and add the functions or libraries manually.

Limitations

The majority of limitations are seen in emulation based apps rather than the platform virtualization based apps, as the emulation apps must utilize a compatibility layer. Thus for libraries and packages to work as expected like in a real OS, the compatibility layer must work properly and must be able to provide the acurate information. However, this requires that the comapatibility layer or any predifined software it uses (ex. Docker) to have access many system related and device related information, which can either be done via utilization of Toybox, or via programing language libararies that Android apps can be made form like, Java, C#, and ect. Although starting from Android 8, many new security restrictions have been placed on apps, and due to these restrictions some API libraries/classes are no longer available or have been replaced by a more restrictive API libraries/classes.

One of the known limitations that were implemented was that apps can only natively access only their own app sandbox root directory or subdirectories on an SD card. Apps wanting to access files or folders outside that on the SD card, are required to use Android's own system file selector. Due to this guest OSes running on, emulation, platform virtualization, or compatibility apps are no longer allowed to access files outside of their own sandbox.

OS Internal Security Enhancements

More modern versions of Android have been seen having more internal system security enhancments, such that some system folders and files are no longer accessible or even viewable for that directories existance. Versions of Android before 9, allowed terminal apps to view Androids root "/" directory (although not allowing modifications or execution).

SELinux

Android utilizes SELinux, and due to this all, system configuration files are not editbable, as well as some are not even readable. Thus apps can only utilize Android API's to learn about the device or system's configuration or settings. However, not all information are avaible to apps, and due to this many OS complatibility layer or emulation apps are not able to run every package or application.

Some known applications or packages that are unable to run are the following  :

  • Udisks2 requires udev which does not work well in most compatibility layer environments, as stated in the sub-sub-section bellow.
  • Snort
  • Open vSwitch
  • mininet (requires open vSwitch to run)

ADB, Prroot, $HOME and $PREFIX usage

Because all Android apps run in an non-privlaged container space, thus the virtualization or emulation apps must utilize their own app space to do the virutalization or emulation. This can be done either by ADB, PRroot, or the usage of $HOME and $PREFIX. The usage of each is used for different purpouses. ADB is used for the emulation of an terminal like environment for the entire Android system, but usually as an unprivlaged user. $HOME and $PREFIX can be using $HOME as "~" and $PREFIX for . However, $HOME can not be set outside of the "/data/apps data space" directory on the android file system, nor can $PREFIX be moved to another place like the SD Card.

For emulators or compatibility layers to emulate or virtualize a Linux based OS on Android Proot must be used.

Android itself being a modified Linux kernel

Because Android is a modified Linux kernel, not all configuration or system files exist or are the same in Android. Because of this emulation apps either need to provide either their own version of the configuration or system files in its application data space, use a pre-modified distibution of ported Linux libraries that do not requie the usage of the missing configuration or system files, or not support the usage of those packages.

Non existance of resolve.conf

Android does not come with etc/resolve.conf, thus compatibility layer or emulation apps either need to provide their own /etc/resolve.conf in their own app space directory. If not provided, then majoirty of OS packages or apps that rely on resolve.conf would not work.

See Also


References