Hcrypt

Android Linux

Running Linux on Android

I wanted a clean CLI experience from the comfort of my phone. I looked up a bit and found out about an open source application which could let you run linux CLI and GUI on your phone! It’s called UserLAnd.

Before we dive in, I just wanna clarify a few things. Not everything will work on it as systemd is not available. Networking is also limited.

With that out of the way, let’s dive in.

Benefits?

  • it’s fun
  • run bash scripts on the fly
  • ssh from any device (explained later)
  • experimentation
  • no root
  • and much more (i got tired of thinking)

Arch install

I will be installing ArchLinux. You can choose any distro of your choice from the available options (Debian, Ubuntu, Kali and Alpine).

First, download and install the app either from Play Store or Aurora Store.

Home screen looks something like this

home

Alright. Now just click on your distro of your choice and it will ask for terminal or GUI install. We will be going with terminal for now.

It will take ~10 minutes to setup the filesystem. After it’s done, it will take you straight to the terminal.

terminal

Updating

Let’s first update the system (the quality of images aren’t so good, I was using scrcmpy to share the android screen)

update

Run neofetch for some satisfaction

neofetch

Well, that’s it for the basic installation. Onto the networking part now.

Networking

For ssh’ing from different device, we would need to find the private IP of our phone.

The networking commands such as ip doesn’t work because it doesn’t have netlink socket. If you try to run it even with root, you would get something like this

ipa

Luckily for us, ifconfig still works but with limited output.

ifconfig

My private IP is 192.168.29.32. We will use this to ssh from another device on port 2022 (that’s the default port UserLAnd opens during the installation).

You could also edit /etc/hosts/ to specify a hostname so that you do not have to remember the IP.

blog

To find the password for the userland user, go to the the filesystems and edit the one you created. You can view the password in there

password

ssh userland@arch -p 2022

ssh

That’s it for this one. Keep experimenting!