Why can I not open gparted from the command line? The 2019 Stack Overflow Developer Survey Results Are InWill Wayland ever support graphical sudo?Structure of graphical modules in Linux LubuntuForwarding X11 not working - Error: Can't open display: localhost:11.0Best way to connect to all X displayswhy can I not see the unallocated space in gpartedHow to grow filesystem to use unallocated space in partition?Start standalone full-screen google chrome apps by command lineGoogle Chrome on Ubuntu serverCan only mount with gpartedweb browsers zoom in by default in Ubuntu 14.04.5 LTSGParted PXE Boot Fails at Root FS mount - Kernel Panic
How to make payment on the internet without leaving a money trail?
Does duplicating a spell with Wish count as casting that spell?
On the insanity of kings as an argument against monarchy
Why could you hear an Amstrad CPC working?
Pristine Bit Checking
It's possible to achieve negative score?
Is this food a bread or a loaf?
Inflated grade on resume at previous job, might former employer tell new employer?
Where to refill my bottle in India?
"To split hairs" vs "To be pedantic"
Inline version of a function returns different value then non-inline version
How to change the limits of integration
Is bread bad for ducks?
Time travel alters history but people keep saying nothing's changed
Why don't Unix/Linux systems traverse through directories until they find the required version of a linked library?
A poker game description that does not feel gimmicky
Is there a name of the flying bionic bird?
What tool would a Roman-age civilization have to grind silver and other metals into dust?
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
Does light intensity oscillate really fast since it is a wave?
Manuscript was "unsubmitted" because the manuscript was deposited in Arxiv Preprints
Why can Shazam do this?
Are there any other methods to apply to solving simultaneous equations?
Is it possible for the two major parties in the UK to form a coalition with each other instead of a much smaller party?
Why can I not open gparted from the command line?
The 2019 Stack Overflow Developer Survey Results Are InWill Wayland ever support graphical sudo?Structure of graphical modules in Linux LubuntuForwarding X11 not working - Error: Can't open display: localhost:11.0Best way to connect to all X displayswhy can I not see the unallocated space in gpartedHow to grow filesystem to use unallocated space in partition?Start standalone full-screen google chrome apps by command lineGoogle Chrome on Ubuntu serverCan only mount with gpartedweb browsers zoom in by default in Ubuntu 14.04.5 LTSGParted PXE Boot Fails at Root FS mount - Kernel Panic
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I seem to be unable to start gparted from the command line. I am using Trisquel 8 (based on Ubuntu 16.04) with LXDE. If I try to open it, I get the following error and nothing happens:
$ sudo gparted
(gpartedbin:7820): Gtk-WARNING **: cannot open display:
However, it seems to open fine from the graphical application menu.
I searched a bit online and one recommendation was to try:
xhost +localhost
However, that didn't help. Apparently, it seems there can be an issue with opening gtk applications from the command line as root in Wayland; however, I am using X11. This is just on a local laptop - no ssh-ing or remote systems involved.
It seems strange, because I have always been able to open gparted from the command line in the past. I have also tried re-installing gparted and that didn't seem to help.
Update:
Following meuh's suggestions in the comments, I added DISPLAY=:0
to the /etc/environment file, so it should be passed when using sudo. However, I am still experiencing an error, but it has now changed:
$ sudo gparted
No protocol specified
(gpartedbin:5549): Gtk-WARNING **: cannot open display: :0
It seems that the DISPLAY variable is now being passed, but I'm not sure what that 'no protocol' message means.
x11 gparted
|
show 1 more comment
I seem to be unable to start gparted from the command line. I am using Trisquel 8 (based on Ubuntu 16.04) with LXDE. If I try to open it, I get the following error and nothing happens:
$ sudo gparted
(gpartedbin:7820): Gtk-WARNING **: cannot open display:
However, it seems to open fine from the graphical application menu.
I searched a bit online and one recommendation was to try:
xhost +localhost
However, that didn't help. Apparently, it seems there can be an issue with opening gtk applications from the command line as root in Wayland; however, I am using X11. This is just on a local laptop - no ssh-ing or remote systems involved.
It seems strange, because I have always been able to open gparted from the command line in the past. I have also tried re-installing gparted and that didn't seem to help.
Update:
Following meuh's suggestions in the comments, I added DISPLAY=:0
to the /etc/environment file, so it should be passed when using sudo. However, I am still experiencing an error, but it has now changed:
$ sudo gparted
No protocol specified
(gpartedbin:5549): Gtk-WARNING **: cannot open display: :0
It seems that the DISPLAY variable is now being passed, but I'm not sure what that 'no protocol' message means.
x11 gparted
1
Looks like the environment variable DISPLAY is not set (it should be seen following the error message "...display:"). TryDISPLAY=:0 sudo gparted
or if that fails,sudo sh -c 'DISPLAY=:0 exec gparted'
– meuh
Feb 18 '18 at 16:48
Hmm. The DISPLAY variable was already set to ':0' and it wasn't working. However, the method of usingsh
andexec
did work. Strange.
– Time4Tea
Feb 18 '18 at 16:53
The/etc/sudoers
file can configure what variables are passed through the sudo command. Look forenv_keep
in the file. Trysudo -ll
to list the current setting for you.
– meuh
Feb 18 '18 at 16:55
@meuh I addedDISPLAY=:0
to /etc/environment, so that variable should be passed with sudo; however, I am still getting the error, but it has changed. I will update my question with the details.
– Time4Tea
Feb 18 '18 at 19:14
Does it work withoutsudo
from the terminal? I get the same error as you withsudo
, but without it I get an authentication pop up to type root password and everything works properly. I'm still trying to understand this myself.
– Paul H.
Feb 18 '18 at 19:53
|
show 1 more comment
I seem to be unable to start gparted from the command line. I am using Trisquel 8 (based on Ubuntu 16.04) with LXDE. If I try to open it, I get the following error and nothing happens:
$ sudo gparted
(gpartedbin:7820): Gtk-WARNING **: cannot open display:
However, it seems to open fine from the graphical application menu.
I searched a bit online and one recommendation was to try:
xhost +localhost
However, that didn't help. Apparently, it seems there can be an issue with opening gtk applications from the command line as root in Wayland; however, I am using X11. This is just on a local laptop - no ssh-ing or remote systems involved.
It seems strange, because I have always been able to open gparted from the command line in the past. I have also tried re-installing gparted and that didn't seem to help.
Update:
Following meuh's suggestions in the comments, I added DISPLAY=:0
to the /etc/environment file, so it should be passed when using sudo. However, I am still experiencing an error, but it has now changed:
$ sudo gparted
No protocol specified
(gpartedbin:5549): Gtk-WARNING **: cannot open display: :0
It seems that the DISPLAY variable is now being passed, but I'm not sure what that 'no protocol' message means.
x11 gparted
I seem to be unable to start gparted from the command line. I am using Trisquel 8 (based on Ubuntu 16.04) with LXDE. If I try to open it, I get the following error and nothing happens:
$ sudo gparted
(gpartedbin:7820): Gtk-WARNING **: cannot open display:
However, it seems to open fine from the graphical application menu.
I searched a bit online and one recommendation was to try:
xhost +localhost
However, that didn't help. Apparently, it seems there can be an issue with opening gtk applications from the command line as root in Wayland; however, I am using X11. This is just on a local laptop - no ssh-ing or remote systems involved.
It seems strange, because I have always been able to open gparted from the command line in the past. I have also tried re-installing gparted and that didn't seem to help.
Update:
Following meuh's suggestions in the comments, I added DISPLAY=:0
to the /etc/environment file, so it should be passed when using sudo. However, I am still experiencing an error, but it has now changed:
$ sudo gparted
No protocol specified
(gpartedbin:5549): Gtk-WARNING **: cannot open display: :0
It seems that the DISPLAY variable is now being passed, but I'm not sure what that 'no protocol' message means.
x11 gparted
x11 gparted
edited Feb 18 '18 at 19:17
Time4Tea
asked Feb 18 '18 at 16:18
Time4TeaTime4Tea
1,145325
1,145325
1
Looks like the environment variable DISPLAY is not set (it should be seen following the error message "...display:"). TryDISPLAY=:0 sudo gparted
or if that fails,sudo sh -c 'DISPLAY=:0 exec gparted'
– meuh
Feb 18 '18 at 16:48
Hmm. The DISPLAY variable was already set to ':0' and it wasn't working. However, the method of usingsh
andexec
did work. Strange.
– Time4Tea
Feb 18 '18 at 16:53
The/etc/sudoers
file can configure what variables are passed through the sudo command. Look forenv_keep
in the file. Trysudo -ll
to list the current setting for you.
– meuh
Feb 18 '18 at 16:55
@meuh I addedDISPLAY=:0
to /etc/environment, so that variable should be passed with sudo; however, I am still getting the error, but it has changed. I will update my question with the details.
– Time4Tea
Feb 18 '18 at 19:14
Does it work withoutsudo
from the terminal? I get the same error as you withsudo
, but without it I get an authentication pop up to type root password and everything works properly. I'm still trying to understand this myself.
– Paul H.
Feb 18 '18 at 19:53
|
show 1 more comment
1
Looks like the environment variable DISPLAY is not set (it should be seen following the error message "...display:"). TryDISPLAY=:0 sudo gparted
or if that fails,sudo sh -c 'DISPLAY=:0 exec gparted'
– meuh
Feb 18 '18 at 16:48
Hmm. The DISPLAY variable was already set to ':0' and it wasn't working. However, the method of usingsh
andexec
did work. Strange.
– Time4Tea
Feb 18 '18 at 16:53
The/etc/sudoers
file can configure what variables are passed through the sudo command. Look forenv_keep
in the file. Trysudo -ll
to list the current setting for you.
– meuh
Feb 18 '18 at 16:55
@meuh I addedDISPLAY=:0
to /etc/environment, so that variable should be passed with sudo; however, I am still getting the error, but it has changed. I will update my question with the details.
– Time4Tea
Feb 18 '18 at 19:14
Does it work withoutsudo
from the terminal? I get the same error as you withsudo
, but without it I get an authentication pop up to type root password and everything works properly. I'm still trying to understand this myself.
– Paul H.
Feb 18 '18 at 19:53
1
1
Looks like the environment variable DISPLAY is not set (it should be seen following the error message "...display:"). Try
DISPLAY=:0 sudo gparted
or if that fails, sudo sh -c 'DISPLAY=:0 exec gparted'
– meuh
Feb 18 '18 at 16:48
Looks like the environment variable DISPLAY is not set (it should be seen following the error message "...display:"). Try
DISPLAY=:0 sudo gparted
or if that fails, sudo sh -c 'DISPLAY=:0 exec gparted'
– meuh
Feb 18 '18 at 16:48
Hmm. The DISPLAY variable was already set to ':0' and it wasn't working. However, the method of using
sh
and exec
did work. Strange.– Time4Tea
Feb 18 '18 at 16:53
Hmm. The DISPLAY variable was already set to ':0' and it wasn't working. However, the method of using
sh
and exec
did work. Strange.– Time4Tea
Feb 18 '18 at 16:53
The
/etc/sudoers
file can configure what variables are passed through the sudo command. Look for env_keep
in the file. Try sudo -ll
to list the current setting for you.– meuh
Feb 18 '18 at 16:55
The
/etc/sudoers
file can configure what variables are passed through the sudo command. Look for env_keep
in the file. Try sudo -ll
to list the current setting for you.– meuh
Feb 18 '18 at 16:55
@meuh I added
DISPLAY=:0
to /etc/environment, so that variable should be passed with sudo; however, I am still getting the error, but it has changed. I will update my question with the details.– Time4Tea
Feb 18 '18 at 19:14
@meuh I added
DISPLAY=:0
to /etc/environment, so that variable should be passed with sudo; however, I am still getting the error, but it has changed. I will update my question with the details.– Time4Tea
Feb 18 '18 at 19:14
Does it work without
sudo
from the terminal? I get the same error as you with sudo
, but without it I get an authentication pop up to type root password and everything works properly. I'm still trying to understand this myself.– Paul H.
Feb 18 '18 at 19:53
Does it work without
sudo
from the terminal? I get the same error as you with sudo
, but without it I get an authentication pop up to type root password and everything works properly. I'm still trying to understand this myself.– Paul H.
Feb 18 '18 at 19:53
|
show 1 more comment
2 Answers
2
active
oldest
votes
To access X you need environment variables DISPLAY
and XAUTHORITY
. Depending on setup, sudo may delete them. You can check that with sudo env
to see the environment variables.
To preserve your users environment, you can use sudo -E
. That has the pitfall setting HOME
to your users home, and config files may get wrong file permissions. However, to avoid that, sudo -H
sets HOME
to /root
.
Combine this for gparted:
sudo -EH gparted
Only desired variables can be set with:
sudo env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gparted
Error messages:
cannot open display:
means DISPLAY
is empty or does not exist.
no protocol specified
means DISPLAY
is set and vaild, but XAUTHORITY
pointing to authentication cookie is not set or the cookie is invalid. Alternativly, xhost +SI:localuser:root
allows root temporary access to X until logout.
Similar goes for Wayland access with WAYLAND_DISPLAY
and XDG_RUNTIME_DIR
. Wayland root access issues can be solved with sudo -EH
, too. For detail and a pitfall with XDG_RUNTIME_DIR
see Will Wayland ever support graphical sudo?
Great. I added XAUTHORITY to the list of variables being passed to sudo and that worked. Thank you!
– Time4Tea
Feb 18 '18 at 21:14
add a comment |
There is kdesudo
, gsudo
, and some other sudo
s that solve this.
Here is one, I hacked together (not security audited/tested).
#/bin/bash
inner()
sed -e s/^/:/ ) "
if [ "$1" = "---innermode" ]
then
shift
user="$1"
display="$2"
shift 2
inner "$@"
else
self="$0"
sudo "$self" ---innermode "$USER" "$DISPLAY" "$@"
fi
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f424987%2fwhy-can-i-not-open-gparted-from-the-command-line%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
To access X you need environment variables DISPLAY
and XAUTHORITY
. Depending on setup, sudo may delete them. You can check that with sudo env
to see the environment variables.
To preserve your users environment, you can use sudo -E
. That has the pitfall setting HOME
to your users home, and config files may get wrong file permissions. However, to avoid that, sudo -H
sets HOME
to /root
.
Combine this for gparted:
sudo -EH gparted
Only desired variables can be set with:
sudo env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gparted
Error messages:
cannot open display:
means DISPLAY
is empty or does not exist.
no protocol specified
means DISPLAY
is set and vaild, but XAUTHORITY
pointing to authentication cookie is not set or the cookie is invalid. Alternativly, xhost +SI:localuser:root
allows root temporary access to X until logout.
Similar goes for Wayland access with WAYLAND_DISPLAY
and XDG_RUNTIME_DIR
. Wayland root access issues can be solved with sudo -EH
, too. For detail and a pitfall with XDG_RUNTIME_DIR
see Will Wayland ever support graphical sudo?
Great. I added XAUTHORITY to the list of variables being passed to sudo and that worked. Thank you!
– Time4Tea
Feb 18 '18 at 21:14
add a comment |
To access X you need environment variables DISPLAY
and XAUTHORITY
. Depending on setup, sudo may delete them. You can check that with sudo env
to see the environment variables.
To preserve your users environment, you can use sudo -E
. That has the pitfall setting HOME
to your users home, and config files may get wrong file permissions. However, to avoid that, sudo -H
sets HOME
to /root
.
Combine this for gparted:
sudo -EH gparted
Only desired variables can be set with:
sudo env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gparted
Error messages:
cannot open display:
means DISPLAY
is empty or does not exist.
no protocol specified
means DISPLAY
is set and vaild, but XAUTHORITY
pointing to authentication cookie is not set or the cookie is invalid. Alternativly, xhost +SI:localuser:root
allows root temporary access to X until logout.
Similar goes for Wayland access with WAYLAND_DISPLAY
and XDG_RUNTIME_DIR
. Wayland root access issues can be solved with sudo -EH
, too. For detail and a pitfall with XDG_RUNTIME_DIR
see Will Wayland ever support graphical sudo?
Great. I added XAUTHORITY to the list of variables being passed to sudo and that worked. Thank you!
– Time4Tea
Feb 18 '18 at 21:14
add a comment |
To access X you need environment variables DISPLAY
and XAUTHORITY
. Depending on setup, sudo may delete them. You can check that with sudo env
to see the environment variables.
To preserve your users environment, you can use sudo -E
. That has the pitfall setting HOME
to your users home, and config files may get wrong file permissions. However, to avoid that, sudo -H
sets HOME
to /root
.
Combine this for gparted:
sudo -EH gparted
Only desired variables can be set with:
sudo env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gparted
Error messages:
cannot open display:
means DISPLAY
is empty or does not exist.
no protocol specified
means DISPLAY
is set and vaild, but XAUTHORITY
pointing to authentication cookie is not set or the cookie is invalid. Alternativly, xhost +SI:localuser:root
allows root temporary access to X until logout.
Similar goes for Wayland access with WAYLAND_DISPLAY
and XDG_RUNTIME_DIR
. Wayland root access issues can be solved with sudo -EH
, too. For detail and a pitfall with XDG_RUNTIME_DIR
see Will Wayland ever support graphical sudo?
To access X you need environment variables DISPLAY
and XAUTHORITY
. Depending on setup, sudo may delete them. You can check that with sudo env
to see the environment variables.
To preserve your users environment, you can use sudo -E
. That has the pitfall setting HOME
to your users home, and config files may get wrong file permissions. However, to avoid that, sudo -H
sets HOME
to /root
.
Combine this for gparted:
sudo -EH gparted
Only desired variables can be set with:
sudo env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gparted
Error messages:
cannot open display:
means DISPLAY
is empty or does not exist.
no protocol specified
means DISPLAY
is set and vaild, but XAUTHORITY
pointing to authentication cookie is not set or the cookie is invalid. Alternativly, xhost +SI:localuser:root
allows root temporary access to X until logout.
Similar goes for Wayland access with WAYLAND_DISPLAY
and XDG_RUNTIME_DIR
. Wayland root access issues can be solved with sudo -EH
, too. For detail and a pitfall with XDG_RUNTIME_DIR
see Will Wayland ever support graphical sudo?
edited Feb 18 '18 at 21:42
answered Feb 18 '18 at 19:29
mviereckmviereck
1,2751512
1,2751512
Great. I added XAUTHORITY to the list of variables being passed to sudo and that worked. Thank you!
– Time4Tea
Feb 18 '18 at 21:14
add a comment |
Great. I added XAUTHORITY to the list of variables being passed to sudo and that worked. Thank you!
– Time4Tea
Feb 18 '18 at 21:14
Great. I added XAUTHORITY to the list of variables being passed to sudo and that worked. Thank you!
– Time4Tea
Feb 18 '18 at 21:14
Great. I added XAUTHORITY to the list of variables being passed to sudo and that worked. Thank you!
– Time4Tea
Feb 18 '18 at 21:14
add a comment |
There is kdesudo
, gsudo
, and some other sudo
s that solve this.
Here is one, I hacked together (not security audited/tested).
#/bin/bash
inner()
sed -e s/^/:/ ) "
if [ "$1" = "---innermode" ]
then
shift
user="$1"
display="$2"
shift 2
inner "$@"
else
self="$0"
sudo "$self" ---innermode "$USER" "$DISPLAY" "$@"
fi
add a comment |
There is kdesudo
, gsudo
, and some other sudo
s that solve this.
Here is one, I hacked together (not security audited/tested).
#/bin/bash
inner()
sed -e s/^/:/ ) "
if [ "$1" = "---innermode" ]
then
shift
user="$1"
display="$2"
shift 2
inner "$@"
else
self="$0"
sudo "$self" ---innermode "$USER" "$DISPLAY" "$@"
fi
add a comment |
There is kdesudo
, gsudo
, and some other sudo
s that solve this.
Here is one, I hacked together (not security audited/tested).
#/bin/bash
inner()
sed -e s/^/:/ ) "
if [ "$1" = "---innermode" ]
then
shift
user="$1"
display="$2"
shift 2
inner "$@"
else
self="$0"
sudo "$self" ---innermode "$USER" "$DISPLAY" "$@"
fi
There is kdesudo
, gsudo
, and some other sudo
s that solve this.
Here is one, I hacked together (not security audited/tested).
#/bin/bash
inner()
sed -e s/^/:/ ) "
if [ "$1" = "---innermode" ]
then
shift
user="$1"
display="$2"
shift 2
inner "$@"
else
self="$0"
sudo "$self" ---innermode "$USER" "$DISPLAY" "$@"
fi
answered Apr 6 at 22:04
ctrl-alt-delorctrl-alt-delor
12.4k52662
12.4k52662
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f424987%2fwhy-can-i-not-open-gparted-from-the-command-line%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
-gparted, x11
1
Looks like the environment variable DISPLAY is not set (it should be seen following the error message "...display:"). Try
DISPLAY=:0 sudo gparted
or if that fails,sudo sh -c 'DISPLAY=:0 exec gparted'
– meuh
Feb 18 '18 at 16:48
Hmm. The DISPLAY variable was already set to ':0' and it wasn't working. However, the method of using
sh
andexec
did work. Strange.– Time4Tea
Feb 18 '18 at 16:53
The
/etc/sudoers
file can configure what variables are passed through the sudo command. Look forenv_keep
in the file. Trysudo -ll
to list the current setting for you.– meuh
Feb 18 '18 at 16:55
@meuh I added
DISPLAY=:0
to /etc/environment, so that variable should be passed with sudo; however, I am still getting the error, but it has changed. I will update my question with the details.– Time4Tea
Feb 18 '18 at 19:14
Does it work without
sudo
from the terminal? I get the same error as you withsudo
, but without it I get an authentication pop up to type root password and everything works properly. I'm still trying to understand this myself.– Paul H.
Feb 18 '18 at 19:53