Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script may fail when run as root on GNOME #270

Open
lukas-w opened this issue May 12, 2022 · 2 comments
Open

Script may fail when run as root on GNOME #270

lukas-w opened this issue May 12, 2022 · 2 comments

Comments

@lukas-w
Copy link

lukas-w commented May 12, 2022

If the extraction script determines that it's not running in a terminal, it will try to open one:

makeself/makeself-header.sh

Lines 573 to 579 in e7eb0fd

GUESS_XTERMS="xterm gnome-terminal rxvt dtterm eterm Eterm xfce4-terminal lxterminal kvt konsole aterm terminology"
for a in \$GUESS_XTERMS; do
if type \$a >/dev/null 2>&1; then
XTERM=\$a
break
fi
done

On GNOME, this may lead to an error when run as root because gnome-terminal cannot be run with sudo:

Exit status 7

Starting Terminal fails with this error message:

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 7

Reason: You are trying to run gnome-terminal with su, sudo or some similar mechanism. You cannot do so. Instead, run su, sudo, etc., inside the terminal. E.g.

gnome-terminal -- su ...

You should be able to reproduce the problem by running sudo gnome-terminal in a terminal which fails. In contrast, sudo dbus-launch gnome-terminal works, but I don't know if this an acceptable workaround.

Related Stackoverflow: https://unix.stackexchange.com/questions/344617/error-constructing-proxy-when-trying-to-launch-gnome-terminal-as-root

@megastep
Copy link
Owner

Interesting points for an important use case. I think the more obvious fix would be to run su/sudo within the terminal, rather than running the terminal itself like this.

This would require some changes to the logic of spawning the terminals on X11 but it should be worth looking at.

@megastep
Copy link
Owner

At the time this was written, this was more for the case where the actual root user was the logged in user on the X11 session; this is a much less common case these days. Spawning terminals while in sudo has always been problematic and often needed messing with xhost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants