I'm accessing my Raspberry Pi 3 with PuTTY, and using X11 programs like GParted through ssh connection. It was perfectly working until I turned off IPv6 by adding the following line to /etc/sysctl.conf.
net.ipv6.conf.all.disable_ipv6 = 1
It does disable IPv6, but it makes X11 programs stop starting. It always shows message something like
pi@RPi-Dev:~$ sudo -E gparted [sudo] password for pi: (gpartedbin:1173): Gtk-WARNING **: cannot open display:
Why does disabling ipv6 cause it and how can I fix it?