OS-6211

support Linux accounting

Status:
Resolved
Resolution:
Fixed
Created:
2017-06-27T13:21:54.000-0400
Updated:
2017-12-14T12:24:15.123-0500

Description

I'm seeing the message: accton: Function not implemented

I'm trying to understand if this is a problem in psacct or in systemd namespace issues.

[root@53507b54-9413-c84f-e181-c2bcf412b6db ~]# systemctl status psacct
● psacct.service - Kernel process accounting
   Loaded: loaded (/usr/lib/systemd/system/psacct.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@53507b54-9413-c84f-e181-c2bcf412b6db ~]# systemctl start psacct
Job for psacct.service failed because the control process exited with error code. See "systemctl status psacct.service" and "journalctl -xe" for details.
[root@53507b54-9413-c84f-e181-c2bcf412b6db ~]# 
[root@53507b54-9413-c84f-e181-c2bcf412b6db ~]# journalctl -xe
Jun 27 16:44:20 53507b54-9413-c84f-e181-c2bcf412b6db systemd-logind[62084]: Removed session c2.
-- Subject: Session c2 has been terminated
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
-- 
-- A session with the ID c2 has been terminated.
Jun 27 16:44:38 53507b54-9413-c84f-e181-c2bcf412b6db sshd[63662]: Accepted publickey for root from 174.21.153.122 port 54424 ssh2: RSA 46:26:9a:c2:ef:0f:07:b2:ce:83:
Jun 27 16:44:38 53507b54-9413-c84f-e181-c2bcf412b6db systemd-logind[62084]: New session c3 of user root.
-- Subject: A new session c3 has been created for user root
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
-- 
-- A new session with the ID c3 has been created for the user root.
-- 
-- The leading process of the session is 63662.
Jun 27 16:44:38 53507b54-9413-c84f-e181-c2bcf412b6db systemd[61747]: Started Session c3 of user root.
-- Subject: Unit session-c3.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit session-c3.scope has finished starting up.
-- 
-- The start-up result is done.
Jun 27 16:44:38 53507b54-9413-c84f-e181-c2bcf412b6db systemd[61747]: Starting Session c3 of user root.
-- Subject: Unit session-c3.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit session-c3.scope has begun starting up.
Jun 27 16:44:38 53507b54-9413-c84f-e181-c2bcf412b6db sshd[63662]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jun 27 16:44:38 53507b54-9413-c84f-e181-c2bcf412b6db sshd[63662]: Received disconnect from 174.21.153.122: 11: disconnected by user
Jun 27 16:44:38 53507b54-9413-c84f-e181-c2bcf412b6db sshd[63662]: pam_unix(sshd:session): session closed for user root
Jun 27 16:44:38 53507b54-9413-c84f-e181-c2bcf412b6db systemd-logind[62084]: Removed session c3.
-- Subject: Session c3 has been terminated
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
-- 
-- A session with the ID c3 has been terminated.
Jun 27 16:49:07 53507b54-9413-c84f-e181-c2bcf412b6db polkitd[62081]: Registered Authentication Agent for unix-process:68303:339118 (system bus name :1.11 [/usr/bin/p
Jun 27 16:49:07 53507b54-9413-c84f-e181-c2bcf412b6db systemd[61747]: Starting Kernel process accounting...
-- Subject: Unit psacct.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit psacct.service has begun starting up.
Jun 27 16:49:07 53507b54-9413-c84f-e181-c2bcf412b6db accton[68314]: accton: Function not implemented
Jun 27 16:49:07 53507b54-9413-c84f-e181-c2bcf412b6db accton[68314]: Turning on process accounting, file set to '/var/account/pacct'.
Jun 27 16:49:07 53507b54-9413-c84f-e181-c2bcf412b6db systemd[61747]: psacct.service: main process exited, code=exited, status=38/n/a
Jun 27 16:49:07 53507b54-9413-c84f-e181-c2bcf412b6db systemd[61747]: Failed to start Kernel process accounting.
-- Subject: Unit psacct.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit psacct.service has failed.
-- 
-- The result is failed.

Comments (4)

Former user commented on 2017-06-27T15:27:35.000-0400 (edited 2017-12-14T12:24:08.193-0500):

This is the tail end of the relevant part of my trace:

accton 18738 1 <- arch_prctl(0x1002 0xff050740)=0
accton 18738 1 <- mprotect(0x7ffffedb7000 16384 1)=0
accton 18738 1 <- mprotect(0x7fffff401000 4096 1)=0
accton 18738 1 <- mprotect(0x7fffff021000 4096 1)=0
accton 18738 1 <- munmap(0x7fffff070000 33106)=0
accton 18738 1 UNSUPP: NOSYS (acct): No equivalent illumos functionality\0
accton 18738 1 <- acct=-38
accton 18738 1 <- fstat(1 0x7fffffeff450)=0
accton 18738 1 <- mmap(0x0 8192 3 0x22 -1 0x0)=0x7fffff040000 end 0x7fffff042000
accton 18738 1 <- dup(2)=3
accton 18738 1 <- fcntl(3, 3, 0x0)=2
accton 18738 1 <- brk(0x0)=4096
accton 18738 1 <- brk(0x22000)=139264
accton 18738 1 <- brk(0x0)=139264
accton 18738 1 <- fstat(3 0x7fffffefefe0)=0
accton 18738 1 <- mmap(0x0 8192 3 0x22 -1 0x0)=0x7fffff010000 end 0x7fffff012000
accton 18738 1 <- write(3 accton: Function not implemented\n\0 33)=33
accton 18738 1 <- close(3)=0
accton 18738 1 <- munmap(0x7fffff010000 8192)=0
accton 18738 1 <- write(1 Turning on process accounting, file set to '/var/account/pacct'.\nd\0 65)=65
accton 18738 -> rexit(38) ppid: 17641
accton 18738 -> exit(1) ppid: 17641

Former user commented on 2017-06-28T15:54:25.000-0400 (edited 2017-12-14T12:24:10.456-0500):

We have the same basic native acct facility as is available on Linux. The primary difference is the format of the accounting file. Linux is using the struct acct_v3 definition from the acct(5) man page, whereas native uses the struct acct definition from acct.h(3HEAD). I have added the acct syscall support and psacct runs. Accounting records are being produced, but not in the expected format for tools like sa. We need a brand hook in the account record generation code so we can emit the records in the proper format

Former user commented on 2017-06-30T09:54:32.000-0400 (edited 2017-12-14T12:24:15.108-0500):

For testing I have installed the accounting pkg on a Centos7, Ubuntu 16.04 and Ubuntu 14.04 zone. I have verified that the Linux sa command works properly on all three. I also have a simple test program which reads and prints each accounting record. I have visually confirmed that the records appear to be reasonable for a variety of commands. I have also run that test program in a kvm for comparison.

Former user commented on 2017-07-10T11:51:12.000-0400:

illumos-joyent commit 6209c5b (branch master, by Jerry Jelinek)

OS-6211#icft=OS-6211 support Linux accounting
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Approved by: Patrick Mooney <patrick.mooney@joyent.com>