2010-01-25

Setting Up a Minimal Graphical Ubuntu (Karmic Koala)

i had been using Ubuntu previously, until around the time Fedora Leonidas was released, when i decided to give Fedora a try, and since then have stuck with it (also upgrading to the more recent Constantine). One thing that i liked about Fedora which was not present in Ubuntu (Desktop) was the opportunity to select the packages i want during installation. Instead, Ubuntu installs a number of applications by default, most of which i don't use (e.g. Ekiga Softphone and all the games). Sure, i could remove those applications after installation, but that would still leave some previously-dependant packages present when there would actually be no remaining dependency on them.

However, recently i decided to try out the latest version of Ubuntu (Karmic Koala), and got attracted back again. Mainly, its pleasant looking fonts (the same fonts in Fedora somehow didn't look as good) and excellent package management system proved irresistible. Happily, i also found that i could achieve an equivalent of selecting only the packages that i want by starting out with the server version.

1. Install Ubuntu using the Server Installation CD. At the "software selection" stage (DNS server, LAMP server, mail server, etc), select NOTHING. Complete the installation, and reboot and login to the command line interface.

2. RECOMMENDED: Update the existing packages to the latest version by doing

$ sudo aptitude update && sudo aptitude safe-upgrade

(The machine may need to be rebooted one more time after this if the kernel was also upgraded.)

3. Install the minimal packages needed for the graphical interface:

$ sudo aptitude install xorg gnome-core

(Here, i'm going for the Gnome desktop. If you want a really lightweight system, you may want to use Xfce instead. In that case, install the package xfce4 instead of gnome-core.)

4. Launch the graphical interface. There's no need to reboot. Just run

$ startx

Now we have the very minimal graphical desktop installation for Ubuntu with the following applications:

nautilus
gedit
gnome-terminal
gnome-sound-recorder (i have no idea how this got there)
system monitor
preferences

From this point on, we use aptitude or apt-get to install other applications as needed.

5. OPTIONAL: If you want a graphical login screen instead of having to type startx to get to the graphical interface, install GDM:

$ sudo aptitude install gdm

6. OPTIONAL: If you want to use a graphical frontend for installing packages, install Synaptic:

sudo aptitude install synaptic

Reference: http://ubuntuforums.org/showthread.php?t=1334736

HTH.

2010-01-16

Using Android Debug Bridge (ADB) in Linux

i have just done the necessary setup to do some Android development on my Fedora 12 machine using Eclipse (Galileo) and the Android SDK. As i have a HTC Dream (or G1) with me, i also wanted to deploy and test directly on the phone itself instead of using an emulator.

However, things didn't go very smoothly when trying to connect to the phone through ADB.

What i had done to that point was:

1. Created a simple Hello World Android application.

2. Turned on the USB Debugging option on the phone (Menu > Settings > Applications > Development > USB Debugging).

3. Connected the phone to the PC (there was an acknowledgement there on the phone in the form of a notification: USB debugging connected - A computer is connected to your phone).

However, when i tried to run the application, the Android Device Chooser (i had set the Deployment Target Selection Mode to Manual) showed this:



And of course, i couldn't run the application even after selecting the "unknown" target.

Doing a adb devices on the command line also showed a problem:

$ ./adb devices
List of devices attached
???????????? no permissions


It turned out that this was quite a common problem (at least for those developing in Linux), and quite a number of pages (references at the end of article) were devoted to solving (or actually, working around) it. Broadly, there were three different workarounds (or rather, attempts).

1. Ensure that the phone device was added with world writable and readable permissions.

Create the new file /etc/udev/rules.d/50-android.rules containing the line

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"

Reload the rules by doing

# udevadm control --reload-rules

Thereafter, when the phone is plugged in, the corresponding devices in /dev would have the rw-rw-rw- permission.

However, this did not work. i do not know why, but from some trial and error, it seemed like it was necessary for the ADB server process and the phone devices to be owned by the same user. This led to the other two workarounds.

2. Start the ADB server as root.

Simply, kill the existing ADB server process

# ./adb kill-server

and start it up as root

# ./adb start-server

i'm not too keen on this though, as i try and avoid starting any process as root.

3. Connect the phone device as the non-root user who starts the ADB server process.

The steps are similar to the first (unsuccessful) workaround, with the content of the /etc/udev/rules.d/50-android.rules file slightly different

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", OWNER="user"

where user is the user who starts the ADB server process.

This is still not completely satisfactory though. If another user were to use the same machine, he/she would face the same issue. (At this point, you may be thinking about groups. i've tested it, and no, having the user who starts the ADB server process to be a member of the disk group (the group that owns the phone device) still is insufficient.) However, i'm running a single-user system, so this workaround was still acceptable.

Notes:
The ATTRS{idVendor}=="0bb4" works for my HTC Dream. If you have a different Android device, you may need a different vendor ID. i'm not too sure about this.

References:
http://www.2linessoftware.com/2009/01/31/getting-android-sdk-to-work-with-fedora-10/
http://forum.xda-developers.com/showthread.php?t=561270
http://www.manvstech.com/2009/12/06/android-sdk-i386-on-64-bit-system-cannot-open-shared-object-file-issue/
http://androidforums.com/support/3534-problems-mounting-communicating-g1-ubuntu.html
http://www.mail-archive.com/android-discuss@googlegroups.com/msg14523.html

HTH.

Eclipse Issue With GTK on Fedora 12

i have downloaded Eclipse (Galileo) - downloaded from eclipse.org instead of installing from repository - and was trying to add some plugins when i ran into problems with an unresponsive button. Specifically, after configuring the Name and Location in the Add Site dialog, nothing would happen upon clicking on the OK button. It seemed like an application freeze except that i could still click on Cancel to get out of the dialog.

After spending a good couple of hours trying out a number of different things, including but not limited to, increasing heap size, using different JDK/JRE, using fresh workspace, deleting .eclipse folder, running as root, running as non-root, etc, i got to the point of trying to file a bug report.

It was at the point of searching for similar bugs when i found https://bugs.eclipse.org/bugs/show_bug.cgi?id=298899.

According to the bug report comments, this issue will be fixed in 3.6 as well as 3.5.2. For now the workaround would be to set the environment variable GDK_NATIVE_WINDOWS=true before launching Eclipse.

i.e. i have a script eclipse.sh that contains

#!/bin/sh
export GDK_NATIVE_WINDOWS=true
/opt/eclipse/eclipse


and i launch Eclipse through this script instead.

HTH.