I cannot get the driver running on Linux. Black screen on GDM3 login with GTX 1050.

Alright, so I have a laptop Lenovo Legion Y530, running 8350H and GTX 1050. I had managed to install Ubuntu 18.04 with nvidia-390 a month ago, but not without hassle. Everything worked, the 1050 was recognized and used(I could easily verify that then).

I even managed to update the kernel+drivers to 410 and Linux 4.19 without any hassle and the GPU still worked. However battery life was absurd, 30 minutes or less without any graphically intensive applications, so I went to the GUI Nvidia X server settings and used PRIME to switch to Intel, for better battery life, and thats when things went downhill…I could no longer initiate any X session or window manager, I tried purging nvidia drivers, purging Xserver and GDM, installing lightdm, nothing worked… I even went as far to use the recovery console and upgrade to 18.10…and again nothing. I tried going up or down the kernels I installed, from 4.18.8 to 4.18.15 to 4.19 and then the default 4.18.0 kernel for 18.10, I also tried downgrading from 410 do 390 then 396…nothing. Adding the kernel parameter ‘nomodeset’ at least allowed me to boot and login, but that was it. Then I somehow managed to get the Intel GPU working(without nomodeset), I thought great, now I can do ‘prime-select nvidia’, but…alas as soon as I got a login screen of GDM3 and logged in, I get a black screen. I even tried disabling all Meltdown/Spectre/L1TF patches as suggested elsewhere, didn’t help.
Using prime-select nvidia I couldn’t login with default Ubuntu window manager, but Wayland worked, although the GPU was the integrated Intel GPU(HD630) for some reason, using anything else where nvidia is supposed to load, nothing happens.

In order to help, I am providing logs of a lot of things.

dmesg - [ 0.000000] microcode: microcode updated early to revision 0x96, date = 2018- - Pastebin.com
syslog - Oct 29 12:50:10 ******* gnome-shell[4554]: [AppIndicatorSupport-WARN] Attempti - Pastebin.com
lspci - 00:00.0 Host bridge [0600]: Intel Corporation Device [8086:3e10] (rev 07) Subs - Pastebin.com
nvidia-smi Mon Oct 29 12:55:59 2018 +---------------------------------------------- - Pastebin.com
Xorg.0.log - [ 73.011] (--) Log file renamed from "/var/log/Xorg.pid-2142.log" to "/var/lo - Pastebin.com
uname -a - Linux ******** 4.18.15-041815-generic #201810180430 SMP Thu Oct 18 08:33:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

You might notice I added a few kernel params, especially nvidia-drm.modeset=1 this was suggested elsewhere, it also did not help.

Do I need the horsepower of GTX 1050? Well I have not used CUDA yet, but I plan to in the future, it is a dev machine. The idea was to get Nvidia Optimus working. And now I can’t even get nvidia working AT ALL.

Your xorg logs looks like you have an incorrect /etc/X11/xorg.conf installed, please delete that.