netatalk issue
基本的なサービスは大体導入も終わって、概ね落ち着いてきたDebian鯖。
残るはafpdくらいか。
Snow Leopard鯖の時から、ウチの職場では共有フォルダを作って仕事のファイルのやり取りをしてる関係上、これが無いと不便であるとプレッシャーかけられている次第。
調べてみたら、afpdを制御するnetatalkは、squeezeだとパッケージされてるのが2.1.2-2ってことなので、現行の安定板である2.2系列を入れたければ、自分でソースからビルドするしかなさそうです。
というわけで、まずテスト鯖でやってみたらハマりました。
netatalkならまずここっていうNetatalk and Sambaで勉強します。
Berkeley DBとLibgcryptが必要なようなので、まず自分のところに入っているか確認。
長いので、iがついているものだけを抜き出すと、
$ sudo aptitude search libdb i libdb4.6 - Berkeley v4.6 Database Libraries [runtime] i libdb4.7 - Berkeley v4.7 Database Libraries [runtime] i libdb4.8 - Berkeley v4.8 Database Libraries [runtime] i A libdbd-mysql-perl - Perl5 database interface to the MySQL data i A libdbi-perl - Perl Database Interface (DBI) $ sudo aptitude search libgcrypt i libgcrypt11 - LGPL Crypto library - runtime library
とこんな感じ。どちらもインストール済みなのかなって思って、Netatalk – Networking Apple Macintosh through Open Sourceからnetatalk-2.2.2.tar.gzを落として、自分のホームにFTPでput。早速解凍してconfigureしてみます。
$ tar zxvf netatalk-2.2.2.tar.gz $ cd netatalk-2.2.2 $ ./configure \ > --enable-debian
としてみたところ、最後の方で
checking for libgcrypt-config... no checking for LIBGCRYPT - version >= 1.2.3... no checking for SSL... no checking for Berkeley DB headers in /usr/local/include/... no checking for Berkeley DB headers in /usr/local/include/db5... no checking for Berkeley DB headers in /usr/local/include/db5.1... no checking for Berkeley DB headers in /usr/local/include/db51... no checking for Berkeley DB headers in /usr/local/include/db5.0... no checking for Berkeley DB headers in /usr/local/include/db50... no checking for Berkeley DB headers in /usr/local/include/db4.8... no checking for Berkeley DB headers in /usr/local/include/db48... no checking for Berkeley DB headers in /usr/local/include/db4.7... no checking for Berkeley DB headers in /usr/local/include/db47... no checking for Berkeley DB headers in /usr/local/include/db4.6... no checking for Berkeley DB headers in /usr/local/include/db46... no checking for Berkeley DB headers in /usr/local/include/db4... no checking for Berkeley DB headers in /usr/include/... no checking for Berkeley DB headers in /usr/include/db5... no checking for Berkeley DB headers in /usr/include/db5.1... no checking for Berkeley DB headers in /usr/include/db51... no checking for Berkeley DB headers in /usr/include/db5.0... no checking for Berkeley DB headers in /usr/include/db50... no checking for Berkeley DB headers in /usr/include/db4.8... no checking for Berkeley DB headers in /usr/include/db48... no checking for Berkeley DB headers in /usr/include/db4.7... no checking for Berkeley DB headers in /usr/include/db47... no checking for Berkeley DB headers in /usr/include/db4.6... no checking for Berkeley DB headers in /usr/include/db46... no checking for Berkeley DB headers in /usr/include/db4... no Make sure you have the required Berkeley DB libraries AND headers installed. You can download the latest version from http://www.sleepycat.com. If you have installed BDB in a non standard location use the --with-bdb=/path/to/bdb configure option and make sure your linker is configured to check for libraries there. configure: error: Berkeley DB library required but not found!
とあったので、やはり最初の二つは入っていなかったことが判明。
では、何が必要なのかと思い、また探してみて今度は同じ方のこちらの記事を参考に
$ sudo aptitude install libssl-dev libgcrypt11-dev libpam0g-dev libwrap0-dev libdb4.8-dev
とまとめてインストール。再度configureしてみると、
Using libraries: LIBS = -lpthread -L$(top_srcdir)/libatalk CFLAGS = -I$(top_srcdir)/include -D_U_="__attribute__((unused))" -g -O2 -I$(top_srcdir)/sys SSL: LIBS = -L/usr/lib64 -lcrypto CFLAGS = -I/usr/include/openssl LIBGCRYPT: LIBS = -lgcrypt CFLAGS = PAM: LIBS = -lpam CFLAGS = WRAP: LIBS = -lwrap CFLAGS = BDB: LIBS = -L/usr/lib64 -ldb-4.8 CFLAGS = Configure summary: Install style: debian AFP: Large file support (>2GB) for AFP3: yes Extended Attributes: ad | sys CNID: backends: dbd last tdb UAMS: DHX (PAM SHADOW) DHX2 (PAM SHADOW) RANDNUM (afppasswd) clrtxt (PAM SHADOW) guest Options: DDP (AppleTalk) support: no SLP support: no Zeroconf support: no tcp wrapper support: yes quota support: yes admin group support: yes valid shell check: yes cracklib support: no dropbox kludge: no force volume uid/gid: no ACL support: no LDAP support: no
とsummaryが表示されたので、まずビルドしてみました。
$ make $ sudo make install
インストールが終わったら設定します。
設定ファイルの置き場所を調べてみて
$ sudo afpd -V afpd 2.2.2 - Apple Filing Protocol (AFP) daemon of Netatalk This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Please see the file COPYING for further information and details. afpd has been compiled with support for these features: AFP versions: 2.2 3.0 3.1 3.2 3.3 DDP(AppleTalk) Support: No CNID backends: dbd last tdb SLP support: No Zeroconf support: No TCP wrappers support: Yes Quota support: Yes Admin group support: Yes Valid shell checks: Yes cracklib support: No Dropbox kludge: No Force volume uid/gid: No EA support: ad | sys ACL support: No LDAP support: No afpd.conf: /usr/local/etc/netatalk/afpd.conf AppleVolumes.system: /usr/local/etc/netatalk/AppleVolumes.system AppleVolumes.default: /usr/local/etc/netatalk/AppleVolumes.default afp_signature.conf: /usr/local/etc/netatalk/afp_signature.conf afp_voluuid.conf: /usr/local/etc/netatalk/afp_voluuid.conf afp_ldap.conf: not supported UAM search path: /usr/local/etc/netatalk/uams/ Server messages path: /usr/local/etc/netatalk/msg/ lockfile: /var/lock/afpd
まずは/etc/default/netatalkから
#### server (unix) and legacy client (<= Mac OS 9) charsets ATALK_UNIX_CHARSET='UTF8' ATALK_MAC_CHARSET='MAC_JAPANESE' #### config for cnid_metad. Default log config: CNID_CONFIG="-l log_note -f /var/log/netatalk.log"
次に/usr/local/etc/netatalk/afpd.conf
# default: - -tcp -noddp -uamlist uams_dhx.so,uams_dhx2.so -nosavepassword -setuplog "default LOG_NOTE /var/log/netatalk.log"
つづいて/usr/local/etc/netatalk/AppleVolumes.default
# The line below sets some DEFAULT, starting with Netatalk 2.1. :DEFAULT: options:upriv,usedots dperm:0755 fperm:0644 # The "~" below indicates that Home directories are visible by default. # If you do not wish to have people accessing their Home directories, # please put a pound sign in front of the tilde or delete it. ~ /home/share "共有" allow:huge
iptablesでport548を解放させていよいよnetatalkを起動。
$ sudo /etc/init.d/netatalk start Starting Netatalk services (this will take a while): cnid_metad afpd.
早速Finderからサーバに接続でテスト鯖を選択。
設定してた共有を選ぶと…
繋がりません(;´Д`)
自分のホームディレクトリには問題なく接続・マウント・ファイル操作ができているので、netatalkのインストール自体はウマくいっていると思われます。
“共有”に設定したディレクトリのpermission関係が問題なのかと思って、何でもありな777にしてみてもやはり入れません。
なのにlsコマンドで見てみると、
$ ls -al /home/share 合計 24 drwxrwxrwx 6 nobody root 4096 2012-04-06 11:05 . drwxr-xr-x 5 root root 4096 2012-04-06 10:18 .. drwxrwxrwx 2 nobody hoge 4096 2012-04-06 10:25 .AppleDesktop drwxrwxrwx 2 nobody hoge 4096 2012-04-06 10:28 .AppleDouble drwxrwxrwx 3 nobody hoge 4096 2012-04-06 10:25 Network Trash Folder drwxrwxrwx 3 nobody hoge 4096 2012-04-06 10:25 Temporary Items
.AppleDesktopとか.AppleDoubleといったドットファイルが作成されていて、OS Xとやり取りしたのは間違いないわけで…
ログはどうだろう、と見に行ってみたら
$ sudo cat /var/log/netatalk.log Apr 06 11:23:37.491465 afpd[21930] {volume.c:2221} (W:AFPDaemon): volume "共有" does not support Extended Attributes, using ea:ad instead Apr 06 11:23:39.543194 afpd[21930] {charcnv.c:395} (E:Default): Conversion failed (CH_UCS2 to MAC_ROMAN):Invalid or incomplete multibyte or wide character Apr 06 11:23:39.543597 afpd[21930] {dsi_stream.c:108} (E:DSI): dsi_peek: EOF Apr 06 11:23:39.543624 afpd[21930] {dsi_stream.c:484} (E:DSI): dsi_stream_send: Resource temporarily unavailable Apr 06 11:23:39.543646 afpd[21930] {afp_dsi.c:644} (E:AFPDaemon): dsi_cmdreply(8): Resource temporarily unavailable Apr 06 11:23:39.543661 afpd[21930] {dsi_stream.c:247} (N:DSI): dsi_disconnect: entering disconnected state Apr 06 11:23:39.543684 afpd[21930] {dsi_stream.c:247} (N:DSI): dsi_disconnect: entering disconnected state
原因っぽいのが、この行。文字コードの問題?
Conversion failed (CH_UCS2 to MAC_ROMAN):Invalid or incomplete multibyte or wide character
netatalk.confで文字コードを設定しているはずなんだけど…
念のためafpd.confを再編集
- -tcp -noddp -uamlist uams_dhx.so,uams_dhx2.so -nosavepassword -setuplog "default LOG_NOTE /var/log/netatalk.log" -maccodepage MAC_JAPANESE -unixcodepage UTF8
-maccodepage MAC_JAPANESE -unixcodepage UTF8を付加してみた。
$ sudo /etc/init.d/netatalk restart
netatalkを再起動して、今度は問題なくマウントできました。
$ mount afp_4wB8JI2o15Og0fRZXZ1QMfrI-3.3000000b on /Volumes/共有 (afpfs, nodev, nosuid, mounted by hoge)
afpが使えるとFTPの出番も減るし、なんといってもラクチンだし、これで一つまた解決しました。
2.2のインストールをするのに3.0を参考にするのもどうかと。
他にも参考ページは沢山あることだし。
HATさん>
>2.2のインストールをするのに3.0を参考にするのもどうかと。
確かに仰る通りです。
おかげさまで、今のところ無事に動いているようです。
サーバ側のファイルシステムで拡張属性を有効にしておいたほうがいいと思います。一応。
ありがとうございます。早速設定しました。
Do choose an electrical contractor that has a reputation in the market.
This model of Harbor Breeze Ceiling Fans is only priced
at $109. If you would have known it was this
easy you may have made this change sooner.