gparted menu entry depends on gksu

Bug #616274 reported by Malte S. Stretz
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gparted (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: gparted

When you try to run gparted from Kubuntu and don't have gksu installed, you get the message "KDEInit could not launch 'gksu'.: Could not find 'gksu' executable."

Seems like the menu entry hard codes gksu instead of choosing the best su available (is there anything like sensible-sudo?).

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: gparted 0.5.1-1ubuntu3
ProcVersionSignature: Ubuntu 2.6.32-24.39-generic 2.6.32.15+drm33.5
Uname: Linux 2.6.32-24-generic i686
Architecture: i386
Date: Wed Aug 11 12:00:12 2010
InstallationMedia: Kubuntu 10.04 LTS "Lucid Lynx" - Release i386 (20100427)
ProcEnviron:
 LANGUAGE=
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: gparted

Revision history for this message
Malte S. Stretz (mss) wrote :
Revision history for this message
David Sugar (dyfet-deactivatedaccount) wrote :

gparted does have gksu as a "recommends:". However, if the gksu package is manually removed by the user, then yes, gparted running from the menu will be broken. This I think is true for other sudo requiring gnome/gtk packages when ran from menus on KDE and I imagine conversely true for KDE apps that use kde's sudo menu entries when on gnome.

Perhaps what is needed is an "alternatives" method to support different sudo via a symlink based on the desktop. This is a broader question of course, like the idea of a "sensible-sudo" that might for example be a script that uses $DESKTOP_SESSION. The packager could also change gksu from a "Recommends:" to a hard "Depends:", but I think this is not a good solution.

Revision history for this message
Malte S. Stretz (mss) wrote :

Here's a proposal for a sensible-sudo. The Exec line in the desktop file should look like

sensible-sudo --desktop %k -- /usr/sbin/gparted

Revision history for this message
Malte S. Stretz (mss) wrote :

I added sensible-utils as an affected package, maybe this script could be included there.

Revision history for this message
David Sugar (dyfet-deactivatedaccount) wrote :

My observation was simply that we have $DESKTOP_SESSION, and hence we could use it to do a "smarter" sudo for the desktop, which for gnome (or xubuntu) calls gksu, for kde the kde one, and if there is no desktop session or X at all (such as a ssh or console instance), maybe just calls terminal sudo. I could make it into a formal small blueprint for Narwhal for sensible-utils if there is interest in something like this.

Revision history for this message
Malte S. Stretz (mss) wrote :

I think the approach I used in my script should be sufficient: If a KDE session is running (based on $KDE_FULL_SESSION), look for kdesudo first, then for gksudo. If no KDE is running (GNOME, XFCE, ...) look for gksudo first, then kdesudo. Those are all X sudos I could find.

If a X session is running, it shouldn't really fall back to plain sudo since the user will never see the prompt if the script was called from a desktop file. Maybe I could change it such that it will fall back to sudo unless the --desktop parameter was given.

Relying on $DESKTOP_SESSION is more complicated, because for example on my box it just says "default" and I'd have to go looking in some X config files to find out what that means (ie. find out which window manager I'm currently using).

I tried to implement a third option with kdialog and SUDO_ASKPASS but in the end it got to error prone for a feature which is probably never used (since when kdialog is installed there will probably also kdesudo). And it seems like xdialog isn't included in Debian/Ubuntu anymore.

In the end, gparted should just use PolicyKit or whatever instead of being started completely as root, but I guess it will take a while until that is the case.

Revision history for this message
Malte S. Stretz (mss) wrote :

Here is a revised version of the script which skips the plain sudo only if --desktop was given.

Revision history for this message
Jan Claeys (janc) wrote :

A 'sensible-sudo' already exists, only it's named 'su-to-root' and is part of the 'menu' package (which builds menus for Debian systems since before there was a freedesktop.org-based standard for it). I haven't tested it, but from reading the manpage it should do what you want.

Revision history for this message
Phillip Susi (psusi) wrote :

This was fixed in gparted (0.8.1-1ubuntu3) by switching to pkexec.

Changed in gparted (Ubuntu):
status: New → Fix Released
no longer affects: sensible-utils (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.