Avahi....getting better

309 views
Skip to first unread message

Hamish Campbell

unread,
Nov 17, 2010, 4:15:55 PM11/17/10
to Alt-F
Hi Joao,

Thanks for the user info.

I used you commands to make the default group and default user

addgroup -S -g <group id> default
adduser -S -g "avahi daemon" -G default -u <user id under 100> -h /var/
lib/default default

chown -R default:default /etc/avahi/
ln -sf /usr/sbin/rcscript /sbin/rcavahi

Note that your posting made an avahi user, it needs to be default,
also there wasn't a .conf file I don't think so I made the whole avahi
directory owned by default.

Anyway, if took me a while to work out I needed to do the save
settings via the web admin to make the user and group stay there after
reboot :)

On boot the log seems to say that avahi started successfully so thats
good.

%%%%%%%%%%%%%%%%%%%% from system log
Nov 17 20:33:26 CampbellNAS daemon.info avahi-daemon[483]: Found user
'default' (UID 83) and group 'default' (GID 83).
Nov 17 20:33:26 CampbellNAS daemon.info avahi-daemon[483]:
Successfully dropped root privileges.
Nov 17 20:33:26 CampbellNAS daemon.info avahi-daemon[483]: avahi-
daemon 0.6.23 starting up.
Nov 17 20:33:26 CampbellNAS daemon.warn avahi-daemon[483]: WARNING: No
NSS support for mDNS detected, consider installing nss-mdns!
Nov 17 20:33:26 CampbellNAS daemon.info avahi-daemon[483]: Loading
service file /etc/avahi/services/sftp-ssh.service.
Nov 17 20:33:26 CampbellNAS daemon.info avahi-daemon[483]: Loading
service file /etc/avahi/services/ssh.service.
Nov 17 20:33:26 CampbellNAS daemon.info avahi-daemon[483]: Joining
mDNS multicast group on interface eth0.IPv4 with address
192.168.0.102.
Nov 17 20:33:26 CampbellNAS daemon.info avahi-daemon[483]: New
relevant interface eth0.IPv4 for mDNS.
Nov 17 20:33:26 CampbellNAS daemon.info avahi-daemon[483]: Network
interface enumeration completed.
Nov 17 20:33:26 CampbellNAS daemon.info avahi-daemon[483]: Registering
new address record for 192.168.0.102 on eth0.IPv4.
Nov 17 20:33:26 CampbellNAS daemon.info avahi-daemon[483]: Registering
HINFO record with values 'ARMV5TEL'/'LINUX'.
Nov 17 20:33:26 CampbellNAS user.notice root:
Nov 17 20:33:27 CampbellNAS daemon.info avahi-daemon[483]: Server
startup complete. Host name is CampbellNAS.local. Local service cookie
is 174717744.
Nov 17 20:33:28 CampbellNAS daemon.info avahi-daemon[483]: Service
"CampbellNAS" (/etc/avahi/services/ssh.service) successfully
established.
Nov 17 20:33:28 CampbellNAS daemon.info avahi-daemon[483]: Service
"SFTP File Transfer on CampbellNAS" (/etc/avahi/services/sftp-
ssh.service) successfully established.
%%%%%%%%%%%%%

Google seems to say the NSS stuff isn't required.

So now to the problems:

1.
MacBook can't see the nas via avahi/bonjour, but can see the samba.
Ubuntu can see samba AND see 'SFTP File Transfer on CampbellNas' but
can't mount it.

2.

I added Type= net into the start up scripts, so I can see the avahi
daemon in the web admin.
However, even though the service starts on boot, the web page says
that service is not running. ps confirms that it is.
Is there some naming that needs to be the same for it to know it is
running. I put a NAME= in the script too, which is the same as the
name of the daemon I believe.

Any help appreciated.

Haven't played any more with miniDLNA, but will do some at some point.

Hamish Campbell

unread,
Nov 18, 2010, 2:59:21 AM11/18/10
to Alt-F
Ok, it's always after one writes that one finds out something new.

Avahi - Discovery of devices, advertisement of services.
Netatalk - AFP device access.

Took me a while to work this out as on Macs they just talk about
'Bonjour' and really mean both those, plus the official DNS 323
firmware has an add-on (which i used) called bonjour to give these two
services.

SO.......

I found I needed to update the /etc/avahi/services/ directory with new
service files. These are XML descriptions. So I added one for samba
(bit redundent) and AFP.

After a restart the samba via avahi was available from my ubuntu
laptop and worked.

AFP was not. This is reliant on netatalk working. I had installed
the netatalk package via alt-f but it seems there is some work to do
there. Thats the next thing to have a go at.

Anyone know if netatalk should run as a service? Or is it just
available libraries?
On installation from alt-f there is a /etc/netatalk with some bits and
pieces and some .ko files but no obvious scripts for running and
nothing has been placed in the init.d directory to start it up.

Note: alt-f admin pages still can't see that avahi is running.

Cheers

Haim

Joao Cardoso

unread,
Nov 18, 2010, 5:23:41 AM11/18/10
to Alt-F


On Nov 18, 7:59 am, Hamish Campbell <haimcampb...@gmail.com> wrote:
> Ok, it's always after one writes that one finds out something new.
>
> Avahi - Discovery of devices, advertisement of services.
> Netatalk - AFP device access.
>
> Took me a while to work this out as on Macs they just talk about
> 'Bonjour' and really mean both those, plus the official DNS 323
> firmware has an add-on (which i used) called bonjour to give these two
> services.
>
> SO.......
>
> I found I needed to update the /etc/avahi/services/ directory with new
> service files.  These are XML descriptions.  So I added one for samba
> (bit redundent) and AFP.
>
> After a restart the samba via avahi was available from my ubuntu
> laptop and worked.
>
> AFP was not.  This is reliant on netatalk working.  I had installed
> the netatalk package via alt-f but it seems there is some work to do
> there.  Thats the next thing to have a go at.

netatalk and avahi are the only Alt-F untested packages... they were
just compiled and the installed files bundled together into a
package.

I was thinking in dropping netatalk, as I read that it has worse
performance than samba on macs.

> Anyone know if netatalk should run as a service? Or is it just
> available libraries?
> On installation from alt-f there is a /etc/netatalk with some bits and
> pieces and some .ko files but no obvious scripts for running and
> nothing has been placed in the init.d directory to start it up.

The configs are in /etc/netatalk/, notably afpd.conf.

You have a wiki and the documentation

http://sourceforge.net/apps/mediawiki/netatalk/index.php?title=Main_Page
http://netatalk.sourceforge.net/2.1/htmldocs/

While reading, please notice that AppleTalk is not available under Alt-
F, and the netatalk package is version 2.1

Start first by familiarizing yourself with netatalk using your Ubunto,
make it work, then try to do the same in Alt-F, starting aftp from the
command line -- you might have to set some options.

Remember, what you want is afpd - AppleTalk Filing Protocol daemon

I cant be of any help, as I don't have a Mac.

> Note: alt-f admin pages still can't see that avahi is running.

Please replace /etc/init.d/S50avahi-daemon with the following:

-----------8<---------------------
#!/bin/sh
#
# avahi-daemon init script

DESC="The Avahi mDNS/DNS-SD daemon"
NAME=avahi-daemon
TYPE=net

umask 077

. $(dirname $0)/common

case "$1" in
start) start $NAME -- -D ;;
stop) stop $NAME ;;
status) status $NAME ;;
reload) reload $NAME ;;
restart) restart $NAME ;;
*) usage $0 "start|stop|status|restart|reload" ;;
esac
----------->8---------------------

Also, the shortcut for the init script must be:

ln -sf /usr/sbin/rcscript /sbin/rcavahi-daemon

and a few more service fragments:

----- ftp.service -----
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">FTP File Sharing on %h</name>
<service>
<type>_ftp._tcp</type>
<port>21</port>
</service>
</service-group>

----- http.service -----
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">HTTP server in %h</name>
<service>
<type>_http._tcp</type>
<port>80</port>
</service>
</service-group>

----- samba.service -----
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Samba Shares on %h</name>
<service>
<type>_smb._tcp</type>
<port>139</port>
</service>
</service-group>

----- sftp-ssh.service -----
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">SFTP File Transfer on %h</name>
<service>
<type>_sftp-ssh._tcp</type>
<port>22</port>
</service>
</service-group>

----- ssh.service -----
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">SSH services on %h</name>
<service>
<type>_ssh._tcp</type>
<port>22</port>
</service>
</service-group>

Please keeping reporting progress

Luck,
Joao

> Cheers
>
> Haim

Hamish Campbell

unread,
Nov 18, 2010, 5:50:59 AM11/18/10
to Alt-F
Cheers Joao,

Whilst bored at work, I have been doing some looking round and found
netatalk pages. So, yes I need the afpd service running. I think
with this knowledge I should be able to get it going, we'll see if I
have time tonight to have a play.

I checked the version actually, as on the main dns forums people where
setting up 2.1.3 or something, and that required a different db
version. So confirmed that shouldn't be a problem here.

Once it's up and running then the mac 'timemachine' backup should
work. I have had that running on the stock firmware.

And will compare the suggested script content for avahi to see what
I've got wrong there. cheers :)



On Nov 18, 11:23 am, Joao Cardoso <whoami.jc...@gmail.com> wrote:

Hamish Campbell

unread,
Nov 20, 2010, 1:18:53 AM11/20/10
to Alt-F

New avahi startup script worked a treat. Service now starts and stops
from web admin. cheers.

I'll have a look at netatalk now. It's actually setup in ubuntu by
default so I can test from that.....handy as I struggle to get the mac
off the wife :)

Hamish Campbell

unread,
Nov 20, 2010, 1:54:06 AM11/20/10
to Alt-F

Hmmm...well from my reading too what I just need to run is the afpd
daemon.

However I can't find this anywhere. I can find atalkd, and plenty of
conf files and other references to netatalk, and there is even a
afpd<something> .py file, however no afpd. Can that be some issue
with the install? I'm a bit surprised as it looks like the other
daemons that come with netatalk are all optional and afpd is the one
that must run.

Joao Cardoso

unread,
Nov 20, 2010, 10:52:18 AM11/20/10
to Alt-F
You seems to be right... I have attached it, put it in /usr/sbin, make
sure it
is root:root and executable and report back, please.

I don't know if the list handles attachements, so I BCC you (have you
received it?)

Thanks

Hamish Campbell

unread,
Nov 21, 2010, 4:03:18 PM11/21/10
to Alt-F
Didn't have so much time to play around,

I've popped that the file in sbin and ran it from the command line.
Seems to run happily.

Tried restarting avahi, which has the afp service supposedly starting
up ok, however still no AFP appearing on the network. Presume
something in
my netatalk setup is not right. Have looked at a couple of how-to's
for putting it on via ffp, nothing obvious yet. Haven't looked in
logs yet so that will be the next
step, hopefully tomorrow night.

Thanks for the help.

Haim

Joao Cardoso

unread,
Nov 22, 2010, 12:47:15 PM11/22/10
to Alt-F


On Nov 21, 9:03 pm, Hamish Campbell <haimcampb...@gmail.com> wrote:
> Didn't have so much time to play around,
>
> I've popped that the file in sbin and ran it from the command line.
> Seems to run happily.
>
> Tried restarting avahi, which has the afp service supposedly starting
> up ok, however still no AFP appearing on the network.

In order for avahi to publish afp it needs the following file:

-----------8<--------/etc/avahi/services/afp.service-----------------
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
</service-group>
------------>8-------------------------------------------

The following script might be usefull too:

-----------8<--------/etc/init.d/S51afpd-----------------
#!/bin/sh

NAME=afpd
DESC="AppleTalk Filing Protocol daemon."
TYPE=net

AFPD_OPTS=""

. $(dirname $0)/common

case "$1" in
start) start $NAME -- $AFPD_OPTS ;;
stop) stop $NAME ;;
restart) restart $NAME ;;
reload) reload $NAME ;;
status) status $NAME ;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac
------------>8-------------------------------------------

Although I don't have a Mac, I tried using afpfs-ng in another linux
host to simulate a Mac cmd line client.

I can connect, login and select a afp share, but I can't get a
directory listing. It seems to be a db (Berkeley Database) problem.

So I uninstalled Alt-F db and netatalk and installed ffp db48-4.8.30-1
and netatalk-2.1.3-1, and they worked; I could login, select an afp
share, get a directory listing and download a file.

So, until I fix Alt-F db, you can resort to ffp. Remember to uninstall
first Alt-F db and netatalk, as Alt-F binaries have priority over ffp
ones.

Joao
Reply all
Reply to author
Forward
0 new messages