nvidia-settings errors in Ubuntu 16
#1
First of all, this is my fan speed script with my GTX 1080.  I run it prior to launching hashcat.

#!/bin/bash
nvidia-settings -a GPUFanControlState=1
nvidia-settings -a GPUTargetFanSpeed=75
nvidia-settings -a GPUPowerMizerMode=1
nvidia-settings -a GPUGraphicsClockOffset[3]=200

(yes, I'm only running 75 percent with my GPU fan; I never break 60C with a single GPU)

In Ubuntu 16, while trying to execute my fan speed script, I was getting this error:

"Failed to connect to Mir: Failed to connect to server socket"

I corrected the above error by running, "apt-get install unity8-desktop-session-mir"

*Edit on August 6th, 2017*

If you are running headless and before you install the unity8-desktop-session-mir package in order to correct the "Failed to connect to Mir:" issue, try exporting your DISPLAY environment variable first.

export DISPLAY=:0

*Edit on August 6th, 2017*


"nvidia-settings -a GPUFanControlState=1" and "nvidia-settings -a GPUPowerMizerMode=1" can now execute, but the other commands won't.

"nvidia-settings -a GPUTargetFanSpeed=75" returns with:
Quote:
ERROR: Error assigning value 75 to attribute 'GPUTargetFanSpeed' (hostname:0[fan:0]) as specified in assignment

       'GPUTargetFanSpeed=75' (Unknown Error).



And "nvidia-settings -a GPUGraphicsClockOffset[3]=200" returns with:
Quote:** (nvidia-settings:2388): WARNING **: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.


Some other details about my environment follow:


I am attempting to run "headless" with lightdm set to auto login.  This worked flawlessly in Ubuntu 14, but doesn't seem to in 16.

/etc/lightdm/lightdm.conf
greeter-session=unity-greeter
user-session=openbox
autologin-user=myuser
autologin-user-timeout=0

On boot, with the above in my lightdm.conf, on boot, I get a window that says, "The system is running in low graphics mode"

I used to just get a black screen in Ubuntu 14 and everything worked.

When hashcat is done, I also want to be able to run my "back to normal" script:


nvidia-settings -a GPUGraphicsClockOffset[3]=0
nvidia-settings -a GPUPowerMizerMode=0
nvidia-settings -a GPUFanControlState=0

But I'm having some issue that I haven't identified yet.  

Any help is greatly appreciated since this is a show stopper for me.
#2
I have solved this issue. I got tired of fighting with Ubuntu 16 and so reinstalled to version 14. That doesn't necessarily mean that this won't work with version 16 though.

The goal was to get this working over ssh in "headless" form.

After following the wiki,

https://hashcat.net/wiki/doku.php?id=lin...nvironment

everything seems to be working.

At the time of my original post, I had not followed the instructions on the wiki. After I installed the minimal X11 environment by installing the xdm package and created a proper /etc/X11/xorg.conf file, I'm good to go.

The xorg.conf file was created with the following commands:
Quote:nvidia-xconfig -s -a --allow-empty-initial-configuration \
--cool-bits=12 --registry-dwords="PerfLevelSrc=0x2222" \
--no-sli --connected-monitor="DFP-0" -o /etc/X11/xorg.conf

sed -i '/Driver/a Option "Interactive" "False"' /etc/X11/xorg.conf

A few notes:
Ignore that setting for lightdm.conf since the wiki guide uses xdm instead of lightdm.
Executing "sudo apt-get dist-upgrade" to upgrade to version 16 might break things (unknown at this time and before I try it, I will image my entire hard drive so I can restore if necessary)
Admins, consider adding the xorg.conf creation instructions to the wiki how-to.
#3
I recently added an additional GTX 1080 FE to my setup and couldn't control it through nvidia-settings commands.  It is not quite plug and play.  After the physical installation of the card, you will need to rerun nvidia-xconfig just like in the previous post.

I am still running Ubuntu 14 with xdm as my login manager.  It has been configured per the instructions on the wiki (even though those instructions are for AMD).
https://hashcat.net/wiki/doku.php?id=lin...nvironment

Optionally, update the Nvidia driver to version 378 with "sudo apt-get install nvidia-378"
(You don't really need to update the driver.  I could post benchmarks for the GTX 1080 FE with driver versions 370, 375, and 378, but they are almost identical.)

If you want to update to the latest driver (384 as of August 6th, 2017), then execute the following:

Code:
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-384 nvidia-libopencl1-384 nvidia-opencl-icd-384

Reboot.

Run the following as root. (Note: I am running headless.)

Code:
nvidia-xconfig -s -a --allow-empty-initial-configuration \
--cool-bits=12 --registry-dwords="PerfLevelSrc=0x2222" \
--no-sli --connected-monitor="DFP-0" -o /etc/X11/xorg.conf

sed -i '/Driver/a Option "Interactive" "False"' /etc/X11/xorg.conf

Reboot once more and you should be good to go.

I can now control the fans with commands like:

nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUTargetFanSpeed=90" --ctrl-display=:0
nvidia-settings -a "[gpu:1]/GPUFanControlState=1" -a "[fan:1]/GPUTargetFanSpeed=90" --ctrl-display=:0

Footnote: if you are doing this from scratch, see evilmog's guide on how to do this with Ubuntu 16.
https://hashcat.net/forum/thread-6063-post-32355.html

Also, admins, please consider updating the wiki one of these days.
#4
@devilsadvocate: as i've being fiddling with this for some time i found your thread that seems quite related. my cards are of the GTX900 and i'm running debian 8 (instead of ubuntu) with nvidias 378 driver (manually downloaded form nvidia.com as debian does not supply nonfree packages) so that might make a difference but still:

i found that the problem why setting GPUFanControlState=1 but GPUGraphicsClockOffset[3]=150 won't work is somehow related with the current performance mode that the driver selects for the card.
here the odd thing on my system is that even when GPUPowerMizerMode=1 is set and nothing runs on the card(s), the driver selects the highest performance level (3 in my case). but as soon as something is run on the cards, the performance level changes to 2 (second highest) and as
nvidia-settings -q GPUPerfModes | grep editable=
shows, some values can only be set in certain performance-levels.

now when i stop whatever hogs my cards, the performance-level goes back to the highest value.
has anybody come across something similar and can point me to what i need to change in order to make this work as intended?

EDIT: in the supplied code in previous posts the call of sed adds the option Interactive below every line reading Driver which is the case for me in several sections (namely each InputDevice and Device); my guess this is only needed for the Device -sections?

thx in advance,
red