LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   wicd or wicd-gtk problem (https://www.linuxquestions.org/questions/linux-software-2/wicd-or-wicd-gtk-problem-4175609583/)

Altoid 07-10-2017 01:04 PM

wicd or wicd-gtk problem
 
Hello:

I have a problem with wicd or wicd-gtk, really cannot say.

It works perfectly except when I try to edit scripts via the GUI.

Package: wicd
Version: 1.7.4-1pclos2016

Kernel 4.11.3-pclos2 #1 SMP Sun Jun 4 22:16:40 CDT 2017 x86_64 GNU/Linux

Expected behaviour:
The 'Scripts' button in the network profile's properties dialog should launch a window asking for the root password and then launch the 'Configure Scripts' window.

Behaviour:
The 'Scripts' button in the network profile's properties dialog launches a window with this text:

---
<b>Failed to run /usr/share/wicd/gtk/configscript.py '4' 'wireless' as user root.</b>
Failed to exec new process: No such file or directory
---

It seems that Wicd is working properly because if I run /usr/share/wicd/gtk/configscript.py '4' 'wireless' in a terminal as root, I get the sequence expected from pressing the 'Scripts' button.

Also, running gksu /usr/share/wicd/gtk/configscript.py '4' 'wireless' in a terminal does the same ie: launches a window asking for root password and then launches the Configure Scripts (as superuser) window.

But ...

Running gksudo /usr/share/wicd/gtk/configscript.py '4' 'wireless' in a terminal launches a window with this text:

---
<b>Failed to run /usr/share/wicd/gtk/configscript.py '4' 'wireless' as user root.</b>
Failed to exec new process: No such file or directory
---

So ...
It would seem that the 'Scripts' button launches this:

Code:

gksudo /usr/share/wicd/gtk/configscript.py '4' 'wireless'
instead of launching this:

Code:

gksu /usr/share/wicd/gtk/configscript.py '4' 'wireless'
Apparently all the dependencies are met.

[groucho@groucho ~]$ apt-cache depends wicd

wicd-1.7.4-1pclos2016
Depends: python >= 2.6
Depends: python-urwid
Depends: python-gobject
Depends: pygtk2.0
Depends: python-dbus
Depends: wireless-tools
Depends: </bin/sh>
bash-4.3-48.1pclos2017
Depends: </bin/sh>
bash-4.3-48.1pclos2017
Depends: </bin/sh>
bash-4.3-48.1pclos2017
Depends: </bin/sh>
bash-4.3-48.1pclos2017
Depends: python >= 2.7
[groucho@groucho ~]$

Installed:

python 2.7.9
python-urwid 1.1.1
python-gobject 2.28.6
pygtk2.0 2.24.0
python-dbus 1.2.4
wireless-tools 30
bash-4.3-48.1pclos2017

Any help with this would be greatly appreciated.

Thanks in advance.

A.

AwesomeMachine 07-10-2017 02:13 PM

The manual just says that configuring scripts requires root privileges, So, it's a bug that is not allowing a password box to pop up.

Network-manager is now the preferred tool. Wicd has fallen behind.

Altoid 07-12-2017 09:03 AM

[SOLVED] wicd or wicd-gtk problem
 
Hello:

Problem solved.

The 'Scripts' button in the Wicd network profile's properties dialog should launch a window asking for root password and then launch the 'Configure Scripts (as superuser)' window.

For the 'Configure Scripts' application to actually launch, it needs an external graphical sudo program.

Code:

""" configscript -- Configure the scripts for a particular network.

Script for configuring the scripts for a network passed in as a
command line argument.  This needs to run a separate process because
editing scripts requires root access, and the GUI/Tray are typically
run as the current user.

"""

Wicd has a choice of any one of four options: gksudo, kdesu, ktsuss or 'Automatic'.
Any one of them can be chosen in the Wicd Preferences -> External Programs -> Graphical Sudo Application, 'Automatic' being the recommended one.

In 'Automatic', if the user doesn't have any of them installed, clicking on the menu icon fails, notifying that it could not run the script.

ie:
---
<b>Failed to run /usr/share/wicd/gtk/configscript.py '4' 'wireless'
as user root.</b>
Failed to exec new process: No such file or directory
---

My DE is not KDE so kdesu is not an option and ktsuss refuses to initialize.
See http://www.gtk.org/setuid.html

Being new to Linux (or just dumb), it was not really clear to me that what was actually missing wasn't configscript.py but gksudo.

Which makes sense since sudo is not part of the OS.

I spent a few afternoons looking around for a lead to the cause of this issue and found this:
https://bugs.debian.org/cgi-bin/bugr...cgi?bug=575403

Quote:

Well it was as easy as exchanging the order of "gksudo" and "gksu" on line 462 in the file
/usr/share/pyshared/wicd/misc.py
So I looked for the file, which is /usr/lib/python2.7/site-packages/wicd/misc.py and found it.
The line in question in this version is #560:

Code:

549 def choose_sudo_prog(prog_num=0):
550    """ Try to intelligently decide which graphical sudo program to use. """
551    if prog_num:
552        return find_path(_sudo_dict[prog_num])
553    desktop_env = detect_desktop_environment()
554    env_path = os.environ['PATH'].split(":")
555    paths = []
556   
557    if desktop_env == "kde":
558        progs = ["kdesu", "kdesudo", "ktsuss"]
559    else:
560        progs = ["gksudo", "gksu", "ktsuss"]  <-  change to progs = ["gksu", "gksudo", "ktsuss"]
561       
562    for prog in progs:
563        paths.extend([os.path.join(p, prog) for p in env_path])
564       
565    for path in paths:
566        if os.path.exists(path):
567            return path
568    return ""

With this change, it works perfectly. =-)

ie: The 'Scripts' button in the Wicd network profile's properties dialog launches a window asking for root password and then launches the 'Configure Scripts (as superuser)' window.

Comment:
I think (?) that what was happening here was that the script did find gksudo but as in PCLinuxOS gksudo is not an executable but a link to the gksu executable, it failed.

But as it does find gksudo (making no differentiation between link and executable), it does not go on to use the next available option, gksu.

My guess is that this is because a link to an executable with a command line ('4' 'wireless') does not result in the linked-to executable with that same command line.

ie:
Code:

gksudo /usr/share/wicd/gtk/configscript.py '4' 'wireless'
Resulted in:
---
<b>Failed to run /usr/share/wicd/gtk/configscript.py '4' 'wireless' as user root.</b>
Failed to exec new process: No such file or directory
---

Code:

gksu /usr/share/wicd/gtk/configscript.py '4' 'wireless'
Worked as expected.

If there was a way to do incorporate this to PCLinuxOS, any application calling gksudo (a link to the gksu executable) with a command line would run gksu (the executable) with the same parameters but asking for the password to elevate privileges first.

This would make the absence of gksudo in PCLinuxOS a non-issue.

Any comments/corrections welcome.

Thanks in adance.

A.


All times are GMT -5. The time now is 07:01 AM.