Installing Ubuntu on Android - An overview

Created: 2012-12-09 by Chad Clark


Synopses:

This is an overview of how I installed Ubuntu 12.04 inside Android so I could work on Go code while in a train tunnel and outside of network coverage. Please note you will not find a detailed list of all of the commands you will need to run on this page.

My setup is a Nexus S running stock Android 4.1.2.

Steps:

  1. Install Android Terminal Emulator
  2. Install Complete Linux Installer
  3. Run the "Complete Linux Installer" and install just the "core" of Ubuntu 12.04.
  4. Inside the chroot as root run apt-get install gccgo
  5. Inside the chroot as root run apt-get install git emacs23-nox
  6. Inside the chroot the user named ubuntu has the password ubuntu.
  7. I had to run sudo chmod 666 /dev/tty . Before doing that I was not able to ssh from a non-root account. I ran into this while trying to install my github ssh key.
  8. I also had to add the new non-root user to all the same groups that the ubuntu user is in (other than the ubuntu group itself) using vigr and vigr -s before my new user could access the network. The socket() system call would return EACCES until I added the groups.

Tips:

  1. If you enable sshd the you can ssh from a tablet to your phone when the phone is acting as a wifi access point.
  2. After connecting your Android device to a linux desktop via USB you can forward port 2222 on your desktop to OpenSSH on port 22 on the Android devices by running adb forward tcp:2222 tcp:22 . This lets you copy & past commands into the shell.

Resources:

  1. linuxonandroid.org and the wiki.
  2. The Go language.
  3. GitHub setup help.