Need help trying to create Gnome Root Terminal menu shortcut.

Hello,

I’ve been struggling with trying to find a way to add a shortcut to Gnome 3’s menu. All I want is a shortcut that says Gnome Root Terminal and it starts Gnome Terminal, after asking for root’s password. I’m trying to use
gnomesu for this. I have my .desktop file in the /home/spork/.local/share/applications directory. My username is spork. When I have gnomesu added to TryExec and Exec, the .desktop file never shows. When I remove the gnomesu part, it shows up fine. Here’s the section I’m talking about:


TryExec="gnomesu gnome-terminal"Exec="gnomesu gnome-terminal"

I’ve tried it without the double quotes as well, like this:


TryExec=gnomesu gnome-terminal
Exec=gnomesu gnome-terminal

So it seems tryExec and Exec don’t like the space. Any suggestions on how I can accomplish what I want to accomplish? Thanks!

Spork Schivago

Just incase anyone needed it, here’s my full gnome-root-terminal.desktop file:


[Desktop Entry]
X-SuSE-translate=true
GenericName=Root Terminal
Name=GNOME Root Terminal
Comment=Use the command line as root
Keywords=root;shell;prompt;command;commandline;cmd;
TryExec="/usr/bin/gnomesu gnome-terminal"
Exec="/usr/bin/gnomesu gnome-terminal"
Icon=utilities-terminal
Type=Application
X-GNOME-DocPath=gnome-terminal/index.html
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-terminal
X-GNOME-Bugzilla-Component=BugBuddyBugs
X-GNOME-Bugzilla-Version=3.18.2
Categories=GNOME;GTK;System;TerminalEmulator;
StartupNotify=true
X-GNOME-SingleWindow=false
Encoding=UTF-8

I just added the full path to gnomesu, thinking that might work, but Gnome Root Terminal still doesn’t show up in the menu. If I remove gnomesu all together, it shows up just fine. Thanks!

I made a little progress by copying YaST.desktop to /home/spork/.local/share/applications after editing it. I stuck with using xdg-su -c “/usr/bin/gnome-terminal”. It now asks for the password but when I type in root’s password, gnome-terminal does NOT start up. I can’t seem to find any log files that tell me why either. Any suggestions?

Hi
First off you need to use gnomesu -c <some-command> and you need to mark it as trusted… so open Naultilus and browse down to ~/.local/share/applications in here, you will see the desktop entry looking like a file, double click on it and mark as trusted, then it will show the dektop file with it’s icon. Now double click on it and you should be good to go.

If it’s still failing, the add DBusActivatable=true to the desktop file.

Thank you Malcolmlewis. This is my new root-terminal.desktop file:


#!/usr/bin/env xdg-open
[Desktop Entry]
X-SuSE-translate=true
Type=Application
Categories=GNOME;GTK;System;TerminalEmulator;
Name=Gnome Root Terminal
Icon=utilities-terminal
GenericName=Gnome Root Terminal
Exec=/usr/bin/gnomesu -c "/usr/bin/gnome-terminal"
Encoding=UTF-8
Comment=Provide a root shell.
DBusActivatable=true

Regardless of whether I use gnomesu -c or xdg-su -c, it still just asks for the password but never opens up the terminal program, even with the DBusActivatable=true key. Even if I hit ALT-F2 and type:


gnomesu -c /usr/bin/gnome-terminal

The same happens. I get asked for the password but gnome-terminal never starts. Could it have something to do with my user spork running X-Windows but it’s somehow trying to look for a X-Windows session that might of been started by root instead of spork?

Any more suggestions? Thanks!

On Thu 04 Feb 2016 12:46:02 AM CST, Spork Schivago wrote:

malcolmlewis;2752320 Wrote:
> Hi
> First off you need to use gnomesu -c <some-command> and you need to
> mark it as trusted… so open Naultilus and browse down to
> ~/.local/share/applications in here, you will see the desktop entry
> looking like a file, double click on it and mark as trusted, then it
> will show the dektop file with it’s icon. Now double click on it and
> you should be good to go.
>
> If it’s still failing, the add DBusActivatable=true to the desktop
> file.
Thank you Malcolmlewis. This is my new root-terminal.desktop file:

Code:

#!/usr/bin/env xdg-open
[Desktop Entry]
X-SuSE-translate=true
Type=Application
Categories=GNOME;GTK;System;TerminalEmulator;
Name=Gnome Root Terminal
Icon=utilities-terminal
GenericName=Gnome Root Terminal
Exec=/usr/bin/gnomesu -c “/usr/bin/gnome-terminal”
Encoding=UTF-8
Comment=Provide a root shell.
DBusActivatable=true


Regardless of whether I use gnomesu -c or xdg-su -c, it still just asks
for the password but never opens up the terminal program, even with the
DBusActivatable=true key. Even if I hit ALT-F2 and type:

Code:

gnomesu -c /usr/bin/gnome-terminal


The same happens. I get asked for the password but gnome-terminal
never starts. Could it have something to do with my user spork running
X-Windows but it’s somehow trying to look for a X-Windows session that
might of been started by root instead of spork?

Any more suggestions? Thanks!

Hi
I have it working on Leap, however it’s not actually switching to root
user environment… need to play some more.


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 SP1|GNOME 3.10.4|3.12.51-60.25-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

How did you get it working? I could only get it to open a terminal window if I didn’t try opening it as root. What was the trick? Thanks!

I added the Terminal=true option. When I double click the .desktop file, I see it displaying error messages. It goes real quick but I believe what I’m seeing says:


(gnomesu:21369): Gtk-WARNING **: gtk_window_set_titlebar() called on a realized window
Gtk-Message: GtkDialog mapped without a transient parent.   This is discouraged.

(then I type root's password and I believe this is what flashes by)

Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error calling StartServiceByName for org.gnome.Terminal: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.gnome.Terminal exited with status 10

I’ve also tried, from a terminal window, running as root, the localectl command that people suggested on the net to fix this problem. When I rebooted, I thought i was making progress. I would open the terminal window as root, and then close it. I thought maybe all I had to do was remove either the Terminal=true from the .desktop file or the DBus. However, that didn’t fix the problem and even with them back in, I now get the previous error message about the proxy stuff.

Hi
OK, in the desktop file use;


gnome-terminal -e pkexec

You should be good to go, as well as having root user environment :wink: After you modify the desktop file, use alt+F2 enter r then press enter to restart the shell and rebuild the desktop file database with your changes.

How did you figure this out? You’re a freaking genius! Thank you!!! Been trying to do this for a while now!

Ken

On Thu 04 Feb 2016 05:56:01 PM CST, Spork Schivago wrote:

malcolmlewis;2752423 Wrote:
> Hi
> OK, in the desktop file use;
> >
Code:

> >
> gnome-terminal -e pkexec
>

> >
> You should be good to go, as well as having root user environment :wink:
> After you modify the desktop file, use alt+F2 enter r then press enter
> to restart the shell and rebuild the desktop file database with your
> changes.
How did you figure this out? You’re a freaking genius! Thank you!!!
Been trying to do this for a while now!

Ken

Hi
Alas, not me :wink: I was pointed to this rather than getting gksu (it
needs to go away) enable to build for Leap by one of my fellow
gnome-ites on IRC…


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 SP1|GNOME 3.10.4|3.12.51-60.25-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Thank you for your help! It seems to be working like a charm! Just gotta work on getting my program to compile successfully now. Thanks!

On Thu 04 Feb 2016 12:46:02 AM CST, Spork Schivago wrote:

malcolmlewis;2752320 Wrote:
> Hi
> First off you need to use gnomesu -c <some-command> and you need to
> mark it as trusted… so open Naultilus and browse down to
> ~/.local/share/applications in here, you will see the desktop entry
> looking like a file, double click on it and mark as trusted, then it
> will show the dektop file with it’s icon. Now double click on it and
> you should be good to go.
>
> If it’s still failing, the add DBusActivatable=true to the desktop
> file.
Thank you Malcolmlewis. This is my new root-terminal.desktop file:

Code:

#!/usr/bin/env xdg-open
[Desktop Entry]
X-SuSE-translate=true
Type=Application
Categories=GNOME;GTK;System;TerminalEmulator;
Name=Gnome Root Terminal
Icon=utilities-terminal
GenericName=Gnome Root Terminal
Exec=/usr/bin/gnomesu -c “/usr/bin/gnome-terminal”
Encoding=UTF-8
Comment=Provide a root shell.
DBusActivatable=true


Regardless of whether I use gnomesu -c or xdg-su -c, it still just asks
for the password but never opens up the terminal program, even with the
DBusActivatable=true key. Even if I hit ALT-F2 and type:

Code:

gnomesu -c /usr/bin/gnome-terminal


The same happens. I get asked for the password but gnome-terminal
never starts. Could it have something to do with my user spork running
X-Windows but it’s somehow trying to look for a X-Windows session that
might of been started by root instead of spork?

Any more suggestions? Thanks!

Hi
I have it working on Leap, however it’s not actually switching to root
user environment… need to play some more.


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 SP1|GNOME 3.10.4|3.12.51-60.25-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

On Thu 04 Feb 2016 05:56:01 PM CST, Spork Schivago wrote:

malcolmlewis;2752423 Wrote:
> Hi
> OK, in the desktop file use;
> >
Code:

> >
> gnome-terminal -e pkexec
>

> >
> You should be good to go, as well as having root user environment :wink:
> After you modify the desktop file, use alt+F2 enter r then press enter
> to restart the shell and rebuild the desktop file database with your
> changes.
How did you figure this out? You’re a freaking genius! Thank you!!!
Been trying to do this for a while now!

Ken

Hi
Alas, not me :wink: I was pointed to this rather than getting gksu (it
needs to go away) enable to build for Leap by one of my fellow
gnome-ites on IRC…


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 SP1|GNOME 3.10.4|3.12.51-60.25-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

This worked until a recent system upgrade. I’m now running Gnome 3.24.2 and when I click on Root Terminal, it first pops up a gnome-terminal window, for a split second, goes away, and then the authentication window pops up saying:


Sorry, that didn't work.   Please try again later.

Then I type the password for root in that authentication window, and it just hangs there forever. It’s almost like it’s trying to spawn gnome-terminal first, and then ask for authentication. I’ve tried various things, including:


Exec=pkexec gnome-terminal

Same thing happens.

I even tried creating a PolicyKit policy file for gnome-terminal under the /usr/share/polkit-1/actions/ directory.

Any idea how to get this working properly again?

Any help would be greatly appreciated, as always. Thank you.