Q:

Ubuntu 18.04.2 LTS freezes randomly - the cursor will not move either. Any solution to prevent this from happening?

I have recently installed Ubuntu 18.04.2 LTS on Dell XPS 15 9618 which has

16 GB RAM
8th Generation Intel Core i7-8750H Processor (9MB Cache, up to 4.1 GHz, 6 Cores)
NVIDIA GeForce GTX 1050Ti with 4GB GDDR5.

Now the issues I'm facing every day is that the OS freezes completely and randomly. Randomly as in like when I'm trying to connect to wifi, or open a terminal, etc. I cannot move the cursor and cannot kill process suing SysReq+ALT+F or SysReq+ALT+K.
The only options seem to be working are either I use SysReq+ALT+REISUB or turn the PC off by holding the power button. I read on the internet that the crash might be due to the unresponsive X server. However, I am not sure how to confirm if that is the issue or there is something which causes the system to freeze.
Are there any other approaches to prevent the system from freezing or at least reducing the frequency?

A:

I had similar problems and it turned out to be due to a problem with the "nouveau" graphics driver that was used by default. In my case it was solved by installing another graphics driver, like this:
sudo apt install nvidia-driver-390

Then that newly installed driver was used instead of the nouveau driver, and then everything worked fine.
In case it freezes already before you can get a terminal and enter that apt command, you can try booting to Linux in runlevel 3 (no graphics) first; that worked for me.

