Well... it was a lot of work. But it was worth it! Once everything is set up, you have a Linux installation on your Android phone at native speed (if you don't think about the resources Android needs to run). Even 3D acceleration for games works! It is still buggy and in very early development, but it works well enough. And the X11 hardware acceleration works great for everything else. It is literally an ARM PC in your phone. I used a lot of pre made tools to set everything up. All the stuff you need to do is soooo muuuucccchh. I would take weeks if I had to learn, try and setup everything muliple times. Read all the scripts and what each file does before e you use/execute them!
Originally I wanted to use a native installation of Linux on my Unihertz phone, but well. No source code makes it almost impossible if you value your time and sanity. I will not rant again. If you want to know more: /Blog/2023.07.15_Unihertz_Titan_Slim_UbuntuTouch_Fail/Unihertz_Titan_Slim_UbuntuTouch_Fail.html
What can you do with it? You can run a lot of Linux software, play a lot of games with Box64 (everything from actual big 3D games to modern emulators wink* wink*). The crazy thing is that the chroot intall has nativ access to your hardware (Except for the GPU, probably due to an Android driver already loaded, thats why you need the special driver. something something android). Well, what you can do is almost everything.
So what do you need? A rooted phone (No proot is not an alternative to chroot. The layers in between makes it not even comparable in performance aspect when it comes to responsiveness and peek performance), a good amount of memory and time.
Thanks to everyone involved in all the projects used! Everything used to make this is linked in the sources section..
I expect you to know your way around a shell and Linux, and at least be able to read bash code.
Every time I write "CLOSE" you have to go back to android, stop termux and termux-x11 in the android settings, then start termux and type "chroot-installer stop" in that order! This is also how you completely close the Linux season, and no, because of the way chroot works, there is currently no better way to close everything.
You will see that if you use chroot with a folder, dbus will not work properly and everything will load slowly. I dont know if this is a bug or misconfiguration. But this is why you make a disk image. If you use the scripts to install the rootfs with the file option, something goes wrong with the configuration and 3D acceleration will not work and the filesystem will corrupt after a few boots. If you need more size, you can resize the disc image afterwards with "resize2fs ubuntu.img 50G". This is only possible because the chroot was installed as a folder and is still used as such by the scripts, but inside a disk image. There are no partitions or anything. Just one big root directory, more or less. If you want to make a small image, before using it, for backup purposes, use 10 GB on the create command. This should be large enough for a clean install. The biggest advantages of a disk image are: no permissions issues, no ownership issues and it's very portable and easy to backup/transfer to another device without any problems. You just need to re-configure your termux and put the folders like the .chroot-installer folder back into it. Also: You can use any distro you like. But Ubuntu works best. You can also create a disk-image with "Linux Deploy" and copy it over, or create your own. Just make sure you configure everything correctly, otherwise sound, 3D acceleration, hardware rendering and/or dbus will not work!
The goal of this experiment was to get Ubuntu Touch or KDE Mobile running in chroot, but it did not work because of missing repositories with Ubuntu Touch and incompatibility with KDE Mobile. But this is also very useful, close enough and cool! If I find a way to make Linux more usable on such small screens (different DE or panel configuration) I will definitely add it!
And on the Internet, as usual: IF YOU TRY ANYTHING WRITTEN ON THIS BLOG YOU ARE DOING IT AT YOUR OWN RISK! IT SHOULD BE OBVIOUS! DON'T COME TO ME CRYING IF SOMETHING WENT WRONG. THAT'S YOUR PROBLEM AND ONLY YOURS! If you do one or a few things wrong or an error happens, you can wipe your your entire storage and even brick your phone (yes, that is actually possible)!
Update: chroot disables your accessibility apps in the Android-Settings. Why this happens idk. Could be one of the scripts or Android itself panicking.
How I did it:
Preparing the Phone:
Preparing Termux:
Installing a rootfs:
If something goes wrong in one of the scripts, look at the line in the script and do it yourself:
Setting up the chroot install:
nano .profile
Add the following at the end:
---
---
nano .startDE.sh
---
---
CLOSE
Setting up the rest in Termux:
nano startUbuntu.sh
---
---
First startup and last setup steps:
sudo nano /etc/apt/preferences.d/99mozillateamppa
---
---
CLOSE
nano ./.chroot_installer/containers/Ubuntu.conf
---
---
Installing a Backup-Tool [Read this for more information: https://github.com/laraib07/TermuxBackupTools]:
wget https://raw.githubusercontent.com/laraib07/TermuxBackupTools/master/rewind && chmod u+x rewind && mv rewind $PREFIX/bin/