LinHES Forums
http://forum.linhes.org/

Realtime priority
http://forum.linhes.org/viewtopic.php?f=3&t=8085
Page 1 of 1

Author:  bobmyth [ Tue Jan 24, 2006 9:48 pm ]
Post subject:  Realtime priority

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?

Author:  cesman [ Tue Jan 24, 2006 11:44 pm ]
Post subject: 

Wait for the next release which does this via PAM... How is that for an idea? ;)

Author:  bobmyth [ Wed Jan 25, 2006 9:11 pm ]
Post subject: 

Looks like the next release will do it using PAM, can't wait.

Author:  sammo2828 [ Mon Feb 20, 2006 10:51 pm ]
Post subject: 

Is there any reason why setuid doesn't work?

Author:  tjc [ Mon Feb 20, 2006 10:56 pm ]
Post subject: 

Because then it runs as root and a lot of stuff ends up either ends up owned by root or in odd places...

Author:  sammo2828 [ Tue Feb 21, 2006 12:04 am ]
Post subject: 

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

Author:  sammo2828 [ Tue Feb 21, 2006 6:11 pm ]
Post subject: 

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?

Author:  cesman [ Tue Feb 21, 2006 6:29 pm ]
Post subject: 

Per the docs, you need
Quote:
* - rtprio 0
* - nice 0
@audio - rtprio 50
@audio - nice 0
Do you have the first two lines?

Author:  sammo2828 [ Tue Feb 21, 2006 6:45 pm ]
Post subject: 

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

Author:  cesman [ Tue Feb 21, 2006 6:54 pm ]
Post subject: 

Perhaps. Please do try it and let me know as I too followed the directions in the MythTV docs.

Author:  sammo2828 [ Tue Feb 21, 2006 7:00 pm ]
Post subject: 

okay, followed the instructions to download pam source, patch, rebuild and install ... rebooted and success!

Using realtime priority.

Author:  cecil [ Wed Feb 22, 2006 5:44 am ]
Post subject: 

Perhaps providing greater details, steps, etc.

Author:  sammo2828 [ Wed Feb 22, 2006 6:18 am ]
Post subject: 

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!)

Author:  cesman [ Thu Feb 23, 2006 3:52 am ]
Post subject: 

Cool! Thanks for contributing.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/