Can not login X Window Ubuntu 16.04.4 LTS

Dell Inspiron 15-5577 with GTX 1050
During installation and boot, set “nomodeset” in grub
Boot linux using system default driver and login - no issue
Download driver 390.48 from Unix Drivers | NVIDIA
run “sudo service lightdm stop” to exit X Window
sudo NVIDIA-Linux-x86_64-390.48.run
It says provider pre-install script failed, I checked the pre-install script, and found it always returns fail, so ignore it and continue
The NVIDIA-Linux-x86_64-390.48.run program completed
reboot

Problem: Then I can not login X Window. I input password and clicked enter, after a few seconds, the login screen reappear.

I use ctrl+alt+F4 to switch to a console, login, and run vidia-bug-report.sh
nvidia-bug-report.log.gz (77.8 KB)

It’s an Optimus system with hybrid graphics. Don’t use the .run installer, uninstall it. use only the drivers from ubuntus graphics ppa. Have the package nvidia-prime installed, remove the ‘nomodeset’ parameter.

Thanks!