Headless installation and configuration on Windows10

Moderators: Site Moderators, FAHC Science Team

wuerfelfreak
Posts: 9
Joined: Mon Mar 23, 2020 9:03 am

Headless installation and configuration on Windows10

Post by wuerfelfreak »

Schools in my country are currently closed and our computer rooms are unused waiting to start folding.
Around 60 decent windows machines are at my disposal but i want to avoid installing each one by hand. Especially because I would need to do it from home office.

Is there a way to automate the installation and configuration?
I know that you can use the installer with /S to install silently. But how does one change the configuration afterwards? (To enable remote Access)
Also I want the F@HClient to start as system service at boot time, which would be possible with the custom install option in the graphical installer.

Any help is very much appreciated!

Further information:
Country: Germany
OS in School: Windows10 professional inside windows domain
Client management: Opsi (Open PC Server Integration) (IServ)
Joe_H
Site Admin
Posts: 7856
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: Headless installation and configuration on Windows10

Post by Joe_H »

Some thoughts, and hopefully some others who have done similar software rollouts of the F@h software will respond.

You can install the client as a system service, however in that mode it can only do CPU folding due to Windows restrictions on access to the video system.

The FAHClient as installed supports access through a telnet connection on the local IP number 127.0.0.1 over port 36330. Most of the setup options are available this way and there is a rudimentary help. The same access is available through an API - https://github.com/FoldingAtHome/fah-co ... Client-API. For the telnet option, creating a script that enters the settings you want for initial setup could be useful for the next suggestion.

The advanced control - FAHControl, can be configured to monitor and control multiple systems remotely. There are two different tabs involved under Configure, Connection and Remote Access. I am not certain of all of the settings that can be made remotely, but a number of them can.

An useful option you may want to set as part of the install is 'pause-on-start' set to 'true'. The default is false and folding start almost immediately after the install. Since some of the settings changes, especially the remote access ones require that FAHClient be restarted, this can set the system to wait for when you have things ready.

Hopefully this gives you some ideas.

Oh, and have the school administrators approve doing this if they haven't already, don't want you to have problems with them.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
bruce
Posts: 20910
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: Headless installation and configuration on Windows10

Post by bruce »

Automated installation has been equivalenced to installing malware so we havn't really tried to make it easy to do.

Read the EULA. You have to have permission of the hardware's OWNER which may be a challenge. (and I recommend WRITTEN permission).

It's not that I don't appreciate your desire to help, but I don't want you to get fired in case some other school admin takes over from the current one.

Each installation must be performed independently -- you can't clone it. During the installation, the client downloads a unique ID.
wuerfelfreak
Posts: 9
Joined: Mon Mar 23, 2020 9:03 am

Re: Headless installation and configuration on Windows10

Post by wuerfelfreak »

Thank you very much for the suggestions and the advice. I'll give the API a try.

I do have written permission from our headmaster to use the computers but I appreciate your precautions.
The "no cloning"-thing is a good tip, Thanks
olliecampbell
Posts: 10
Joined: Mon Mar 23, 2020 7:15 pm

Re: Headless installation and configuration on Windows10

Post by olliecampbell »

I have a similar requirement for the small startup that I work for. It runs in Powershell and I don't think it's quite right yet, but a work in progress.

I have permission to install it on everything and have managed to get this far so far:

[*]It checks to see if the app is installed (very basically)
[*]Copies the install file from our centralised install location
[*]Runs the installer
[*]Runs the app using our ID/Team ID/Pass key

$local_ITfolder_file_path="Your locally cached folder on each computer"
$remote_ITfolder_file_path="Central store of apps"

##################
#Install Folding@Home
##################
Write-Host "Installing Folding@Home..."
if ((Test-Path -path "C:\Program Files (x86)\FAHClient" -erroraction 'silentlycontinue') -eq $FALSE)
{
#The install folder doesn't exist so the app isn't installed. Install it.
if ((Test-Path -path "$local_ITfolder_file_path\Apps\fah-installer_7.5.1_x86.exe" -erroraction 'silentlycontinue') -eq $FALSE)
{
#The installer isn't local. Copy it locally.
New-Item "$local_ITfolder_file_path\Apps" -Type Directory
Copy-Item "$remote_ITfolder_file_path\Apps\fah-installer_7.5.1_x86.exe" "$local_ITfolder_file_path\Apps\fah-installer_7.5.1_x86.exe"
Start-Process "$local_ITfolder_file_path\Apps\fah-installer_7.5.1_x86.exe" -ArgumentList "/S /V /qn" -Wait
$x = Start-Process "C:\Program Files (x86)\FAHClient\FAHClient" -ArgumentList "--user=XXXXXXX --team=XXXXXX--passkey=XXXXXX--gpu=true --smp=true" -PassThru
Start-Sleep -s 5
Stop-Process -Id $x.Id
}
else{
#The installer exists, so use it.
Start-Process "$local_ITfolder_file_path\Apps\fah-installer_7.5.1_x86.exe" -ArgumentList "/S /V /qn" -Wait
$x = Start-Process "C:\Program Files (x86)\FAHClient\FAHClient" -ArgumentList "--user=XXXXX--team=XXXXX --passkey=XXXXX --gpu=true --smp=true" -PassThru
Start-Sleep -s 5
Stop-Process -Id $x.Id
#The screensaver is set to use the F@H one later in this script.
}
}
else{
#The app is installed. Do nothing.
}

At the moment, because of the way I call the process, it drops a few files on the desktop (the working directory as I test it). It should be dropping these into "C:\Users\XXXX\AppData\Roaming\" I believe.

I hope it's of help...
fowie
Posts: 11
Joined: Mon Mar 23, 2020 11:23 pm

Re: Headless installation and configuration on Windows10

Post by fowie »

I'm in a similar boat. Trying to get this running on a moderate Win 10 server farm. Using the /S switch on the installer does a standard install, but is there any way to make it install as a service silently? These are headless servers without workstations, so no one is logged in, meaning FAHClient doesn't start.

I've tried

Code: Select all

FAHClient.exe --install-service
and it does create a service, but trying to run that service from windows services results in:
The Folding@home Client service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs
Running

Code: Select all

FAHClient.exe --start-service 
I get:
23:30:30:ERROR:Exception: Timed out waiting for service to stop
and manually running

Code: Select all

FAHClient.exe --service
Starts up FAH just fine, but it leaves the console window attached, so I can't easily run this remotely either.

Any hints on how to properly get an unattended install in service mode working?
wuerfelfreak
Posts: 9
Joined: Mon Mar 23, 2020 9:03 am

Re: Headless installation and configuration on Windows10

Post by wuerfelfreak »

Thank you for all your awesome help! It works now:

First thing I do is run the installer like so:

Code: Select all

 fah-installer_7.5.1_x86.exe /S 
This installs F@H to C:\Program Files (x86)\FAHClient and C:\User\Username\Appdata\Remote\FAHClient
But it does not install a system service nor start the client.

EDIT:
After some testing I found out, that the graphical installer does some things differently than the silent installer!
The following steps only work, when you use the graphical installer sadly. When using the silent installer the system service does not work for some very strange reasons...
I'll look into that.



After that I add a system service in cmd like this:

Code: Select all

sc.exe create "fah" binPath= "C:\Program Files (x86)\FAHClient\FAHClient.exe --service" start= auto
or in powershell

Code: Select all

New-Service -Name "fah" -BinaryPathName '"C:\Program Files (x86)\FAHClient\FAHClient.exe" --service'
The --service in the Windows service is important, otherwise it will time out like @fowie said

Then I overwrite the configuration in C:\User\Username\Appdata\Remote\FAHClient\config.xml. This way I don't need to start the client to configure it.
On could also start it like this:

Code: Select all

FAHClient.exe --paused=true
and then configure using telnet which also works quite nicely.

After a restart the FAHClient should now start automatically at boot with my configuration.
I hope that helps.


Some further remarks:

Does someone now what /qn does in the installers argument list?
olliecampbell wrote: Start-Process "$local_ITfolder_file_path\Apps\fah-installer_7.5.1_x86.exe" -ArgumentList "/S /V /qn" -Wait
I also had this problem where the service would not start correctly.
fowie wrote: The Folding@home Client service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs
In the end I had a syntactical Error in the configuration which made it crash even though starting manually worked fine.
You might consider reinstalling F@H just to be save.

Also I am NOT a professional (but a student)! I normally don't use windows at all so take my advice with a grain of salt.
olliecampbell
Posts: 10
Joined: Mon Mar 23, 2020 7:15 pm

Re: Headless installation and configuration on Windows10

Post by olliecampbell »

Hi,

Sorry for the confusion, the /qn is for msiexec based installers so can be ignored for this, my bad.

Excellent work here guys. Off to test the new scripting.
Joe_H
Site Admin
Posts: 7856
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: Headless installation and configuration on Windows10

Post by Joe_H »

Another person was looking to do the same with idle computers at their university, have pointed to this topic.

Whie responding I did think of one thing that may help in deploying. The client is assigned an unique ID the first time it connects to a F@h server to request work. So if installed to a computer not connected to the network, that install should not have one and could be used to clone from. I would suggest testing that first, but that might be an approach you can use.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
wuerfelfreak
Posts: 9
Joined: Mon Mar 23, 2020 9:03 am

Re: Headless installation and configuration on Windows10

Post by wuerfelfreak »

A little update on the non functioning system service:

The system service does not work when F@H is installed via cmd and /S but it does work when installed with the graphical installer as mentioned in my edit above.
I compared the installation ( C:\Program Files (x86)\FAHClient\ ) of both methods but they were exactly the same (sha1sum) so that can not be the problem.

The files in C:\Users\...\Appdata\FAHClient are essential for the service to start properly and the silent installer does not put them there automatically. But adding them also does not make the silent installer work.

Also when you first install FAHClient with the graphical installer and then again install with the silent installer without uninstalling in between it does not work anymore.

I really cant find the reason why the silent installer is not working.
1. It does work when started manually. Just the service crashes.
2. The service does not produce any logs, even when FAHClient.exe is started with "--log C:\path\to\logfile.txt"

Also where is the Unique ID saved? Do I miss something here?
Joe_H
Site Admin
Posts: 7856
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: Headless installation and configuration on Windows10

Post by Joe_H »

wuerfelfreak wrote:Also where is the Unique ID saved? Do I miss something here?
That I don't know offhand. From what I do know, it is not part of the config.xml file. But you can see the request in the log of a client being started up for the first time.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
fowie
Posts: 11
Joined: Mon Mar 23, 2020 11:23 pm

Re: Headless installation and configuration on Windows10

Post by fowie »

Joe_H wrote:Another person was looking to do the same with idle computers at their university, have pointed to this topic.

Whie responding I did think of one thing that may help in deploying. The client is assigned an unique ID the first time it connects to a F@h server to request work. So if installed to a computer not connected to the network, that install should not have one and could be used to clone from. I would suggest testing that first, but that might be an approach you can use.
Good idea. I tried it to no success, though. I downloaded the exe on a laptop, put it in airplane mode, and ran the GUI installer, setting it to install as a service. I then zipped up the C:\users\username\AppData\Roaming\FAHClient and the C:\Program Files (x86)\FAHClient folders, and copied them to another machine. I unzipped them in their respective locations on the second machine, and added a valid, working, config.xml to both folders. Then I created the service using sc

Code: Select all

sc create "Folding@home Client" displayName= "Folding@home Client" binpath= "\"C:\Program Files (x86)\FAHClient\FAHClient.exe\" --service"
but the service still refuses to run.
wuerfelfreak
Posts: 9
Joined: Mon Mar 23, 2020 9:03 am

Re: Headless installation and configuration on Windows10

Post by wuerfelfreak »

Might there be some path or registry key that we are missing here? I can't think of anything else holding us back right now.
fowie
Posts: 11
Joined: Mon Mar 23, 2020 11:23 pm

Re: Headless installation and configuration on Windows10

Post by fowie »

wuerfelfreak wrote:Might there be some path or registry key that we are missing here? I can't think of anything else holding us back right now.
Yep. Looks like the silent installer doesn't complete the registry keys. You need to manually add the keys here:

HKCU\Environment\Path has C:\Program Files (x86)\FAHClient added to it
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths has a key for FAHClient:

Code: Select all

(Default) REG_SZ C:\Program Files (x86)\FAHClient\FAHControl.exe
Path        REG_SZ C:\Program Files (x86)\FAHClient
And you must have the uninstaller key as well, or the service will not start

Code: Select all

HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FAHClient

(Default)                        REG_SZ                        (value not set)
DataDirectory                 REG_SZ                        C:\users\USERNAME\AppData\Roaming\FAHClient
DisplayIcon                     REG_SZ                        C:\Program Files (x86)\FAHClient\FAHClient.ico
DisplayName                   REG_SZ                        FAHClient
DisplayVersion                REG_SZ                         7.5.1
InstalledService              REG_DWORD                 0x00000001 (1)
Publisher                        REG_SZ                         Folding@home.org
UninstallString                REG_SZ                        C:\Program Files (x86)\FAHClient\Uninstall.exe
URLInfoAbout                  REG_SZ                       https://foldingathome.org
And the entries in the registry that refer to the service I created. They are basically identical, except that the service that the installer creates has the value:

Code: Select all

WOW64    REG_DWORD   0x0000014c (332)
Adding the registry entries got the service to start for me.
Last edited by fowie on Tue Mar 24, 2020 5:15 pm, edited 1 time in total.
js2010
Posts: 15
Joined: Tue Mar 24, 2020 4:17 pm

Re: Headless installation and configuration on Windows10

Post by js2010 »

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?

Ok, it looks like it's using the registry. But with a silent install, this ends up being blank, and the service can't start. This seems very challenging.

Code: Select all

reg query HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FAHClient /v DataDirectory 
C:\Users\myuser\AppData\Roaming\FAHClient
Where do you download the command line only version? I'm assuming the word "here" used to be linked to something:
https://foldingathome.org/support/faq/i ... ne-option/

Silent uninstall:

Code: Select all

"C:\Program Files (x86)\FAHClient\Uninstall.exe" /S
Possible install.bat script:

Code: Select all

start /wait fah-installer_7.5.1_x86.exe /S
"C:\Program Files (x86)\FAHClient\FAHClient.exe" --install-service
set datadir=c:\users\myadmin\appdata\roaming\fahclient
reg add HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\FAHClient /v DataDirectory /f /d %datadir%
mkdir %datadir%
copy /y config.xml %datadir%
net start "Folding@home Client"
Last edited by js2010 on Wed Apr 01, 2020 9:18 pm, edited 17 times in total.
Post Reply