View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 14 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: Realtime priority
PostPosted: Tue Jan 24, 2006 9:48 pm 
Offline
Joined: Wed Jan 18, 2006 8:36 pm
Posts: 196
My current myth system is a bit under powered to play back HDTV. To address this, I've started using the "Realtime priority" feature in the front end. I found a good posting about this:

http://mythtv.org/pipermail/mythtv-users/2005-June/090868.html

I tried to set my frontend as SUID root, but I wasn't able to get the realtime priority to work. So, I had to add the frontend to sudo:

1. Edit (as root) /etc/sudoers
2. Add /usr/bin/mythfrontend to the last line in the file

Be warned: there are security implications to doing this. I have also noticed that some files are created and are owned by root instead of mythtv.

To get your frontend to start using sudo:
1. Edit (as root) /usr/local/bin/KnoppMyth-run
2. Change line 15 from this:
Code:
exec mythfrontend

to this:
Code:
exec sudo mythfrontend


Anyone else have better ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 24, 2006 11:44 pm 
Offline
Joined: Fri Sep 19, 2003 7:05 pm
Posts: 5088
Location: Fontana, Ca
Wait for the next release which does this via PAM... How is that for an idea? ;)

_________________
cesman

When the source is open, the possibilities are endless!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 9:11 pm 
Offline
Joined: Wed Jan 18, 2006 8:36 pm
Posts: 196
Looks like the next release will do it using PAM, can't wait.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 20, 2006 10:51 pm 
Offline
Joined: Sat Sep 18, 2004 9:07 pm
Posts: 94
Is there any reason why setuid doesn't work?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 20, 2006 10:56 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
Because then it runs as root and a lot of stuff ends up either ends up owned by root or in odd places...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 12:04 am 
Offline
Joined: Sat Sep 18, 2004 9:07 pm
Posts: 94
Yah, I understand that running mythfrontend as root means that some files end up being owned by root or in odd places.

My question is, why does setuid root (chmod ug+s /usr/bin/mythfrontend) not work? Why do you have to use sudo?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 6:11 pm 
Offline
Joined: Sat Sep 18, 2004 9:07 pm
Posts: 94
cesman wrote:
Wait for the next release which does this via PAM... How is that for an idea? ;)


The mythtv docs say you need Linux 2.6.12 or newer and PAM 0.79 or newer.

I am running Linux 2.6.13, and just upgraded PAM with:

apt-get update
apt-get install libpam-modules libpam-runtime libpam0g

dpkg -l |grep libpam
ii libpam-modules 0.79-3.1 Pluggable Authentication Modules for PAM
ii libpam-runtime 0.79-3.1 Runtime support for the PAM library
ii libpam0g 0.79-3.1 Pluggable Authentication Modules library

Added the following lines to /etc/security/limits.conf

@mythtv - rtprio 50
@mythtv - nice 0

Rebooted

Still getting "Realtime priority would require SUID as root." in mythfrontend log :(

Any tips on what I'm missing out on?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 6:29 pm 
Offline
Joined: Fri Sep 19, 2003 7:05 pm
Posts: 5088
Location: Fontana, Ca
Per the docs, you need
Quote:
* - rtprio 0
* - nice 0
@audio - rtprio 50
@audio - nice 0
Do you have the first two lines?

_________________
cesman

When the source is open, the possibilities are endless!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 6:45 pm 
Offline
Joined: Sat Sep 18, 2004 9:07 pm
Posts: 94
yah, sorry, i have the first two lines too ...

and @mythtv instead of @audio

Do I need to try this patch:??

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=313588
http://ubuntustudio.com/wiki/index.php/ ... -Aware_PAM


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 6:54 pm 
Offline
Joined: Fri Sep 19, 2003 7:05 pm
Posts: 5088
Location: Fontana, Ca
Perhaps. Please do try it and let me know as I too followed the directions in the MythTV docs.

_________________
cesman

When the source is open, the possibilities are endless!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 7:00 pm 
Offline
Joined: Sat Sep 18, 2004 9:07 pm
Posts: 94
okay, followed the instructions to download pam source, patch, rebuild and install ... rebooted and success!

Using realtime priority.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 22, 2006 5:44 am 
Offline
Site Admin
Joined: Fri Sep 19, 2003 6:37 pm
Posts: 2657
Location: Whittier, Ca
Perhaps providing greater details, steps, etc.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 22, 2006 6:18 am 
Offline
Joined: Sat Sep 18, 2004 9:07 pm
Posts: 94
yo...

just followed the instructions to patch PAM at http://ubuntustudio.com/wiki/index.php/ ... -Aware_PAM

here's exactly what i did:

started with R5A12, mythtv 0.19, kernel 2.6.13

Code:
apt-get update
apt-get install libpam-modules libpam-runtime libpam0g

(above step probably doesn't make a difference because i ended up patching the package and reinstalling in a later step)

add the following lines to /etc/security/limits.conf:

Code:
* - rtprio 0
* - nice 0
@mythtv - rtprio 50
@mythtv - nice 0


(now this is the hardest part)

Code:
su

(enter password)

Code:
apt-get install pbuilder

vi /etc/pbuilderrc


(change mirror to closest site MIRRORSITE=http://ftp.au.debian.org/debian)

Code:
pbuilder create

(wait for about an hour, cos it took ages downloading some stuff)

Code:
exit

(get out of root)

Code:
mkdir /tmp/pam
cd /tmp/pam
apt-get source pam
wget http://librarian.launchpad.net/1510182/pam-rtlimits.patch
mv pam-rtlimits.patch pam-0.79/debian/patches-applied/070_pam_rlimit_rtprio.patch
cat > pam-0.79/debian/patches-applied/071_pam_rlimit_rtprio_defines.patch << "EOF"
--- Linux-PAM-0.79/modules/pam_limits/pam_limits.c-orig
+++ Linux-PAM-0.79/modules/pam_limits/pam_limits.c
@@ -34,6 +34,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/resource.h>
+/* hack: glibc-2.3.6 doesn't yet know about these yet */
+#define RLIMIT_NICE 13
+#define RLIMIT_RTPRIO 14
+#undef RLIM_NLIMITS
+#define RLIM_NLIMITS 15

 #include <utmp.h>
 #ifndef UT_USER  /* some systems have ut_name instead of ut_user */
EOF
cd pam-0.79/Linux-PAM/
patch -p2 < ../debian/patches-applied/070_pam_rlimit_rtprio.patch
patch -p1 < ../debian/patches-applied/071_pam_rlimit_rtprio_defines.patch
cd ../..


(edit pam-0.79/debian/changelog and add a changelog entry at top):

Code:
pam (0.79-3ubuntu7rtprio1) dapper; urgency=low

  * Linux-PAM/modules/pam_limits/pam_limits.c: add support for rtprio
    (RLIMIT_RTPRIO) and nice (RLIMIT_NICE).
    Closes: debian #326555, ubuntu #17348.

 -- Wolfgang Hoffmann <woho@woho.de>  Sat,  4 Feb 2006 20:01:00 +0100


Code:
dpkg-source -b pam-0.79/ pam_0.79.orig.tar.gz

su

(enter root password again)

Code:
pbuilder build pam_0.79-3ubuntu7rtprio1.dsc

(takes a while, half an hour or more???)

Code:
dpkg -i /var/cache/pbuilder/result/libpam*3ubuntu7rtprio1*.deb

(this installs the new package)

Code:
reboot


********************

exit out of mythfrontend

start xterm (alt-x)

Code:
mythfrontend -l blah.txt -v playback


(goto recorded playback or watchtv and play something)

(go back to xterm with alt-tab)

Code:
less blah.txt


/realtime
(search for realtime and you will see it is working sucessfully .. yippeeeeeee!)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 23, 2006 3:52 am 
Offline
Joined: Fri Sep 19, 2003 7:05 pm
Posts: 5088
Location: Fontana, Ca
Cool! Thanks for contributing.

_________________
cesman

When the source is open, the possibilities are endless!


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu