Project

General

Profile

Bug #28127

Enable providing afpstats via D-Bus interface

Added by Caleb St. John about 1 year ago. Updated about 1 year ago.

Status:
Done
Priority:
Important
Assignee:
Timur Bakeyev
Category:
OS
Target version:
Seen in:
TrueNAS - TrueNAS 11.1-U2
Severity:
Reason for Closing:
Reason for Blocked:
Needs QA:
Yes
Needs Doc:
No
Needs Merging:
No
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:
ChangeLog Required:
No

Related projects 1 project

Description

Running 11.1-U2-RC5 and issuing the afpstats command from the CLI produces a traceback. Please find the verbiage below.

root@truenasbck:~ # afpstats
Traceback (most recent call last):
File "/usr/local/bin/afpstats", line 16, in main
"/org/netatalk/AFPStats")
File "/usr/local/lib/python2.7/site-packages/dbus/bus.py", line 241, in get_object
follow_name_owner_changes=follow_name_owner_changes)
File "/usr/local/lib/python2.7/site-packages/dbus/proxies.py", line 248, in init
self._named_service = conn.activate_name_owner(bus_name)
File "/usr/local/lib/python2.7/site-packages/dbus/bus.py", line 180, in activate_name_owner
self.start_service_by_name(bus_name)
File "/usr/local/lib/python2.7/site-packages/dbus/bus.py", line 278, in start_service_by_name
'su', (bus_name, flags)))
File "/usr/local/lib/python2.7/site-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.netatalk.AFPStats was not provided by any .service files

History

#1 Updated by Dru Lavigne about 1 year ago

  • Assignee changed from Ash Gokhale to Vladimir Vinogradenko
  • Target version changed from N/A to TrueNAS 11.1-U2

#2 Updated by Caleb St. John about 1 year ago

  • File debug-truenasbck-20180201103413.tgz added
  • Assignee changed from Vladimir Vinogradenko to Ash Gokhale
  • Target version changed from TrueNAS 11.1-U2 to N/A
  • Support Suite Ticket set to VYJ-392-56686

Attaching debug of system with the problem.

#3 Updated by Caleb St. John about 1 year ago

  • Private changed from No to Yes

#4 Updated by Vladimir Vinogradenko about 1 year ago

  • Status changed from Not Started to Broken
  • Reason for Blocked set to Waiting for feedback

I have found this https://redmine.ixsystems.com/issues/7886 and not a single evidence that situation has changed since then.

Has it ever been working on FreeNAS?

#5 Updated by Caleb St. John about 1 year ago

It seems like afpstats has never worked based on the last comment on that ticket. If we have another tool to you use (afpuser), then we should either

1. remove afpstats utility
or
2. symlink the afpstats utility to the afpusers utility

What do you think, Vlad?

#6 Avatar?id=14398&size=24x24 Updated by Kris Moore about 1 year ago

Probably makes sense to just remove the afpstats utility if its broken and another one performs the same function.

#7 Updated by Dru Lavigne about 1 year ago

  • Project changed from TrueNAS to FreeNAS
  • Category changed from OS to OS
  • Assignee changed from Ash Gokhale to Timur Bakeyev
  • Target version changed from N/A to 11.2-RC2
  • Support Suite Ticket deleted (VYJ-392-56686)
  • Migration Needed deleted (No)
  • Hide from ChangeLog deleted (No)
  • Support Department Priority deleted (0)

After discussion with Kris, passing to Timur as will require a change to net/netatalk3. It is also possible that one of the default config options is breaking it.

#8 Updated by Timur Bakeyev about 1 year ago

It looks like that all afpstats does is calling equivalent of:

dbus-send --system --dest=org.netatalk.AFPStats /org/netatalk/AFPStats --type=method_call org.netatalk.AFPStats.GetUsers

Possibly with the --print-reply flag also. Need to test that on a live system with some AFP users connected to...

#9 Updated by Timur Bakeyev about 1 year ago

Kris - what changes to @net/netatalk3 did you have in mind?

#10 Updated by Timur Bakeyev about 1 year ago

I think we can get afpstats to work by simply enabling DBus in the port options.

#11 Updated by Timur Bakeyev about 1 year ago

Ok, to make things work we need:

  1. Enable DBUS support for the net/natatalk3 port on the build
  2. In the afp.conf file add:
    afpstats = yes
    

    config option.
  3. Make sure server is restarted.

So, the fix is simple, if there are no objections - I'd implement it. I think afpstats should be statically enabled, no need to make any switches for it in the GUI.

# dbus-send --system --dest=org.netatalk.AFPStats /org/netatalk/AFPStats --print-reply=literal --type=method_call org.netatalk.AFPStats.GetUsers
   array [
   ]
# afpstats
#

As I don't have real consumers for it.

Incidentally, afpusers seems to be broken as well, at least in 11.1-U1:

# afpusers
  File "/usr/local/bin/afpusers", line 97
    print "PID      UID      Username         Name                 Logintime Mac" 
                                                                                ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(int "PID      UID      Username         Name                 Logintime Mac")?

#12 Updated by Caleb St. John about 1 year ago

afpusers being broken seems to be a simple syntax problem so I fixed that but it's throwing errors at the gethostbyaddr function call.

#13 Updated by Timur Bakeyev about 1 year ago

It seems to work for me on 11-STABLE:

# afpusers
PID      UID      Username         Name                 Logintime Mac
root@fn110-sdk:~# uname -a
FreeBSD fn110-sdk.freenas 11.1-STABLE FreeBSD 11.1-STABLE #17 63185ca20c3(freenas/11-stable): Sat Jan 20 04:01:44 UTC 2018     root@gauntlet:/freenas-sdk/freenas/_BE/objs/freenas-sdk/freenas/_BE/os/sys/FreeNAS.amd64  amd64

#14 Updated by Caleb St. John about 1 year ago

Timur, maybe an encoding problem and/or by changing from python2 to python3.

#15 Updated by Timur Bakeyev about 1 year ago

user#17 I'm tempted to resolve this issue by just enabling DBUS in the net/netatalk3 build. That seems to bring afpstats back to life. Any objections regarding this solution?

#16 Updated by Caleb St. John about 1 year ago

I can confirm Timur's fix resolves the afpstats issue.

1. Compiling the netatalk3 port with dbus
2. afpstats = yes under the [Global] section of /usr/local/etc/afp.conf

This produces the following output from afpstats while an AFP session is active:

root@freenas:~ # afpstats
name: afp, pid: 70674, logintime: Feb 07 07:52:41, state: active, volumes: afp-share

#17 Updated by John Hixson about 1 year ago

Timur Bakeyev wrote:

user#17 I'm tempted to resolve this issue by just enabling DBUS in the net/netatalk3 build. That seems to bring afpstats back to life. Any objections regarding this solution?

Sounds good to me. Do it ;-)

#18 Updated by Dru Lavigne about 1 year ago

  • Status changed from Broken to In Progress

#20 Updated by Dru Lavigne about 1 year ago

  • Subject changed from afpstats throws a traceback in 11.1-U2-RC5 to Enable providing afpstats via D-Bus interface

#21 Updated by Timur Bakeyev about 1 year ago

  • File deleted (debug-truenasbck-20180201103413.tgz)

#22 Updated by Timur Bakeyev about 1 year ago

  • Private changed from Yes to No

Also available in: Atom PDF