Debian

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Running X as normal user)
(Using dbus as a normal user)
Line 264: Line 264:
 
* '''copy''' /etc/dbus-1/system.d/frameworkd.conf to /etc/dbus-1/system.d/my-frameworkd.conf
 
* '''copy''' /etc/dbus-1/system.d/frameworkd.conf to /etc/dbus-1/system.d/my-frameworkd.conf
 
* open /etc/dbus-1/system.d/my-frameworkd.conf and replace all instances of 'user="root"' with 'user="youruser"'
 
* open /etc/dbus-1/system.d/my-frameworkd.conf and replace all instances of 'user="root"' with 'user="youruser"'
 +
 +
Alternatively, replace all instances of 'user="root"' with 'group="messagebus"' and add your user to the messagebus group.
  
 
== Sound ==
 
== Sound ==

Revision as of 00:51, 30 January 2009


Debian is used on many other embedded devices. Using Debian on the FreeRunner gives access to the Huge army of software packaged in the Debian repositories, already compiled for the arm processors. Moreover, one can build one's own things without having to learn the OpenEmbedded way. For example compiling natively is a snap with Debian, just apt-get gcc&libc-dev.

In the early days, one had to install Debian manually. Now there is an installer script. The "official" instructions on how to install Debian on FreeRunner or Debian on Neo1973 are hosted on Debian's wiki. This page is about post-install configuration and FreeRunner specific tips. For support or bug reporting please read the section Support.

Contents

Configuring a base system

Password

The default root password is blank. You should change that as soon as possible

# passwd

Suspend

Press the power button or run 'apm -s' to suspend. To change the time for the display to darken/turn off edit in

 /usr/share/python-support/fso-frameworkd/framework/subsystems/odeviced/idlenotifier.py

the section

       self.timeouts = { \
                       "idle": 10,
                       "idle_dim": 20,
                       "idle_prelock": 12,
                       "lock": 2,
                       "suspend": 20, \

idle_dim is the time in seconds to dim the display (which adds up to the idle time), idle_prelock is the time to turn it off. After that execute

 mv /var/lib/python-support/python2.5/framework/subsystems/odeviced/idlenotifier.pyc /var/lib/python-support/python2.5/framework/subsystems/odeviced/idlenotifier.pyc.old

You can turn off Suspend completely by commenting out the entire section "Idleness Brightness Handling" in

 /etc/freesmartphone/oevents/rules.yaml

Time

The default time zone is UTC. Reconfigure it by running

# dpkg-reconfigure tzdata

To set the clock manually do something like

# date -s 00:33

If you have a network connection, do something like

# apt-get install ntpdate
# ntpdate-debian

If you want to synchronize the internal clock with GPS time you can use a script like

#!/usr/bin/env python
#
# Set the gps time
# Be sure your GPS is active before to launch this script

import dbus
import subprocess
import time

proxy = dbus.SystemBus().get_object('org.freesmartphone.frameworkd', '/org/freedesktop/Gypsy') # bus name, object name
interface = dbus.Interface(proxy, 'org.freedesktop.Gypsy.Time');
subprocess.call(['date',time.strftime( '%m%d%H%M%Y.%S', time.localtime(interface.GetTime()))])

Wifi

Using GUI

If you don't want to mess up with configuration files and are looking for an easy gui for wireless configuration, then wifi-radar or wicd is what you are looking for.

apt-get install wifi-radar
wifi-radar

or

apt-get install wicd
wicd-client -n

If you are looking for more, read on...

Using /etc/network/interfaces (simple mode)

Make sure the following packages are installed:

apt-get install wireless-tools wpasupplicant dhcp3-client

Assuming your wireless router uses WPA security and DHCP, edit /etc/network/interfaces to include a section like this:

auto eth0
iface eth0 inet dhcp
wpa-driver wext
wpa-ssid "MyWirelessName"
wpa-psk "MyWirelessPassword"

Where, of course, you're using the name of your wireless network and it's password instead of MyWirelessName and MyWirelessPassword.

You can test by running

# ifup eth0

You can determine your IP address by running

# ifconfig eth0

Issues:

  • only works if in presence of wireless network on boot, or when manually running ifup eth0
  • booting away from wireless network is slower because waits for DHCP to time out
  • does not reestablish connection when leaving wireless area and then returning
  • does not support multiple wireless networks or open hotspots that you may travel between

Once wpa_supplicant has begun managing your wifi interface, you should type "wpa_action eth0 stop" instead of "ifdown eth0".

Using wpa-supplicant (roaming mode)

To configure WPA to roam between wireless networks, you will need to create a new configuration file:

/etc/wpa_supplicant/wpa_supplicant.conf

a template for this file (and more documentation) is available in:

/usr/share/doc/wpasupplicant/examples/wpa-roam.conf

You'll need to add networks to this file. Examples:

  • WEP:
network={
       ssid="MySSID"
       key_mgmt=NONE
       wep_key0="abcdefghijklm"
#      wep_key0=6162636465  # <- no quotes, so hex number
       wep_tx_keyidx=0
       id_str="MySSID"
}
  • No key:
network={
       ssid="SomeNetwork"
       key_mgmt=NONE
}
  • WPA:
       network={
       ssid="Example WPA Network"
       psk="mysecretpassphrase"
       id_str="home"
}

Next, you'll need to edit /etc/network/interfaces. This lets you configure your wireless networks to use dhcp, or other appropriate TCP/IP settings:

auto eth0
iface eth0 inet manual
wpa-driver wext
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

# MySSID comes from an id_str above.
iface MySSID inet dhcp

# default is what's used if there is no id_str setting.
# so the 'SomeNetwork' network will use DHCP.
iface default inet dhcp

iface home inet static
# static interface settings, or whatever...

Finally, if you want attempts to access the internet to default to eth0 (and not usb0), then comment out this line under usb0 adapter configuration:

gateway 192.168.0.200


  • Roaming from network to network is not automatic. Instead, you need to manually run "wpa_action eth0 stop; ifup eth0" to switch networks

For some reason, I had to reboot for the id_str settings to take effect. However, you should now be able to use "ifup eth0" to associate with the access point and "wpa_action eth0 stop" to down the wifi adapter.

TODO: Which of the issues that single network configurations suffer from are addressed by WPA roaming mode? Would ifplugd / guessnet help, or just make things more complicated? (See: To-Do List)

Further reading

To use all the possibilities of wpasupplicant like roaming and automatic connection to different networks, you should read /usr/share/doc/wpasupplicant/README.Debian.gz

Bluetooth

The FreeRunner uses the standard Linux bluez stack, installed with

# apt-get install bluez-utils

There is also a module missing from /etc/modules, which is critical to getting your device recognized. (kudos to johnsu01 on irc.freenode.net:#openmoko-debian for the find)

# echo ohci-hcd >> /etc/modules

The first time you try this, you can also

# modprobe ohci-hcd

The only atypical part of using bluetooth on the FreeRunner is turning it on, which can be done with

# mdbus -s org.freesmartphone.frameworkd  /org/freesmartphone/Device/PowerControl/Bluetooth SetPower 1

Then the device should be visible using

# hcitool dev
TODO: Then what to do next? (See: To-Do List)

Packages manager

You can install dselect(~2.2MB) or aptitude(~12MB) to visually inspect the available debian packages using the desktop's console.
Also the gtk-based package-manager synaptic(~15.7MB) is working after installing lsb-release and hicolor-icon-theme, but it is very slow.
Finally, on constrained systems, just issue the command:

grep -e Package: -e Description /var/lib/dpkg/available|more

Xglamo acceleration

By default debian uses fbdev, but we can use Xglamo to get better performance:

apt-get install xserver-xglamo

after that edit /etc/X11/xorg.conf and change the line

Driver          "fbdev"

to:

Driver          "Xglamo"

and if you want to run xserver as normal user:

chmod u+s /usr/bin/Xglamo
You may also want to force the X server to 96 dpi to have the same fonts as with fbdev. Add "-dpi 96" to the X_OPTIONS variable in /etc/init.d/nodm:
X_OPTIONS="vt4 -nolisten tcp -dpi 96"

with that you:

  • can use xrandr
  • don't have the pointer callibration bug with the rotated mode
  • have better performances

Using xglamo you must remember that:

  • You can't use on xorg.conf the "Option Rotate" to rotate the screen
  • You can't use the tslib patch to simulate right click

Running X as normal user

1. Create a new user

# useradd -m -G audio,dialout,floppy,video,staff username
# passwd username

2. Edit /etc/init.d/nodm and change USER=root to USER=username in it. Then to make sure changes are not lost on upgrade, run

dpkg-divert --add /etc/init.d/nodm

This will make new versions of /etc/init.d/nodm be written to /etc/init.d/nodm.distrib

3. Edit /etc/X11/Xwrapper.config and change allowed_users=console to allowed_users=anybody (Or use dpkg-reconfigure x11-common)

4. Copy /root/.xsession into ~username/

5. Note that, if you ran zhone as root first, you may have to change ownership or remove /tmp/zhone.log, as a normal user is not able to write to a file owned by root.

6. If you have already configured to use Xglamo as a driver, chmod u+s /usr/bin/Xglamo (as can be read below)

Using dbus as a normal user

If you want to make calls or interact with the gps daemon through a dbus interface, you user will have to have the rights to do that. One way of adding these rights is as follows:

  • copy /etc/dbus-1/system.d/frameworkd.conf to /etc/dbus-1/system.d/my-frameworkd.conf
  • open /etc/dbus-1/system.d/my-frameworkd.conf and replace all instances of 'user="root"' with 'user="youruser"'

Alternatively, replace all instances of 'user="root"' with 'group="messagebus"' and add your user to the messagebus group.

Sound

Make sure to put your user in the audio group ("adduser <username> audio").

If there is no error but no sound, try these state files: Talk:Manual_Debian#Sound

Keyboards and other input methods

As a default the Matchbox keyboard is installed, which you can use to input characters into your neo. As an alternative you might want to install CellWriter. It is a grid-entry natural handwriting input panel. As you write characters into the cells, your writing is instantly recognized at the character level. It also features a full fledged onscreen keyboard.

Installation:

apt-get install cellwriter

More information can be found on the homepage.

Kernel

Debian way

When Debian is installed, the kernel is provided by the package linux-image-2.6.24-openmoko-gta02. This package can be installed only in POSIX compliant filesystems, so it can not be used if your boot partition is a vfat one. Your kernel will be keep updated like the other packages of the system. You should use this way if you are unsure and you need an (almost) stable system.

Openmoko way

Otherwise you can choose to manual install an OM kernel. But only do this if you know what you are doing. At the moment there is a little problem in the question which kernel to use. Hopefully it will be solved in the near future.

The original openmoko kernel works fine inclusive suspending and supports different really nice usb gadgets (not all working at the moment). :)
download stable: http://downloads.openmoko.org/releases/Om2008.9/
download testing: http://downloads.openmoko.org/daily/

The new FSO4 kernel works fine and suspend/resume is also possible. But this kernel still has no loadable usb gadget modules (10-Nov-2008). :/
download testing: http://downloads.freesmartphone.org/fso-testing/images/
download unstable: http://downloads.freesmartphone.org/fso-unstable/images/

  1. Download a recent kernel and rootfs (tar.gz) from one of the above mentioned sources. It's your decision if you want suspend or usb gadget modules at the moment.
  2. Backup your running kernel like mv /boot/uImage.bin /boot/uImage.bin.old, then
    copy the downloaded uImage file to the freerunner as /boot/uImage.bin.
  3. Backup your actual modules like mv /lib/modules/2.6.24 /lib/modules/2.6.24.old, then
    extract the downloaded rootfs tar.gz to a temporary directory and copy lib/modules/2.6.24 from the temp directory to /lib/modules/2.6.24 on the FreeRunner.
  4. Do a chown -R root.root /lib/modules/2.6.24 because the owner from the tar.gz is something else (for me).
  5. Run a depmod -a.
  6. This step is only needed for the OM kernel but it doesn't harm the FSO kernel setup. Add "g_ether" Module to /etc/modules like echo g_ether >> /etc/modules. I read in an email, that the module "ohci-hcd" is also needed for some bluetooth functions, but i don't know this for real. I inserted it to my modules file to be on the safe side.
  7. Reboot and hope everything works as expected. :)

Desktop environments

Matchbox with fbpanel

It is not really a Desktop environment, but using fbpanel with Matchbox you can have a fast, lightweight, gtk2 desktop panel.

Debian with fbpanel, matchbox-window-manager and Zhone running
  1. Install fbpanel:
    sudo apt-get install fbpanel
  2. Customize the X startup process:
    ~/.xsession
    #!/bin/sh
    export GTK_MODULES=libgtkstylus.so
    zhone &
    xsetroot -solid black
    matchbox-keyboard-toggle &
    matchbox-window-manager -use_titlebar yes &
    # -use_titlebar yes to minimize & toggle between apps
    # fbpanel's taskbar does not work with matchbox-window-manager
    #~/bin/auxlaunch &
    while true;
    do
    fbpanel;
    sleep 1;
    done;
    
  3. Read http://fbpanel.sourceforge.net/docs.html#config
    ~/.fbpanel/default
    mkdir ~/.fbpanel
    cp /etc/fbpanel/default ~/.fbpanel/default
    nano ~/.fbpanel/default
    

    Remove section with 'taskbar' plugin - it's useless with matchbox-window-manager. You may add plugin 'cpu'

    Plugin {
    type = cpu
    }

    Also, plugin 'genmon' is useful:

    Plugin {
    type = genmon
    config {
    Command = echo -e $(grep "MemFree" /proc/meminfo | awk '{printf "%0.2f", $2 / 1024}') "|"\
    $(cat /proc/loadavg | awk '{print $3}') "|" $(apm | awk '{print $5}')
    PollingTime = 60
    TextSize = small
    TextColor = darkblue
    }
    }
    After 'killall fbpanel' it will show: free mem in megabytes | loadavg | battery % left.
  4. Default theme is ugly. You can change it and / or make font's bigger:
    ~/.gtkrc-2.0
    sudo apt-cache search gtk2-engines
    sudo apt-get install gtk2-engines gtk-theme-switch
    DISPLAY=:0 gtk-theme-switch2
    Now choose your theme, font and save it. To see changes do 'killall fbpanel'.

XFCE

The debian installation script installs by default the matchbox window manager. It doesn't feature a desktop environment. xfce is a small and lightweight desktop environment and so is quite fast for the FreeRunner.

apt-get install xfce4

Edit your .xsession to launch xfce4 at X startup :

#!/bin/sh
xfce4-session

Edit section [Failsafe Session] of /etc/xdg/xfce4-session/xfce4-session.rc (or ~/.config/xfce4-session/xfce4-session.rc) to handle the auto-started apps. For example:

[Failsafe Session]
Count=3
Client0_Command=xfce4-panel
Client0_PerScreen=False
Client1_Command=xfdesktop
Client1_PerScreen=False
Client2_Command=zhone
Client2_PerScreen=True

Start XFCE !

/etc/init.d/nodm restart

The desktop takes a while to start but once up was snappy as can be expected. I've not yet looked at the reason for the seemingly too slow start for the desktop.

zhone is available from the "Office" menu in xfce. The matchbox keyboard is available in "Accessories".

If you want to display the screen on the long side (ie rotated, 4:3 aspect), add the following to the /etc/X11/xorg.conf in both the Device and InputDevice sections :

Option          "Rotate"                "CCW"

and then (re)start xfce.

If you want to be able to shutdown/restart the device, add the following line to /etc/sudoers (don't forget to replace username with your actual username):

username localhost = NOPASSWD: /usr/sbin/xfsm-shutdown-helper

Using matchbox-window-manager with XFCE

XFCE's window manager is poorly configured for use with the FreeRunner. Fortunately, matchbox's window manager is compatible with xfce. To use the matchbox window manager, modify ~/.xsession as follows:

#!/bin/sh
exec matchbox-window-manager -use_titlebar no -use_cursor no &
xfce4-session

LXDE

I you want a really nice desktop enviroment but you think XFCE is too fat, you can try to install LXDE. It give to you the GTK comfort, but use only a fraction of the ram needed by XFCE.

To install it:

apt-get install lxde

to launch it create a /etc/init.d/lxde script in the same way descripted for xfce4, replacing startxfce4 accorence with startlxde.

Additional Software

Web Browser

Arne Anka suggested trying the light-weight webkit-based midori browser:

apt-get install midori

Another light-weight browser is Dillo. It can be easily installed with:

apt-get install dillo

If you think the previous options are quite slow on Freerunner try Links2.

apt-get install links2

Run as:

xlinks2

GPS

Openmoko Freerunner has integrated a good AGPS chip that can be used to know in every moment the phone position. The most known free applications to use gps with graphical maps are:

Main article: TangoGPS


Main article: Navit
(Attention: Navit is not yet present on Debian repository)

E-Book reader

To read an E-Book you have diffent possibilities:

  • FBReader a good reader that can display txt, fb2, html and various other formats.
  • Epdfview a simple and lightweight PDF viewer, it can be installed from Debian repository.
  • Evince the official Gnome viewer, it can display pdf, djvu, cbz, and other formats.

There is also an hack to convert drm protected adobe ebooks to .cbz files readable as mentioned on the mailing list.

Miscellaneous

Making the cursor invisible

Using matchbox

Matchbox has an option, use_cursor, that can be used to control whether to show the cursor. For the default setup, edit /usr/bin/zhone-session and change the matchbox command to matchbox-window-manager -use_titlebar no -use_cursor no

Using unclutter

Unclutter is a program that hides the cursor after a period of inactivity. To use unclutter, install it

  1. apt-get install unclutter

and choose Yes to the question Start unclutter automatically?. To change settings edit /etc/default/unclutter.

Changing the cursor

To make the cursor invisible create a file called empty.cursor with this content:

#define empty.cursor_width 16
#define empty.cursor_height 16
static unsigned char empty.cursor_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

Now you can execute: xsetroot -cursor empty.cursor empty.cursor and the cursor will be invisible. To make this permanent you have to invent something ;) It must be executed after zhone has finished starting up.

Running X applications on your desktop in nested X server

Sometimes it is helpful to have a big screen, keyboard and mouse. You can run X applications in a nested X server window. On your desktop install the nested X server application Xephyr (better that Xnest) apt-get install xserver-xephyr Run a nested X server as display=:1 Xephyr :1 -ac -br -screen 480x640 -reset -terminate & Now you are able to run apps on your Neo which will display on your desktop PC. Make sure to set the display, for example if "mydesktop" is your desktop hostname DISPLAY=mydesktop:1 xfce4-session &

Simulating right click with stylus

With fbdev driver from xserver-xorg

To have the right click with stylus an easy way is to use the Sebastian Ohl's tslib patch: you can find it here until it will not enter in the official Debian package.

You can install it with:

wget http://www.ohli.de/download/xserver-xorg-input-tslib_0.0.5-1+fso1_armel.deb
dpkg --install xserver-xorg-input-tslib

This patch makes it necessary to add a new line to your xorg.conf.

Option          "EmulateRightButton"    "1"

Just add it to you InputDevice section. Without this line the old behavior of the tslib driver is restored -> this means no right click.


Warning: this patch is external to Debian repository and is not (yet) supported by Debian comunity.

In this way, to get a right click you can simply tap and hold the stylus and after a while a right click will occurs.

Warning: tslib patch is incompatible with xserver-xglamo. Use libgtkstylus instead (see below).

With Xglamo driver from xserver-xglamo

  1. apt-get install libgtkstylus
  2. Insert this line at the beginning of ~/.xsession:
    export GTK_MODULES=libgtkstylus.so &

Using the mouse and keyboard from your desktop on the OM device

Method 1: xsession export (works with a linux host)

If you are running Linux (or a similar xorg capable operating system) on your Desktop, you can export your xsession to the openmoko device and use your mouse and keyboard on the Neo screen. A little program called x2x makes it even possible to do this simultaneously on the fly. When activated you just move your mouse to the edge of your monitor and then the mouse cursor continues on the screen of your openmoko device. If you select a window on the OM, the input of your keyboard is automatically entered in that window. You can even use the clipboard to copy data from tour desktop to OM and in the reverse direction.

Configure your desktop computer to export your xsession: On your desktop (with root permissions): Make sure that sshd is installed and in /etc/ssh/sshd_config you have set X11Forwarding yes

In K/Ubuntu sshd is in the package openssh-server.

On your OM device install x2x (with root permissions) apt-get install xauth x2x Now open a new X terminal on your desktop computer. You MUST be the same user that is running the xsession on your desktop (i.e. do not su to root or another user in your x terminal!). Use the same username that is running an xsession on your OM device. Assuming that you have a usb networking connection to OM (with standard configuration) on the user prompt of your desktop type: user@desktop:~$ ssh -X openmoko@192.168.0.202 "/usr/bin/x2x -east -to :0.0" Hit return and enter your password. The xterm window will be unresponsive after that, but keep it open until you disconnect your OM device.

Now move your mouse cursor across the right edge of your monitor. It should enter the screen of your OM device from the left. Of course you can also use -west, -north or -south, depending on your preference where you place your OM.

If computer says: sh: /usr/X11R6/bin/xauth: No such file or directory X11 connection rejected because of wrong authentication. x2x - error: can not open display localhost:11.0

It means you haven't installed xauth on your OM. So on your OM (with root permissions) apt-get install xauth

Method 2: synergy (works with a windows/linux host)

With this method you can have the following functionality:

  • Mouse moves from screen edge to the next screen
  • Keyboard types on the focused window
  • Clipboard is transferred as well
  • Connect as many computers and screens you wish
  • Connect windows computers too

All devices/computers in question should be able to install synergy. Windows computers can use an installer exe. Debian devices have a package ready to be used.

apt-get install synergy quicksynergy

quick synergy will appear in your XFCE programs menu (Accessories->QuickSynergy). Run it, switch to the "Use" tab, enter the IP address of the computer with the mouse and keyboard you wish to use, and press Execute.

In the windows host, (or linux) run the synergy after installation, and configure it to share its keyboard and mouse(server), configuration is fairly simple, you add all the hostnames of the devices/computers that ever would be joined to the "screens" list, and create 2 links for each connection.

If your desktop's hostname is homepc, and the device's is debian_gta02, and i place the device to the left of the desktop, the links would look like this:

homepc is right of debian_gta02
debian_gta02 is left of homepc

Now move back to the main screen, and press Start.

That should be it, in windows you should have an icon with a yellow lightning in it when synergy is connected and working. Synergy supports connection of more then one screen so one could set up a full lab with only one keyboard and mouse :)

See also

Support

To have more information about Debian go to Debian homepage.

If you have some problems, you can find support in smartphone mailing list. Report your discovered bugs to this list but remember to put Joachim Breitner in CC.

If you'd like to help the packaging activities, you can join the fso mainteiner list.

Consider a swap partition [1] [2].

Known Issues

Problem with usage install.sh

If partition table creation passes with an error use the following patch:

--- install.sh	2009-01-19 17:36:26.000000000 +0300
+++ install_good.sh	2009-01-19 17:44:51.000000000 +0300
@@ -405,9 +405,9 @@
 
 echo " * Waiting for partitions to appear"
 SLEEP_SECONDS=3
-while ! ([ "$SINGLE_PART" = "true" ] && test -e ${SD_DEVICE}p1) ||\
-	test -e ${SD_DEVICE}p1 -a -e ${SD_DEVICE}p2; do
-	if [ "$SLEEP_SECONDS" = 15 ]; then
+while ! (([ "$SINGLE_PART" = "true" ] && test -e ${SD_DEVICE}p1) ||\
+	test -e ${SD_DEVICE}p1 -a -e ${SD_DEVICE}p2); do
+	if [ "$SLEEP_SECONDS" = 30 ]; then
 		echo "E: Partitioning has failed, partitions have not been created"
 		exit 1
 	fi
@@ -598,7 +598,7 @@
 rootfs	/		auto	defaults,errors=remount-ro,noatime	0 1
 __END__
 
-if ![ "$SINGLE_PART" = "true" ]; then
+if [ "$SINGLE_PART" != "true" ]; then
 cat >> $INST_DIR/etc/fstab <<__END__
 /dev/mmcblk0p1	/boot	auto	defaults,noatime			0 2
 __END__

apt-get segmentation fault Whenever you get a segmentation fault while using apt-get or aptitude, clean the database so it will rebuild it

 rm /var/cache/apt/*.bin

If Zhone doesn't start it is most likely due to a bug in the python-evas package[3] (fixed in new install). Install the alternate package:

 wget http://www.ginguppin.de/files/python-evas_0.2.1-2_armel.deb
 dpkg -i python-evas_0.2.1-2_armel.deb
Personal tools


Debian is used on many other embedded devices. Using Debian on the FreeRunner gives access to the Huge army of software packaged in the Debian repositories, already compiled for the arm processors. Moreover, one can build one's own things without having to learn the OpenEmbedded way. For example compiling natively is a snap with Debian, just apt-get gcc&libc-dev.

In the early days, one had to install Debian manually. Now there is an installer script. The "official" instructions on how to install Debian on FreeRunner or Debian on Neo1973 are hosted on Debian's wiki. This page is about post-install configuration and FreeRunner specific tips. For support or bug reporting please read the section Support.

Configuring a base system

Password

The default root password is blank. You should change that as soon as possible

# passwd

Suspend

Press the power button or run 'apm -s' to suspend. To change the time for the display to darken/turn off edit in

 /usr/share/python-support/fso-frameworkd/framework/subsystems/odeviced/idlenotifier.py

the section

       self.timeouts = { \
                       "idle": 10,
                       "idle_dim": 20,
                       "idle_prelock": 12,
                       "lock": 2,
                       "suspend": 20, \

idle_dim is the time in seconds to dim the display (which adds up to the idle time), idle_prelock is the time to turn it off. After that execute

 mv /var/lib/python-support/python2.5/framework/subsystems/odeviced/idlenotifier.pyc /var/lib/python-support/python2.5/framework/subsystems/odeviced/idlenotifier.pyc.old

You can turn off Suspend completely by commenting out the entire section "Idleness Brightness Handling" in

 /etc/freesmartphone/oevents/rules.yaml

Time

The default time zone is UTC. Reconfigure it by running

# dpkg-reconfigure tzdata

To set the clock manually do something like

# date -s 00:33

If you have a network connection, do something like

# apt-get install ntpdate
# ntpdate-debian

If you want to synchronize the internal clock with GPS time you can use a script like

#!/usr/bin/env python
#
# Set the gps time
# Be sure your GPS is active before to launch this script

import dbus
import subprocess
import time

proxy = dbus.SystemBus().get_object('org.freesmartphone.frameworkd', '/org/freedesktop/Gypsy') # bus name, object name
interface = dbus.Interface(proxy, 'org.freedesktop.Gypsy.Time');
subprocess.call(['date',time.strftime( '%m%d%H%M%Y.%S', time.localtime(interface.GetTime()))])

Wifi

Using GUI

If you don't want to mess up with configuration files and are looking for an easy gui for wireless configuration, then wifi-radar or wicd is what you are looking for.

apt-get install wifi-radar
wifi-radar

or

apt-get install wicd
wicd-client -n

If you are looking for more, read on...

Using /etc/network/interfaces (simple mode)

Make sure the following packages are installed:

apt-get install wireless-tools wpasupplicant dhcp3-client

Assuming your wireless router uses WPA security and DHCP, edit /etc/network/interfaces to include a section like this:

auto eth0
iface eth0 inet dhcp
wpa-driver wext
wpa-ssid "MyWirelessName"
wpa-psk "MyWirelessPassword"

Where, of course, you're using the name of your wireless network and it's password instead of MyWirelessName and MyWirelessPassword.

You can test by running

# ifup eth0

You can determine your IP address by running

# ifconfig eth0

Issues:

  • only works if in presence of wireless network on boot, or when manually running ifup eth0
  • booting away from wireless network is slower because waits for DHCP to time out
  • does not reestablish connection when leaving wireless area and then returning
  • does not support multiple wireless networks or open hotspots that you may travel between

Once wpa_supplicant has begun managing your wifi interface, you should type "wpa_action eth0 stop" instead of "ifdown eth0".

Using wpa-supplicant (roaming mode)

To configure WPA to roam between wireless networks, you will need to create a new configuration file:

/etc/wpa_supplicant/wpa_supplicant.conf

a template for this file (and more documentation) is available in:

/usr/share/doc/wpasupplicant/examples/wpa-roam.conf

You'll need to add networks to this file. Examples:

  • WEP:
network={
       ssid="MySSID"
       key_mgmt=NONE
       wep_key0="abcdefghijklm"
#      wep_key0=6162636465  # <- no quotes, so hex number
       wep_tx_keyidx=0
       id_str="MySSID"
}
  • No key:
network={
       ssid="SomeNetwork"
       key_mgmt=NONE
}
  • WPA:
       network={
       ssid="Example WPA Network"
       psk="mysecretpassphrase"
       id_str="home"
}

Next, you'll need to edit /etc/network/interfaces. This lets you configure your wireless networks to use dhcp, or other appropriate TCP/IP settings:

auto eth0
iface eth0 inet manual
wpa-driver wext
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

# MySSID comes from an id_str above.
iface MySSID inet dhcp

# default is what's used if there is no id_str setting.
# so the 'SomeNetwork' network will use DHCP.
iface default inet dhcp

iface home inet static
# static interface settings, or whatever...

Finally, if you want attempts to access the internet to default to eth0 (and not usb0), then comment out this line under usb0 adapter configuration:

gateway 192.168.0.200


  • Roaming from network to network is not automatic. Instead, you need to manually run "wpa_action eth0 stop; ifup eth0" to switch networks

For some reason, I had to reboot for the id_str settings to take effect. However, you should now be able to use "ifup eth0" to associate with the access point and "wpa_action eth0 stop" to down the wifi adapter.

TODO: Which of the issues that single network configurations suffer from are addressed by WPA roaming mode? Would ifplugd / guessnet help, or just make things more complicated? (See: To-Do List)

Further reading

To use all the possibilities of wpasupplicant like roaming and automatic connection to different networks, you should read /usr/share/doc/wpasupplicant/README.Debian.gz

Bluetooth

The FreeRunner uses the standard Linux bluez stack, installed with

# apt-get install bluez-utils

There is also a module missing from /etc/modules, which is critical to getting your device recognized. (kudos to johnsu01 on irc.freenode.net:#openmoko-debian for the find)

# echo ohci-hcd >> /etc/modules

The first time you try this, you can also

# modprobe ohci-hcd

The only atypical part of using bluetooth on the FreeRunner is turning it on, which can be done with

# mdbus -s org.freesmartphone.frameworkd  /org/freesmartphone/Device/PowerControl/Bluetooth SetPower 1

Then the device should be visible using

# hcitool dev
TODO: Then what to do next? (See: To-Do List)

Packages manager

You can install dselect(~2.2MB) or aptitude(~12MB) to visually inspect the available debian packages using the desktop's console.
Also the gtk-based package-manager synaptic(~15.7MB) is working after installing lsb-release and hicolor-icon-theme, but it is very slow.
Finally, on constrained systems, just issue the command:

grep -e Package: -e Description /var/lib/dpkg/available|more

Xglamo acceleration

By default debian uses fbdev, but we can use Xglamo to get better performance:

apt-get install xserver-xglamo

after that edit /etc/X11/xorg.conf and change the line

Driver          "fbdev"

to:

Driver          "Xglamo"

and if you want to run xserver as normal user:

chmod u+s /usr/bin/Xglamo
You may also want to force the X server to 96 dpi to have the same fonts as with fbdev. Add "-dpi 96" to the X_OPTIONS variable in /etc/init.d/nodm:
X_OPTIONS="vt4 -nolisten tcp -dpi 96"

with that you:

  • can use xrandr
  • don't have the pointer callibration bug with the rotated mode
  • have better performances

Using xglamo you must remember that:

  • You can't use on xorg.conf the "Option Rotate" to rotate the screen
  • You can't use the tslib patch to simulate right click

Running X as normal user

1. Create a new user

# useradd -m -G audio,dialout,floppy,video,staff username
# passwd username

2. Edit /etc/init.d/nodm and change USER=root to USER=username in it. Then to make sure changes are not lost on upgrade, run

dpkg-divert --add /etc/init.d/nodm

This will make new versions of /etc/init.d/nodm be written to /etc/init.d/nodm.distrib

3. Edit /etc/X11/Xwrapper.config and change allowed_users=console to allowed_users=anybody (Or use dpkg-reconfigure x11-common)

4. Copy /root/.xsession into ~username/

5. Note that, if you ran zhone as root first, you may have to change ownership or remove /tmp/zhone.log, as a normal user is not able to write to a file owned by root.

6. If you have already configured to use Xglamo as a driver, chmod u+s /usr/bin/Xglamo (as can be read below)

Using dbus as a normal user

If you want to make calls or interact with the gps daemon through a dbus interface, you user will have to have the rights to do that. One way of adding these rights is as follows:

  • copy /etc/dbus-1/system.d/frameworkd.conf to /etc/dbus-1/system.d/my-frameworkd.conf
  • open /etc/dbus-1/system.d/my-frameworkd.conf and replace all instances of 'user="root"' with 'user="youruser"'

Alternatively, replace all instances of 'user="root"' with 'group="messagebus"' and add your user to the messagebus group.

Sound

Make sure to put your user in the audio group ("adduser <username> audio").

If there is no error but no sound, try these state files: Talk:Manual_Debian#Sound

Keyboards and other input methods

As a default the Matchbox keyboard is installed, which you can use to input characters into your neo. As an alternative you might want to install CellWriter. It is a grid-entry natural handwriting input panel. As you write characters into the cells, your writing is instantly recognized at the character level. It also features a full fledged onscreen keyboard.

Installation:

apt-get install cellwriter

More information can be found on the homepage.

Kernel

Debian way

When Debian is installed, the kernel is provided by the package linux-image-2.6.24-openmoko-gta02. This package can be installed only in POSIX compliant filesystems, so it can not be used if your boot partition is a vfat one. Your kernel will be keep updated like the other packages of the system. You should use this way if you are unsure and you need an (almost) stable system.

Openmoko way

Otherwise you can choose to manual install an OM kernel. But only do this if you know what you are doing. At the moment there is a little problem in the question which kernel to use. Hopefully it will be solved in the near future.

The original openmoko kernel works fine inclusive suspending and supports different really nice usb gadgets (not all working at the moment). :)
download stable: http://downloads.openmoko.org/releases/Om2008.9/
download testing: http://downloads.openmoko.org/daily/

The new FSO4 kernel works fine and suspend/resume is also possible. But this kernel still has no loadable usb gadget modules (10-Nov-2008). :/
download testing: http://downloads.freesmartphone.org/fso-testing/images/
download unstable: http://downloads.freesmartphone.org/fso-unstable/images/

  1. Download a recent kernel and rootfs (tar.gz) from one of the above mentioned sources. It's your decision if you want suspend or usb gadget modules at the moment.
  2. Backup your running kernel like mv /boot/uImage.bin /boot/uImage.bin.old, then
    copy the downloaded uImage file to the freerunner as /boot/uImage.bin.
  3. Backup your actual modules like mv /lib/modules/2.6.24 /lib/modules/2.6.24.old, then
    extract the downloaded rootfs tar.gz to a temporary directory and copy lib/modules/2.6.24 from the temp directory to /lib/modules/2.6.24 on the FreeRunner.
  4. Do a chown -R root.root /lib/modules/2.6.24 because the owner from the tar.gz is something else (for me).
  5. Run a depmod -a.
  6. This step is only needed for the OM kernel but it doesn't harm the FSO kernel setup. Add "g_ether" Module to /etc/modules like echo g_ether >> /etc/modules. I read in an email, that the module "ohci-hcd" is also needed for some bluetooth functions, but i don't know this for real. I inserted it to my modules file to be on the safe side.
  7. Reboot and hope everything works as expected. :)

Desktop environments

Matchbox with fbpanel

It is not really a Desktop environment, but using fbpanel with Matchbox you can have a fast, lightweight, gtk2 desktop panel.

Debian with fbpanel, matchbox-window-manager and Zhone running
  1. Install fbpanel:
    sudo apt-get install fbpanel
  2. Customize the X startup process:
    ~/.xsession
    #!/bin/sh
    export GTK_MODULES=libgtkstylus.so
    zhone &
    xsetroot -solid black
    matchbox-keyboard-toggle &
    matchbox-window-manager -use_titlebar yes &
    # -use_titlebar yes to minimize & toggle between apps
    # fbpanel's taskbar does not work with matchbox-window-manager
    #~/bin/auxlaunch &
    while true;
    do
    fbpanel;
    sleep 1;
    done;
    
  3. Read http://fbpanel.sourceforge.net/docs.html#config
    ~/.fbpanel/default
    mkdir ~/.fbpanel
    cp /etc/fbpanel/default ~/.fbpanel/default
    nano ~/.fbpanel/default
    

    Remove section with 'taskbar' plugin - it's useless with matchbox-window-manager. You may add plugin 'cpu'

    Plugin {
    type = cpu
    }

    Also, plugin 'genmon' is useful:

    Plugin {
    type = genmon
    config {
    Command = echo -e $(grep "MemFree" /proc/meminfo | awk '{printf "%0.2f", $2 / 1024}') "|"\
    $(cat /proc/loadavg | awk '{print $3}') "|" $(apm | awk '{print $5}')
    PollingTime = 60
    TextSize = small
    TextColor = darkblue
    }
    }
    After 'killall fbpanel' it will show: free mem in megabytes | loadavg | battery % left.
  4. Default theme is ugly. You can change it and / or make font's bigger:
    ~/.gtkrc-2.0
    sudo apt-cache search gtk2-engines
    sudo apt-get install gtk2-engines gtk-theme-switch
    DISPLAY=:0 gtk-theme-switch2
    Now choose your theme, font and save it. To see changes do 'killall fbpanel'.

XFCE

The debian installation script installs by default the matchbox window manager. It doesn't feature a desktop environment. xfce is a small and lightweight desktop environment and so is quite fast for the FreeRunner.

apt-get install xfce4

Edit your .xsession to launch xfce4 at X startup :

#!/bin/sh
xfce4-session

Edit section [Failsafe Session] of /etc/xdg/xfce4-session/xfce4-session.rc (or ~/.config/xfce4-session/xfce4-session.rc) to handle the auto-started apps. For example:

[Failsafe Session]
Count=3
Client0_Command=xfce4-panel
Client0_PerScreen=False
Client1_Command=xfdesktop
Client1_PerScreen=False
Client2_Command=zhone
Client2_PerScreen=True

Start XFCE !

/etc/init.d/nodm restart

The desktop takes a while to start but once up was snappy as can be expected. I've not yet looked at the reason for the seemingly too slow start for the desktop.

zhone is available from the "Office" menu in xfce. The matchbox keyboard is available in "Accessories".

If you want to display the screen on the long side (ie rotated, 4:3 aspect), add the following to the /etc/X11/xorg.conf in both the Device and InputDevice sections :

Option          "Rotate"                "CCW"

and then (re)start xfce.

If you want to be able to shutdown/restart the device, add the following line to /etc/sudoers (don't forget to replace username with your actual username):

username localhost = NOPASSWD: /usr/sbin/xfsm-shutdown-helper

Using matchbox-window-manager with XFCE

XFCE's window manager is poorly configured for use with the FreeRunner. Fortunately, matchbox's window manager is compatible with xfce. To use the matchbox window manager, modify ~/.xsession as follows:

#!/bin/sh
exec matchbox-window-manager -use_titlebar no -use_cursor no &
xfce4-session

LXDE

I you want a really nice desktop enviroment but you think XFCE is too fat, you can try to install LXDE. It give to you the GTK comfort, but use only a fraction of the ram needed by XFCE.

To install it:

apt-get install lxde

to launch it create a /etc/init.d/lxde script in the same way descripted for xfce4, replacing startxfce4 accorence with startlxde.

Additional Software

Web Browser

Arne Anka suggested trying the light-weight webkit-based midori browser:

apt-get install midori

Another light-weight browser is Dillo. It can be easily installed with:

apt-get install dillo

If you think the previous options are quite slow on Freerunner try Links2.

apt-get install links2

Run as:

xlinks2

GPS

Openmoko Freerunner has integrated a good AGPS chip that can be used to know in every moment the phone position. The most known free applications to use gps with graphical maps are:

    Main article: TangoGPS


      Main article: Navit
      (Attention: Navit is not yet present on Debian repository)
      

      E-Book reader

      To read an E-Book you have diffent possibilities:

      • FBReader a good reader that can display txt, fb2, html and various other formats.
      • Epdfview a simple and lightweight PDF viewer, it can be installed from Debian repository.
      • Evince the official Gnome viewer, it can display pdf, djvu, cbz, and other formats.

      There is also an hack to convert drm protected adobe ebooks to .cbz files readable as mentioned on the mailing list.

      Miscellaneous

      Making the cursor invisible

      Using matchbox

      Matchbox has an option, use_cursor, that can be used to control whether to show the cursor. For the default setup, edit /usr/bin/zhone-session and change the matchbox command to matchbox-window-manager -use_titlebar no -use_cursor no

      Using unclutter

      Unclutter is a program that hides the cursor after a period of inactivity. To use unclutter, install it

      1. apt-get install unclutter

      and choose Yes to the question Start unclutter automatically?. To change settings edit /etc/default/unclutter.

      Changing the cursor

      To make the cursor invisible create a file called empty.cursor with this content:

      #define empty.cursor_width 16
      #define empty.cursor_height 16
      static unsigned char empty.cursor_bits[] = {
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
      

      Now you can execute: xsetroot -cursor empty.cursor empty.cursor and the cursor will be invisible. To make this permanent you have to invent something ;) It must be executed after zhone has finished starting up.

      Running X applications on your desktop in nested X server

      Sometimes it is helpful to have a big screen, keyboard and mouse. You can run X applications in a nested X server window. On your desktop install the nested X server application Xephyr (better that Xnest) apt-get install xserver-xephyr Run a nested X server as display=:1 Xephyr :1 -ac -br -screen 480x640 -reset -terminate & Now you are able to run apps on your Neo which will display on your desktop PC. Make sure to set the display, for example if "mydesktop" is your desktop hostname DISPLAY=mydesktop:1 xfce4-session &

      Simulating right click with stylus

      With fbdev driver from xserver-xorg

      To have the right click with stylus an easy way is to use the Sebastian Ohl's tslib patch: you can find it here until it will not enter in the official Debian package.

      You can install it with:

      wget http://www.ohli.de/download/xserver-xorg-input-tslib_0.0.5-1+fso1_armel.deb
      dpkg --install xserver-xorg-input-tslib
      

      This patch makes it necessary to add a new line to your xorg.conf.

      Option          "EmulateRightButton"    "1"
      

      Just add it to you InputDevice section. Without this line the old behavior of the tslib driver is restored -> this means no right click.


      Warning: this patch is external to Debian repository and is not (yet) supported by Debian comunity.

      In this way, to get a right click you can simply tap and hold the stylus and after a while a right click will occurs.

      Warning: tslib patch is incompatible with xserver-xglamo. Use libgtkstylus instead (see below).

      With Xglamo driver from xserver-xglamo

      1. apt-get install libgtkstylus
      2. Insert this line at the beginning of ~/.xsession:
        export GTK_MODULES=libgtkstylus.so &

      Using the mouse and keyboard from your desktop on the OM device

      Method 1: xsession export (works with a linux host)

      If you are running Linux (or a similar xorg capable operating system) on your Desktop, you can export your xsession to the openmoko device and use your mouse and keyboard on the Neo screen. A little program called x2x makes it even possible to do this simultaneously on the fly. When activated you just move your mouse to the edge of your monitor and then the mouse cursor continues on the screen of your openmoko device. If you select a window on the OM, the input of your keyboard is automatically entered in that window. You can even use the clipboard to copy data from tour desktop to OM and in the reverse direction.

      Configure your desktop computer to export your xsession: On your desktop (with root permissions): Make sure that sshd is installed and in /etc/ssh/sshd_config you have set X11Forwarding yes

      In K/Ubuntu sshd is in the package openssh-server.

      On your OM device install x2x (with root permissions) apt-get install xauth x2x Now open a new X terminal on your desktop computer. You MUST be the same user that is running the xsession on your desktop (i.e. do not su to root or another user in your x terminal!). Use the same username that is running an xsession on your OM device. Assuming that you have a usb networking connection to OM (with standard configuration) on the user prompt of your desktop type: user@desktop:~$ ssh -X openmoko@192.168.0.202 "/usr/bin/x2x -east -to :0.0" Hit return and enter your password. The xterm window will be unresponsive after that, but keep it open until you disconnect your OM device.

      Now move your mouse cursor across the right edge of your monitor. It should enter the screen of your OM device from the left. Of course you can also use -west, -north or -south, depending on your preference where you place your OM.

      If computer says: sh: /usr/X11R6/bin/xauth: No such file or directory X11 connection rejected because of wrong authentication. x2x - error: can not open display localhost:11.0

      It means you haven't installed xauth on your OM. So on your OM (with root permissions) apt-get install xauth

      Method 2: synergy (works with a windows/linux host)

      With this method you can have the following functionality:

      • Mouse moves from screen edge to the next screen
      • Keyboard types on the focused window
      • Clipboard is transferred as well
      • Connect as many computers and screens you wish
      • Connect windows computers too

      All devices/computers in question should be able to install synergy. Windows computers can use an installer exe. Debian devices have a package ready to be used.

      apt-get install synergy quicksynergy
      

      quick synergy will appear in your XFCE programs menu (Accessories->QuickSynergy). Run it, switch to the "Use" tab, enter the IP address of the computer with the mouse and keyboard you wish to use, and press Execute.

      In the windows host, (or linux) run the synergy after installation, and configure it to share its keyboard and mouse(server), configuration is fairly simple, you add all the hostnames of the devices/computers that ever would be joined to the "screens" list, and create 2 links for each connection.

      If your desktop's hostname is homepc, and the device's is debian_gta02, and i place the device to the left of the desktop, the links would look like this:

      homepc is right of debian_gta02
      debian_gta02 is left of homepc
      

      Now move back to the main screen, and press Start.

      That should be it, in windows you should have an icon with a yellow lightning in it when synergy is connected and working. Synergy supports connection of more then one screen so one could set up a full lab with only one keyboard and mouse :)

      See also

      Support

      To have more information about Debian go to Debian homepage.

      If you have some problems, you can find support in smartphone mailing list. Report your discovered bugs to this list but remember to put Joachim Breitner in CC.

      If you'd like to help the packaging activities, you can join the fso mainteiner list.

      Consider a swap partition [1] [2].

      Known Issues

      Problem with usage install.sh

      If partition table creation passes with an error use the following patch:

      --- install.sh	2009-01-19 17:36:26.000000000 +0300
      +++ install_good.sh	2009-01-19 17:44:51.000000000 +0300
      @@ -405,9 +405,9 @@
       
       echo " * Waiting for partitions to appear"
       SLEEP_SECONDS=3
      -while ! ([ "$SINGLE_PART" = "true" ] && test -e ${SD_DEVICE}p1) ||\
      -	test -e ${SD_DEVICE}p1 -a -e ${SD_DEVICE}p2; do
      -	if [ "$SLEEP_SECONDS" = 15 ]; then
      +while ! (([ "$SINGLE_PART" = "true" ] && test -e ${SD_DEVICE}p1) ||\
      +	test -e ${SD_DEVICE}p1 -a -e ${SD_DEVICE}p2); do
      +	if [ "$SLEEP_SECONDS" = 30 ]; then
       		echo "E: Partitioning has failed, partitions have not been created"
       		exit 1
       	fi
      @@ -598,7 +598,7 @@
       rootfs	/		auto	defaults,errors=remount-ro,noatime	0 1
       __END__
       
      -if ![ "$SINGLE_PART" = "true" ]; then
      +if [ "$SINGLE_PART" != "true" ]; then
       cat >> $INST_DIR/etc/fstab <<__END__
       /dev/mmcblk0p1	/boot	auto	defaults,noatime			0 2
       __END__
      

      apt-get segmentation fault Whenever you get a segmentation fault while using apt-get or aptitude, clean the database so it will rebuild it

       rm /var/cache/apt/*.bin
      

      If Zhone doesn't start it is most likely due to a bug in the python-evas package[3] (fixed in new install). Install the alternate package:

       wget http://www.ginguppin.de/files/python-evas_0.2.1-2_armel.deb
       dpkg -i python-evas_0.2.1-2_armel.deb