kde-on-android
kde-on-android copied to clipboard
Install kde-plasma-desktop and ubuntu on android (chroot)
kde-on-android
Install kde-plasma-desktop and ubuntu on android (chroot)
REQUIRES ROOTED DEVICE
Requires at least 5 GB of storage, approx <1.5 GB of network data

Backup and rename your /sdcard/linux.img if you have one
Initial Setup
- Install Linux Deploy and Termux
- Open Linux Deploy.
- Goto Linux Deploy Settings and change the following settings
- Distribution :
Ubuntu - User name :
username - User Password :
password - Init > Enable (tick checkbox)
- Init > Init Settings > Init user :
username - Mounts > Enable (tick checkbox)
- Mounts > Mount points >
+icon on top right > Source :/sdcardTarget :/sdcard - SSH > Enable (tick checkbox)
- Distribution :
- Click
⋮icon in Linux Deploy > Install . It needs a stable Internet connection, otherwise it might fail at some step. Proceed to next step only after installation is complete. - Press
STARTbutton in Linux Deploy. - Open Termux and type following commands.
apt updateapt install -y openssh e2fsprogs pulseaudioecho "pkill pulseaudio;pulseaudio --start --exit-idle-time=-1 && pacmd load-module module-native-protocol-tcp auth-anonymous=1" > $PREFIX/etc/profile.d/pulseaudio.shchmod +x $PREFIX/etc/profile.d/pulseaudio.sh$PREFIX/etc/profile.d/pulseaudio.shtermux-setup-storage(Allow termux to access storage)e2fsck -f /sdcard/linux.img(Press enter on all prompts. Recommended to stop linux deploy before this step and start after resizing!)resize2fs /sdcard/linux.img 5G(This step will change size of linux.img to 5G. You can change it anytime required.)ssh-keygen(Press Enter on all prompts. If it asks for overwrite type 'y' and press Enter)ssh-copy-id -i ~/.ssh/id_rsa username@localhost(Type "yes" to accept fingerprint. On prompt for password type password you set in Linux Deploy)ssh username@localhost
- Now you should be logged into ubuntu. Verify it by running
whoamiorsudo apt install -y neofetch && neofetchand it should display your username. - Run the following commands in ubuntu.
sudo passwd(Set root user password. Enter your password 2 times. This is root user password, the password set in Linux Deploy was username user password)sudo su -c 'grep -qxF "deb http://ports.ubuntu.com/ bionic-updates main restricted" /etc/apt/sources.list || echo "deb http://ports.ubuntu.com/ bionic-updates main restricted" >> /etc/apt/sources.list'sudo apt updatesudo DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgradesudo apt install -y ubuntu-release-upgrader-coresudo do-release-upgrade -f DistUpgradeViewNonInteractive(Press 'Enter' key on any prompt. Upgrades from ubuntu bionic 18.04 to focal 20.04. Takes long time)sudo sed -i 's/Prompt=lts/Prompt=normal/g' /etc/update-manager/release-upgradessudo do-release-upgrade -f DistUpgradeViewNonInteractive(Press 'Enter' key on any prompt. Upgrades from ubuntu focal 20.04 to hirsute 21.04. Takes long time)sudo do-release-upgrade -f DistUpgradeViewNonInteractive(Press 'Enter' key on any prompt. Upgrades from ubuntu hirsute 21.04 to Impish Indri 21.10. Takes long time)sudo apt install -y kde-plasma-desktop(Press 'Enter' key on any prompt. Installs plasma kde desktop. apprx 600 Mb. download)sudo apt remove -y tightvncserver && sudo apt install -y --install-suggests tigervnc-standalone-server dbus-x11 net-toolssudo service dbus startsudo bash -c 'mkdir -p /etc/rc.local && echo -e "#!/bin/bash \n [[ -z "\$PULSE_SERVER" ]] && export PULSE_SERVER=127.0.0.1 \n sudo rm -rf /etc/profile.d/pulse.sh \n vncserver -kill :1 \n sudo rm /tmp/.X11-unix/X1 /tmp/.X1-lock \n dbus-launch tigervncserver -localhost no -geometry 1366x768 -xstartup /usr/bin/startplasma-x11 -listen tcp :1" > /etc/rc.local/init'sudo bash -c 'echo -e "#!/bin/bash \n [[ ! -z "\$XDG_CURRENT_DESKTOP" ]] &&echo "Execute this command from termux after logging in to ubuntu via ssh" && exit \n export PULSE_SERVER=\$1 \n vncserver -kill :1 \n /etc/rc.local/init">/bin/audioserver 'sudo chmod +x /etc/rc.local/init /bin/audioservervncpasswd(Here set your VNC password to be used in vnc viewer. Enternwhen it asks for "Would you like to enter a view-only password".)sudo mv /etc/apt/apt.conf.d/20packagekit /etc/apt/apt.conf.d/20packagekit.disabled(Fix the "Error connecting: Could not connect: Connection refused" bug with apt)
Now simply restart linux container. Linux Deploy>STOP. Linux Deploy>START.
View on android
- Start container from Linux Deploy>START.
- Install the VNC viewer app.
- Add a new computer and use
locahost:5901as address. Set Picture Quality to "High". - Enter your vnc password that you had set with vncpasswd.
- Enjoy. :-)
View on PC
- Start container from Linux Deploy>START.
- Install Remmina
- On Windows: Use any VNC viewer available for windows. For example TigerVNC or realVNC. I don't use windows so I don't know which is better.
- On Linux PC:
sudo apt install -y --install-suggests remmina remmina-plugin-vnc
- Connect your android and PC to a common network. For example to a common wifi, or start mobile hotspot and connect PC to it.
- Type
ifconfigin Termux. You will see a screen similiar to below image. Get theinetofwlan0orwlan1whichever represents your common network. This is the address you will use in VNC viewer. Lets call itinternal_ip
- In address of VNC viewer type internal_ip:5901. Press Enter key.

- If the resolution is incorrect and video seems to be cut, refer to Changing Display Resolution in customisation section below.
- Enjoy :-)
Customisation
This section includes some customisations to make life easier. ;-). These steps are completely voluntary, and my personal preference. Login to ubuntu via termux or vnc viewer (and open konsole). Also restart linux container after customisation to take effect.
- Install firefox :
sudo apt install -y firefox - Install ZSH as default shell :
sudo apt install -y zsh && sudo chsh $(which zsh) - Install OhMyZsh :
sudo apt install -y curl git && sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" - Install zsh plugins : zsh-auto-suggesitons, zsh-syntax-highlighting and command-not-found . Open ~/.zshrc and change the plugins line to
plugins=(git command-not-found zsh-autosuggesitions zsh-syntax-highlighting). Note that zsh-syntax-highlighting should be the last plugin. - Installing kdeconnect - The ultimate android integration with linux
- Resizing linux.img, in case your linux runs out of storage.
- Make sure linux container is stopped. Linux Deploy>STOP.
- In termux type
e2fsck -f /sdcard/linux.img(Press enter on all prompts.)resize2fs /sdcard/linux.img 10G(Replace 10G with the amount of storage u want linux to have)
- Changing Display Resolution : If you are using vnc viewer on PC then you might have to change resolution. First get the resolution of your PC display. You can google it, or in Linux pc use
xdpyinfo | grep 'dimensions:'to find resolution.- Run the following command in ubuntu to change resolution. Replace 1366x768 with your resolution
sudo bash -c 'echo -e "#!/bin/bash \n [[ -z "\$PULSE_SERVER" ]] && export PULSE_SERVER=127.0.0.1 \n sudo rm -rf /etc/profile.d/pulse.sh \n vncserver -kill :1 \n sudo rm /tmp/.X11-unix/X1 /tmp/.X1-lock \n dbus-launch tigervncserver -localhost no -geometry 1366x768 -xstartup /usr/bin/startplasma-x11 -listen tcp :1" > /etc/rc.local/init'
- Run the following command in ubuntu to change resolution. Replace 1366x768 with your resolution
- Setting up audio output :
- Audio via android : Make sure that termux is running in background, and audio should work out-of-the-box.
- Audio via Linux pc : Currently I only know how to do this on linux pc with pulseaudio installed. Open terminal your linux pc and type :
pacmd load-module module-native-protocol-tcp auth-anonymous=1(You can also add it to your .profile file, so it will run on startup from next boot.)ifconfig(and get theinetaddress. Lets call it internal_ip)- Login to ubuntu via termux and type
audioserver internal_ip(Replace internal_ip with the inet address you got from linux pc. After this command vncserver will restart and you have to reconnect to vnc with audio output to your linux pc ip address.)
- Login to ubuntu via termux and type
- Installing kde-full : KDE just doesn't end here. KDE has its own, tons of personalised and beautiful ui applications. Install full set of kde applications by running
sudo apt install -y kde-full(approx 1000 Mb).