I use the following scripts to initialize multiscreen setup:
#!/bin/bash
# Initializes Nvidia Optimus for multi-screen functionality.
sudo modprobe bbswitch
optirun true
intel-virtual-output
But when my machine suspends, it goes back to a single screen. I try to restart by terminating and initializating again. I terminate with the following:
sudo kill -15 $xorg_process
sudo rmmod nvidia
sudo tee /proc/acpi/bbswitch <<<OFF
Then I run the initialize script again, but I get the following message:
[16929.676769] [ERROR]Cannot access secondary GPU - error: [XORG] (EE) Server terminated successfully (0). Closing log file.
[16929.676811] [ERROR]Aborting because fallback start is disabled.
Manual testing indicates that this error comes from the optirun true
command in the initialize script. Is there a way I can reload my second screen after my machine hibernates? (or, more specifically, how to reload the Nvidia driver?)
I am referencing the solution to the Optimus multiscreen monitor issue (for machines with outputs hard-wired to the discrete GPU) found here.