[CUDA installation]can't display GUI from ssh X anymore

I used to utilize a software with ssh and display the GUI of this software. But after installing the CUDA (with apt-get) on my Ubuntu 16, I can’t display the GUI anymore. It returned a lack of libGL error like follows:

libGL error: failed to load driver:swrast

I followed some advices from Stack Overflow but not succeed.(my post:https://askubuntu.com/questions/1025770/libgl-error-failed-to-load-driver-swrast-while-connecting-to-a-server and https://askubuntu.com/questions/1026405/terminal-cant-be-opened?noredirect=1#comment1668048_1026405

Then I tried to modified the 50-xserver-command.conf file in /usr/share/lightdm/lightdm.conf.d/ like following:

#Dump core
xserver-command=X -core


xserver-command=X -core +iglx

Then I further lost my Terminal (even though I changed it back to initial configuration)
Could master can help me, plz???

I can see some reference here:
What do you mean saying you lost terminal?
Does it return error when you connect via ssh?