# Massive netatalk errors



## traustitj (May 5, 2013)

Hi all. 

I think my problems started when I updated my Mac to the latest 10.8.3 update, but I am not entirely sure. Anyway the problems can be described in this way. Either my shares open up read-only, or they say my disk is full when trying to write files larger than a few megabytes. In my logs, I am seeing:

```
May  5 14:07:43 q afpd[64337]: AFP3.3 Login by tj
May  5 14:07:46 q cnid_metad[64329]: error in sendmsg: Broken pipe
May  5 14:08:07 q afpd[64337]: transmit: Request to dbd daemon (db_dir /mysan/asan) timed out.
May  5 14:08:07 q afpd[64337]: Reopen volume /mysan/asan using in memory temporary CNID DB.
```
When I start netatalk, it says in my logs: 

```
May  5 13:47:38 q afpd[64112]: main: atp_open: Protocol not supported
May  5 13:47:38 q afpd[64112]: AFP/TCP started, advertising 10.0.0.94:548 (2.2.4)
May  5 13:47:38 q afpd[64112]: AFP/TCP started, advertising 10.0.0.94:548 (2.2.4)
May  5 13:47:38 q afpd[64112]: dsi_tcp_init: no suitable network config for TCP socket
May  5 13:47:38 q afpd[64112]: main: dsi_init: Address already in use
May  5 13:47:38 q afpd[64112]: uam_register: "DHCAST128" already loaded by uams_dhx_passwd.so
May  5 13:47:38 q afpd[64112]: uam_load(uams_dhx_passwd.so): uam_setup failed
May  5 13:47:38 q afpd[64112]: uam: uams_dhx_passwd.so load failure
May  5 13:47:38 q afpd[64112]: uam_register: "DHX2" already loaded by uams_dhx2_passwd.so
May  5 13:47:38 q afpd[64112]: uam_load(uams_dhx2_passwd.so): uam_setup failed
May  5 13:47:38 q afpd[64112]: uam: uams_dhx2_passwd.so load failure
```

What I have already done.

My system was FreeBSD 9.0, so I upgraded it to 9.1 using a recipe I found in the freebsd FreeBSD book. Upgraded the /usr/ports tree, and upgraded the latest netatalk 2.2.4 (from 2.2.3), I did have to remove the old version and install it again. I have deleted all .AppleD* files as people have said. No luck.

I did create a new fresh empty IFS filesystem called mysan/asan just to test with so I don't damage the other ones, but no luck.

This is extremely urgent as I have my 

I enclose my config files in hope someone can help me. I did omit the lines with # as they are useless. Here are the files (then no one needs to download them):

All files from /usr/local/etc

afpd.conf

```
"Q" - defaultvol /usr/local/etc/AppleVolumes.default -systemvol /usr/local/etc/AppleVolumes.system -uamlist uams_random.so,uams_dhx.so,uams_dhx2.so -maccodepage MAC_ROMAN -unixcodepage UTF8 -savepassword -setpassword -transall -mimicmodel RackMac -ipaddr 10.0.0.94

default:
- -tcp -noddp -uamlist uams_dhx.so,uams_dhx2.so -nosavepassword
```
netatalk.conf

```
ATALK_UNIX_CHARSET='LOCALE'
ATALK_MAC_CHARSET='MAC_ROMAN'

export ATALK_UNIX_CHARSET
export ATALK_MAC_CHARSET

CNID_METAD_RUN=yes
AFPD_RUN=yes
```
AppleVolumes.default

```
:DEFAULT: options:upriv,usedots

/mysan/traustitm "TimeMachine for $u" adouble:osx allow:tj cnidscheme:dbd ea:auto options:tm,invisibledots,upriv dperm:0770 fperm:0660 volcharset:UTF8
/mysan/elsatm "TimeMachine for $u" adouble:osx allow:elsa cnidscheme:dbd ea:auto options:tm,invisibledots,upriv dperm:0770 fperm:0660 volcharset:UTF8
/mysan/scratch "NAS area" adouble:osx allow:elsa,tj cnidscheme:dbd ea:auto options:tm,invisibledots,upriv dperm:0770 fperm:0660 volcharset:UTF8
/mysan/asan "Apple San" adouble:osx allow:tj cnidscheme:dbd ea:auto options:tm,invisibledots,upriv dperm:0770 fperm:0660 volcharset:UTF8
```
In my /etc/rc.conf I have (complete file):

```
ntpd_enable="YES"
ntpd_sync_on_start="YES"
hostname="q"
zfs_enable="YES"
sshd_enable="YES"
keymap="icelandic.iso.kbd"
ifconfig_em0=" inet 10.0.0.94 netmask 255.255.255.0"
defaultrouter="10.0.0.138"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
dbus_enable="YES"
netatalk_enable="YES"
afpd_enable="YES"
cnid_metad_enable="YES"
avahi_daemon_enable="YES"
avahi_dnsconfd_enable="YES"
hald_enable="YES"
nfs_server_enable="YES"
mountd_flags="-r"
nfs_client_enable="YES"
rpcbind_enable="YES"
iscsi_target_enable="YES"
samba_enable="YES"
svscan_enable="YES"
#djb dns
# Daemontools svscan variables
MINSEGMENT=10240
MAXSEGMENT=20480
MAXFILESIZE=10240
MAXFD=100
MAXCHILD=40

# ulimits
ulimit -d ${MINSEGMENT}
ulimit -f ${MAXFILESIZE}
ulimit -m ${MAXSEGMENT}
ulimit -n ${MAXFD}
ulimit -s ${MINSEGMENT}
ulimit -u ${MAXCHILD}
```
I hope someone can help me. I have been googling for weeks, trying everything and that includes deleting everything and start from scratch.

Side question, is netatalk going to be useless?


----------



## Anonymous (May 5, 2013)

To begin with, I got one FreeBSD 9.1 box running net/netatalk-2.2.4_1,1. And it is working very well with all my Macs, including 2 with OS X 10.8.3.



			
				traustitj said:
			
		

> ```
> ...
> May  5 14:07:43 q afpd[64337]: AFP3.3 Login by tj
> May  5 14:07:46 q cnid_metad[64329]: error in sendmsg: Broken pipe
> ...



This error message looks like the cnid_metad could not find its dbd database directory. You said, that you created /mysan/asan as an IFS = Inode File System. On an IFS, files are referenced by their inode number only, and not by name. Are you sure that cnid_metad and cnid_dbd never want to access files in their database directory by name? Is this specified somewhere or has this ever worked before for you?

My netatalk configuration is more simple than yours. afpd.conf and netatalk.conf are not changed at all, and my AppleVolumes.default looks like this:


```
:DEFAULT: options:upriv,usedots dbpath:/var/dbd/AppleDB/$v dperm:0770 fperm:0660 umask:0007

/home/$u $u dperm:0700 fperm:0600 umask:0077
/usr/files Files allow:@users
/tm Backup allow:rolf,andreia options:tm ea:ad
```

Note, how I explicitely defined the dbpath residing on a volume belonging to the system, and I created this path not as a volatile file system but as a standard directory.


```
drwx------  8 root  wheel  512 May  5 11:15 /var/dbd/AppleDB
```

For your troubleshooting approach you might want to think about resetting all your configuration files to the factory defaults, then add step-by-step your refined settings, checking after each step, whether everything is still working.

My perception is that netatalk is not going to become useless. In contrary it is under heavy development and there is also already the latest and greatest net/netatalk3 in the ports. Which works also well on one of my other FreeBSD 9.1 boxes.


----------



## traustitj (May 5, 2013)

Hi.

I am using ZFS. I also tried to use dbpath, but the end result is the same.


----------



## traustitj (May 5, 2013)

I changed the Applevolumes.default as you suggested. This is the result:


```
[root@q /]# /usr/local/etc/rc.d/netatalk start
[root@q /]# May  6 00:10:42 q afpd[65734]: main: atp_open: Protocol not supported
May  6 00:10:42 q afpd[65734]: AFP/TCP started, advertising 10.0.0.94:548 (2.2.4)
May  6 00:10:42 q afpd[65734]: AFP/TCP started, advertising 10.0.0.94:548 (2.2.4)
May  6 00:10:42 q afpd[65734]: dsi_tcp_init: no suitable network config for TCP socket
May  6 00:10:42 q afpd[65734]: main: dsi_init: Address already in use

[root@q /]# May  6 00:10:54 q afpd[65737]: AFP3.3 Login by tj
May  6 00:10:56 q cnid_metad[65731]: error in sendmsg: Broken pipe
May  6 00:11:17 q afpd[65737]: transmit: Request to dbd daemon (db_dir /mysan/asan) timed out.
May  6 00:11:17 q afpd[65737]: Reopen volume /mysan/asan using in memory temporary CNID DB.
May  6 00:12:00 q afpd[65737]: write_file: DISK FULL

[root@q /]# /usr/local/etc/rc.d/netatalk stop 
May  6 00:12:01 q afpd[65737]: write_file: DISK FULL
May  6 00:12:11 q afpd[65737]: AFP statistics: 10386.99 KB read, 61.75 KB written
May  6 00:12:11 q afpd[65734]: AFP Server shutting down on SIGTERM
May  6 00:12:11 q afpd[65737]: dsi_stream_write: Bad file descriptor
May  6 00:12:11 q afpd[65737]: AFP statistics: 10386.99 KB read, 61.77 KB written
May  6 00:12:11 q afpd[65737]: dsi_stream_write: Bad file descriptor
```

The error message is different, but the results are the same. I can not copy a 900 MB file over as it states that disk is full, even though it reports 6.7 TB free.

I am willing to try anything here, pretty much


----------



## Anonymous (May 5, 2013)

traustitj said:
			
		

> ```
> ...
> May  6 00:10:56 q cnid_metad[65731]: error in sendmsg: Broken pipe
> May  6 00:11:17 q afpd[65737]: transmit: Request to dbd daemon (db_dir /mysan/asan) timed out.
> ...



Hmm, with respect to the cnid_metad error, it is still the same. It is still looking for /mysan/asan for its database storage, and obviously can't find it.

What happens if you submit as root the following command sequence?

`# mkdir /mysan/asan/test`
`# touch /mysan/asan/test/cnid2.db`

Does this create the test directory at the supposed DB storage, and a file in there?


----------



## traustitj (May 7, 2013)

Creating files, directories and such on the unix side works like a charm. The files even appear in the Finder, but doing work through Netatalk is troublesome, as can be seen above.

This ZFS filesystem was created specifically brand new as a trouble shoot directory.


----------



## traustitj (May 7, 2013)

When I tried another netatalk share, this came in the logs:


```
May  7 22:38:14 q afpd[70520]: transmit: Request to dbd daemon (db_dir /mysan/scratch) timed out.
May  7 22:38:35 q afpd[70520]: transmit: Request to dbd daemon (db_dir /mysan/scratch) timed out.
May  7 22:38:35 q afpd[70520]: enumerate(vid:5, did:2, name:'.'): error adding dir: 'Virtual Machines'
May  7 22:38:35 q cnid_metad[70512]: error in sendmsg: Broken pipe
May  7 22:38:56 q afpd[70520]: transmit: Request to dbd daemon (db_dir /mysan/scratch) timed out.
May  7 22:38:56 q afpd[70520]: enumerate(vid:5, did:2, name:'.'): error adding dir: 'Virtual Machines'
May  7 22:39:17 q afpd[70520]: transmit: Request to dbd daemon (db_dir /mysan/scratch) timed out.
May  7 22:39:17 q afpd[70520]: enumerate(vid:5, did:2, name:'.'): error adding dir: 'Virtual Machines'
May  7 22:39:53 q afpd[70520]: transmit: Request to dbd daemon (db_dir /mysan/scratch) timed out.
May  7 22:39:53 q afpd[70520]: enumerate(vid:5, did:2, name:'.'): error adding dir: 'Virtual Machines'
```

This same directory works like a charm over NFS and under Unix. There are no disk issues.


----------



## traustitj (May 9, 2013)

What would be the steps I need to take in order to reset my Netatalk? I am sure this is working for most people, if not I would be finding more information.


----------

