Samstag, 8. November 2008

Get Avahi working on Maemo

Avahi is a service discovery service (phew!) for local networks (Apple calls this technology Bonjour). Among other things, its most basic functionality is to allow you to have a ".local" domain for your home network managed in a peer-to-peer fashion. This way, you do not have to remember the IP of your N8x0, but can use "threepwood.local" (if your N8x0 is named "threepwood").

The packages that need to be installed are "avahi-daemon" and "avahi-dnsconfd". There are some other avahi packages available (including GUIs) that you might want to try out. After installing, you should be able to ping your N8x0 from your Linux (with Avahi installed) or Mac OS X (works out of the box) machine.

The only problem: Avahi's daemons and D-Bus start in the same order (S20) on startup, and therefore Avahi gets to be first (alphabetical order), so you have to get root on your tablet and rename all S20avahi-* files in /etc/rc2.d/ to S21avahi-*. This way, D-Bus gets started first and after that, Avahi can start successfully (if Avahi is started before D-Bus, it won't work!).

After that, you can disable the HomeIP applet and start reading and typing IPs around your home network, but let Avahi/Bonjour do the hard work and you just type the easy-to-remember ".local" if you want to SSH to your tablet.

You can do even more fun things when you put "ssh.service" into /etc/avahi/services/ and install "service-discovery-applet" on your Gnome Desktop. This way, you can directly connect via SSH/SFTP to your tablet without needing to remember anything.

What are your uses for Avahi?

5 Kommentare:

Marius Gedminas hat gesagt…

First of all, thank you very much for this HOWTO. The packages are available from Maemo Extras, right?

The packages I got installed rc2.d scripts named S14avahi-daemon and S16avahi-dnsconfd. I renamed S20dbus to S13dbus, which seemed simpler than renaming the two avahi scripts and also closer to my desktop where dbus is started in S12.

The default hostname (Nokia-N810-23-14) is not very descriptive. I assume it should be enough to change it in /etc/hostname and /etc/hosts, but one should be very careful -- a mistake resulting in a hostname that cannot be resolved might break sudo and result in an unbootable device, requiring a reflash.

thp hat gesagt…

Marius, you can modify the hostname that is published by Avahi by modifying /etc/avahi/avahi-daemon.conf ("host-name" property in the [server] section). This way, your system-side hostname stays the same, but your tablet can be named differently in the mDNS network :)

Qole Pejorian hat gesagt…

Even worse! On my tablet, avahi services are explicitly started before dbus!

S14avahi-daemon
S16avahi-dnsconfd

What were they thinking?

Unknown hat gesagt…

Rumors of an Apple tablet – essentially a large iPhone or iPod touch, may launch in September 2009. But is it just a bigger iPhone or a totally new package, I don't know!

Amanda
my site

Unknown hat gesagt…

for me avahi on the n900 maemo works in that way, that I can connect from my Mac using the hostname.local scheme: my Mac finds my N900.
But it does not work the other way round: My N900 does not find my MacBook.local. What is the problem here?