From: Lee A. <alk...@go...> - 2008-09-10 19:41:21
|
Hi Matt (and list), sorry for the delay - I had real problems getting irexec to run as user mythtv. Eventually managed, after a complete rewrite of my /etc/sudoers file... 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 10 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 10 sudo -u mythtv irexec /home/leeko/.lircrc #sudo irexec /home/leeko/.lircrc exit 0 [/code] - 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 root 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 [/code] - 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 [/code] - 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 [/code] - 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. 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 [/code] - 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 [/code] 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 [/code] 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 ---------- Matt Nelson wrote: > I have a separate machine for my mythbackend and mythfrontend(s). On > my frontends I created a user, "mythfe". I set my frontends to boot, > autologin, and start mythfrontend without any user intervention. This > said, since I login as mythfe I just put the following in the mythfe's > bashrc: > > ###### START ######## > > [mythfe@mythfe1 ~]$ cat ~/.bashrc > # .bashrc > > # Source global definitions > if [ -f /etc/bashrc ]; then > . /etc/bashrc > fi > > # User specific aliases and functions > > PATH=$PATH:/sbin > > irexec -d > > ####### END ######## > > irexec will use the /hoem/mythfe/lircrc since there was none > specified. Give this a try and let me know if this works for ya. > > On Sun, Sep 7, 2008 at 1:32 PM, Lee Alkureishi > <lee...@ho... <mailto:lee...@ho...>> wrote: > > Hi Matt, > > The system is set to auto-login as leeko. Lircd is running as > root, while irexec and mythfrontend are both running as leeko. > mythbackend is running as mythtv, but this is the only process > which runs as this user. How do I run the irexec process as > mythtv? I'm currently autostarting it by using this line in > /etc/rc/local: > > > usr/bin/irexec -d /home/leeko/.lircrc > > But I don't see where to specify the user. > > As for wake-up: I'm only trying to suspend from the remote at the > moment, as I don't think wake-up is an (easy) option. I'm using a > serial receiver (packard bell fastmedia remote), which may support > wake-on-ring, but I don't think my motherboard does. It's an ECS > l7vmm2 v1.0a - I think later versions do support it. > > Thanks for your help, > > lee > > > > Matt Nelson wrote: >> >> You are using the config from the user leeko, but is the irexec >> process running as that user? On my mythbox I found that I run >> the lircd as root, and my lircexec as my mythuser, this was the >> only way that I could get it to work right. >> >> Also as far as the suspend, I got mine working great. What remote >> are you using, is it usb? I found that I had to tell that >> specific usb port to not suspend so it could listen for the >> signal to wake. I also had to use a specific button on mine since >> that was the only one that would send the wake signal; I am using >> a MCEUSB2 remote, and have been very happy. >> >> On Sat, Sep 6, 2008 at 1:34 AM, Lee Alkureishi >> <alk...@go... >> <mailto:alk...@go...>> wrote: >> >> Hi all, >> >> I'm trying to get my mythbuntu box to go to S3 suspend via >> remote. I've >> followed several sets of instructions, and have almost got it >> working. >> >> I added my user (leeko) and the mythtv user (mythtv) to the >> sudoers file >> for /usr/sbin/pmi with the following lines: >> mythtv >> ALL=NOPASSWD:/sbin/halt,/sbin/shutdown,/sbin/reboot,/bin/mount,/bin/umount,/usr/sbin/pmi >> leeko ALL=NOPASSWD: /usr/sbin/pmi >> >> I then created a suspend script (/home/leeko/scripts/suspend.sh): >> ------------------------ >> #!/bin/bash >> sudo /usr/sbin/pmi action suspend >> ------------------------ >> >> Running the script with ./suspend.sh (logged in as leeko) >> works fine. If >> I start irexec manually, I can use the power button on my >> remote to >> suspend the computer. But, if I ask irexec to run at startup, >> it doesn't >> respond to the button press. >> >> ps aux | grep irexec shows one running irexec process after >> startup. I >> am auto-starting it by adding the following line to >> /etc/rc.local: >> >> usr/bin/irexec -d /home/leeko/.lircrc >> >> I have also tried it without the -d flag, without specifying >> the config >> file, and with the config file in various different places. >> No change. >> >> Can anyone suggest why this isn't working? >> >> Thanks in advance, >> >> Lee >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move >> Developer's challenge >> Build the coolest Linux based applications with Moblin SDK & >> win great prizes >> Grand prize is a trip for two to an Open Source event >> anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> <http://moblin-contest.org/redirect.php?banner_id=100&url=/> >> >> > > |
From: Lee A. <lee...@ho...> - 2008-09-11 18:49:08
|
How incredibly weird! As an act of desperation, I tried one last thing in the script: - kill the rogue autostarted "irexec -d /home/leeko/.lircrc" process, which was owned by user leeko - wait 30 seconds - restart irexec /as the same user, leeko/, with "irexec /home/leeko/.lircrc" (no daemon flag this time). It works this time - pressing the power button suspends the computer. Woooo! I conclude that irexec: - doesn't work properly when autostarted - doesn't work properly when the -d flag is set - is a pain in the backside to get working properly! Of course, these conclusions only hold true for my setup (which is not too unusual...). Thanks for the input, Lee ------------------------------- Lee Alkureishi wrote: > Hi Matt (and list), > > sorry for the delay - I had real problems getting irexec to run as > user mythtv. Eventually managed, after a complete rewrite of my > /etc/sudoers file... 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 10 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 10 > sudo -u mythtv irexec /home/leeko/.lircrc > #sudo irexec /home/leeko/.lircrc > exit 0 > [/code] > > - 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 > root 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 > [/code] > > - 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 > [/code] > > - 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 > [/code] > > - 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. > > 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 > [/code] > > - 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 > [/code] > > > 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 > [/code] > > 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 > ---------- > > > > > Matt Nelson wrote: >> I have a separate machine for my mythbackend and mythfrontend(s). On >> my frontends I created a user, "mythfe". I set my frontends to boot, >> autologin, and start mythfrontend without any user intervention. This >> said, since I login as mythfe I just put the following in the >> mythfe's bashrc: >> >> ###### START ######## >> >> [mythfe@mythfe1 ~]$ cat ~/.bashrc >> # .bashrc >> >> # Source global definitions >> if [ -f /etc/bashrc ]; then >> . /etc/bashrc >> fi >> >> # User specific aliases and functions >> >> PATH=$PATH:/sbin >> >> irexec -d >> >> ####### END ######## >> >> irexec will use the /hoem/mythfe/lircrc since there was none >> specified. Give this a try and let me know if this works for ya. >> >> On Sun, Sep 7, 2008 at 1:32 PM, Lee Alkureishi >> <lee...@ho... <mailto:lee...@ho...>> wrote: >> >> Hi Matt, >> >> The system is set to auto-login as leeko. Lircd is running as >> root, while irexec and mythfrontend are both running as leeko. >> mythbackend is running as mythtv, but this is the only process >> which runs as this user. How do I run the irexec process as >> mythtv? I'm currently autostarting it by using this line in >> /etc/rc/local: >> >> >> usr/bin/irexec -d /home/leeko/.lircrc >> >> But I don't see where to specify the user. >> >> As for wake-up: I'm only trying to suspend from the remote at the >> moment, as I don't think wake-up is an (easy) option. I'm using a >> serial receiver (packard bell fastmedia remote), which may >> support wake-on-ring, but I don't think my motherboard does. It's >> an ECS l7vmm2 v1.0a - I think later versions do support it. >> >> Thanks for your help, >> >> lee >> >> >> >> Matt Nelson wrote: >>> >>> You are using the config from the user leeko, but is the irexec >>> process running as that user? On my mythbox I found that I run >>> the lircd as root, and my lircexec as my mythuser, this was the >>> only way that I could get it to work right. >>> >>> Also as far as the suspend, I got mine working great. What >>> remote are you using, is it usb? I found that I had to tell that >>> specific usb port to not suspend so it could listen for the >>> signal to wake. I also had to use a specific button on mine >>> since that was the only one that would send the wake signal; I >>> am using a MCEUSB2 remote, and have been very happy. >>> >>> On Sat, Sep 6, 2008 at 1:34 AM, Lee Alkureishi >>> <alk...@go... >>> <mailto:alk...@go...>> wrote: >>> >>> Hi all, >>> >>> I'm trying to get my mythbuntu box to go to S3 suspend via >>> remote. I've >>> followed several sets of instructions, and have almost got >>> it working. >>> >>> I added my user (leeko) and the mythtv user (mythtv) to the >>> sudoers file >>> for /usr/sbin/pmi with the following lines: >>> mythtv >>> ALL=NOPASSWD:/sbin/halt,/sbin/shutdown,/sbin/reboot,/bin/mount,/bin/umount,/usr/sbin/pmi >>> leeko ALL=NOPASSWD: /usr/sbin/pmi >>> >>> I then created a suspend script >>> (/home/leeko/scripts/suspend.sh): >>> ------------------------ >>> #!/bin/bash >>> sudo /usr/sbin/pmi action suspend >>> ------------------------ >>> >>> Running the script with ./suspend.sh (logged in as leeko) >>> works fine. If >>> I start irexec manually, I can use the power button on my >>> remote to >>> suspend the computer. But, if I ask irexec to run at >>> startup, it doesn't >>> respond to the button press. >>> >>> ps aux | grep irexec shows one running irexec process after >>> startup. I >>> am auto-starting it by adding the following line to >>> /etc/rc.local: >>> >>> usr/bin/irexec -d /home/leeko/.lircrc >>> >>> I have also tried it without the -d flag, without specifying >>> the config >>> file, and with the config file in various different places. >>> No change. >>> >>> Can anyone suggest why this isn't working? >>> >>> Thanks in advance, >>> >>> Lee >>> >>> ------------------------------------------------------------------------- >>> This SF.Net email is sponsored by the Moblin Your Move >>> Developer's challenge >>> Build the coolest Linux based applications with Moblin SDK & >>> win great prizes >>> Grand prize is a trip for two to an Open Source event >>> anywhere in the world >>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/> >>> >>> >> >> > |
From: Matt N. <ma...@fr...> - 2008-09-12 05:12:24
|
The key with irexec seams to be to have it load after everything else, but before mythfrontend. Glad you can at least get it working, now you can work on getting it to start automatically :)/. On Thu, Sep 11, 2008 at 12:49 PM, Lee Alkureishi <lee...@ho... > wrote: > How incredibly weird! > > As an act of desperation, I tried one last thing in the script: > > - kill the rogue autostarted "irexec -d /home/leeko/.lircrc" process, which > was owned by user leeko > - wait 30 seconds > - restart irexec *as the same user, leeko*, with "irexec > /home/leeko/.lircrc" (no daemon flag this time). > > It works this time - pressing the power button suspends the computer. > Woooo! > > I conclude that irexec: > - doesn't work properly when autostarted > - doesn't work properly when the -d flag is set > - is a pain in the backside to get working properly! > > Of course, these conclusions only hold true for my setup (which is not too > unusual...). > > Thanks for the input, > > Lee > > > ------------------------------- > > Lee Alkureishi wrote: > > Hi Matt (and list), > > sorry for the delay - I had real problems getting irexec to run as user > mythtv. Eventually managed, after a complete rewrite of my /etc/sudoers > file... 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 10 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 10 > sudo -u mythtv irexec /home/leeko/.lircrc > #sudo irexec /home/leeko/.lircrc > exit 0 > [/code] > > - 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 > root 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 > [/code] > > - 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 > [/code] > > - 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 > [/code] > > - 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. > > 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 > [/code] > > - 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 > [/code] > > > 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 > [/code] > > 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 > ---------- > > > > > Matt Nelson wrote: > > I have a separate machine for my mythbackend and mythfrontend(s). On my > frontends I created a user, "mythfe". I set my frontends to boot, autologin, > and start mythfrontend without any user intervention. This said, since I > login as mythfe I just put the following in the mythfe's bashrc: > > ###### START ######## > > [mythfe@mythfe1 ~]$ cat ~/.bashrc > # .bashrc > > # Source global definitions > if [ -f /etc/bashrc ]; then > . /etc/bashrc > fi > > # User specific aliases and functions > > PATH=$PATH:/sbin > > irexec -d > > ####### END ######## > > irexec will use the /hoem/mythfe/lircrc since there was none specified. > Give this a try and let me know if this works for ya. > > On Sun, Sep 7, 2008 at 1:32 PM, Lee Alkureishi <lee...@ho... > > wrote: > >> Hi Matt, >> >> The system is set to auto-login as leeko. Lircd is running as root, while >> irexec and mythfrontend are both running as leeko. mythbackend is running as >> mythtv, but this is the only process which runs as this user. How do I run >> the irexec process as mythtv? I'm currently autostarting it by using this >> line in /etc/rc/local: >> >> usr/bin/irexec -d /home/leeko/.lircrc >> >> But I don't see where to specify the user. >> >> As for wake-up: I'm only trying to suspend from the remote at the moment, >> as I don't think wake-up is an (easy) option. I'm using a serial receiver >> (packard bell fastmedia remote), which may support wake-on-ring, but I don't >> think my motherboard does. It's an ECS l7vmm2 v1.0a - I think later versions >> do support it. >> >> Thanks for your help, >> >> lee >> >> >> Matt Nelson wrote: >> >> >> You are using the config from the user leeko, but is the irexec process >> running as that user? On my mythbox I found that I run the lircd as root, >> and my lircexec as my mythuser, this was the only way that I could get it to >> work right. >> >> Also as far as the suspend, I got mine working great. What remote are you >> using, is it usb? I found that I had to tell that specific usb port to not >> suspend so it could listen for the signal to wake. I also had to use a >> specific button on mine since that was the only one that would send the wake >> signal; I am using a MCEUSB2 remote, and have been very happy. >> >> On Sat, Sep 6, 2008 at 1:34 AM, Lee Alkureishi < >> alk...@go...> wrote: >> >>> Hi all, >>> >>> I'm trying to get my mythbuntu box to go to S3 suspend via remote. I've >>> followed several sets of instructions, and have almost got it working. >>> >>> I added my user (leeko) and the mythtv user (mythtv) to the sudoers file >>> for /usr/sbin/pmi with the following lines: >>> mythtv >>> >>> ALL=NOPASSWD:/sbin/halt,/sbin/shutdown,/sbin/reboot,/bin/mount,/bin/umount,/usr/sbin/pmi >>> leeko ALL=NOPASSWD: /usr/sbin/pmi >>> >>> I then created a suspend script (/home/leeko/scripts/suspend.sh): >>> ------------------------ >>> #!/bin/bash >>> sudo /usr/sbin/pmi action suspend >>> ------------------------ >>> >>> Running the script with ./suspend.sh (logged in as leeko) works fine. If >>> I start irexec manually, I can use the power button on my remote to >>> suspend the computer. But, if I ask irexec to run at startup, it doesn't >>> respond to the button press. >>> >>> ps aux | grep irexec shows one running irexec process after startup. I >>> am auto-starting it by adding the following line to /etc/rc.local: >>> >>> usr/bin/irexec -d /home/leeko/.lircrc >>> >>> I have also tried it without the -d flag, without specifying the config >>> file, and with the config file in various different places. No change. >>> >>> Can anyone suggest why this isn't working? >>> >>> Thanks in advance, >>> >>> Lee >>> >>> ------------------------------------------------------------------------- >>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>> challenge >>> Build the coolest Linux based applications with Moblin SDK & win great >>> prizes >>> Grand prize is a trip for two to an Open Source event anywhere in the >>> world >>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>> >> >> >> > > > |
From: Lee A. <lee...@ho...> - 2008-09-12 10:35:28
|
That's the thing, though - it /is/ working automatically now :) I just removed the sudo part of the command so it runs as leeko. Didn't work before, now it does. Bizarre... Ah well... hope i never have to set it up again :P Lee Matt Nelson wrote: > The key with irexec seams to be to have it load after everything else, > but before mythfrontend. > > Glad you can at least get it working, now you can work on getting it > to start automatically :)/. > > On Thu, Sep 11, 2008 at 12:49 PM, Lee Alkureishi > <lee...@ho... <mailto:lee...@ho...>> wrote: > > How incredibly weird! > > As an act of desperation, I tried one last thing in the script: > > - kill the rogue autostarted "irexec -d /home/leeko/.lircrc" > process, which was owned by user leeko > - wait 30 seconds > - restart irexec /as the same user, leeko/, with "irexec > /home/leeko/.lircrc" (no daemon flag this time). > > It works this time - pressing the power button suspends the > computer. Woooo! > > I conclude that irexec: > - doesn't work properly when autostarted > - doesn't work properly when the -d flag is set > - is a pain in the backside to get working properly! > > Of course, these conclusions only hold true for my setup (which is > not too unusual...). > > Thanks for the input, > > Lee > > > ------------------------------- > > Lee Alkureishi wrote: >> Hi Matt (and list), >> >> sorry for the delay - I had real problems getting irexec to run >> as user mythtv. Eventually managed, after a complete rewrite of >> my /etc/sudoers file... 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 10 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 10 >> sudo -u mythtv irexec /home/leeko/.lircrc >> #sudo irexec /home/leeko/.lircrc >> exit 0 >> [/code] >> >> - 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 leeko 5913 0.0 0.2 4264 1428 ? Ss >> 11:44 0:00 /bin/bash /usr/local/bin/irexeclauncher >> root 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 >> [/code] >> >> - 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 >> [/code] >> >> - 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 >> [/code] >> >> - 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. >> >> 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 >> [/code] >> >> - 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 >> [/code] >> >> >> 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 >> [/code] >> >> 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 >> ---------- >> >> >> >> >> Matt Nelson wrote: >>> I have a separate machine for my mythbackend and >>> mythfrontend(s). On my frontends I created a user, "mythfe". I >>> set my frontends to boot, autologin, and start mythfrontend >>> without any user intervention. This said, since I login as >>> mythfe I just put the following in the mythfe's bashrc: >>> >>> ###### START ######## >>> >>> [mythfe@mythfe1 ~]$ cat ~/.bashrc >>> # .bashrc >>> >>> # Source global definitions >>> if [ -f /etc/bashrc ]; then >>> . /etc/bashrc >>> fi >>> >>> # User specific aliases and functions >>> >>> PATH=$PATH:/sbin >>> >>> irexec -d >>> >>> ####### END ######## >>> >>> irexec will use the /hoem/mythfe/lircrc since there was none >>> specified. Give this a try and let me know if this works for ya. >>> >>> On Sun, Sep 7, 2008 at 1:32 PM, Lee Alkureishi >>> <lee...@ho... <mailto:lee...@ho...>> >>> wrote: >>> >>> Hi Matt, >>> >>> The system is set to auto-login as leeko. Lircd is running >>> as root, while irexec and mythfrontend are both running as >>> leeko. mythbackend is running as mythtv, but this is the >>> only process which runs as this user. How do I run the >>> irexec process as mythtv? I'm currently autostarting it by >>> using this line in /etc/rc/local: >>> >>> >>> usr/bin/irexec -d /home/leeko/.lircrc >>> >>> But I don't see where to specify the user. >>> >>> As for wake-up: I'm only trying to suspend from the remote >>> at the moment, as I don't think wake-up is an (easy) option. >>> I'm using a serial receiver (packard bell fastmedia remote), >>> which may support wake-on-ring, but I don't think my >>> motherboard does. It's an ECS l7vmm2 v1.0a - I think later >>> versions do support it. >>> >>> Thanks for your help, >>> >>> lee >>> >>> >>> >>> Matt Nelson wrote: >>>> >>>> You are using the config from the user leeko, but is the >>>> irexec process running as that user? On my mythbox I found >>>> that I run the lircd as root, and my lircexec as my >>>> mythuser, this was the only way that I could get it to work >>>> right. >>>> >>>> Also as far as the suspend, I got mine working great. What >>>> remote are you using, is it usb? I found that I had to tell >>>> that specific usb port to not suspend so it could listen >>>> for the signal to wake. I also had to use a specific button >>>> on mine since that was the only one that would send the >>>> wake signal; I am using a MCEUSB2 remote, and have been >>>> very happy. >>>> >>>> On Sat, Sep 6, 2008 at 1:34 AM, Lee Alkureishi >>>> <alk...@go... >>>> <mailto:alk...@go...>> wrote: >>>> >>>> Hi all, >>>> >>>> I'm trying to get my mythbuntu box to go to S3 suspend >>>> via remote. I've >>>> followed several sets of instructions, and have almost >>>> got it working. >>>> >>>> I added my user (leeko) and the mythtv user (mythtv) to >>>> the sudoers file >>>> for /usr/sbin/pmi with the following lines: >>>> mythtv >>>> ALL=NOPASSWD:/sbin/halt,/sbin/shutdown,/sbin/reboot,/bin/mount,/bin/umount,/usr/sbin/pmi >>>> leeko ALL=NOPASSWD: /usr/sbin/pmi >>>> >>>> I then created a suspend script >>>> (/home/leeko/scripts/suspend.sh): >>>> ------------------------ >>>> #!/bin/bash >>>> sudo /usr/sbin/pmi action suspend >>>> ------------------------ >>>> >>>> Running the script with ./suspend.sh (logged in as >>>> leeko) works fine. If >>>> I start irexec manually, I can use the power button on >>>> my remote to >>>> suspend the computer. But, if I ask irexec to run at >>>> startup, it doesn't >>>> respond to the button press. >>>> >>>> ps aux | grep irexec shows one running irexec process >>>> after startup. I >>>> am auto-starting it by adding the following line to >>>> /etc/rc.local: >>>> >>>> usr/bin/irexec -d /home/leeko/.lircrc >>>> >>>> I have also tried it without the -d flag, without >>>> specifying the config >>>> file, and with the config file in various different >>>> places. No change. >>>> >>>> Can anyone suggest why this isn't working? >>>> >>>> Thanks in advance, >>>> >>>> Lee >>>> >>>> ------------------------------------------------------------------------- >>>> This SF.Net email is sponsored by the Moblin Your Move >>>> Developer's challenge >>>> Build the coolest Linux based applications with Moblin >>>> SDK & win great prizes >>>> Grand prize is a trip for two to an Open Source event >>>> anywhere in the world >>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/> >>>> >>>> >>> >>> >> > > |