Author Topic: Installing a Linux distribution inside Android  (Read 3580 times)

wkbd006

  • Newbie
  • *
  • Posts: 4
    • View Profile
Installing a Linux distribution inside Android
« on: December 21, 2020, 05:17:37 am »
This is another method of installing a Linux distribution on Android. I have found it a little bit easier and the final result more functional than the Devuan installation posted on February. The steps are based on this article https://www.makeuseof.com/tag/how-to-linux-on-android. It is assumed that Android allows root user access.

Here are the steps (the option names may be different depending on the language):
  • Prepare a microSD card: create at least one ext4 partition which is going to be used as a root partition for the newly installed system. You can also create a FAT32 partition to share data as well as other Linux partitions. After partitioning insert it into Cosmo.
  • Install following apps from Play Store: Linux deploy, XServer XSDL. The original article also recommends installing Busybox, but it seems to be not necessary.
  • Start Linux Deploy and choose the configuration button in upper right corner, set the following configuration options:
    Bootstrap
    - distribution: Debian
    - architecture: arm64
    - distribution package: buster
    - type of installation: partition
    - installation path: for example /dev/block/mmcblk1p2
    - filesystem: ext4
    - username: set a suitable value
    - password: set a suitable value
    - locale: set a suitable value, for example en_GB.UTF-8
    Mounts
    - custom mount points: yes
    - mount point list: add here entries for other partitions such as /home
    SSH
    - SSH: yes
    PulseAudio
    - enable: yes
    GUI
    - GUI: yes
    - graphical subsystem: X11
    - graphical environment: choose your favourite
  • Next, open the three dots menu o the right and select install, this may take some time.
  • After installation you should be able to start the system by selecting "▶ Launch"
  • Now you should be able to log in by ssh from other system in the local network or from Termux. Start XServer XSDL and enter this in the terminal to start Mate:
    export PULSE_SERVER=tcp:127.0.0.1:4713
    export DISPLAY=:0
    mate-session
Overall this gives access to a desktop-style Linux environment with its services, user interface and package manager while your Android apps continue running in the background. Compared to Gemian, at the moment of writing the battery seems to get drained less, although the GUI is a little less reactive.

Zarhan

  • Sr. Member
  • ****
  • Posts: 364
    • View Profile
Re: Installing a Linux distribution inside Android
« Reply #1 on: December 21, 2020, 11:38:25 am »
Can you drop your privileges to "normal user" account? This is one of those things that is missing in the Devuan-based approach.

wkbd006

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Installing a Linux distribution inside Android
« Reply #2 on: December 22, 2020, 11:20:35 am »
The bootstrap script creates one unprivileged user who can run sudo. The user name and the password need to be set in the configuration before starting the installation.

LinuxGuy

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: Installing a Linux distribution inside Android
« Reply #3 on: April 18, 2021, 09:08:32 am »
Dear wkbd006,

Thanks a lot for posting this tutorial!

  • Next, open the three dots menu o the right and select install, this may take some time.

At this step, i get the following error (in LinuxDeploy):

[14:58:29] E: Failed getting release file http://ftp.debian.org/debian/dists/buster/Release
[14:58:29] <<< deploy

Strange:
I can access http://ftp.debian.org/debian/dists/buster/Release in my browser without any issues and LinuxDeploy has full network access.


Any hint? Is there maybe another debian repository? Thanks a lot!

LinuxGuy

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: Installing a Linux distribution inside Android
« Reply #4 on: April 22, 2021, 11:21:18 am »
Dear wkbd006


well it was a firewall issues, stopping AF-firewall app let everythingwork smoothly, also things take a while - xsdl even started automatically ...


The big pitfall:

- formatting the SD card and knowing its block device name
I finally managed this with an app called AParted.

- the step with configuring xsdl / vnc

LinuxGuy

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: Installing a Linux distribution inside Android
« Reply #5 on: April 23, 2021, 11:43:34 am »
I finally managed to get ubuntu with LXDE running! Great!

The only two problems left:

- firefox/chromium dont have internet access allthough they can be downloaded via the console

- cant access my android files - maybe I messed up with only ticking the box in the linuxdeploy preinstall configuration - didnt know how to name a mount point

Any hints? What a wonderfull tool ...

LinuxGuy

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: Installing a Linux distribution inside Android
« Reply #6 on: May 08, 2021, 01:30:13 pm »
Hi  there,


Just in case this could help anyone, as I really prefer linuxdeploy to userland, allthough setup was more difficult.

My configuration, which works for me with Android 9:

Bootstrap
- distribution: Ubuntu
- architecture: arm64
- distribution package: bionic
- type of installation: file
- image size: 15 000MB
- installation path: (the location given by LD=internal memory
- filesystem: ext4
- username: root
- password: set a suitable value
- privileged users: root:aid_inet root:aid_sdcard_rw root:aid_graphics
- locale: set a suitable value

Mounts
- custom mount points: yes (without any special mountpoint, this allready mounts the ubuntu file system to /data/local/mnt in Android!)
- mount point list: /storage/345mysdcard /root/desktop/SD-card
SSH
- SSH: yes (dont use it)
PulseAudio
- enable: yes
GUI
- GUI: yes
- graphical subsystem: X11
- graphical environment: LXDE

This gives me a real ubuntu in my pocket with audio, internet, data transfert to android and without the need to reboot.

The only thing, which I still could not fix:
if I build the container with a ""normal"" user (=not root), which I would prefere, internet access is limited to the console. Browser/Mailclient dont get access ... weird. ..

LinuxGuy

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: Installing a Linux distribution inside Android
« Reply #7 on: May 08, 2021, 01:42:33 pm »
... and of course: didnt find the right settings for af-firewall app - giving Linuxdeploy and Xserverxsdl internet access is unfortunately not sufficient. So if I am using (rarely) internet via my ubuntu installation, I have to deactivate the firewall ... <sigh>

wkbd006

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Installing a Linux distribution inside Android
« Reply #8 on: May 31, 2021, 06:11:06 am »
I did not use my Cosmo much afterwards unfortunately, so there was no further development. I think the issue which was blocking for me was that my desktop environment (MATE) did not play well Cosmo's screen size. Either font sizes had to be very small or Firefox left only half of the screen height for a page content.