Difference between revisions of "User talk:Wrea"

From WebOS Internals
Jump to navigation Jump to search
(Reworking of avahi page for when avahi is in the wosi feed)
 
(Blanked the page)
 
Line 1: Line 1:
=Avahi=
 
[http://avahi.org Avahi] is a Linux service for providing multicast-DNS/DNS-SD (also known as [http://en.wikipedia.org/wiki/Bonjour_%28software%29 Bonjour] or mDNS/DNS-SD). Avahi allows for simple service discovery and advertisement on a local network and provides name resolution for all hosts running a mDNS/DNS-SD service.
 
  
Using Avahi allows for easy SSH access, among other things, over a local wireless network. Once installed and started, users can ssh to their device using their mDNS assigned hostname.
 
 
 
==Avahi Installation==
 
For 2.x and 3.x devices, avahi can be found in the alpha repo, any other devices install via ipkg as follows:
 
 
First, use novacom to access the Pre and install the Avahi ipkg.
 
 
$> sudo /opt/bin/ipkg-opt install avahi
 
 
 
Avahi seems to want to run as a user named "avahi".  To create the user, run the following command:
 
 
$> adduser -h /opt/var/run/avahi avahi
 
 
 
Avahi currently attempts to access a different dbus system socket than the one provided by the Pre's dbus, it is possible to start Avahi with dbus support by creating a symbolic link from palm dbus directory to the /opt dbus directory and starting avahi daemon with root privileges. According to the Avahi website, however running avahi-daemon with root privileges is not recommended.
 
 
The following command will create a symbolic link to /opt dbus directory to palm dbus directory:
 
 
ln -s /var/run/dbus /opt/var/run/dbus
 
 
 
if preferred avahi can be be ran without dbus support by editing <tt>/opt/etc/avahi/avahi-daemon.conf</tt> and make the following change:
 
 
Replace this line:
 
#enable-dbus=yes
 
 
With this line:
 
enable-dbus=no
 
 
However, this does not allow the use of avahi commands such as avahi-browse, avahi-publish etc...
 
 
 
At this point, the Avahi daemon can be started with root privileges and dbus support with the following command:
 
 
$> /opt/sbin/avahi-daemon --no-drop-root
 
 
If you disabled dbus support however it is recommended to run Avahi daemon without root privileges using the following command:
 
 
$> /opt/sbin/avahi-daemon
 
 
 
If you would like Avahi to start up at boot, create the following two files:
 
 
 
'''/opt/etc/init.d/S60avahi'''
 
#!/bin/sh
 
 
[ -e /opt/etc/default/avahi ] && . /opt/etc/default/avahi
 
 
if [ "$AVAHI_ENABLE" = "no" ]; then
 
    exit
 
fi
 
 
if [ -n "`pidof /opt/sbin/avahi-daemon`" ]; then
 
    killall /opt/sbin/avahi 2>/dev/null
 
fi
 
 
/opt/sbin/avahi-daemon -D
 
 
 
'''/opt/etc/default/avahi'''
 
AVAHI_ENABLE=yes
 
 
Make sure you set the startup script to executable:
 
 
$> chmod 755 /opt/etc/init.d/S60avahi
 
 
Alternatively, you can create an upstart script at '''/etc/event.d/avahi''':
 
 
start on started PmConnectionManager                                           
 
                                                                               
 
console output                                                                 
 
                                                                               
 
exec /opt/sbin/avahi-daemon -D                                                 
 
respawn
 
 
NOTE: This script is not being stored in the /opt directory. You may have to replace it after an update, and it may cause problems with your Pre.
 
 
==Connecting via SSH using mDNS==
 
 
mDNS uses the system's hostname and appends it to the <tt>local.</tt> domain. Using the Pre's default <tt>palm-webos-device</tt> hostname, the following command would be used to SSH to your Pre on port 222:
 
 
$> ssh -P 222 palm-webos-device.local.
 
 
If you are using an OpenSSH key to connect:
 
 
$> ssh -i /path/to/ssh/key palm-webos-device.local.
 
 
'''Note: The system that you are connecting from MUST have a mDNS service also running, else the hostname will not resolve'''
 
 
==Current Issues on the Pre==
 
 
* The ipkg binary of Avahi attempts to find the dbus socket at <tt>/opt/var/run/dbus/system_bus_socket</tt>, but the Pre's dbus socket is at <tt>/var/run/dbus/system_bus_socket</tt>. I have detailed a solution by running Avahi with root privileges however an approach which allow it to run after dropping root privileges is preferred.
 
* The avahi-daemon seems to have issues keeping the mDNS name resolution running for more than a few minutes. I don't know if this is a power management issue or something else at this point.
 

Latest revision as of 02:17, 28 December 2011