Bug 545339 - lastcomm shows only root, even for commands from other users
Summary: lastcomm shows only root, even for commands from other users
Keywords:
Status: CLOSED DUPLICATE of bug 543456
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-12-08 08:51 UTC by Herbert Gasiorowski
Modified: 2010-01-04 21:20 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-12-16 07:20:19 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
psacct/accton binary output /var/account/test (832 bytes, application/octet-stream)
2009-12-09 09:18 UTC, Herbert Gasiorowski
no flags Details

Description Herbert Gasiorowski 2009-12-08 08:51:22 UTC
Description of problem:

calling lasscomm gives a list with commands executed only by root,
even those called from someone else.

Version-Release number of selected component (if applicable):
psacct-6.3.2-55.fc12.i686

How reproducible:

lastcomm | grep -v root
  is allways empty

Additional info:
- It seems to me that the uid field in /var/account/pacct file is allways zero.
- It all works fine with fedora 11

Comment 1 Ivana Varekova 2009-12-08 14:58:10 UTC
When I try to reproduce this problem I found a bug in psacct init script. So please could you test whether your psacct daemon is running? 
If yes then just try to call any command (ls, dome other) by non-root user and test whether the problem happen and write here the result. (If the problem will appear again, plese write here whether the command is not on the list or is on the list and the user is root there).
Thanks.

Comment 2 Fedora Update System 2009-12-09 07:16:29 UTC
psacct-6.3.2-59.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/psacct-6.3.2-59.fc12

Comment 3 Herbert Gasiorowski 2009-12-09 08:43:12 UTC
I assume, that the update only fixes the init script and it has not yet arrived here, so my answer to comment #1:

- psacct is running ("/etc/init.d/psacct status" says so - but there should not be a daemon running?)
- commands are logged and shown by lastcomm
- commands from no-root-user are listed but as being executed by root

Comment 4 Ivana Varekova 2009-12-09 08:52:04 UTC
Yes you are right - the update fix only the init script - but there is some changes of input file handling too (the previous patches). So it is worth to test too.
Please could you run some test case and attach here the relevant /var/account/psacct file (or its part) and write here which command from psacct output (some unified description like command name and time if it is not uniq then some other detail) should belong to non-root user there (id would be useful to have the user id of user which run the application too). 
Thanks.

Comment 5 Herbert Gasiorowski 2009-12-09 09:16:39 UTC
as root:
# touch /var/account/test
# accton /var/account/test

as user gasi uid=1377:
$ ls | grep a | sort

back to root:
# accton /var/account/pacct
# lastcomm -f /var/account/test 
accton                  root     pts/0      0.00 secs Wed Dec  9 10:09
ksmtuned           F    root     __         0.00 secs Wed Dec  9 10:09
awk                     root     __         0.00 secs Wed Dec  9 10:09
ps                S     root     __         0.01 secs Wed Dec  9 10:09
ksmtuned           F    root     __         0.00 secs Wed Dec  9 10:09
pgrep                   root     __         0.00 secs Wed Dec  9 10:09
ksmtuned           F    root     __         0.00 secs Wed Dec  9 10:09
awk                     root     __         0.00 secs Wed Dec  9 10:09
sleep                   root     __         0.00 secs Wed Dec  9 10:08
grep                    root     pts/5      0.00 secs Wed Dec  9 10:09
sort                    root     pts/5      0.00 secs Wed Dec  9 10:09
ls                      root     pts/5      0.00 secs Wed Dec  9 10:09
accton            S     root     pts/0      0.00 secs Wed Dec  9 10:09

- the user(gasi) entries have been called on pts/5
- I try to attach the binary file /var/account/test to this bug-report

Comment 6 Herbert Gasiorowski 2009-12-09 09:18:31 UTC
Created attachment 377124 [details]
psacct/accton binary output /var/account/test

Comment 7 Ivana Varekova 2009-12-10 07:19:11 UTC
Hello,
for me it looks like kernel problem - the accounting is done by kernel syscall, and lastcomm command seems to work ok and read the data from accounting file fine. 
Please, to confirm this theory, could you try to downgrade psacct package to the version which works for you (fc11 version - rpms are eg. on http://koji.fedoraproject.org/koji/buildinfo?buildID=91298 ). And then try to reproduce the problem again and write here the results?

Comment 8 Herbert Gasiorowski 2009-12-10 07:56:59 UTC
Your shurely are right: the kernel writes /var/account/psacct and there is no other uid but 0 inside.

Anyway -I tried it with
  psacct-6.3.2-53.fc11.i586
and have the same faulty results

Comment 9 Ivana Varekova 2009-12-10 08:09:45 UTC
Thanks for the testing, I'm reassigning the bug to kernel.

Comment 10 Michal Schmidt 2009-12-10 11:42:36 UTC
Already reported upstream: http://bugzilla.kernel.org/show_bug.cgi?id=14676

A patch from Alexey Dobriyan fixes it and should be merged in Linus's tree soon.
http://lkml.org/lkml/2009/11/30/425

The patch has been proposed into 2.6.31-stable also.

Comment 11 Michal Schmidt 2009-12-16 07:20:19 UTC

*** This bug has been marked as a duplicate of bug 543456 ***

Comment 12 Fedora Update System 2010-01-04 21:20:08 UTC
psacct-6.3.2-59.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.