snapin bash
-
Hello,
I’m a French teacher and I want to use Fog to deploy Ubuntu images on workstations in a school and I can’t manage to use a script/bash snapin.
The Ubuntu 22.04 image is deployed on my client machine and the Fog client is installed and working.
The file attached to my snapin contains this little script :#!/bin/bash
sudo apt install geanyIn the client log file I have the following trace:
4/5/2024 5:08:34 PM Client-Info Client Version: 0.13.0 4/5/2024 5:08:34 PM Client-Info Client OS: Linux 4/5/2024 5:08:34 PM Client-Info Server Version: 1.5.10 4/5/2024 5:08:34 PM Middleware::Response Success 4/5/2024 5:08:34 PM SnapinClient Running snapin installation geany 4/5/2024 5:08:34 PM Middleware::Communication Download: http://172.16.0.1/fog/service/snapins.file.php?mac=00:68:EB:A7:21:C4&taskid=1 4/5/2024 5:08:35 PM SnapinClient /opt/fog-service/tmp/snapin_geany_ubunut2204.sh 4/5/2024 5:08:35 PM Bus Emmiting message on channel: Notification 4/5/2024 5:08:35 PM SnapinClient Starting snapin 4/5/2024 5:08:35 PM SnapinClient Snapin finished 4/5/2024 5:08:35 PM SnapinClient Return Code: 1 4/5/2024 5:08:35 PM Bus Emmiting message on channel: Notification 4/5/2024 5:08:35 PM Middleware::Communication URL: http://172.16.0.1/fog/service/snapins.checkin.php?taskid=1&exitcode=1&mac=00:68:EB:A7:21:C4&newService&json 4/5/2024 5:08:35 PM Power Creating shutdown command in 60 seconds 4/5/2024 5:08:35 PM Bus Emmiting message on channel: Power
Attached is a screenshot of the creation of my snapin. Is the problem with my snapin settings, the client, a rights issue or something else?
Thanks in advance to anyone who can shed some light on this.
-
@fjunier Could you try this script:
#!/bin/bash sudo apt-get -y --force-yes install geany && exit 0 || exit 1
-
Have you ried logging into the machine and just runnign the script as yourself?
-
This post is deleted! -
@Tom-Elliott il y a moins d’une minute
Yes, the script runs on the machine. I also disabled password entry for the machine’s unique account because I thought that entering the password could cause problems.
-
@fjunier Could you try this script:
#!/bin/bash sudo apt-get -y --force-yes install geany && exit 0 || exit 1
-
@Tom-Elliott Thank you. I reinstalled with SmartInstaller.exe and now the snapins no longer run. I have the following error:
---------------------------------SnapinClient--------------------------------- ------------------------------------------------------------------------------ 4/12/2024 12:59:11 PM Client-Info Client Version: 0.13.0 4/12/2024 12:59:11 PM Client-Info Client OS: Linux 4/12/2024 12:59:11 PM Client-Info Server Version: 1.5.10 4/12/2024 12:59:11 PM Middleware::Response ERROR: Unable to get subsection 4/12/2024 12:59:11 PM Middleware::Response ERROR: Object reference not set to an instance of an object
and next :
----------------------------------UserTracker--------------------------------- ------------------------------------------------------------------------------ 4/12/2024 12:59:11 PM Client-Info Client Version: 0.13.0 4/12/2024 12:59:11 PM Client-Info Client OS: Linux 4/12/2024 12:59:11 PM Client-Info Server Version: 1.5.10 4/12/2024 12:59:11 PM Middleware::Response ERROR: Unable to get subsection 4/12/2024 12:59:11 PM Middleware::Response ERROR: Object reference not set to an instance of an object 4/12/2024 12:59:11 PM Service Sleeping for 66 seconds 4/12/2024 1:00:17 PM Middleware::Communication URL: http://172.16.0.1/fog/management/index.php?sub=requestClientInfo&configure&newService&json 4/12/2024 1:00:17 PM Middleware::Response Success 4/12/2024 1:00:17 PM Middleware::Communication URL: http://172.16.0.1/fog/management/index.php?sub=requestClientInfo&mac=00:68:EB:A7:21:C4&newService&json 4/12/2024 1:00:17 PM Middleware::Authentication Waiting for authentication timeout to pass 4/12/2024 1:01:11 PM Middleware::Communication Download: http://172.16.0.1/fog/management/other/ssl/srvpublic.crt 4/12/2024 1:01:11 PM Middleware::Authentication Cert OK 4/12/2024 1:01:11 PM Middleware::Authentication No token found at /opt/fog-service/token.dat, this is expected if the client has not authenticated before 4/12/2024 1:01:11 PM Middleware::Authentication ERROR: Could not get security token 4/12/2024 1:01:11 PM Middleware::Authentication ERROR: Could not find file "/opt/fog-service/token.dat" 4/12/2024 1:01:11 PM Middleware::Communication POST URL: http://172.16.0.1/fog/management/index.php?sub=requestClientInfo&authorize&newService 4/12/2024 1:01:11 PM Middleware::Response Invalid security token 4/12/2024 1:01:11 PM Middleware::Response Success 4/12/2024 1:01:11 PM Middleware::Communication URL: http://172.16.0.1/fog/service/getversion.php?clientver&newService&json 4/12/2024 1:01:11 PM Middleware::Communication URL: http://172.16.0.1/fog/service/getversion.php?newService&json 4/12/2024 1:01:11 PM Service Creating user agent cache 4/12/2024 1:01:11 PM Middleware::Response ERROR: Unable to get subsection 4/12/2024 1:01:11 PM Middleware::Response ERROR: Object reference not set to an instance of an object 4/12/2024 1:01:11 PM Middleware::Response ERROR: Unable to get subsection 4/12/2024 1:01:11 PM Middleware::Response ERROR: Object reference not set to an instance of an object 4/12/2024 1:01:11 PM Middleware::Response ERROR: Unable to get subsection 4/12/2024 1:01:11 PM Middleware::Response ERROR: Object reference not set to an instance of an object
I will reinstall the client
-
@Tom-Elliott Thanks for the response. I I have click the button Reset Encryption Data and the authentification problem is solved, moreover mys snapin ran successfully. Cool !
-
@fjunier So i suspect the original script you had:
#!/bin/bash sudo apt install geany
Was either the incorrect command (most times apt and apt-get are not the same things)
and/or it was waiting for confirmation from the end user.
I don’t know why it would run successfully when you ran the script locally, but maybe you would just “confirm” if it was requesting?
The methods I added :
&& exit 0 || exit 1
were to ensure if the command completed successfully (the && part) to return with a code of 0 explicitely, while if the command failed, return with an exit code of 1 explicitely.Hopefully this works properly for you.
The other pieces added after replacing apt with apt-get, was -y (confirm) and --force-yes (if interaction needed to confirm as well beyond the base install confirmation)
So should be more consistent.
-
@Tom-Elliott thanks for all !
-