suddenly this afternoon, my computer kinda crashed (it rebooted out of nowhere), and then my double screen stopped working, and then I tried to run nvidia-smi and it returned the following error message : Failed to initialize NVML: Driver/library version mismatch
Using: nvidia-installer ncurses v6 user interface
→ Detected 16 CPUs online; setting concurrency level to 16.
→ Installing NVIDIA driver version 530.41.03.
→ There appears to already be a driver installed on your system (version: 535.98). As part of installing this driver (version: 530.41.03), the existing driver will be uninstalled. Are you sure you want to continue? (Answer: Continue installation)
→ An alternate method of installing the NVIDIA driver was detected. (This is usually a package provided by your distributor.) A driver installed via that method may integrate better with your system than a driver installed by nvidia-installer.
Please review the message provided by the maintainer of this alternate installation method and decide how to proceed:
The NVIDIA driver provided by Ubuntu can be installed by launching the “Software & Updates” application, and by selecting the NVIDIA driver from the “Additional Drivers” tab.
(Answer: Continue installation)
You installed the nvidia driver 530 via .run file, over the distro package 535.
You ignored the warnings, that messed up your system.
→ Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X? Any pre-existing X configuration file will be backed up. (Answer: Yes)
Then you created an Xorg config, which is totally unusable for mixed graphics laptops (Optimus laptops).
1: delete: /etc/X11/xorg.conf
2: Use the .run file of the 530 version to uninstall that version of the driver.
3: run in a terminal: sudo apt purge 'nvidia*' 'libnvidia*'
4: sudo apt install nvidia-driver-535
5: reboot