Hi,
Thanks for the reply. When I run irexec manually, logged in as user leeko, it works fine. I can use the remote to suspend the computer. It just doesn't work when I try to autostart irexec at login.
I've tried autostarting irexec as leeko, mythtv and root. None of them allow it. I've also added a "sleep 30" line to the startup script, because another user noted that irexec doesn't work if it's started too close to lirc - no joy.
I posted this problem on another forum, but haven't had any response. Here's the full post:
-----------------------
Hi everyone,
Sorry for the long post - I've been working at this for a while :P
I'm trying to get lirc and irexec to allow me to suspend my computer from the remote control (packard bell fastmedia serial remote). I had problems when running irexec as myself (leeko), and major issues with trying to get it to run as user mythtv (suggested on another forum). Eventually, I rewrote my sudoers file and it now runs as mythtv. Unfortunately, even running as mythtv does not allow irexec to call the suspend script. I even tried running it as root, and it still doesn't work.
Here is my complete setup:
- Mythbuntu 8.04, fully up-to-date
- Set to auto-login as user leeko
- lircd autostarts as root user. All lircd functions work perfectly within mythtv/mplayer
- An irexec daemon autostarts as user leeko. I don't know where this is set to do this. I have removed all entries from /config/autostart, and rc.local, and I don't have any scripts set. So, I autorun a script: /usr/local/bin/irexeclauncher. This script kills the existing irexec process, waits 30 seconds, then restarts it as user mythtv (or root). This works fine now.
Code:
leeko@leeko-media:~$ cat /usr/local/bin/irexeclauncher
#!/bin/bash
# Launcher for IREXEC because it's STUPID and won't launch properly in startup scripts!
sleep 10
killall irexec
sleep 30
sudo -u mythtv irexec /home/leeko/.lircrc
#sudo irexec /home/leeko/.lircrc
exit 0
- After giving the script time to run, "ps aux | grep ir" shows:
Code:
leeko@leeko-media:~$ ps aux |grep ir
root 4 0.0 0.0 0 0 ? S< 11:43 0:00 [ksoftirqd/0]
mysql 4977 0.1 3.6 128268 18624 ? Sl 11:43 0:01 /usr/sbin/mysqld --basedir=/usr--datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
root 5495 0.0 0.1 2932 584 ? S<s 11:44 0:00 /usr/sbin/lircd --device=/dev/lirc0
leeko 5913 0.0 0.2 4264 1428 ? Ss 11:44 0:00 /bin/bash /usr/local/bin/irexeclauncher
mythtv 5979 0.0 0.1 1716 516 ? S 11:44 0:00 irexec /home/leeko/.lircrc
leeko 6862 0.0 0.1 3008 772 pts/1 R+ 12:06 0:00 grep ir
- My /home/leeko/.lircrc file has an entry to call /home/leeko/scripts/suspend.sh when I press button "SRS" on the remote:
Code:
leeko@leeko-media:~$ cat /home/leeko/.lircrc
#Custom lircrc generated via mythbuntu-lirc-generator
#All application specific lircrc files are within ~/.lirc
include ~/.lirc/mythtv
include ~/.lirc/mplayer
include ~/.lirc/xine
include ~/.lirc/vlc
include ~/.lirc/xmame
include ~/.lirc/xmess
include ~/.lirc/totem
include ~/.lirc/elisa
# include ~/.lirc/irexec
begin
remote = PackBell
prog = irexec
button = SRS
config = /home/leeko/scripts/suspend.sh
repeat = 0
delay = 0
end
- Here are the contents of the suspend.sh script:
Code:
leeko@leeko-media:~$ cat scripts/suspend.sh
#!/bin/bash
sudo /usr/sbin/pmi action suspend
- Immediately after login, I am able to manually suspend the computer using the suspend script. I am not asked for a password, as I have specified that user leeko can run "pmi action suspend" without a password.
-I have tried changing the ownership of the file from "leeko" to "mythtv" - no joy.
My sudoers file:
Code:
# /etc/sudoers
Defaults env_reset
%admin ALL=(ALL) ALL
leeko ALL = ALL
leeko ALL = NOPASSWD: /usr/bin/irexec
leeko ALL = (mythtv) NOPASSWD: ALL
leeko ALL = NOPASSWD: /usr/sbin/pmi
mythtv ALL = NOPASSWD: /usr/sbin/pmi
mythtv ALL = NOPASSWD: /usr/bin/irexec
mythtv ALL = ALL
mythtv ALL = NOPASSWD: /sbin/halt,/sbin/shutdown,/sbin/reboot,/bin/umount
- My lircd.conf has the following entry for button "SRS"
SRS 0x0000000000004EB1
- Using irw, pressing the button SRS gives:
Code:
leeko@leeko-media:~$ irw
00000000f7089d62 00 SRS PackBell
00000000f7089d62 01 SRS PackBell
As far as I can tell, everything is set up correctly. I can't figure out why irexec won't do what I'm asking!
My only clue is auth.log. Whenever I press the power button, auth.log appends this to the tail:
Code:
Sep 10 12:31:47 leeko-media sudo: pam_unix(sudo:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost= user=mythtv
Any help with this issue would be very much appreciated. I'm knackered from getting up off the couch to switch this machine off!
Thanks,
Lee
----------