Ubuntu Server 17.04
Kernel 4.10.0-35 Generic
nVidia driver 384.90
I am in the process of changing from a GUI Mint system to a headless Ubuntu Server system, but I've been unable to adjust the GPU fan speeds thus far. I am interacting with the system via SSH.
The system was installed with the bare minimum. During installation, I deselected system utilities and selected OpenSSH in tasksel. After installation, I added the PPA for graphics-drivers, and apt installed nvidia-384 and xorg. Also did:
sudo nvidia-xconfig -a --enable-all-gpus --cool-bits=28 --allow-empty-initial-configuration
However, I could not do either of these two:
sudo nvidia-settings -a [gpu:0]/GPUFanControlState=1 sudo nvidia-settings -a [gpu:0]/GPUTargetFanSpeed=100
Both result in:
Unable to init server: Could not connect: Connection refused ERROR: The control display is undefined; please run `nvidia-settings --help`for usage information.
I thought adding Option "UseDisplayDevice" "DFP" under one of the device sections in xorg.conf would fix the error, but it made no difference after a reboot, so I removed the line again. Still, not sure how it's related to the connection refused message.
Looking through some other questions with similar issues, one answer suggested I add something extra before my commands, due to being over SSH, so I tried:
DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 sudo nvidia-settings -a [gpu:0]/GPUFanControlState=1 DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 sudo nvidia-settings -a [gpu:0]/GPUTargetFanSpeed=100
This seemed to work for the first command, giving me the message:
Attribute 'GPUFanControlState' (hiigaran:0[gpu:0]) assigned value 1
However, upon trying the second command, no message was returned, and I heard no change in fan speed. nvidia-smi confirmed that the fans were still running at 30%.
While reading about the answer suggesting I prepend the DISPLAY command over SSH, I thought perhaps the issue was somehow just related to SSH interaction, so I created a script called fancontrols, which contained the following:
nvidia-settings -a [gpu:0]/GPUFanControlState=1 nvidia-settings -a [fan:0]/GPUTargetFanSpeed=100 nvidia-settings -a [gpu:1]/GPUFanControlState=1 nvidia-settings -a [fan:1]/GPUTargetFanSpeed=100 nvidia-settings -a [gpu:2]/GPUFanControlState=1 nvidia-settings -a [fan:2]/GPUTargetFanSpeed=100 nvidia-settings -a [gpu:3]/GPUFanControlState=1 nvidia-settings -a [fan:3]/GPUTargetFanSpeed=100
After a chmod +x, I added this line to crontab -e:
I know that this script works, because I have an identical system running Mint with Cinnamon, where the file is added to the startup applications. I thought that if SSH might be the problem, perhaps getting the system to execute the commands by itself would solve the problem. It did not. I should hear the fans, as they get loud at 100%, but there was no change.
Here is my xorg.conf
Additionally, I've read that echo $DISPLAY should output :0, but in my case, there is no output. Which is odd, because I remember it also output :10 at one point. Perhaps when I tried setting the option in the .conf earlier on.
The goal is simply to get an absolute minimal headless system up and running, where I can set the fan speeds automatically on boot. I'm able to do everything else that is needed from this computer, except this.
If need be, I'm ready to reinstall the OS for a fresh start.