Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved!] netatalk cause CPU 100%
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
bluephoenix
Tux's lil' helper
Tux's lil' helper


Joined: 01 Nov 2008
Posts: 94

PostPosted: Sun Mar 02, 2014 2:44 pm    Post subject: [Solved!] netatalk cause CPU 100% Reply with quote

After I installed netatalk to provide the shared folder for my mac, I got CPU 100% as long as I start my computer.

I checked the afpd.log and I get the following error message:
# tail /var/log/afpd.log
Mar 02 22:20:24.488166 cnid_metad[1674] {usockfd.c:169} (E:CNID): error in accept: Socket operation on non-socket
Mar 02 22:20:24.488171 cnid_metad[1674] {usockfd.c:169} (E:CNID): error in accept: Socket operation on non-socket
message repeated 999 times
Mar 02 22:20:24.488898 cnid_metad[1674] {usockfd.c:169} (E:CNID): error in accept: Socket operation on non-socket
Mar 02 22:20:24.488909 cnid_metad[1674] {usockfd.c:169} (E:CNID): error in accept: Socket operation on non-socket
Mar 02 22:20:24.488915 cnid_metad[1674] {usockfd.c:169} (E:CNID): error in accept: Socket operation on non-socket
Mar 02 22:20:24.488921 cnid_metad[1674] {usockfd.c:169} (E:CNID): error in accept: Socket operation on non-socket
message repeated 999 times
Mar 02 22:20:24.489574 afpd[1673] {main.c:102} (N:AFPDaemon): AFP Server shutting down
Mar 02 22:20:24.489889 netatalk[1671] {netatalk.c:340} (N:AFPDaemon): Netatalk AFP server exiting

In deed, you can find the sub process of netatalk - cnid_metad creates hundreds or thousands error logs per second in "afpd.log" so that I have to stop the service or the log file will fill out my whole hard disk.

my /etc/afp.conf is as follows:
[Global]
hostname = BPLinuxDesk
log file = /var/log/afpd.log

[Homes]
path = Downloads
basedir regex = /home

But one strange thing is this phenomenon will only happen when I auto-start netatalk by using "systemctl enable netatalk". If I disable this service from boot up (systemd), instead I start it after the boot up by manually command input, this phenomenon will not happen any more and everything seems normal. Whatever there is error syslog or not, this computer can share its folder for my macbook. So I strongly doubt this issue is caused by systemd. But I am not sure and don't know how to fix it.

I cannot get any fixing method from google. It seems that this is not a popular issue.

Is there any one could share some good idea to solve it?


Last edited by bluephoenix on Mon Mar 03, 2014 2:11 pm; edited 1 time in total
Back to top
View user's profile Send private message
SirRobin2318
Apprentice
Apprentice


Joined: 24 Apr 2004
Posts: 241
Location: Strasbourg, france.

PostPosted: Sun Mar 02, 2014 2:51 pm    Post subject: Reply with quote

Is this the service file you're using?
(this one is a template from their github)

Code:
[Unit]
Description=Netatalk AFP fileserver for Macintosh clients
Documentation=man:afp.conf(5) man:netatalk(8) man:afpd(8) man:cnid_metad(8) man:cnid_dbd(8)
Documentation=http://netatalk.sourceforge.net/
After=syslog.target network.target avahi-daemon.service

[Service]
Type=forking
GuessMainPID=no
ExecStart=/bin/sh -c :SBINDIR:/netatalk
PIDFile=:PATH_NETATALK_LOCK:
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=1

[Install]
WantedBy=multi-user.target
Back to top
View user's profile Send private message
bluephoenix
Tux's lil' helper
Tux's lil' helper


Joined: 01 Nov 2008
Posts: 94

PostPosted: Mon Mar 03, 2014 5:41 am    Post subject: reply Reply with quote

the netatalk.service file I am using is as follows:
Code:

[Unit]
Description=Netatalk AFP fileserver for Macintosh clients
Documentation=man:afp.conf(5) man:netatalk(8) man:afpd(8) man:cnid_metad(8) man:cnid_dbd(8)
Documentation=http://netatalk.sourceforge.net/
After=syslog.target network.target avahi-daemon.service

[Service]
Type=forking
GuessMainPID=no
ExecStart=/usr/sbin/netatalk
PIDFile=/run/lock/netatalk
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=1

[Install]
WantedBy=multi-user.target


I also tried your above proposal, but which causes netatalk service cannot be started then.
I also tried to use netatalk 3.1.0 version instead of the 3.0.5 while I also tried to install avahi. But both method cannot solve my initial problem although both of them can work.
Back to top
View user's profile Send private message
SirRobin2318
Apprentice
Apprentice


Joined: 24 Apr 2004
Posts: 241
Location: Strasbourg, france.

PostPosted: Mon Mar 03, 2014 10:00 am    Post subject: Reply with quote

Hmmm, you're not alone apparently: https://groups.google.com/forum/#!topic/alt-f/G4P_o7Uikx0
Start by checking your /etc/hosts file, then you can try this:
Quote:
I think I fixe the problem by modifying the start up parameters in /
etc/init.d/S51afpd to hard code the IP address:

CNID_OPTS="-h 127.0.0.1 -p 4700 -l log_info -f /var/log/cnid.log"


I'll do a little digging to see if I can find something else.
Just to try to rule out systemd, if you boot with netatalk disabled, but start it with systemctl start netatalk, does it work?
Back to top
View user's profile Send private message
bluephoenix
Tux's lil' helper
Tux's lil' helper


Joined: 01 Nov 2008
Posts: 94

PostPosted: Mon Mar 03, 2014 1:48 pm    Post subject: reply Reply with quote

Hi, SirRobin,

Thanks a lot!

1. I cannot access the google forum since I am in China, where google is not legal. So I can not catch up your point about modify the file in "/etc/init.d" folder. Indeed, there is no the file with the same file name you mentioned in my folder.

2. If I start the netatalk by using the command "systemctl start netatalk" after booting in a terminal, CPU usage is normal. But if I let the systemd to start netatalk in the booting procedure, the CPU usage will reach 100%.
Back to top
View user's profile Send private message
SirRobin2318
Apprentice
Apprentice


Joined: 24 Apr 2004
Posts: 241
Location: Strasbourg, france.

PostPosted: Mon Mar 03, 2014 2:00 pm    Post subject: Reply with quote

Could you post your /etc/hosts, /etc/hostname, and the afpd config file (on google they were saying it was /etc/init.d, on gentoo it might be different) please?


If you'd like to access google, you might be interested in this: https://www.torproject.org/projects/torbrowser.html.en
Just download it, un tar it, start it with ./start-tor-browser
Back to top
View user's profile Send private message
bluephoenix
Tux's lil' helper
Tux's lil' helper


Joined: 01 Nov 2008
Posts: 94

PostPosted: Mon Mar 03, 2014 2:11 pm    Post subject: Reply with quote

Many thanks, Robin,

I did solve this issue just by modifying the "/etc/hosts" file. I ever changed this file for some reason before and I deleted "localhost" item. Now I try to add this item back to the file and restart my computer, everything is fine now!

So really many thanks!

Although google is not legal in China, I can still have a little access to the page you proposed finally. After long waiting for the web page transfer, I get some clue from that page. So I find the "localhost" item missing issue.

Solved, quite nice!
Back to top
View user's profile Send private message
SirRobin2318
Apprentice
Apprentice


Joined: 24 Apr 2004
Posts: 241
Location: Strasbourg, france.

PostPosted: Mon Mar 03, 2014 2:21 pm    Post subject: Reply with quote

Ok great :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum