Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Users

Device permissions

 

 

MythTV users RSS feed   Index | Next | Previous | View Threaded


memoryguy at gmail

Nov 20, 2009, 11:56 AM

Post #1 of 5 (462 views)
Permalink
Device permissions

Hi all,

I know this isn't directly MythTV-related, but it's for my mythbox, so... ;)

I'm in the process of rebuilding my system on Slackware 13. I have
been on Slackware 9 for 5+ years (and even before that, way to back to
Myth 0.06 in 2002).

I'm only just now moving to the wonderful world of the 2.6 kernel. At
least, on a box that I actually need/want to tweak. So much has
changed! In particular, udev.

So, the problem is this:
If I start mythbackend from the prompt, everything works perfectly (hooray!)

But when I start mythbackend from daemontools [1], it doesn't have
permission to the /dev/video* nodes (two identical PVR-250s, so video0
and video1)

I'm pretty sure I have an idea where the problem is coming from, I
just don't know how to fix it.

The nodes have permissions:
root [at] myt:/dev# ls -l video*
crw-rw---- 1 root video 81, 0 2009-11-20 14:21 video0
crw-rw---- 1 root video 81, 4 2009-11-20 14:21 video1
crw-rw---- 1 root video 81, 3 2009-11-20 14:21 video24
crw-rw---- 1 root video 81, 7 2009-11-20 14:21 video25
crw-rw---- 1 root video 81, 1 2009-11-20 14:21 video32
crw-rw---- 1 root video 81, 5 2009-11-20 14:21 video33

Which is fine.... my Myth user is part of the "video" group:
root [at] myt:/dev# id myth
uid=1000(myth) gid=100(users)
groups=100(users),6(disk),10(wheel),11(floppy),17(audio),18(video),19(cdrom),83(plugdev),84(power),86(netdev)

(and again, when I start the backend manually from the prompt
everything is fine)

Daemontools gets started from init, and it runs as root, but I'm using
this command to start the backend:

setuidgid myth /usr/local/bin/mythbackend -l $LOGFILE > /dev/null 2>&1

What that does is run the given command ("mythbackend") as the
specified user ("myth"). Best as I can tell, mythbackend *is* running
as the correct user:

root [at] myt:/service/mythbackend# ps -ef | grep mythbackend
root 3387 3376 0 13:47 ? 00:00:00 supervise mythbackend
myth 19421 19410 0 14:12 ? 00:00:03
/usr/local/bin/mythbackend -l /var/log/myth/backend.log

...unless I'm reading that incorrectly, the second line is the
backend, and the owner is "myth", the correct user.

If I go to /dev and "chmod a+rw video*" and then get daemontools to
restart the backend, everything works perfectly, so I am certain it is
a permissions problem. But I don't understand why there is a problem,
since it looks to me like things are configured right.

I figured the easy fix would be to add a udev rule to set the
permissions to 0666:

root [at] myt:/etc/udev/rules.d# cat 11-ivtv.rules
KERNEL=="video[0-9]+", NAME=="video%n", MODE=="0666"

But this doesn't seem to do anything. Is the above correct? Should it work?

I also recall that I wasn't able to get the LIRC udev rule (from the
LIRC site) to work either... which leads me to wonder if there is more
involved in setting up udev rules than just dropping a file into
/etc/udev/rules.d?

Can anyone offer any suggestions? Or is there any additional
information that would be helpful?

Thanks in advance,
aaron

[1] http://cr.yp.to/daemontools/install.html , I know there are
probably better ways to do it these days, but this was the suggested
tool back when I was initially building the box.
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


shadestalker at thatsmystapler

Nov 20, 2009, 1:01 PM

Post #2 of 5 (452 views)
Permalink
Re: Device permissions [In reply to]

On Fri, Nov 20, 2009 at 2:56 PM, aaron <memoryguy [at] gmail> wrote:

> Hi all,
>
> I know this isn't directly MythTV-related, but it's for my mythbox, so...
> ;)
>
> I'm in the process of rebuilding my system on Slackware 13. I have
> been on Slackware 9 for 5+ years (and even before that, way to back to
> Myth 0.06 in 2002).
>
> I'm only just now moving to the wonderful world of the 2.6 kernel. At
> least, on a box that I actually need/want to tweak. So much has
> changed! In particular, udev.
>
> So, the problem is this:
> If I start mythbackend from the prompt, everything works perfectly
> (hooray!)
>
> But when I start mythbackend from daemontools [1], it doesn't have
> permission to the /dev/video* nodes (two identical PVR-250s, so video0
> and video1)
>
>
http://cr.yp.to/daemontools/setuidgid.html

" setuidgid sets its uid and gid to *account*'s uid and gid, *removing all
supplementary groups*. It then runs *child*."

I would try 'su myth -c' instead.

HTH,

Jason


memoryguy at gmail

Nov 20, 2009, 1:08 PM

Post #3 of 5 (449 views)
Permalink
Re: Device permissions [In reply to]

On Fri, Nov 20, 2009 at 16:01, Jason Spears
<shadestalker [at] thatsmystapler> wrote:
>
> http://cr.yp.to/daemontools/setuidgid.html
>
> " setuidgid sets its uid and gid to account's uid and gid, removing all
> supplementary groups. It then runs child."
>
> I would try 'su myth -c' instead.
>

*blink*

How the heck did I miss that? I've had to go back to those pages every
time need to use the tools because the documentation is pretty much
non-existent.

*furious typing*
wow. I feel like an moron now. :)

Thanks so much, Jason. That worked.

aaron
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


mythtv at rodsbooks

Nov 20, 2009, 2:54 PM

Post #4 of 5 (429 views)
Permalink
Re: Device permissions [In reply to]

On Friday 20 November 2009 02:56:22 pm aaron wrote:
>
> I figured the easy fix would be to add a udev rule to set the
> permissions to 0666:
>
> root [at] myt:/etc/udev/rules.d# cat 11-ivtv.rules
> KERNEL=="video[0-9]+", NAME=="video%n", MODE=="0666"
>
> But this doesn't seem to do anything. Is the above correct? Should it work?

I realize you've solved your problem in another way, but I thought I'd point
out for your own future reference and/or for the benefit of others that
you've used the udev equality test operator (==) in at least one place where
you should have used the assignment operator (=). Specifically,
'MODE=="0666"' just tests to find device files with a mode of 0666 (at least,
that's what the syntax says; I don't know if udev actually supports this
test), but you almost certainly meant 'MODE="0666"' to have it set the mode
to 0666. The same might be true of the NAME test, although that should only
appear in the primary definition for the device. On most distributions you
wouldn't edit this definition; instead, you'd create a new definition (in a
file you create yourself) that just adds whatever symbolic links, ownership
changes, permissions changes, etc., that you want to add. That way, the
distribution's package management tools won't erase your changes when it
upgrades your udev package (or whatever package has the default file). Many
of Slackware's package management and system configuration procedures are
different from those for most other Linux distributions, though, so I'm not
sure if the general procedure of adding new, rather than editing existing,
udev rules applies to Slackware.

FWIW, the MythTV wiki has a section on udev, with examples tailored to the
sorts of things MythTV users often need to do with udev:

http://www.mythtv.org/wiki/Device_Filenames_and_udev

Disclaimer: I'm the creator and primary author of that wiki page, although
others have added some sections.

--
Rod Smith
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users


memoryguy at gmail

Nov 21, 2009, 7:19 AM

Post #5 of 5 (420 views)
Permalink
Re: Device permissions [In reply to]

On Fri, Nov 20, 2009 at 17:54, Rod Smith <mythtv [at] rodsbooks> wrote:
>
> I realize you've solved your problem in another way, but I thought I'd point
> out for your own future reference and/or for the benefit of others that
<snip>

Aha! I got the video nodes to have 0666 permissions, finally... no
luck yet with LIRC (creating a "lirc" symlink) but I already solved
that a while ago by updating my script to make lircd look at lirc0
directly. :)

Thanks!

> upgrades your udev package (or whatever package has the default file). Many
> of Slackware's package management and system configuration procedures are
> different from those for most other Linux distributions, though, so I'm not
> sure if the general procedure of adding new, rather than editing existing,
> udev rules applies to Slackware.

Slackware is usually pretty good about not overwriting configuration
files that you modify/create yourself... famous last words... ;-) It
looks like I should be safe adding my own rules to the directory...
Slackware's philosphy tends to be to stay out of your way and let you
do your thing.

>
> FWIW, the MythTV wiki has a section on udev, with examples tailored to the
> sorts of things MythTV users often need to do with udev:
>
> http://www.mythtv.org/wiki/Device_Filenames_and_udev

Maybe I'm getting old, but I always have trouble searching the wiki
and finding useful results :( That could be why I didn't think to
look there first :/

(I still need to read through the full page, but so far your
explanation has really helped me to understand the magic udev
language... it doesn't feel quite as random as it had before :) )

Thanks again,
aaron
_______________________________________________
mythtv-users mailing list
mythtv-users [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

MythTV users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.