[GUIDE][NO-ROOT] How to install Ubuntu and other Linux Distros on Your Phone or Android TV Box, using Termux

Search This thread

jenneh

Senior Member
NOTICE:
THIS METHOD IS ONLY FOR NON ROOTED DEVICES
1680701641466.png

PROOT-DISTRO GITHUB PAGE

Hello Friends!

Today I wanted to start a thread that will house prebuilt Linux environments, as well as instructions for building the Linux environments yourself. These "environments" theoretically can be run on any non-rooted Android Device.

The first premade being released is an Ubuntu (Jammy) environment with a GUI that I built from scratch and will show you how to build as well! It is as bare bones as I could get with just xfce4 for the gui and it's goodies package. Tightvncserver is installed as well so we can remote into the environment.

(If you would rather use windows RDC then do not install tightvncserver)

UBUNTU THEMED VERSION:
1.png
2.PNG
3.PNG


BASIC 'BUNTU VERSION:
1.PNG
2.PNG
3.PNG
INSTALLATION INSTRUCTIONS:

Download and install Termux on your Android Device: DIRECT DOWNLOAD LINK

Download the Premade Ubuntu Backup of your choice on your Android Device.

JAMMY JELLYFISH ENVIRONMENTS:
Basic Ubuntu Environment (xfce4, xfce4-goodies, tightvncserver) with no additional programs: DIRECT DOWNLOAD LINK (394MB)

You are able to set your own user name and root password for the premade environment.

Open Termux and run these commands:
Code:
pkg install x11-repo
pkg update -y
pkg install proot-distro -y
proot-distro install ubuntu
termux-setup-storage
cd storage/downloads
proot-distro restore ./ubxfce-backup.tar.gz
proot-distro login ubuntu

Now to setup your user name and root password:
Code:
passwd root
useradd USERNAME
passwd USERNAME

Now run:
Code:
vncstart

You will be asked to set a password for your vnc. Then you will be told which port number to use in your vnc.

1.png


Now you need to connect to the vnc server by using an app on your phone or by remotely connecting with your pc, both instructions are provided below. Then as soon as you connect, you will be done! Your Ubuntu Environment is now fully setup with a GUI, working internet, and root access.

To change over to your user name and home, run this command:
Code:
su USERNAME
Same as above, but with Chromium and Firefox installed: DIRECT DOWNLOAD LINK (625MB)

You need to open chromium and then close it the very first time, it opens to a blank screen the first run for whatever reason.

Open Termux and run these commands:
Code:
pkg install x11-repo
pkg update -y
pkg install proot-distro -y
proot-distro install ubuntu
termux-setup-storage
cd storage/downloads
proot-distro restore ./ubxfce2-backup.tar.gz
proot-distro login ubuntu

Now to setup your user name and root password:
Code:
passwd root
useradd USERNAME
passwd USERNAME

Now run:
Code:
vncstart

You will be asked to set a password for your vnc. Then you will be told which port number to use in your vnc.

1.png


Now you need to connect to the vnc server by using an app on your phone or by remotely connecting with your pc, both instructions are provided below. Then as soon as you connect, you will be done! Your Ubuntu Environment is now fully setup with a GUI, working internet, and root access.

To change over to your user name and home, run this command:
Code:
su USERNAME
RDP Version for use with Windows Remote Desktop Connection on PC: DIRECT DOWNLOAD LINK (626MB)

OR you can use an RDP app on your phone.

Firefox and chromium are preinstalled. Xrdp is used instead of tightvncserver.

Open Termux and run these commands:
Code:
pkg install x11-repo
pkg update -y
pkg install proot-distro -y
proot-distro install ubuntu
termux-setup-storage
cd storage/downloads
proot-distro restore ./ubxfce3-backup.tar.gz
proot-distro login ubuntu
service xrdp restart

Now to setup your user name and root password:
Code:
passwd root
useradd USERNAME
passwd USERNAME

To change over to your user name and home, run this command:
Code:
su USERNAME

lastly run ifconfig
1.png

Take note of your ip address and make sure you have setup a user with a password or a password for root, then open RDC on your PC or Phone and connect to this IP address. You will then need to type in your user name and password to connect.
Customized to look more like Ubuntu, built for Windows RDC DIRECT DOWNLOAD LINK (804MB)

OR you can use an RDP app on your phone.

Sudo has been added to this machine. Thus it will come with a user this time.

USERNAME PASSWORD
root root
zero zero

Chromium asks for a key, it is 1111.

Open Termux and run these commands:
Code:
pkg install x11-repo
pkg update -y
pkg install proot-distro -y
proot-distro install ubuntu
termux-setup-storage
cd storage/downloads
proot-distro restore ./ubxfce4-backup.tar.gz
proot-distro login ubuntu
service xrdp restart
ifconfig
1.png

Take note of your ip address and open RDC on your PC or Phone and connect to this IP address. You will then need to type in either root root for the username and password or use the username zero password zero.

LUNAR LOBSTER ENVIRONMENTS:
For use with TightVNC or other VNC apps: DIRECT DOWNLOAD LINK
Code:
proot-distro install ubuntu
termux-setup-storage
cd storage/downloads
proot-distro restore ./lunar.tar.gz
proot-distro login ubuntu
vncpasswd
#set your password
vncserver
Built per this guide with no browsers or other programs installed : SEE GUIDE
For use with TightVNC or other VNC apps: DIRECT DOWNLOAD LINK
Code:
proot-distro install ubuntu
termux-setup-storage
cd storage/downloads
proot-distro restore ./lunar2.tar.gz
proot-distro login ubuntu
vncpasswd
#set your password
vncserver
For use with Windows RDC or other RDC / RDP apps: DIRECT DOWNLOAD LINK
Code:
proot-distro install ubuntu
termux-setup-storage
cd storage/downloads
proot-distro restore ./lunar3.tar.gz
proot-distro login ubuntu
service xrdp restart
Now to setup your user name and root password:
Code:
passwd root
useradd USERNAME
passwd USERNAME
There are many ways to do this, the first way being demonstrated today is using the gui package "xfce4" which will install a desktop environment for us, along with other features added from the "xfce4-goodies" package. Lastly tightvncserver is installed so we are able to remote into the distro. Takes 30 mins to an hour to install.

If you would rather use RDC, do not install tightvncserver, use the package xrdp instead. You would then skip the vncserver step below.

Lastly, it is possible to upgrade the distro's file system from Jammy Jellyfish, to Lunar Lobster. See the Customize spoiler below for more details. OR SEE THIS POST FOR A FULL LUNAR BUILD

INSTALLATION INSTRUCTIONS:

Download and install Termux on your Android Device: DIRECT DOWNLOAD LINK

Code:
pkg install x11-repo
pkg update -y
pkg install proot-distro -y
proot-distro install ubuntu
proot-distro login ubuntu
apt update -y
apt install xfce4 xfce4-goodies tightvncserver -y

You can backup your Distro at this point prior to adding any passwords or users, or you may do this step later to backup your customizations to ubuntu with all the programs you have installed.

To backup your distro, type:
Code:
exit
termux-setup-storage
cd storage/downloads
proot-distro backup --output ubxfce-backup.tar.gz ubuntu
#run this command on your pc
adb pull sdcard/Download/ubxfce-backup.tar.gz
#Return to Ubuntu
proot-distro login ubuntu

Now to setup your user name and root password:
Code:
passwd root
useradd USERNAME
passwd USERNAME

Lastly run:
Code:
vncstart

You will be asked to set a password for your vnc. Then you will be told which port number to use in your vnc.

1.png


Now you need to connect to the vnc server by using an app on your phone or by remotely connecting with your pc, both instructions are provided below. Then as soon as you connect, you will be done! Your Ubuntu Environment is fully setup with a GUI, working internet, and root access.

To change over to your user name and home, run this command:
Code:
su USERNAME
If you are going to be connecting to your Ubuntu Environment using only your phone, you will need a Vnc Viewing App.

Type our local ip address of "127.0.0.1:" then add your port number after the :
1.PNG


You can name the connection whatever you like, then save and connect. You should be asked for your vnc server password now.
1.PNG

Run ifconfig
1.png


Note your ip address next to wlan0.

Then connect to the ip address in the app with your user name and password.

If you know of a better RDC app please let us know in the comments below. I do not use these apps regularly. (personally use the PC RDC) Only verified it could run in the app.
If you want to be able to remote connect using your pc, decide if you want to use TightVNC or Windows Remote Desktop Connection.
Run ifconfig
1.png


Note your ip address next to wlan0.

Now open TightVNC for Windows - DIRECT DOWNLOAD LINK

2.PNG


Enter your local ip address: and the port number provided to us earlier.

3.PNG


Then enter your vnc password.

Now you are all set!
So, the package "xrdp" in this Ubuntu port cannot run with tightvncserver installed. Idk why. It took me 3 days to learn this... x.x but yay here we go!

INSTRUCTIONS:
Code:
apt purge tightvncserver
apt install xrdp
service xrdp start
ifconfig
1.png


Grab your ip address and make sure you have setup at least a root password, or a user.
then login to windows remote desktop connection with your ip address and type either root and your root password or the username and user password you set.

1.PNG

If you get disconnected and are unable to reconnect in RDC, run this command:
Code:
service xrdp restart
It is also possible to remote into your phone without installing proot-distro.
OPTIONAL STEP!!

You are able to change your Ubuntu file system version by updating the repository sources.

Code:
nano /etc/apt/sources.list
Then edit jammy to lunar or whatever version you want and save. (ctrl + o and enter, then ctrl +x to exit)
TIMESTAMPED VIDEO OF THIS PART (earlier versions are likely not to work but it doesn't hurt to try. confirmed bionic beaver is not working)

Lastly run:
Code:
apt update
apt upgrade -y
This is for the Jammy Jellyfish version, since the snaps wont work. It is being determined now if Lunar is still having these troubles
Code:
echo "deb http://ftp.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys 605C66F00D6C9793
apt update
apt install firefox-esr
apt install chromium
nano /usr/share/applications/chromium.desktop
press ctrl + w and search for "exec"
then add --no-sandbox after chromium
press ctrl + o to save and ctrl + x to exit
1.png
This port does not come with sudo natively installed. We are able to install it and add any users to the sudoers file.
Code:
apt install sudo
nano /etc/sudoers

Now scroll down to where you see Root, and add your username below. Then copy the ALL=(ALL:ALL) ALL and paste it next to your username.
TIMESTAMPED VIDEO OF THIS PART
This is how the ubxfce4 environment was built. This is a write up of the video below with some modifications and is easier to go through if you watch the video with it.


Code:
apt install ubuntu-wallpapers gedit plank yaru-theme-gtk yaru-theme-icon xfce4-appmenu-plugin rofi git -y

Right click on your desktop and select desktop settings.

In desktop settings, select Folder, then select Other.

This should open you into the xfce backgrounds folder, at the top left, click on the "share" tab. Now highlight the backgrounds folder and select open at the top right.

This will load our wallpapers into settings, make a selection!

Now go into settings > appearance and select the color you would like for your windows.

Next go into settings > windows manager and select your theme, yaru-dark is what is used in the premade.

Now go into settings > default applications and you can change the file manager and terminal emulator.

Now go into settings > window manager tweaks and uncheck Draw frame around selected window while cycling.

Now select the Placement tab and move the ball to the middle.

Now right click on your panel and highlight panel, then select panel preferences.

Switch to panel 2 and select the minus button to remove it.

Switch back to panel 1, You may edit your icon size if you like under Appearance, then switch to the items menu and select applications menu.

You can select any icon you would like by hitting "select icons from" and then the "image file" tab

(I downloaded the SVG file and placed it into usr/share/icons)

You can remove the workgroup, notifications, and windows button panel options if you would like.

You can double click on the clock option to edit the time to look how you want.

You can move the clock in between the separators and expand the separators to change the clock's placement.

Now we can click on action buttons and take the check off everything except logout.

pling.com/p/1463576

Now open a terminal

Code:
cd ~/Downloads
mv Azeny.tar.gz /usr/share/plank/themes
cd /usr/share/plank/themes
tar -xvf Azeny.tar.gz
rm Azeny.tar.gz

Now right click on desktop and go into desktop settings.

Click on the icons tab and change icon type to none.

Now run:
plank --preferences

Turn on Icon Zoom then change position to the left and switch the theme to Azeny.

Go back into panel preferences, click on items, and add a new item. Select App menu plugin.

Shift the app menu plugin's position to second from the top to fix the panel.

Click on app menu and select use CompactMode.

Now go into settings > session and startup session, switch to application autostart and select add.

Name it plank and set the command to plank.

Now exit the ubuntu session and restart.

Now you can add more applications to the plank menu by running them then right clicking their icons to dock them.

Code:
git clone https://github.com/adi1090x/rofi
cd rofi
./setup.sh
cd
cd .config/rofi
rm config.rasi
cd launchers/type-3
nano launcher.sh
change the theme number from 10 to 1

Code:
nano style-1.rasi
Under fullscreen false, change the width to: 1400
Add a line beneath width called height and set it to: 650
Edit background-color to black / 10% --- you can set this to what you like

Scroll down to input bar and change margin to 0% 25%

Scroll down to list view and set scrollbar to true;

pling.com/p/1529470

Code:
cd ~/Downloads
unzip xpple_menu.zip
rm xpple_menu.zip
mkdir ~/local/share
mv applications ~/local/share/
mv Pictogrammers-Material-Dots-square.svg ~/local/share/applications
mkdir -p ~/local/share/menu
mv xpple.menu ~/local/share/menu
cd ~/local/share/applications
nano Launchpad.desktop
change Exec=sh -c ~/.config/rofi/launchers/misc/launcher.sh
to Exec=sh -c ~/.config/rofi/launchers/type-3/launcher.sh

Then in applications, drag and drop rofi to your panel and open panel prefs. We can change the icon in here like before.
(/local/share/applications/Pictogrammers-Material-Dots-square.svg)
Only if you need!

There are / were problems with Android 12 and force closing Termux. To fix this you can run this adb command:
Code:
adb shell device_config put activity_manager max_phantom_processes 2147483647
TERMUX'S KNOWN ISSUES GITHUB LINK
WHAT IS THE DIFFERENCE BETWEEN A WINDOWS MANAGER AND A DESKTOP ENVIRONMENT GUI

Differences in vnc xrdp and gnome desktop:

Some xrdp knowledge, the installer script does not work for this distro:

Ranking linux desktops:

How to use the GNOME Desktop Environment:

How to install gnome in ubuntu --not working:

How to make tasksel work (^):

A good writeup on gui environments usable in Ubuntu:

What is the xserver

Wild tangent on proot-distro origins and one of the devs

Explains ppa repository:

Fix apt-get update “the following signatures couldn’t be verified because the public key is not available”:

How to manually add repositories:

Step by step guide installing xfce:

How to add or delete users in Ubuntu:

Make the Ubuntu port look like a traditional ubuntu desktop environment:

Sysv way to get around sysd things (in comments)

How to check processes:

How to check if your device supports kvm and other kvm knowledge:

Building Android for Qemu -- saving for me

How to list all installed packages:

Build Your Own Distro With Archiso:

How to edit Tightvncserver password:

Showed where xrdp config files are located:

Please note the environments aren't perfect, there's a lot to be discovered and learned here. The way this is built, as improvements are made, the backups can be updated to reflect those changes. Please please do share if you understand how to improve anything or if you know anything about this stuff you want to share. I love learning from you all!

A Very Special Thank You to @ze7zez for taking the time to test the prebuilt, as well as educate us!!

PS I made a mistake in referring to these "Environments" as "Virtual Machines" They are not vms. They share the same kernel as our phone, and therefore are not as secure as a VM. THANKS!
 
Last edited:

jenneh

Senior Member
The next "Premade" is a Debian Environment built from scratch with all code provided. It's gui environment is provided by gnome, which I haven't been successful installing in ubuntu
Screenshot_20230330-040729~2.png
Screenshot_20230330-040719.png

11.png
12.png
13.png
HOW TO INSTALL THE PREMADE:
First Download the Debian Backup: DIRECT DOWNLOAD LINK
Then run this code:
Code:
pkg install x11-repo
pkg update -y
pkg install proot-distro -y
proot-distro install debian
termux-setup-storage
cd storage/downloads
proot-distro restore ./debian-backup.tar.gz
proot-distro login debian
vncserver

HOW TO BUILD YOUR OWN:
You can select your native language this way. It will take 30 mins - an hour to setup
Code:
pkg install x11-repo
pkg update
pkg install proot-distro -y
proot-distro install debian
proot-distro login debian
apt update -y
apt install task-gnome-desktop -y
apt install gnome-session-flashback tightvncserver vim -y
vncserver
vi .vnc/xstartup

Press the letter "i" and then erase everything on screen and paste all of the code below
Code:
#!/bin/sh
autocutsel -fork
xrdb $HOME/.Xresources
gnome-control-center "$VNCDESKTOP Desktop" &
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
export XDG_CURRENT_DESKTOP="GNOME-Flashback:Unity"
export XDG_MENU_PREFIX="gnome-flashback-"
unset DBUS_SESSION_BUS_ADDRESS
gnome-session --session=gnome-flashback-metacity --disable-acceleration-check --debug &
When done, press ESC and type :wq to save and exit vim

Now type vncserver and connect to your machine using the port number provided

Source:
 
Last edited:
Very correctly written instructions.

I don't know if it's Nethunter Kex or Ubuntu's fault, but after logging out of Ubuntu there is some crash with a message about "Connection failed". Restarting Nethunter Kex ends with a java error message and you have to restart the phone.
 

Attachments

  • Screenshot_20230329-203303_NetHunter KeX.png
    Screenshot_20230329-203303_NetHunter KeX.png
    138.3 KB · Views: 36
  • Screenshot_20230329-203205_NetHunter KeX.png
    Screenshot_20230329-203205_NetHunter KeX.png
    39.3 KB · Views: 32
  • Like
Reactions: jenneh

jenneh

Senior Member
Very correctly written instructions.

I don't know if it's Nethunter Kex or Ubuntu's fault, but after logging out of Ubuntu there is some crash with a message about "Connection failed". Restarting Nethunter Kex ends with a java error message and you have to restart the phone.
Thank you for reporting this. I am unsure which it would be, or if it is due to how the distro was backed up and restored, but will see if it can be fixed somehow. This is the first day with the backups, had always just ran it off the scripts and didn't experience that error running it that way. So interesting!
 
  • Like
Reactions: ze7zez

jenneh

Senior Member
@ze7zez
Hi, I know of two ways to achieve this. One requires the use of a usbc hub with an hdmi port, the other uses a tv or device with chromecast built in support.

Using a usbc hub:
This video illustrates that any generic usbc hub with the hdmi port can be attached to your phone and then your tv or monitor and function just like a pc!

I have one from walmart, its super old but it works, cannot find the link but something like this bestbuy one would work

Chromecast mirroring:
Otherwise it is possible if you have a chromecast or a tv / screen with chromecast built in, you could use the "mirroring" feature.
 
Last edited:
  • Like
Reactions: ze7zez

jenneh

Senior Member
I didn't mean imaging the smartphone screen on a larger screen, because that drains the battery, but using, for example, TightVNC Viewer on a PC.
Hi it took me all day but I figured it out! We have to do it through termux first. I will explain in full details how to do it tomorrow, have run out of play time for today. This is what termux with a gui looks like and then we can proot into any of our machines like ubuntu
1.PNG

as an edit before i have to go, we can proot in, but it is still just the terminal, so maybe we can install a viewer in this environment to see that machine, not sure!
1680189229030.png
 
Last edited:
  • Like
Reactions: ze7zez

jenneh

Senior Member
@ze7zez Was able to get free and figured out how to setup tightvncserver in the ubuntu machine, vnc connect to it using the termux package tigervnc-viewer, whilest rdp'd into that termux session with my windows pc.

Here's how:

Okay so in termux we need to install these packages:
Code:
pkg install xfce4 xfce4-goodies tigervnc tigervnc-viewer xrdp vim

Then we need to run this code to be able to edit the rdp init port:
Code:
vim ../usr/etc/xrdp/xrdp.ini

Scroll to the bottom, press the letter "i" and set to port 5901 (change the -1 to 5901)
Now we need to press the ESC key and type :wq to write or save the changes and quit out of vim.
Screenshot_20230330-135722.png

Now run:
Code:
xrdp
vncserver -xstartup ../usr/bin/startxfce4 -listen tcp :1
ifconfig

And look for your local ip address
Screenshot_20230330-135823.png

We will use this ip address in windows rdp client. Search in windows for "RDP" and open the Remote Desktop Connection App. type in your local IP address. If you did everything correctly you will be presented with the xrdp login screen and need to enter your vnc password. Then you will be all set!

Then if you want to connect to a premade machine, open a new terminal window and type in:
Code:
proot-distro login ubuntu

Do not change user yet.

Code:
apt install tightvncserver

Change user now
Code:
su zero
tightvncserver

Set a password again and note the port number it tells you.

Now open a new terminal in termux and type:
vncviewer

This will open a new window, type in:
127.0.0.1: and add the port number tightvncserver told you after the :
(mine was 127.0.0.1:2)

Crappy video example I took of the rdps

PS Thank You so much for asking about this x.x my gosh this will make playing with these things so much easier now.

Source where I learned some of this stuff:
 
Last edited:
  • Love
Reactions: ze7zez
pkg install xfce4 xfce4-goodies tigervnc tigervnc-viewer xrdp vim requires another 1271 MB of disk space, unfortunately. Currently, since the beginning of the installation of the components, it already occupies 2980 MB. I think that it is not necessary to add another desktop environment, but to use the existing one and pkg install x11vnc. I will test it this coming weekend.
 
  • Love
Reactions: jenneh

jenneh

Senior Member
pkg install xfce4 xfce4-goodies tigervnc tigervnc-viewer xrdp vim requires another 1271 MB of disk space, unfortunately. Currently, since the beginning of the installation of the components, it already occupies 2980 MB. I think that it is not necessary to add another desktop environment, but to use the existing one and pkg install x11vnc. I will test it this coming weekend.
Thank you so much! I didn't even think about how much storage it was using, if you could reduce that, that would help folks a lot! I appreciate you taking the time and look forward to anything you share. I had no idea any of this existed until now (or yesterday haha) so... yay!
 
  • Like
Reactions: ze7zez
It is worth doing in ubuntu apt install net-tools

So far I'm trying, but x11vnc doesn't start properly.
I prepared x11vnc configuration for later for easy session opening in TightVNC Viewer on PC. The session password is zero.

Code:
echo "zero" > /home/zero/.vnc/passvnc
echo "-forever" > /home/zero/.x11vncrc
echo "-shared" >> /home/zero/.x11vncrc
echo "-passwdfile /home/zero/.vnc/passvnc" >> /home/zero/.x11vncrc
 
  • Like
Reactions: jenneh
There is no need to install anything else.

I used >this< help.

USB debugging should be enabled on the phone.
On the smartphone in termux I typed:

proot-distro login ubuntu (I used history. Execute the history command and read the command number, type the command number e.g. !11)
su zero vncstart
and read the VNC server's assigned port 5904.

After connecting the smartphone to USB (you can also connect the phone to a local WiFi router), I typed adb forward tcp:5904 tcp:5904 in the terminal on the PC and opened the connection on the PC via TightVNC Viewer.

The PC mouse and keyboard work smoothly. :)(y)

edit
====
There is no error after logging out ubuntu in TightVNC Viewer that occurred after logging out in Nethunter Kex.
 

Attachments

  • ubuntu.png
    ubuntu.png
    250.9 KB · Views: 39
Last edited:
  • Love
Reactions: jenneh
In order to easily use commands in termux in android, it is useful to install a simple GUI fluxbox environment with a terminal:
pkg install aterm fluxbox
Once fluxbox& is running, you can open a termux session in TightVNC Viewer and you will see a gray fluxbox desktop. Use the right mouse button to open the terminal and type commands in termux, for example by pasting them (middle mouse button) from the Windows clipboard.
 
  • Love
Reactions: jenneh

jenneh

Senior Member
@ze7zez Thank You sosososo much for these shares. I finally have time to work through all this and will try to get the guide and machine updated in the next day or two with the steps you shared and credits to you. I really appreciate your time and most especially how you explained what fluxbox actually is. I had read that page before but I didn't understand fully what it was telling us. Thank you so much.
 
  • Love
Reactions: ze7zez
(...)

The machines are built from user submitted scripts that use proot. I am not the Author of the script that built this machine. The Honor lies HERE ( Source - Github)

(...)
It is worth building a new ubuntu.tar.gz from scratch, because of the audio output repair. I made one unsuccessful attempt, but ended up with no root access on the phone.

I thought about creating a proot-distro for another linux distribution since there are not many on https://github.com/termux/proot-distro

However, the above problem showed me that I don't have enough time to do that.
 
  • Like
Reactions: jenneh

jenneh

Senior Member
It is worth building a new ubuntu.tar.gz from scratch, because of the audio output repair. I made one unsuccessful attempt, but ended up with no root access on the phone.

I thought about creating a proot-distro for another linux distribution since there are not many on https://github.com/termux/proot-distro

However, the above problem showed me that I don't have enough time to do that.
Oh goodness I had read about root users having trouble with these things, because of the shared kernel, I am going to add a warning to the thread to help warn others about this. I'm sorry for your trouble on that front but I am glad you reported it. Thank you for suggesting to build a new ubuntu from scratch, I agree. I finally finished writing up a guide that will show the remoting part separately from this thread, so I don't confuse new users too much... So expect an @ later on when it's published. Then I'll do my best to build a new ubuntu machine with the steps now that we kinda understand whats going on here a little better.
 
  • Like
Reactions: ze7zez

jenneh

Senior Member
Hello :) the thread has been completely reworked with a new ubuntu vm built from scratch, that is half the size of the original share (394MB)

The build instructions were provided as well, so now anyone can make a distro in their preferred language. (after running the apt install xfce4 command, at some point you will be able to set this up)
 
  • Love
Reactions: ze7zez

jenneh

Senior Member
Hi There! The Ubuntu distro poses some problems when trying to install certain packages like firefox or chromium due to snapd and it's inability to operate correctly in android. Therefore we have to manually add the repositories so apt install will fetch the right repository and not the silly snap. (I may or may not be explaining that correctly, feel free to correct me if you know)

Here is how to fix the problem and install your browsers:

Code:
echo "deb http://ftp.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys 605C66F00D6C9793
apt update
apt install firefox-esr
apt install chromium
nano /usr/share/applications/chromium.desktop
press ctrl + w and search for "exec"
then add --no-sandbox after chromium

SOURCE

As an edit, another premade has been added to the OP with Chromium and Firefox preinstalled.
 

Attachments

  • 1.png
    1.png
    91.1 KB · Views: 30
  • 1.png
    1.png
    341 KB · Views: 27
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    NOTICE:
    THIS METHOD IS ONLY FOR NON ROOTED DEVICES
    1680701641466.png

    PROOT-DISTRO GITHUB PAGE

    Hello Friends!

    Today I wanted to start a thread that will house prebuilt Linux environments, as well as instructions for building the Linux environments yourself. These "environments" theoretically can be run on any non-rooted Android Device.

    The first premade being released is an Ubuntu (Jammy) environment with a GUI that I built from scratch and will show you how to build as well! It is as bare bones as I could get with just xfce4 for the gui and it's goodies package. Tightvncserver is installed as well so we can remote into the environment.

    (If you would rather use windows RDC then do not install tightvncserver)

    UBUNTU THEMED VERSION:
    1.png
    2.PNG
    3.PNG


    BASIC 'BUNTU VERSION:
    1.PNG
    2.PNG
    3.PNG
    INSTALLATION INSTRUCTIONS:

    Download and install Termux on your Android Device: DIRECT DOWNLOAD LINK

    Download the Premade Ubuntu Backup of your choice on your Android Device.

    JAMMY JELLYFISH ENVIRONMENTS:
    Basic Ubuntu Environment (xfce4, xfce4-goodies, tightvncserver) with no additional programs: DIRECT DOWNLOAD LINK (394MB)

    You are able to set your own user name and root password for the premade environment.

    Open Termux and run these commands:
    Code:
    pkg install x11-repo
    pkg update -y
    pkg install proot-distro -y
    proot-distro install ubuntu
    termux-setup-storage
    cd storage/downloads
    proot-distro restore ./ubxfce-backup.tar.gz
    proot-distro login ubuntu

    Now to setup your user name and root password:
    Code:
    passwd root
    useradd USERNAME
    passwd USERNAME

    Now run:
    Code:
    vncstart

    You will be asked to set a password for your vnc. Then you will be told which port number to use in your vnc.

    1.png


    Now you need to connect to the vnc server by using an app on your phone or by remotely connecting with your pc, both instructions are provided below. Then as soon as you connect, you will be done! Your Ubuntu Environment is now fully setup with a GUI, working internet, and root access.

    To change over to your user name and home, run this command:
    Code:
    su USERNAME
    Same as above, but with Chromium and Firefox installed: DIRECT DOWNLOAD LINK (625MB)

    You need to open chromium and then close it the very first time, it opens to a blank screen the first run for whatever reason.

    Open Termux and run these commands:
    Code:
    pkg install x11-repo
    pkg update -y
    pkg install proot-distro -y
    proot-distro install ubuntu
    termux-setup-storage
    cd storage/downloads
    proot-distro restore ./ubxfce2-backup.tar.gz
    proot-distro login ubuntu

    Now to setup your user name and root password:
    Code:
    passwd root
    useradd USERNAME
    passwd USERNAME

    Now run:
    Code:
    vncstart

    You will be asked to set a password for your vnc. Then you will be told which port number to use in your vnc.

    1.png


    Now you need to connect to the vnc server by using an app on your phone or by remotely connecting with your pc, both instructions are provided below. Then as soon as you connect, you will be done! Your Ubuntu Environment is now fully setup with a GUI, working internet, and root access.

    To change over to your user name and home, run this command:
    Code:
    su USERNAME
    RDP Version for use with Windows Remote Desktop Connection on PC: DIRECT DOWNLOAD LINK (626MB)

    OR you can use an RDP app on your phone.

    Firefox and chromium are preinstalled. Xrdp is used instead of tightvncserver.

    Open Termux and run these commands:
    Code:
    pkg install x11-repo
    pkg update -y
    pkg install proot-distro -y
    proot-distro install ubuntu
    termux-setup-storage
    cd storage/downloads
    proot-distro restore ./ubxfce3-backup.tar.gz
    proot-distro login ubuntu
    service xrdp restart

    Now to setup your user name and root password:
    Code:
    passwd root
    useradd USERNAME
    passwd USERNAME

    To change over to your user name and home, run this command:
    Code:
    su USERNAME

    lastly run ifconfig
    1.png

    Take note of your ip address and make sure you have setup a user with a password or a password for root, then open RDC on your PC or Phone and connect to this IP address. You will then need to type in your user name and password to connect.
    Customized to look more like Ubuntu, built for Windows RDC DIRECT DOWNLOAD LINK (804MB)

    OR you can use an RDP app on your phone.

    Sudo has been added to this machine. Thus it will come with a user this time.

    USERNAME PASSWORD
    root root
    zero zero

    Chromium asks for a key, it is 1111.

    Open Termux and run these commands:
    Code:
    pkg install x11-repo
    pkg update -y
    pkg install proot-distro -y
    proot-distro install ubuntu
    termux-setup-storage
    cd storage/downloads
    proot-distro restore ./ubxfce4-backup.tar.gz
    proot-distro login ubuntu
    service xrdp restart
    ifconfig
    1.png

    Take note of your ip address and open RDC on your PC or Phone and connect to this IP address. You will then need to type in either root root for the username and password or use the username zero password zero.

    LUNAR LOBSTER ENVIRONMENTS:
    For use with TightVNC or other VNC apps: DIRECT DOWNLOAD LINK
    Code:
    proot-distro install ubuntu
    termux-setup-storage
    cd storage/downloads
    proot-distro restore ./lunar.tar.gz
    proot-distro login ubuntu
    vncpasswd
    #set your password
    vncserver
    Built per this guide with no browsers or other programs installed : SEE GUIDE
    For use with TightVNC or other VNC apps: DIRECT DOWNLOAD LINK
    Code:
    proot-distro install ubuntu
    termux-setup-storage
    cd storage/downloads
    proot-distro restore ./lunar2.tar.gz
    proot-distro login ubuntu
    vncpasswd
    #set your password
    vncserver
    For use with Windows RDC or other RDC / RDP apps: DIRECT DOWNLOAD LINK
    Code:
    proot-distro install ubuntu
    termux-setup-storage
    cd storage/downloads
    proot-distro restore ./lunar3.tar.gz
    proot-distro login ubuntu
    service xrdp restart
    Now to setup your user name and root password:
    Code:
    passwd root
    useradd USERNAME
    passwd USERNAME
    There are many ways to do this, the first way being demonstrated today is using the gui package "xfce4" which will install a desktop environment for us, along with other features added from the "xfce4-goodies" package. Lastly tightvncserver is installed so we are able to remote into the distro. Takes 30 mins to an hour to install.

    If you would rather use RDC, do not install tightvncserver, use the package xrdp instead. You would then skip the vncserver step below.

    Lastly, it is possible to upgrade the distro's file system from Jammy Jellyfish, to Lunar Lobster. See the Customize spoiler below for more details. OR SEE THIS POST FOR A FULL LUNAR BUILD

    INSTALLATION INSTRUCTIONS:

    Download and install Termux on your Android Device: DIRECT DOWNLOAD LINK

    Code:
    pkg install x11-repo
    pkg update -y
    pkg install proot-distro -y
    proot-distro install ubuntu
    proot-distro login ubuntu
    apt update -y
    apt install xfce4 xfce4-goodies tightvncserver -y

    You can backup your Distro at this point prior to adding any passwords or users, or you may do this step later to backup your customizations to ubuntu with all the programs you have installed.

    To backup your distro, type:
    Code:
    exit
    termux-setup-storage
    cd storage/downloads
    proot-distro backup --output ubxfce-backup.tar.gz ubuntu
    #run this command on your pc
    adb pull sdcard/Download/ubxfce-backup.tar.gz
    #Return to Ubuntu
    proot-distro login ubuntu

    Now to setup your user name and root password:
    Code:
    passwd root
    useradd USERNAME
    passwd USERNAME

    Lastly run:
    Code:
    vncstart

    You will be asked to set a password for your vnc. Then you will be told which port number to use in your vnc.

    1.png


    Now you need to connect to the vnc server by using an app on your phone or by remotely connecting with your pc, both instructions are provided below. Then as soon as you connect, you will be done! Your Ubuntu Environment is fully setup with a GUI, working internet, and root access.

    To change over to your user name and home, run this command:
    Code:
    su USERNAME
    If you are going to be connecting to your Ubuntu Environment using only your phone, you will need a Vnc Viewing App.

    Type our local ip address of "127.0.0.1:" then add your port number after the :
    1.PNG


    You can name the connection whatever you like, then save and connect. You should be asked for your vnc server password now.
    1.PNG

    Run ifconfig
    1.png


    Note your ip address next to wlan0.

    Then connect to the ip address in the app with your user name and password.

    If you know of a better RDC app please let us know in the comments below. I do not use these apps regularly. (personally use the PC RDC) Only verified it could run in the app.
    If you want to be able to remote connect using your pc, decide if you want to use TightVNC or Windows Remote Desktop Connection.
    Run ifconfig
    1.png


    Note your ip address next to wlan0.

    Now open TightVNC for Windows - DIRECT DOWNLOAD LINK

    2.PNG


    Enter your local ip address: and the port number provided to us earlier.

    3.PNG


    Then enter your vnc password.

    Now you are all set!
    So, the package "xrdp" in this Ubuntu port cannot run with tightvncserver installed. Idk why. It took me 3 days to learn this... x.x but yay here we go!

    INSTRUCTIONS:
    Code:
    apt purge tightvncserver
    apt install xrdp
    service xrdp start
    ifconfig
    1.png


    Grab your ip address and make sure you have setup at least a root password, or a user.
    then login to windows remote desktop connection with your ip address and type either root and your root password or the username and user password you set.

    1.PNG

    If you get disconnected and are unable to reconnect in RDC, run this command:
    Code:
    service xrdp restart
    It is also possible to remote into your phone without installing proot-distro.
    OPTIONAL STEP!!

    You are able to change your Ubuntu file system version by updating the repository sources.

    Code:
    nano /etc/apt/sources.list
    Then edit jammy to lunar or whatever version you want and save. (ctrl + o and enter, then ctrl +x to exit)
    TIMESTAMPED VIDEO OF THIS PART (earlier versions are likely not to work but it doesn't hurt to try. confirmed bionic beaver is not working)

    Lastly run:
    Code:
    apt update
    apt upgrade -y
    This is for the Jammy Jellyfish version, since the snaps wont work. It is being determined now if Lunar is still having these troubles
    Code:
    echo "deb http://ftp.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list
    apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
    apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
    apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys 605C66F00D6C9793
    apt update
    apt install firefox-esr
    apt install chromium
    nano /usr/share/applications/chromium.desktop
    press ctrl + w and search for "exec"
    then add --no-sandbox after chromium
    press ctrl + o to save and ctrl + x to exit
    1.png
    This port does not come with sudo natively installed. We are able to install it and add any users to the sudoers file.
    Code:
    apt install sudo
    nano /etc/sudoers

    Now scroll down to where you see Root, and add your username below. Then copy the ALL=(ALL:ALL) ALL and paste it next to your username.
    TIMESTAMPED VIDEO OF THIS PART
    This is how the ubxfce4 environment was built. This is a write up of the video below with some modifications and is easier to go through if you watch the video with it.


    Code:
    apt install ubuntu-wallpapers gedit plank yaru-theme-gtk yaru-theme-icon xfce4-appmenu-plugin rofi git -y

    Right click on your desktop and select desktop settings.

    In desktop settings, select Folder, then select Other.

    This should open you into the xfce backgrounds folder, at the top left, click on the "share" tab. Now highlight the backgrounds folder and select open at the top right.

    This will load our wallpapers into settings, make a selection!

    Now go into settings > appearance and select the color you would like for your windows.

    Next go into settings > windows manager and select your theme, yaru-dark is what is used in the premade.

    Now go into settings > default applications and you can change the file manager and terminal emulator.

    Now go into settings > window manager tweaks and uncheck Draw frame around selected window while cycling.

    Now select the Placement tab and move the ball to the middle.

    Now right click on your panel and highlight panel, then select panel preferences.

    Switch to panel 2 and select the minus button to remove it.

    Switch back to panel 1, You may edit your icon size if you like under Appearance, then switch to the items menu and select applications menu.

    You can select any icon you would like by hitting "select icons from" and then the "image file" tab

    (I downloaded the SVG file and placed it into usr/share/icons)

    You can remove the workgroup, notifications, and windows button panel options if you would like.

    You can double click on the clock option to edit the time to look how you want.

    You can move the clock in between the separators and expand the separators to change the clock's placement.

    Now we can click on action buttons and take the check off everything except logout.

    pling.com/p/1463576

    Now open a terminal

    Code:
    cd ~/Downloads
    mv Azeny.tar.gz /usr/share/plank/themes
    cd /usr/share/plank/themes
    tar -xvf Azeny.tar.gz
    rm Azeny.tar.gz

    Now right click on desktop and go into desktop settings.

    Click on the icons tab and change icon type to none.

    Now run:
    plank --preferences

    Turn on Icon Zoom then change position to the left and switch the theme to Azeny.

    Go back into panel preferences, click on items, and add a new item. Select App menu plugin.

    Shift the app menu plugin's position to second from the top to fix the panel.

    Click on app menu and select use CompactMode.

    Now go into settings > session and startup session, switch to application autostart and select add.

    Name it plank and set the command to plank.

    Now exit the ubuntu session and restart.

    Now you can add more applications to the plank menu by running them then right clicking their icons to dock them.

    Code:
    git clone https://github.com/adi1090x/rofi
    cd rofi
    ./setup.sh
    cd
    cd .config/rofi
    rm config.rasi
    cd launchers/type-3
    nano launcher.sh
    change the theme number from 10 to 1

    Code:
    nano style-1.rasi
    Under fullscreen false, change the width to: 1400
    Add a line beneath width called height and set it to: 650
    Edit background-color to black / 10% --- you can set this to what you like

    Scroll down to input bar and change margin to 0% 25%

    Scroll down to list view and set scrollbar to true;

    pling.com/p/1529470

    Code:
    cd ~/Downloads
    unzip xpple_menu.zip
    rm xpple_menu.zip
    mkdir ~/local/share
    mv applications ~/local/share/
    mv Pictogrammers-Material-Dots-square.svg ~/local/share/applications
    mkdir -p ~/local/share/menu
    mv xpple.menu ~/local/share/menu
    cd ~/local/share/applications
    nano Launchpad.desktop
    change Exec=sh -c ~/.config/rofi/launchers/misc/launcher.sh
    to Exec=sh -c ~/.config/rofi/launchers/type-3/launcher.sh

    Then in applications, drag and drop rofi to your panel and open panel prefs. We can change the icon in here like before.
    (/local/share/applications/Pictogrammers-Material-Dots-square.svg)
    Only if you need!

    There are / were problems with Android 12 and force closing Termux. To fix this you can run this adb command:
    Code:
    adb shell device_config put activity_manager max_phantom_processes 2147483647
    TERMUX'S KNOWN ISSUES GITHUB LINK
    WHAT IS THE DIFFERENCE BETWEEN A WINDOWS MANAGER AND A DESKTOP ENVIRONMENT GUI

    Differences in vnc xrdp and gnome desktop:

    Some xrdp knowledge, the installer script does not work for this distro:

    Ranking linux desktops:

    How to use the GNOME Desktop Environment:

    How to install gnome in ubuntu --not working:

    How to make tasksel work (^):

    A good writeup on gui environments usable in Ubuntu:

    What is the xserver

    Wild tangent on proot-distro origins and one of the devs

    Explains ppa repository:

    Fix apt-get update “the following signatures couldn’t be verified because the public key is not available”:

    How to manually add repositories:

    Step by step guide installing xfce:

    How to add or delete users in Ubuntu:

    Make the Ubuntu port look like a traditional ubuntu desktop environment:

    Sysv way to get around sysd things (in comments)

    How to check processes:

    How to check if your device supports kvm and other kvm knowledge:

    Building Android for Qemu -- saving for me

    How to list all installed packages:

    Build Your Own Distro With Archiso:

    How to edit Tightvncserver password:

    Showed where xrdp config files are located:

    Please note the environments aren't perfect, there's a lot to be discovered and learned here. The way this is built, as improvements are made, the backups can be updated to reflect those changes. Please please do share if you understand how to improve anything or if you know anything about this stuff you want to share. I love learning from you all!

    A Very Special Thank You to @ze7zez for taking the time to test the prebuilt, as well as educate us!!

    PS I made a mistake in referring to these "Environments" as "Virtual Machines" They are not vms. They share the same kernel as our phone, and therefore are not as secure as a VM. THANKS!
    2
    The next "Premade" is a Debian Environment built from scratch with all code provided. It's gui environment is provided by gnome, which I haven't been successful installing in ubuntu
    Screenshot_20230330-040729~2.png
    Screenshot_20230330-040719.png

    11.png
    12.png
    13.png
    HOW TO INSTALL THE PREMADE:
    First Download the Debian Backup: DIRECT DOWNLOAD LINK
    Then run this code:
    Code:
    pkg install x11-repo
    pkg update -y
    pkg install proot-distro -y
    proot-distro install debian
    termux-setup-storage
    cd storage/downloads
    proot-distro restore ./debian-backup.tar.gz
    proot-distro login debian
    vncserver

    HOW TO BUILD YOUR OWN:
    You can select your native language this way. It will take 30 mins - an hour to setup
    Code:
    pkg install x11-repo
    pkg update
    pkg install proot-distro -y
    proot-distro install debian
    proot-distro login debian
    apt update -y
    apt install task-gnome-desktop -y
    apt install gnome-session-flashback tightvncserver vim -y
    vncserver
    vi .vnc/xstartup

    Press the letter "i" and then erase everything on screen and paste all of the code below
    Code:
    #!/bin/sh
    autocutsel -fork
    xrdb $HOME/.Xresources
    gnome-control-center "$VNCDESKTOP Desktop" &
    xsetroot -solid grey
    export XKL_XMODMAP_DISABLE=1
    export XDG_CURRENT_DESKTOP="GNOME-Flashback:Unity"
    export XDG_MENU_PREFIX="gnome-flashback-"
    unset DBUS_SESSION_BUS_ADDRESS
    gnome-session --session=gnome-flashback-metacity --disable-acceleration-check --debug &
    When done, press ESC and type :wq to save and exit vim

    Now type vncserver and connect to your machine using the port number provided

    Source:
    1
    Very correctly written instructions.

    I don't know if it's Nethunter Kex or Ubuntu's fault, but after logging out of Ubuntu there is some crash with a message about "Connection failed". Restarting Nethunter Kex ends with a java error message and you have to restart the phone.
    1
    Very correctly written instructions.

    I don't know if it's Nethunter Kex or Ubuntu's fault, but after logging out of Ubuntu there is some crash with a message about "Connection failed". Restarting Nethunter Kex ends with a java error message and you have to restart the phone.
    Thank you for reporting this. I am unsure which it would be, or if it is due to how the distro was backed up and restored, but will see if it can be fixed somehow. This is the first day with the backups, had always just ran it off the scripts and didn't experience that error running it that way. So interesting!
    1
    It would be extremely interesting if you described how to open a connection on the local network from a larger PC screen, for example.
    The operation of the interface on a smartphone is smooth and efficient, but still, the virtualization of the desktop size is not what is easy to use.