• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

snapin bash

Scheduled Pinned Locked Moved Solved
Linux Problems
2
9
552
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F
    fjunier
    last edited by Apr 11, 2024, 6:47 PM

    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 geany

    In 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?
    snapin_fog.png

    Thanks in advance to anyone who can shed some light on this.

    T 1 Reply Last reply Apr 11, 2024, 6:49 PM Reply Quote 0
    • T
      Tom Elliott @fjunier
      last edited by Tom Elliott Apr 11, 2024, 2:17 PM Apr 11, 2024, 8:15 PM

      @fjunier Could you try this script:

      #!/bin/bash
      sudo apt-get -y --force-yes install geany && exit 0 || exit 1

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

      F 2 Replies Last reply Apr 12, 2024, 11:19 AM Reply Quote 0
      • T
        Tom Elliott @fjunier
        last edited by Apr 11, 2024, 6:49 PM

        Have you ried logging into the machine and just runnign the script as yourself?

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        F 1 Reply Last reply Apr 11, 2024, 6:56 PM Reply Quote 0
        • F
          fjunier
          last edited by Apr 11, 2024, 6:51 PM

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • F
            fjunier @Tom Elliott
            last edited by Apr 11, 2024, 6:56 PM

            @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.

            T 1 Reply Last reply Apr 11, 2024, 8:15 PM Reply Quote 0
            • T
              Tom Elliott @fjunier
              last edited by Tom Elliott Apr 11, 2024, 2:17 PM Apr 11, 2024, 8:15 PM

              @fjunier Could you try this script:

              #!/bin/bash
              sudo apt-get -y --force-yes install geany && exit 0 || exit 1

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

              Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

              Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

              F 2 Replies Last reply Apr 12, 2024, 11:19 AM Reply Quote 0
              • F
                fjunier @Tom Elliott
                last edited by Apr 12, 2024, 11:19 AM

                @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

                1 Reply Last reply Reply Quote 0
                • F
                  fjunier @Tom Elliott
                  last edited by Apr 12, 2024, 12:00 PM

                  @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 !

                  T 1 Reply Last reply Apr 12, 2024, 12:18 PM Reply Quote 0
                  • T
                    Tom Elliott @fjunier
                    last edited by Apr 12, 2024, 12:18 PM

                    @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.

                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                    Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                    Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                    F 1 Reply Last reply Apr 12, 2024, 3:55 PM Reply Quote 0
                    • F
                      fjunier @Tom Elliott
                      last edited by Apr 12, 2024, 3:55 PM

                      @Tom-Elliott thanks for all !

                      1 Reply Last reply Reply Quote 0
                      • [[undefined-on, T Tom Elliott, Apr 12, 2024, 4:55 PM]]
                      • 1 / 1
                      1 / 1
                      • First post
                        5/9
                        Last post

                      251

                      Online

                      12.0k

                      Users

                      17.3k

                      Topics

                      155.2k

                      Posts
                      Copyright © 2012-2024 FOG Project