Add a GUI to Ubuntu
Before installing a Graphical User Interface I guess it is better to know what to do and how to do:
- Download the VNC Viewer from Google Play or directly from the website and install it on your phone.
We will install the VNC server on Ubuntu and with the VNC client installed on Android, we will connect to Ubuntu. We will also install the necessary packets to add a GUI to Ubuntu.
- The file we have to edit is the
This file checks the updates for Ubuntu from its repositories.
We have to edit it by adding this row:
deb http://ports.ubuntu.com jaunty main universe multiverse
We can now save it!
- Now turn the wifi on or use your data connection and send this command to Ubuntu:
./adb remount ./adb shell cd sdcard sh startubuntusd
To access to Ubuntu and:
apt-get update -> to update the system apt-get install tightvncserver -> the vncserver apt-get install lxde -> the LXDE GUI Or we can use the Icewm instead of Lxde, I used Lxde. apt-get install icewm
You might have some errors during the updates, just repeat every command until the system take all the updates, it’s important that they’re 100% done.
When you will give the command to install the Lxde GUI it will start the setup procedure, you can say Yes to all.
- Send this commands:
export USER=root vncserver -geometry 480x320
There’s no need to modify the resolution at the moment, this is something we will change later on.
It is asking for a password now, choose one. It must be more than 4 char length and more important, you must remember it… Mine was 123456.
When it asks for a special password choose NO – this is very important.
Vnc now started but we don’t use it at the moment, just kill it:
vncserver -kill :1
- If you installed the Lxde, use this command to create the Xstartup and paste the code below:
sudo gedit EXTOFYOURPHONE/root/.vnc/xstartup
#!/bin/sh #xrdb $HOME/.Xresources #xsetroot -solid grey #x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #x-window-manager & # /etc/X11/Xsession icewm & lxsession
Else, if you installed IceWM:
#!/bin/sh #xrdb $HOME/.Xresources #xsetroot -solid grey #x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #x-window-manager & # /etc/X11/Xsession icewm & xterm
- This step is very important, it made my Ubuntu boot up after 3 days.
We have to use the chmod to add the execution flag to xstartup.
Lets give this command:
chmod 755 xstartup
./adb remount ./adb shell chmod 755 /sd-ext/ubuntu/root/.vnc/xstartup
.bashrcfile starts every time the superuser log in to the system, we can edit this file adding some code.
Copy the code below at the beginning of
export USER=root alias vncstart='vncserver :1 -geometry 1024x768 -depth 16 -pixelformat rgb565' alias vncstop='vncserver -kill :1' cd / rm -r -f tmp mkdir tmp cd /
vncserver :1 -geometry 1024x768
We used before the 480×320 px resolution, we can change it now!
The code is longer than before because I found out this is the correct string to don’t let video errors appears.
aliascreates variables and we used both
The second part of that code is about the TMP directory, it is better to erase it at every Ubuntu startup.
vncstopto start and stop the vnc, without writing the whole code.
We modified the EXT partition again, lets reboot !
- We finished! Lets start Ubuntu
./adb remount ./ad shell cd sdcard sh startubuntusd vncstart
We can now open the VncViewer we installed before.
password: the one you used before (123456)
Once hit “Connect” we’re in and we cann see Ubuntu running with the GUI we chose!!
To stop it simply type
vncstopon Ubuntu shell and from the vncviewer hit disconnect.
Ubuntu is still mounted in the memory however, if we reboot we will refresh the EXT and the RAM as well.
- One last thing that I have never read on internet tutorials:
VNC starts using 5900 port as default, the 5901 is the first available and that is why we used this port before.
When we send the
vncstartcode we can see, through
localhost:Nwhich is the port that VNC is using at the moment, it could be localhost:2 – localhost:3 and so on.. the port we must use for the vnc streaming must be the same of localhost:N
localhost:3 would want the 5903
At this point we have to work on a file located in the EXT partition in Ubuntu folder, we can reboot the phone in Recovery mode and mount the memory card from recovery therefore use ADB to work on this file, or we can use a Linux OS and do everything with the GUI of Linux (just like I did with Kubuntu).
After the download and installation of every packet I suggest you to repeat again all the update commands to be sure that everything is installed properly.
We have to edit one more file, this one is the
xstartup, it is located under
The X server is used on every Linux/Unix based system and it is the base of the GUI.
If you’re using Windows OS, you can use the
ADB Pull / Push to transfer the xstartup file from Android EXT partition to Windows OS and edit it with notepad.
Everything is (almost) ready!
We can now create 2 scripts so we can run fast commands to start and stop Ubuntu and Vnc, and an algorithm to clear the temp files.
I was able to run and play a bit with Ubuntu but I used the HTC G1 which is not so powerful and it lagged a bit, but it worked!
Unfortunately I don’t have screenshot but that has been a great goal! Even better than when I run Windows 3.1 on Nokia N81 with Dosbox… !