29

I just installed gparted because I have a 135 GB flash drive that I want to use for bootables for different OSs.

After I installed gparted and opened it from the Dash, I got the prompt for my password, entered it, the window closed, cursor turned to the loading symbol, I waited, the cursor went back to normal, that was it.

I installed it with sudo apt-get install gparted.

The output from gksudo gparted is

Error copying '/home/amolith/.Xauthority' to '/tmp/libgksu-k9KFpI': No such file or directory

The output from gparted-pkexec is

Created symlink /run/systemd/system/-.mount → /dev/null.
Created symlink /run/systemd/system/boot.mount → /dev/null.
Created symlink /run/systemd/system/run-user-1000.mount → /dev/null.
Created symlink /run/systemd/system/run-user-120.mount → /dev/null.
Created symlink /run/systemd/system/snap-core-2381.mount → /dev/null.


Created symlink /run/systemd/system/tmp.mount → /dev/null.
No protocol specified

(gpartedbin:6347): Gtk-WARNING **: cannot open display: :0
Removed /run/systemd/system/-.mount.
Removed /run/systemd/system/boot.mount.
Removed /run/systemd/system/run-user-1000.mount.
Removed /run/systemd/system/run-user-120.mount.
Removed /run/systemd/system/snap-core-2381.mount.
Removed /run/systemd/system/tmp.mount.

Any help would be greatly appreciated.

Ravexina
  • 55,668
  • 25
  • 164
  • 183
Amolith
  • 1,072
  • 1
    In a terminal run gksudo gparted or gparted-pkexec enter your password see what happens what output do you get ? – Ravexina Jul 26 '17 at 11:32
  • @Ravexina The output from both commands is in the question now. – Amolith Jul 26 '17 at 11:45
  • 2
    Seems related to Wayland, run xhost +local: then gparted-pkexec. – Ravexina Jul 26 '17 at 11:47
  • @Ravexina That fixed it! What does xhost +local: do? – Amolith Jul 26 '17 at 11:53
  • 1
    @Amolith man xhost explains clearly: The xhost program is used to add and delete host names or user names to the list allowed to make connections to the X server. And option +local: means grant access (+) for local family of users/addressese etc., and empty string member, thus : at the end. – PeterM Nov 08 '17 at 10:30

1 Answers1

70

Your problem seems related to the wayland, run:

xhost +local:

it lets local users to connect to the display, then run gparted:

gparted-pkexec

it should solve the problem.

source

Ravexina
  • 55,668
  • 25
  • 164
  • 183
  • could you give more specific info for wayland pls @Ravexina.. as i know it is an alternative server of XORG – solfish Jul 26 '17 at 13:54
  • @solfish I'm not really familiar with Wayland but I think it's because of the way it controls display/window permissions, some incomparability between package and Wayland might be the cause of issue. similar question. – Ravexina Jul 26 '17 at 18:47
  • While this fixes issue, this seems to be not persistent. Any idea of how to make it persistent after reboot? – PeterM Nov 07 '17 at 22:14
  • 2
    @PeterM Put the command somewhere like ~/.profile, it should get run automatically every time Ubuntu get started ;) – Ravexina Nov 08 '17 at 05:19
  • the xhost command solved my problem. After executing that I am able to run gparted normally. Thank you very much. – Francesco Apr 06 '19 at 19:33
  • The actual comment that helped me: xhost +SI:localuser:root – user3387542 Jul 14 '19 at 10:01
  • 1
    I don't know for what reason I can't add my answer to this thread (I just don't see such a button on stackoverflow), but actually it looks like solution is to run the command "sudo xhost +" without "local" at the end. It has nothing to do with gparted: this happens as you run in vnc session any gui app under sudo. – Ihor B. Dec 23 '21 at 11:22
  • as @IhorB. pointed out this issues happens when doing a remote session where a "display" is created. It is not just vnc but any remote session software that needs to create a display like nomachine which I use. If there is already a login/display on the machine because some is directly on it and then you attach to that "local" display then this issue won't occur, but if you are connecting to a headless machine a display will need to be created and that's when this issue occurs and is resolved by the xhost command. – DKebler Jun 08 '22 at 16:51