LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-19-2016, 01:53 AM   #1
LQSlacker
Member
 
Registered: Jul 2016
Posts: 94

Rep: Reputation: Disabled
/var/log/pacct is empty


I'm running Slackware 14.2 x86_64

I compiled 4.4.16, grep shows this for the process;

>grep -i process_acct /usr/src/linux/.config
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y

I ran; touch /var/log/pacct

And added this to rc.local;

# Turn process accounting on
if [ -x /sbin/accton ]; then
/sbin/accton /var/log/pacct
echo "Process accounting turned on"
fi


When I rebooted and did various things on my box and checked pacct, I noticed it was empty and 'lastcomm' shows no output at the terminal.

I don't understand why nothing is being logged to /var/log/pacct?
 
Old 08-19-2016, 04:45 AM   #2
STDOUBT
Member
 
Registered: May 2010
Location: Stumptown
Distribution: Slackware64
Posts: 583

Rep: Reputation: 242Reputation: 242Reputation: 242
Quote:
>grep -i process_acct /usr/src/linux/.config
What about grepping the kernel config that you're actually running?

/usr/src/linux/ is where you built yes?
What does this show?
Code:
 grep -i process_acct /boot/config-generic-smp-4.4.16-smp
(modify the above to the kernel you're running, of course)

Also, not sure if this matters but TLDP's page on this says the stansa should read:
Code:
# Turn process accounting on. 
if [ -x /sbin/accton ]
then 
		/sbin/accton /var/log/pacct 
		echo "Process accounting turned on." 
fi
I notice your code's a bit different.

Last edited by STDOUBT; 08-19-2016 at 04:50 AM.
 
Old 08-19-2016, 07:07 AM   #3
Noryungi
Member
 
Registered: Jul 2003
Location: --> X <-- You are here.
Distribution: Slackware, OpenBSD
Posts: 305

Rep: Reputation: 53
This is what /etc/rc.d/rc.M says on my Slackware machine (13.1, soon to be 14.2):

Code:
# Turn on process accounting.  To enable process accounting, make sure the
# option for BSD process accounting is enabled in your kernel, and then
# create the file /var/log/pacct (touch /var/log/pacct).  By default, process
# accounting is not enabled (since /var/log/pacct does not exist).  This is
# because the log file can get VERY large.
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
  chmod 640 /var/log/pacct
  /sbin/accton /var/log/pacct
fi
Does your /var/log/pacct file respect ''640'' (rw-r-----) in terms of rights?

Also, please note the warning contained in the comments...
 
Old 08-19-2016, 10:19 AM   #4
suppy
Member
 
Registered: Mar 2012
Location: Sweden
Distribution: Slackware
Posts: 83

Rep: Reputation: 60
Quote:
Originally Posted by STDOUBT View Post
Code:
 grep -i process_acct /boot/config-generic-smp-4.4.16-smp
I'd rather suggest
Code:
 zgrep -i process_acct /proc/config.gz
 
Old 08-19-2016, 03:39 PM   #5
LQSlacker
Member
 
Registered: Jul 2016
Posts: 94

Original Poster
Rep: Reputation: Disabled
Ahh my bad, didn't realize in 14.2, in the rc.M it had the Process Acct section, so I removed the one from the rc.local.

Yes permissions are the same;

>ls -l pacct
-rw-r----- 1 root root 0 Aug 18 14:47 pacct

What warning in comments?

I did touch /var/log/pacct if this is what you're referring to?

zgrep -i process_acct /proc/config.gz
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y

Still nothing shows in the log.

Do I need Audit support or should I check the kernel for other support that needs to be compiled in?

I also didn't do a full install of Slack, I'm wondering if there's something else that acct is going to need, in order to work?

With the process acct, my understanding, anything you do at the term, mkdir, rm, cd, ls, etc., is going to show in the log?

Last edited by LQSlacker; 08-19-2016 at 03:44 PM.
 
Old 08-19-2016, 04:23 PM   #6
suppy
Member
 
Registered: Mar 2012
Location: Sweden
Distribution: Slackware
Posts: 83

Rep: Reputation: 60
Well, do you have the /sbin/accton binary? and is it executable?
Code:
 ls -l /sbin/accton
 
Old 08-19-2016, 04:34 PM   #7
LQSlacker
Member
 
Registered: Jul 2016
Posts: 94

Original Poster
Rep: Reputation: Disabled
Yes of course I installed acct-6.5.4-x86_64-2

>ls -l /sbin/accton
-rwxr-xr-x 1 root root 8704 Oct 23 2013 /sbin/accton
 
Old 08-19-2016, 04:46 PM   #8
LQSlacker
Member
 
Registered: Jul 2016
Posts: 94

Original Poster
Rep: Reputation: Disabled
Looking at man accton;

accton [OPTION] on|off|filename

--help says the same thing...

>accton --help
Usage: accton [OPTION] on|off|ACCOUNTING_FILE

Turns process accounting on or off, or changes the file where this
info is saved.

OPTIONS:
-h, --help Show help and exit
-V, --version Show version and exit

ARGUMENTS:
on Activate process accounting and use default file
off Deactivate process accounting
ACCOUNTING_FILE Activate (if not active) and save information in
this file

The system's default process accounting file is '/var/log/pacct'.

Report bugs to <bug-acct@gnu.org>

So then I ran accton off & accton on and I'm finally seeing activity!

SO looking over man showing; on|off|filename I don't get why the rc.M entry is not working?


if [ -x /sbin/accton -a -r /var/log/pacct ]; then
chmod 640 /var/log/pacct
/sbin/accton /var/log/pacct
echo "Process accounting turned on"
fi

/sbin/accton /var/log/pacct is not working, is this working for others? If so, since I didn't do a full install of slack, could I be missing something needed, to make this function?

Last edited by LQSlacker; 08-19-2016 at 05:10 PM.
 
Old 08-19-2016, 09:39 PM   #9
LQSlacker
Member
 
Registered: Jul 2016
Posts: 94

Original Poster
Rep: Reputation: Disabled
Not trying to bump here, just wanted to seperate the posts...

Ok I ran the stock 4.4.14 kernel and it worked...

So now I appear to be missing something from the kernel, but it's my understanding it only needs the BSD Process Accounting.

Under 'CPU/Task time and stats accounting' I have all the same options compiled in as the stock kernel.

The thing is, with my kernel, when I log into X and run these cmds it works;

rm /var/log/pacct
touch /var/log/pacct
chmod 640 /var/log/pacct
accton off
accton on

Sometimes I noticed I only had to run accton off and accton on and it worked and other times I had to run all the cmds above to get it running...

I'm lost with this, not understanding what's missing from my kernel, and why this isn't running from the rc.M?

Last edited by LQSlacker; 08-20-2016 at 02:38 AM.
 
Old 08-20-2016, 10:21 AM   #10
Noryungi
Member
 
Registered: Jul 2003
Location: --> X <-- You are here.
Distribution: Slackware, OpenBSD
Posts: 305

Rep: Reputation: 53
The issue is that (if I understand well) you are turning process accounting on and off several times, without restarting your system.

The /etc/rc.d/rc.M file is executed only once, as the system is going into multi-user mode.

If turning process accounting on and off is what you are looking for, then you should probably run the commands you listed in order to run or stop process accounting.

Please be aware that turning process accounting on consumes a lot of disk space in the log file -- this is why I mentioned the warning (followed by a )
 
Old 08-20-2016, 05:27 PM   #11
LQSlacker
Member
 
Registered: Jul 2016
Posts: 94

Original Poster
Rep: Reputation: Disabled
No, if I restart the system with the stock 4.4.14 kernel then rc.M is working to start acct and I see logging happening.

If I restart with my kernel I compiled 4.4.18 I am not seeing rc.M working, it does say at the console that Process Accounting is on, but the logs are empty and lastcomm shows nothing.

So for now I'm trying to figure out what I'm missing in the kernel, I thought all I needed was the BSD Process Accounting, which I have all the same options compiled in as the stock kernel.
 
Old 08-20-2016, 06:39 PM   #12
suppy
Member
 
Registered: Mar 2012
Location: Sweden
Distribution: Slackware
Posts: 83

Rep: Reputation: 60
so, start with a diff of the configs between stock kernel and your kernel, and see if you find anything that looks relevant, then try changing that and see if it works.

then you'd go over the changes one by one until you get a kernel that works for you..

Edit:

... or just stick with the stock kernel ...
 
Old 08-20-2016, 07:52 PM   #13
LQSlacker
Member
 
Registered: Jul 2016
Posts: 94

Original Poster
Rep: Reputation: Disabled
Yes what's relevant to Accounting is the question here, and who knows the answer?

I certainly know all the differences I've made to the kernel, but none of them stick out as Accounting related.

Here's the real kicker, acct works, it just doesn't run from an rc script, as I mentioned before. As root, once logged into X I can run it manually and it's working, but for some odd reason, most of the time I have to rm /var/log/pacct then touch /var/log/pacct and chmod 640 /var/log/pacct THEN accton on and it's working....

If the support to work wasn't there, then running it manually would have no effect, the problem here really is, what is in the stock kernel allowing it to start from the rc.M script?

Hmm

Last edited by LQSlacker; 08-20-2016 at 07:53 PM.
 
Old 08-20-2016, 11:53 PM   #14
LQSlacker
Member
 
Registered: Jul 2016
Posts: 94

Original Poster
Rep: Reputation: Disabled
Something else I just noticed since my last reply, I just compiled 4.4.19 making changes I thought would help, but didn't.

When I rebooted the new kernel and at the console, I ran as root; 'accton off', 'accton on', and lastcomm, and there was nothing.

BUT when I logged into X and ran the cmds over it worked, WHAT THE HECK! Why it doesn't start out in the console, but it does in X...

Hmm this thing is getting weirder by the second, but maybe this will explain something?


Errr :/
 
Old 08-22-2016, 07:49 PM   #15
LQSlacker
Member
 
Registered: Jul 2016
Posts: 94

Original Poster
Rep: Reputation: Disabled
I spent the entire day a few days ago going over this, numerous times recompiing the kernel over.

I finally came to realize one thing, there seems to be a bug here with this application, in what respect, I don't know, but let me explain, what I finally came to conclude, and if this is not a bug here, then hopefully someone can explain what is going on...

I grabbed at the below URL the config-huge 4.4.14 kernel config of Slackware;

http://mirrors.slackware.com/slackwa...config-x86_64/

I made only 2 changes to this kernel and then compiled it.

1. I removed 'CONFIG_BLK_DEV_INITRD' - Initial RAM filesystem and RAM disk (initramfs/initrd) support
I also do not even use this on my box, so I don't see how/why this would also have an effect.

2. Next I changed the CONFIG_DEFAULT_HOSTNAME="darkstar" to the hostname of 'none', another option I do not see how/why this would also have an effect.

3. When I rebooted this kernel and logged into the console, lastcomm did not show anything, I then tried running accton off & accton on, still nothing working, then when I logged into X and ran accton off & accton on, then lastcomm worked.... Hmm

4. Here is the rc.M entry calling this at startup;

if [ -x /sbin/accton -a -r /var/log/pacct ]; then
chmod 640 /var/log/pacct
/sbin/accton /var/log/pacct
fi

How can this not work at startup and not turn on acct, when only removing 'Initial RAM filesystem and RAM disk' when it's not even being used on the box, and changing the hostname in the kernel? If I don't change these options it works. Also then, why wouldn't accton on work out in the console, but it then works in X?

I don't see how this is a problem with Slackware, there appears to be some kind of odd bug with acct.

Now this isn't just the end of the insanity, I can leave these 2 options alone and change anything in the kernel, and for some reason it still acts up the same way. I'm not saying everything you change causes it not to work, but changes that are not even related to BSD Process accounting...

Last edited by LQSlacker; 08-22-2016 at 08:06 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/var/log/boot.log is Empty in RHEL 5.10 (Tikanga) sk2code Red Hat 5 05-01-2014 12:53 PM
[SOLVED] Empty /var/log/boot.log saifkhan123 Linux - General 3 02-22-2010 02:48 AM
/var/log/messages empty turbo_acura Linux - Software 8 11-23-2007 08:07 AM
Empty /var/log/messages jstencil Slackware 1 10-13-2006 09:34 AM
/var/log/messages empty Phathead Slackware 5 12-13-2004 11:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration