Headless installation and configuration on Windows10

Moderators: Site Moderators, FAHC Science Team

fowie
Posts: 11
Joined: Mon Mar 23, 2020 11:23 pm

Re: Headless installation and configuration on Windows10

Post by fowie »

js2010 wrote:I saw this in process monitor during the install:

Code: Select all

"C:\Program Files (x86)\FAHClient\FAHClient.exe" --install-service
Yes, I tried the --install-service. I believe that runs the sc.exe command to create the service. You can do that instead of running sc.exe manually, but you still have to add the registry keys for the uninstaller for the service to start.
fowie
Posts: 11
Joined: Mon Mar 23, 2020 11:23 pm

Re: Headless installation and configuration on Windows10

Post by fowie »

js2010 wrote:I saw this during the install:

Code: Select all

"C:\Program Files (x86)\FAHClient\FAHClient.exe" --install-service
the service itself runs as:

Code: Select all

"C:\Program Files (x86)\FAHClient\FAHClient.exe" --service
A lot of things are installed under the current user, AppData\Roaming\FAHClient, including the config.xml. The service won't start without this appdata\roaming\fahclient folder. How does the service know where to look?
Oddly enough, looks like when you run the service from windows services (not command line) it looks at the registry key HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FAHClient\DataDirectory for the location of the config file. However, if you do silent install, it creates the registry keys, but does not populate that registry value[\b] so you need to set it yourself.
fowie
Posts: 11
Joined: Mon Mar 23, 2020 11:23 pm

Re: Headless installation and configuration on Windows10

Post by fowie »

Just for completeness, here's my powershell script for automating the headless install (and service startup):

Code: Select all

        write-host "Starting installer on $bladeIP"
        $sess = new-pssession $bladeIP
        # Copy the files
        copy-item -ToSession $sess -recurse -path C:\FAHRemoteSetup -destination C:\ -Force
        if(!$?)
        {
            Write-Host -ForegroundColor RED "[$bladeIP] $($error[0].Exception)"
            return $FALSE
        }

        $remoteSB = 
        {
            param($userFolder, $bladeIP)
            write-host "Running installer remotely and waiting 20 seconds for it to complete"
            & C:\FAHRemoteSetup\fah-installer_7.5.1_x86.exe /S /V
            start-sleep -Seconds 20

            write-host "Setting registry keys remotely"
            ##  Add Program Files (x86)\FAHClient to HKCU\Environment\Path
            $registryPath = "HKCU:\Environment"
            $path = Get-ItemPropertyValue -Path $registryPath -Name "Path"
            $path = $path+";C:\Program Files (x86)\FAHClient"
            Set-ItemProperty -Path $registryPath -Name "Path" -Value $path
            ##  Set the correct path in the uninstaller registry key
            $registryPath = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FAHClient"
            if(test-path $registryPath)
            {
                set-itemproperty -Path $registryPath -name "DataDirectory" -value "C:\Users\$userFolder\AppData\Roaming\FAHClient"
            }
            else {
                write-host "WARNING: Uninstaller registry key does not exist.  Installer isn't finished or didn't run?"
            }
            #Install the service
            write-host "Remotely installing as a service"            
            & "C:\Program Files (x86)\FAHClient\FAHClient.exe" --install-service
            start-sleep -s 10
            ## Start the service
            Start-Service -Name "Folding@home Client" 
        }

        write-host "Creating local config files and directories"
        #create the local config directories
        #this needs to be the same path used in the uninstaller registry key
       $userFolder = [LOCALUSERNAMEHERE]                
        new-item -path "\\$bladeIP\C$\users\$userFolder\AppData\Roaming\FAHClient" -force -itemType Directory

        #Make the config file            
        [xml]$configXml = Get-Content C:\FAHRemoteSetup\config.xml
        $configXml.config.user.value = "$thisBladeUsername"
        $configXml.save("\\$bladeIP\C$\Users\$userFolder\AppData\Roaming\FAHClient\config.xml")

        write-host "Remotely creating registry key and starting service"
        invoke-command -session $sess -ScriptBlock $remoteSB -ArgumentList $userFolder,$bladeIP
        if(!$?)
        {
            Write-Host -ForegroundColor RED "[$bladeIP] $($error[0].Exception)"
            return $FALSE
        }
bruce
Posts: 20910
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: Headless installation and configuration on Windows10

Post by bruce »

Windows does not allow the GPU to be used by just anybody. You MUST be logged on and able to display the desktop. Running as a servce only runs CPU assignments.

If you installed from the GUI, the client will have created a GPU slot which will attempt to fold with the GPU and that will fail (and probably abort the service). Manually remove the GPU slot and restart the service.
fowie
Posts: 11
Joined: Mon Mar 23, 2020 11:23 pm

Re: Headless installation and configuration on Windows10

Post by fowie »

Agree, @bruce. These servers don't have GPUs so service method works fine for me.
olliecampbell
Posts: 10
Joined: Mon Mar 23, 2020 7:15 pm

Re: Headless installation and configuration on Windows10

Post by olliecampbell »

Some further learnings aimed at my target install base....

You can't compute using the GPU if F@H is installed as a service so I've decided to stick with a GUI based installation. I can dish out the code I've made for this to work, but don't want to confuse this thread as it's aimed at installing it as a service.
bruce
Posts: 20910
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: Headless installation and configuration on Windows10

Post by bruce »

The CPU based service. can do a lot of useful folding. The (some/most?) current COVAID projects for CPUs are testing the virus's susceptibility/sensitivity to specific chemicals/drug_candidates The new server we just brought online are now saturated.

Folding on a CPU is at a very low priority so it doesn't interfere with foreground use ...it just adds a little heat to the room. When not much (or nothing) is happening in the foreground, low priority doesn't slow it up.

GPU folding can cause screen lag, depending on the hardware and everything stops when somebody logs off. The service runs the CPU whenever the OS is running.
js2010
Posts: 15
Joined: Tue Mar 24, 2020 4:17 pm

Re: Headless installation and configuration on Windows10

Post by js2010 »

I didn't realize there was a second page and have been updating my first post, lol. It seems like folding@home has gone out of their way to make this hard to do. Where is the command line version download for Windows?
fowie
Posts: 11
Joined: Mon Mar 23, 2020 11:23 pm

Re: Headless installation and configuration on Windows10

Post by fowie »

js2010 wrote:I didn't realize there was a second page and have been updating my first post, lol. It seems like folding@home has gone out of their way to make this hard to do. Where is the command line version download for Windows?
Install for GUI and command line are the same, you just use the /S flag on the command line to install without a GUI. Note that the /S install is silent, but also does all default settings.
js2010
Posts: 15
Joined: Tue Mar 24, 2020 4:17 pm

Re: Headless installation and configuration on Windows10

Post by js2010 »

I would expect the command line version not to depend on that uninstall registry entry for the location of the data?
fowie
Posts: 11
Joined: Mon Mar 23, 2020 11:23 pm

Re: Headless installation and configuration on Windows10

Post by fowie »

js2010 wrote:I would expect the command line version not to depend on that uninstall registry entry for the location of the data?
I expected it wouldn't matter either, but it does. At least for service mode it uses the DataDirectory value to know where to find the config.xml
CaptainStarbuck
Posts: 3
Joined: Mon Mar 30, 2020 5:28 pm

Re: Headless installation and configuration on Windows10

Post by CaptainStarbuck »

It would be a huge service to the globe if this thread concluded with a final script and instructions for use. Then anyone can get proper permissions for use and mass-install. I can easily see Facebook threads where "the computer guy that everyone knows" (myself in that group) gets permission to remotely install F@H to friends' PCs. Right now we rely on each person to do their own install, and doing so still seems to be a bit prohibitively mysterious.

It seems there is a fortunate paradox where the virus that has driven many to use this software is also making available global resources for fighting it. That is, there is now a lot of unused equipment in offices, universities, government, and other large organizations. Even for people who now work at home, with company equipment at home, the equipment is not used during business off-hours.

In summary, it would really help if installation is made more accessible to people who aren't as nerdy as us, and if mass remote installation (done properly) is more easily accessible to us nerds. Yeah, that would lead to yet another explosion of workstations with no work units, but that's a different and kinda good problem to have.

Thanks for the effort we see in this thread!!!!!!!!!!
psjrg
Posts: 17
Joined: Mon Mar 23, 2020 7:26 am

Re: Headless installation and configuration on Windows10

Post by psjrg »

Popping in from another thread this was relevant to: if anyone find a way to automate adding each remote FAHClient to FAH control, please share.

I don't want to manually copy and paste each IP from a computer lab to FAHControl.
fowie
Posts: 11
Joined: Mon Mar 23, 2020 11:23 pm

Re: Headless installation and configuration on Windows10

Post by fowie »

I haven't tried it myself, but the data is in a SQLite database (a file that ends in .db) so you could probably easily make some code in your language of choice that opens that db and inserts new records
psjrg
Posts: 17
Joined: Mon Mar 23, 2020 7:26 am

Re: Headless installation and configuration on Windows10

Post by psjrg »

fowie wrote:I haven't tried it myself, but the data is in a SQLite database (a file that ends in .db) so you could probably easily make some code in your language of choice that opens that db and inserts new records
Thanks. I'm working on my script now.
Post Reply