Are you using X11 or Wayland?
Wayland forbids root graphical applications. Whilst there are workarounds for XWayland apps, you really cannot have XWayland-free graphical applications running as root
Those workarounds are written into the startup script of GParted.
Snip from file '/usr/sbin/gparted'
Code:
# Interim workaround to allow GParted run by root access to the
# X11 display server under Wayland. If configured with
# './configure --enable-xhost-root', the xhost command is
# available and root has not been granted access to the X11
# display via xhost, then grant access.
#
ENABLE_XHOST_ROOT=no
GRANTED_XHOST_ROOT=no
if test "x$ENABLE_XHOST_ROOT" = 'xyes' && xhost 1> /dev/null 2>&1; then
if ! xhost | grep -qi 'SI:localuser:root$'; then
xhost +SI:localuser:root
GRANTED_XHOST_ROOT=yes
fi
fi
#
# Run gparted as root.
#
pkexec --disable-internal-agent '/usr/sbin/gparted' "$@"
status=$?
#
# Revoke root access to the X11 display, only if we granted it.
#
if test "x$GRANTED_XHOST_ROOT" = 'xyes'; then
xhost -SI:localuser:root
fi
Test by doing this first... Logout and logback into an X11 session, try to start GParted...