Pandora .pnd with installer, using gksudo, sometimes not working


Linux-SWAT

Forum Addict!
Joined
Feb 13, 2010
Messages
9,176
Hi !


So i bundled a .pnd with those first lines :



Code:
if zenity --question --title="My installer" --text="Welcome.\n\nDo you want to install it ?" --ok-label="Yes, of course" --cancel-label="Cancel" ; then


	#installing some ipk

	/usr/bin/gksudo "/usr/bin/opkg --nodeps install /mnt/pnd/my_installer_data/ipk/*.ipk"


	#installing the root filesystem into /

	/usr/bin/gksudo "/bin/tar zxvf /mnt/pnd/my_installer_data/my_root_pack-1.0-armv7a-1.tgz -C /"


        touch /test

fi


My problem is that sometimes, gksudo doesn't ask the password, therefore commands are not executed.


And test is created...


I don't understand...


Oh, btw, i know gksudo, as sudo does, caches the password during a limited amount of time. I tested installs on fresh systems.
 
Last edited by a moderator:
Don't know if this will help, but here is the script I've used in a couple of PNDs to load a module (with password prompt). Courtesy of sebt3.



Code:
if ! grep -q snd-seq /etc/modules;then

  # the module isn't loaded

  gksudo -D "TiMidity++ needs to load the MIDI module snd-seq blah blah blah." "modprobe -k snd-seq"

fi
 
Last edited by a moderator:
Strange behaviour.


Maybe invoke gksudo with the "--debug"-option, and see if it prints some helpful messages?
 
Ok, thanks, i'll try it soon.


Saw other useful options, like force sudo :



Code:
gksudo [-u <user>] [options] <command>


--debug, -d


Print information on the screen that might be useful for diagnosing and/or solving problems.

--user <user>, -u <user>

    Call <command> as the specified user.

--disable-grab, -g

    Disable the "locking" of the keyboard, mouse, and focus done by the program when asking for password.

--prompt, -P

    Ask the user if they want to have their keyboard and mouse grabbed before doing so.

--preserve-env, -k

    Preserve the current environments, does not set $HOME nor $PATH, for example.

--login, -l

    Make this a login shell. Beware this may cause problems with the Xauthority magic. Run xhost to allow the target user to open windows on your display!

--description <description|file>, -D <description|file>

    Provide a descriptive name for the command to be used in the default message, making it nicer. You can also provide the absolute path for a .desktop file. The Name key for will be used in this case.

--message <message>, -m <message>

    Replace the standard message shown to ask for password for the argument passed to the option. Only use this if --description does not suffice.

--print-pass, -p

    Ask gksu to print the password to stdout, just like ssh-askpass. Useful to use in scripts with programs that accept receiving the password on stdin.


--su-mode, -w

    Force gksu to use su(1) as its backend for running the programs.

--sudo-mode, -S

    Force gksu to use sudo(1) as its backend for running the programs.
 
Last edited by a moderator:
Code:
$ /usr/bin/gksudo -u root -D "Installing some ipk packages" --debug --sudo-mode "/usr/bin/opkg --nodeps install /mnt/pnd/my_installer_data/ipk/*.ipk"

No ask_pass set, using default!ll & )naoh:~$ 

xauth: /tmp/libgksu-aAv25N/.Xauthority

STARTUP_ID: gksudo/|usr|bin|opkg --nodeps install |mnt|pnd|my_installer_data|ipk|*.ipk/6511-0-naoh_TIME0

cmd[0]: /usr/bin/sudo

cmd[1]: -H

cmd[2]: -S

cmd[3]: -n

cmd[4]: -p

cmd[5]: GNOME_SUDO_PASS

cmd[6]: -u

cmd[7]: root

cmd[8]: --

cmd[9]: /usr/bin/opkg

cmd[10]: --nodeps

cmd[11]: install

cmd[12]: /mnt/pnd/my_installer_data/ipk/*.ipk

buffer: --

......................................................................

buffer: --

brute force GNOME_SUDO_PASS ended...

No password prompt found; we'll assume we don't need a password.

xauth: /tmp/libgksu-aAv25N/.Xauthority

xauth_env: (null)

dir: /tmp/libgksu-aAv25N

Collected errors:

 * wfopen: /mnt/pnd/my_installer_data/ipk/*.ipk: No such file or directory.

 * pkg_init_from_file: Failed to extract control file from /mnt/pnd/my_installer_data/ipk/*.ipk.



What the heck !!! "No ask_pass set"


It used to work perfectly some weeks ago. Can it be the Hotfix 5 ?


---EDIT :


using --su-mode asked for password, but command failed anyway !


I did a "ls /mnt/pnd/my_installer_data/ipk/" , and it showed all my .ipk :/
 
Last edited by a moderator:
I don't really understand the gksudo/X internals, but maybe that is a pointer to the problem:


http://linux.derkeiler.com/Mailing-Lists/Ubuntu/2007-01/msg01300.html

[snip]
russell@abraham:~ $ gksudo -d -u dashboard xterm No ask_pass set,


[snip]


If you are running X as "russell", the system will complain if you try to


run an X app as another user ( the other user does not "own" the X


session on display :0 , and is not authorised to connect to the X server


for that display)

Try to add a "xhost +" in front of the call, that should allow anyone to connect to the x (only as a test, I don't know how secure or insecure that is. As I said, I'm not exactly an x pro)
 
Ok, will try it next. I'm too tired for now :^) better go sleeping.


BTW gksudo is executed by the current user so this should not be a problem...


I wonder another thing. The current script is called by another script, the one in the root of my .pnd


Is this chaining bad with .pnd ?
 
That's how i proceeded...


Anyway, my icon doesn't works, and the gksudo stopped working some days ago TT.
 
Last edited by a moderator:
Back
Top