Here's how to fix "gksu not found"

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
wmorrison
Senior
Posts: 165
Joined: Sat Dec 01, 2018 12:05 am
United States of America

Here's how to fix "gksu not found"

Post by wmorrison »

I'm running Xubuntu 19.04. MythTV 30. When I run mythtv-setup from the command line, there is a message printed about gksu not being found.

Long story short, gksu is deprecated and removed. One of the recommended replacements is pkexec.

Look for /usr/share/mythtv/dialog_functions dot s h. Search for SU_TYPE and the code around it, in find_session().

(The forum won't let me post the path above literally because of the script extension.)

It is trying to auto-detect your system and set commands to be used when the main script mythtv-setup dot s h is called. (Same thing with the extension.)

For my system, which is on xfce, the logic to test for this didn't work, so as a hack to get it working, I commented out all the ifs and made it use pkexec. Here's my function. Note passing the environment variables to pkexec.

Code: Select all

find_session()
{
#    if [ x"$KDE_FULL_SESSION" = x"true" ]; then
#       DE=kde;
#       DIALOG=`which kdialog`;
#       DIALOG_TYPE=kdialog;
#       SU=`which kdesudo`
#       SU_TYPE=kdesudo
#    elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then
#       DE=gnome;
#       DIALOG=`which zenity`;
#       DIALOG_TYPE=zenity;
#       SU=`which gksu`
#       SU_TYPE=gksu
#    elif xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then
        DE=xfce;
        DIALOG=`which zenity`;
        DIALOG_TYPE=zenity;
        SU=`which pkexec`
        SU_TYPE="pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY"
#    fi
}
I would have preferred my change to be "elegant" but at least it works now for me, so I'll leave the "elegant" part to MythTV developers for a future version. But maybe this will help someone else in the meantime.
MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Here's how to fix "gksu not found"

Post by MikeB2013 »

There is a trac ticket on this see https://code.mythtv.org/trac/ticket/13256

I have recently updated the trac ticket with a patch to provide a longer term solution, instead of the quick fix of "sudo adduser $USER mythtv" and use of systemctl start/stop mythtv-backend in a terminal session.

Mike
wmorrison
Senior
Posts: 165
Joined: Sat Dec 01, 2018 12:05 am
United States of America

Re: Here's how to fix "gksu not found"

Post by wmorrison »

Great! So is adding user "mythtv" as a sudoer just a workaround, or something that should be done regardless?

I must have previously done that. I've been working on setting up my mythtv box for a while, and don't remember. Would mythtv-setup have worked without my change above replacing gksu (if "mythtv" is a sudoer?)

I just saw the error, cancelled out of mythtv-setup, and didn't continue until I fixed the error. I've had so many "road blocks" over the course of a few reinstalls that I'm wary of ignoring errors and continuing. :)
MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Here's how to fix "gksu not found"

Post by MikeB2013 »

The "sudo adduser $USER mythtv" just adds current user to mythtv group, which is what the dialog_functions script would have done previously when gksu was available.It does not grant sudoer privileges. mythtv-setup would work after this provided it was run in a terminal session and sudo systemctl stop mythtv-backend was used manually prior to mythtv-setup command.

My patch uses sudo (which is standard on current *ubuntu and debian systems) together with a new custom function which effectively replaces gksu, fixes some broken and obsolete code and uses systemd systemctl commands. The net effect of the changes allows mythtv-setup to run from either menu or terminal session.
Post Reply