You are not logged in.

#1 2009-12-16 14:05:22

lswest
Member
From: Munich, Germany
Registered: 2008-06-14
Posts: 456
Website

[solved] acpid when started via HAL doesn't enable event logging

Hey,

I've been trying to help solve a laptop-mode-tools issue today, which resulted in my trying to set it up on my netbook (I gave up once when it didn't work).  After lots of trial and error, and contact with the developer of laptop-mode-tools, I discovered that the problem was caused by the fact that event-logging was off when I started hal (and therefore acpid) via /etc/rc.conf.  If I stop the acpid daemon and start it using

sudo acpid -d -l

everything works correctly, events are logged, and laptop-mode-tools changes settings and runs my custom brightness script as it should.  My question to you is this:

Is there any way I can force event-logging to be enabled when start acpid via HAL?  Is this a bug that should be addressed at the package-level, or is this just a setting/edit that needs to be performed on a file? (see the edit for updated question)

I'm unsure of what files/logs (if any) I should post with this, so I will leave them off for the time being.  If anyone requires a log file or more information, I'll gladly supply it.

*edit* seems my question has changed.  After playing around I have realized that no flags need to be appended to the acpid command to have it work properly, it just doesn't work with event handling when started via the rc.conf file, or stopped/started from the rc.local file.  If I manually stop and start the daemon after logging in, it works without a hitch.  The question now is...why does acpid not start with event logging when started in those ways?  Any way to stop/start the daemon on boot/login without using the rc files? (for testing purposes).

Thanks in advance,
Lswest

*Update* It seems that if I manually stop and then start (not restart) acpid, it starts handling events properly again.  However, if I stick those commands in /etc/rc.local, it doesn't, nor does it work if I specify acpid separately in my DAEMONS line in /etc/rc.conf.

*EDIT #2* I found a work around, and I'm not hopeful about there being an actual fix, so I'm marking this as solved.  See the 3rd post for my solution.

Last edited by lswest (2009-12-16 16:27:32)


Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds

Offline

#2 2009-12-16 15:55:55

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [solved] acpid when started via HAL doesn't enable event logging

Interim workaround: edit /etc/rc.d/acpid as required.

Proper fix:  implement /etc/conf.d/acpid for user-specified daemon options. This would be a feature request - if you have the time/skill/motivation, you could code it yourself and submit a patch with the request.

N.B.

acpid man page wrote:

-d, --debug This option increases the acpid debug level by  one.   If  the
                   debug level is non-zero, acpid will run in the foreground, and
                   will log to stderr, in addition to the regular syslog.

IOW, the -d flag is not intended for use in an init script.

Offline

#3 2009-12-16 15:58:12

lswest
Member
From: Munich, Germany
Registered: 2008-06-14
Posts: 456
Website

Re: [solved] acpid when started via HAL doesn't enable event logging

Thanks for the response.  The -d flag was there in order to check if it was executing laptop-mode tools.  acpid works properly once restarted manually (as mentioned in my update on the post above).  I'd love to update the daemon file, but I just don't know what to add to it, since it seems the flags weren't required to "fix" the problem, simply starting the acpid after I had logged in again (after stopping it), fixes it for me now too.

I've updated my original post so that it's clearer that the question I posed has changed.

*EDIT* I've come up with a work around that works for me without user intervention.  According to a bug I read on launchpad for Ubuntu, the problem seems to lie with HAL.  The hald-addon-acpi starts reading acpi events, but does nothing with them (it seems, it may have changed, since the bug was from 2008).  Either way, my "fix" is this:
1. Edit the visudo file with:

sudo VISUAL=vim visudo

2. Add this line to the groups section:

%power ALL = NOPASSWD:/usr/sbin/acpid
%power ALL = NOPASSWD:/etc/rc.d/acpid

3. Add this to your .xinitrc:

sudo /etc/rc.d/acpid stop
sudo /etc/rc.d/acpid start

This gives all users in the group "power" the ability to start/stop acpid without requiring a password for sudo.  I then stick the commands in the .xinitrc script, which runs when you log in.  Not a great fix, but it works.  I'm not sure what else you could do, or how to fix it permanently.  Hopefully this is helpful to anyone who has the same problem.

Last edited by lswest (2009-12-22 16:15:48)


Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds

Offline

Board footer

Powered by FluxBB