AnLinux: An Easy Way to Install a Linux Environment on an Android Phone Without Root

AnLinux: An Easy Way to Install a Linux Environment on an Android Phone Without Root

Any Android phone or tablet is a Linux device. Yes, a very modified OS, but still the basis of Android is the Linux kernel. But, unfortunately, for most phones, the option to "demolish Android and install the distribution kit to your liking" is not available.

Therefore, if you want Linux on your phone, you have to buy specialized gadgets like PinePhone, about which we already wrote in one of the articles. But there is another way to get a Linux environment on almost any smartphone, and without root access. An installer called AnLinux will help with this.

What is An Linux?

This is a specialized software give a chance use Linux on your phone by mounting an image containing the root filesystem of any of the distributions, including Ubuntu, Kali, Fedora, CentOS, OpenSuse, Arch, Alpine and many others. The installer uses PRoot to emulate root access.

PRoot intercepts all calls made by the user that normally require root access and makes them work under normal conditions. PRoot uses the ptrace system call to debug software, which helps to achieve the goal. With PRoot, all this can be done as with chroot, but without root rights. In addition, PRoot provides fake user access to the pseudo-file system.

AnLinux is a small program. But this is enough, because its only purpose is to install system images and run scripts that raise the user environment. When everything is done, the user gets a Linux PC instead of a smartphone, and Android continues to work in the background. We connect to the device using a VNC viewer or terminal, and you can work.

Of course, this is not an ideal option to β€œstart” Linux on a smartphone, but it is quite working.

Where to start?

The main thing is an Android smartphone with an OS version not lower than Lollipop. Also, a 32-bit or 64-bit ARM or x86 device will do. In addition, you will need a substantial amount of free file space. To do this, you can use a memory card or just a device with a large amount of internal memory.

In addition, you will need:

  • AnLinux (here is the link) on Google Play).
  • Termux (again need google play).
  • VNC client (VNC Viewer - a good option).
  • Bluetooth keyboard (optional).
  • Bluetooth mouse (optional).
  • HDMI cable for mobile phone (optional).

Termux and VNC are needed to gain access to your "computer on Linux". The last three elements are required only to ensure comfortable work with the phone and the installer. An HDMI cable is needed only if it is more convenient for the user to work with a large screen, and not peer at the phone's display.

Well, let's get started

AnLinux: An Easy Way to Install a Linux Environment on an Android Phone Without Root

Once Termux is installed, we get a full-fledged console. Yes, there is no root (if the phone is not rooted), but that's okay. The next step is to install the image for the Linux distribution.

Now you need to open AnLinux and then select Dashboard from the menu. There are three buttons in total, but you can only select one, the first one. After that, the distribution selection menu appears. You can choose not even one, but several, but in this case you will need a large amount of free file space.

After selecting a distribution, two other buttons are activated. The second allows you to download to the clipboard the commands needed to download and install Linux. Usually these are pkg, wget commands and a script to execute them.

AnLinux: An Easy Way to Install a Linux Environment on an Android Phone Without Root

The third button launches Termux so commands can be pasted into the console. Once everything is done, a script is run that allows you to load the distribution environment. To call the distribution kit, you need to run the script every time, but we only install it once.

And what about the graphical shell?

If you need it, then you just need to select the menu for the desktop environment and use more buttons - not three, but more will appear. In addition to the distribution itself, you also need to choose a shell, for example, Xfce4, Mate, LXQt or LXDE. In general, nothing complicated.

Then, in addition to the script that starts the distribution, you will need another one - it activates the VNC server. In general, the whole process is simple and understandable, it is unlikely to cause difficulties.

After starting the VNC server, we connect from the client side using the viewer. You need to know the port and localhost. All this is reported by the script. If everything is done correctly, then the user gets access to his virtual Linux system. The performance of modern phones is at its best, so there will be no particular problems. Of course, it is unlikely that a smartphone can completely replace a desktop, but, in general, it all works.

This method can be useful if you suddenly need to urgently connect to the server, and you are in the car, without a laptop (of course, in this case, all the operations described above with AnLinux should already be completed). A Linux virtual machine allows you to connect to a work or home server. And if for some reason there is a display and a wireless keyboard in the car, then in a matter of seconds you can organize an office in the cabin.

AnLinux: An Easy Way to Install a Linux Environment on an Android Phone Without Root

Source: habr.com

Add a comment