Pandora Pnd Permissions


gruso

thunderbox
Joined
Feb 28, 2008
Messages
7,461
Age
47
Location
Sydney, Australia
Website
pandorapress.net
This is an offshoot from my Seq24 thread. The guys in there have been fantastic and patient, but I think I'm using my credits up :p And, there seems to be a broader question about PND capabilities here.

In a nutshell: Once Seq24 was successfully compiled on my Pandora, it required this before running:

Code:
sudo modprobe snd-seq

This is only good until the next reboot. The permanent fix should be:

Code:
sudo echo snd-seq >> /etc/modules

But the only thing that actually writes to /etc/modules is:

Code:
sudo su
echo snd-seq >> /etc/modules

This is fine until you wrap it up in a PND. You can't use su in a script, so snd-seq can't be loaded permanently.

Has anyone else had to jump through similar hoops to get a PND working? Is there a solution?
 
Last edited by a moderator:
Why not just have a little script included in the PND that adds the needed line?

Or, just have the user type in the password to insert the module every time seq24 is run (unless its already inserted) .. I don't really see whats wrong with this solution - the password is only required the first time seq24 is started after a reboot.

Alternatively, set the suid bit on the script that inserts the module, and see if that works ..
 
"su" is generally bad for somethign like this, since its command line; you'd use gksu or gksudo since you'd be getting a popup dialog for the password (ie: akin to the hotfixes and so on.)

Sounds like a good case for popping out a couple options in the pnd somewhere -- one to set it up permanently (and one to remove it from the permanent load list), otherwise just have the password on launch and modprobe the module up. (Coudl also check if its already there, to avoid needing to do that for multiple invocations of the app in a row.)

You _are_ loading kernel modules, so it _is_ a little trickier .. you cannot (and should not) be able to willy nilly load modules into the kernel without user permissions after all :)

jeff
 
Here's the script I'm using thanks to sebt3:

Code:
if ! lsmod|grep -q snd-seq;then
  # the module isn't loaded
  if ! grep -q snd-seq /etc/modules;then
    # not loaded automagically
    gksudo -D "load MIDI module on startup ?" "echo snd-seq>>/etc/modules"
  fi
  gksudo -D "load MIDI module" "modprobe -k snd-seq"
fi

It has the user prompts, but still doesn't get around the permissions issue. I tried GKSU and it asks for the root password, I also tried setting SUID bit but that action doesn't seem to be permitted at all (on the Pandora). Looks like I'm stuck with the password prompt for each session, perhaps I could add instructions in the readme for loading the module permanently.

Anyway, I don't wish to turn this into another Seq24 thread. That would be greedy. The important thing is that there is now a result when searching the forum for PND permissions. ;) Further philosophical discussion welcomed.
 
I think it's not so much a PND issue as a (gk)sudo one. Redirection just isn't always POLA-compliant ;-) Some discussion of a similar issue here:

http://www.linuxquestions.org/questions/programming-9/gksudo-vs-sudo-strangeness-642251/

The method of using a separate script turned up there too (i.e. put "echo snd-seq>>/etc/modules" in one script and have gksudo call that from the main one).
 
pnd root permissions more to point; pnd permissions could well be what people want when constructing a pnd and forgetting to +x their executables :) (there, covered that now too :)

I would think the gksudo echo >> /etc/modules would do the trick; I don't like the implication that the user wants this forever in the /etc/modules, but thats a small nit. (ie: User first time runs now has the module for life.)

Is the module already copied into the right place, so that it can be found? (ie: its not in the pnd, is it?)

You may need to use /bin/echo instead of 'echo' but I doubt thats it .. hmrf :)

jeff
 
the problem with this syntax :
Code:
gksudo echo >> /etc/modules
is that the redirect (>>) is handled by the shell stating gksudo thus don't have the right privileges...
that's why I put this within double quote for the script I gave to gruso.

alternatively, you could create a script (say root-add-module.sh) containing only :
Code:
#!/bin/sh
echo snd-seq>>/etc/modules

And have :
gksudo -D "load MIDI module on startup ?" root-add-module.sh

by the way gksu, ask for root password instead odf the user password. it's a bad idea to use this one as nobody knon its root password...
 
Gruso said:
Code:
sudo echo snd-seq >> /etc/modules
Try:
Code:
sudo "echo snd-seq >> /etc/modules"
Without quotes, you are running "echo snd-seq" as root, then (as a regular user) attempting to append it to a protected file. Which is pretty much what sebt3 just said.
 
Last edited by a moderator:
^ Thanks for that info, I was actually using quotes but didn't know why. :)

I've also tried calling a separate script (after checking out how the codec pack PND works). Bottom line seems to be, no su, no dice.
 
This is just a shot in the dark, but perhaps use:
Code:
sudo su -c "echo snd-seq >> /etc/modules"
su -c lets you run a command as root. It's effectively just like sudo, but it asks for the root password instead of the user password. Using it with sudo is redundant, but if you say sudo isn't behaving as it should, maybe it's worth a try.
 
I've tried that one also (again courtesy of sebt3). I think I'll have to settle on things how they are, I'm sure the three people using Seq24 won't mind. :D

It's vexing to say the least that you can run a full system update from a PND but not load a perfectly benign module for a MIDI app. Yay Linux.
 
I think either we convince ED and co to add the module in the next Hotfix permanently (seq24 won't be the only app that needs to use USB-MIDI, I promise), or we just put up with the situation that you have to type your password every time you launch seq24 ..
 
I think we'll do both :) For now I'll update the password prompt message, to say it's 'for this session only, please see the readme for instructions on doing it permanently'.

I'll also ask about getting the module added in the Hotfix 5 request thread.
 
I'm not that sure loading that module for everyone with all associated overheads (at least some RAM will be used) is the best idea, it's not something most people are using.
 
As one unlikely to get into the music-making business, I've got to agree with notaz. Limited resources, don't want to consume them unnecessarily.

Only other solution of which I can think is to change /etc/sudoers to allow modprobe to be used without password. I'm not certain, but it might even be possible to have sudoers allow only the command "modprobe snd-seq", forcing all other calls to modprobe to still require password.

But this has the potential to be a security risk. Personally, if I were one to get into the music-making business, I wouldn't mind entering my password one more time per boot.
 
^ Or if you use this a lot why cant you just add the line to autoload the module anyways, no password-querys should be needed after that...
 
^ An individual user could autoload the module, or an individual user could edit sudoers, yes. But the question is whether the default firmware should be modified to make this PND (and other similar ones) easier to use by default.
 
I think the best option is simply to include the password-at-first-run popup and leave it at that. We seq24 users will get used to it ..
 
Back
Top