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

Post Install Script does not work while deploying ubuntu 16.04 image using FOG.

Scheduled Pinned Locked Moved Unsolved
FOG Problems
4
9
1.3k
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.
  • V
    Vinay
    last edited by Jan 10, 2018, 12:01 PM

    Hi Team,

    I am getting “Command not found” error while deploying ubuntu 16.04 OS to a new system.
    i used the Post install script in fog for ubuntu image deployment.
    I followed this link: https://forums.fogproject.org/topic/7740/the-magical-mystical-fog-post-download-script
    I am trying to install few applications and settings change for my requirement.
    I created fog.sh file and edited with required commands to do the task, added fog.sh file path to fog.postdownload file as per the above article, still the same issue.

    1 Reply Last reply Reply Quote 0
    • G
      george1421 Moderator
      last edited by Jan 10, 2018, 12:27 PM

      First let me say I’ve been working on a newish version of the post you linked, here: https://forums.fogproject.org/topic/11126/using-fog-postinstall-scripts-for-windows-driver-injection-2017-ed

      To know where its failing we will need to see your fog.sh script to know where its actually failing. The command not found command simply indicates the command (function) you used is not available in FOS.

      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!

      V 1 Reply Last reply Jan 11, 2018, 7:04 AM Reply Quote 0
      • V
        Vinay @george1421
        last edited by Sebastian Roth Jan 11, 2018, 4:01 AM Jan 11, 2018, 7:04 AM

        @george1421
        Thank you for your reply George.
        It is just not taking systemctl and apt-get install commands.
        My fog.sh file shows as below:

        #!/bin/bash
        
        echo 'Installing required packages'
        apt-get update
        apt-get dist-upgrade
        apt-get -y install samba sssd ntp
        DEBIAN_FRONTEND=noninteractive apt-get -y install krb5-user
        
        # krb5.conf
        echo 'Configuring Kerberos'
        cat << EOF > /etc/krb5.conf
        [libdefaults]
        	default_realm = xx.xxx.COM
        # The following krb5.conf variables are only for MIT Kerberos.
        	krb4_config = /etc/krb.conf
        	krb4_realms = /etc/krb.realms
        	kdc_timesync = 1
        	ccache_type = 4
        	forwardable = true
        	proxiable = true
        # The following libdefaults parameters are only for Heimdal Kerberos.
        	v4_instance_resolve = false
        	v4_name_convert = {
        		host = {
        			rcmd = host
        			ftp = ftp
        		}
        		plain = {
        			something = something-else
        		}
        	}
        	fcc-mit-ticketflags = true
        [realms]
        	xx.xxx.COM = {
        		kdc = xxxxxxx.xx.xxx.COM
        		kdc = xxxxxxx.xx.xxx.COM
        		admin_server = xxxxxxx.xx.xxxx.COM
        	}
        [login]
        	krb4_convert = true
        	krb4_get_tickets = false
        EOF
        
        # ntp.conf
        echo 'Configuring NTP'
        sed -i.orig 's/^server/#server/g' /etc/ntp.conf
        
        cat << EOF >> /etc/ntp.conf
        server xxxxxxx.xx.xxxx.com
        server xxxxxxx.xx.xxxx.com
        EOF
        
        # smb.conf
        echo 'Configuring Samba'
        cp /etc/samba/smb.conf /etc/samba/smb.conf.orig
        cat << EOF > /etc/samba/smb.conf
        [global]
           workgroup = xxxx
           client signing = yes
           client use spnego = yes
           kerberos method = secrets and keytab
           realm = xx.xxxx.COM
           security = ads
           server string = %h server (Samba, Ubuntu)
           dns proxy = no
           log file = /var/log/samba/log.%m
           max log size = 1000
           syslog = 0
           panic action = /usr/share/samba/panic-action %d
           server role = standalone server
           passdb backend = tdbsam
           obey pam restrictions = yes
           unix password sync = yes
           passwd program = /usr/bin/passwd %u
           passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
           pam password change = yes
           map to guest = bad user
           usershare allow guests = yes
        EOF
        
        # sssd.conf
        echo 'Configuring SSSD'
        cat << EOF > /etc/sssd/sssd.conf
        [sssd]
        services = nss, pam, sudo
        config_file_version = 2
        domains = xx.xxxx.COM
        [domain/xx.xxxx.COM]
        id_provider = ad
        access_provider = ad
        cache_credentials = True
        override_homedir = /home/%d/%u
        default_shell = /bin/bash
        EOF
        
        sudo chown root:root /etc/sssd/sssd.conf
        sudo chmod 600 /etc/sssd/sssd.conf
        
        # hosts
        echo 'Configuring Hosts'
        cat << EOF >> /etc/hosts
        #xx.xxx.x.xx xxxxx.xx.xxxx.com xxxxxx
        #xx.xxx.xx.xx xxxxxx.xx.xxxx.com xxxxxxx
        EOF
        
        HOSTNAME=`hostname`
        sed -i.orig "s/${HOSTNAME}/${HOSTNAME}.ad.here.com ${HOSTNAME}/g" /etc/hosts
        
        # pam
        echo 'Configuring PAM'
        sed -i.orig '/session\s*required\s*pam_unix.so/a session required pam_mkhomedir.so skel=/etc/skel/ umask=0077' /etc/pam.d/common-session
        
        # lightdm
        echo 'Configuring LightDM'
        cat << EOF >> /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf
        greeter-show-manual-login=true
        greeter-hide-users=true
        EOF
        cat << EOF >> /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
        allow-guest=false
        EOF
        
        # restart services
        echo 'Restarting SMBD'
        systemctl restart smbd.service
        echo 'Restarting NMBD'
        systemctl restart nmbd.service
        echo 'Restarting NTP'
        systemctl restart ntp.service
        
        # join the domain
        echo 'Obtaining Kerberos ticket'
        sudo kinit xxxxxx
        echo 'Getting info about the obtained ticket'
        sudo klist
        echo 'Joining to the domain'
        sudo net ads join -k
        
        echo 'Restarting SSSD'
        systemctl restart sssd.service
        
        . /usr/share/fog/lib/funcs.sh
        

        ERROR:
        0_1515654212046_f636028f-cc93-4ccb-a7fb-863bff33eaf9-image.png

        G 1 Reply Last reply Jan 11, 2018, 11:03 AM Reply Quote 0
        • S
          Sebastian Roth Moderator
          last edited by Jan 11, 2018, 10:06 AM

          @Vinay The command need to be run in the destination Linux system. Something like this before running your commands.

          mkdir -p /mnt/ubuntu
          mount /dev/sdaX /mnt/ubuntu
          chroot /mnt/ubuntu /bin/bash
          ...
          

          If you haven’t heard about chroot yet you better start reading… 🙂

          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

          V 1 Reply Last reply Jan 16, 2018, 1:05 PM Reply Quote 0
          • G
            george1421 Moderator @Vinay
            last edited by Jan 11, 2018, 11:03 AM

            @vinay said in Post Install Script does not work while deploying ubuntu 16.04 image using FOG.:

            . /usr/share/fog/lib/funcs.sh

            First of all, thank you for sharing your script it helps greatly with resolving your issue.

            The simple thing first. You can remove this line . /usr/share/fog/lib/funcs.sh since you are not using any of the fog built in functions.

            Second, your script runs in the context of FOS. FOS is a highly customized version of linux, where target OS commands will not work as you found.

            You can probably use the change root command like Sebastian mentioned, but I would be concerned about the operating environment of FOS interfering with ubuntu native commands like apt-get.

            I think you should modify your postinstall script to drop this fog.sh script on your target system during imaging. Then configure ubuntu to execute this script via an rc.local startup script entry. Then at the end of your fog.sh script, have it remove the call to fog.sh from rc.local entry once fog.sh runs. That way your script is running within the context of your ubuntu environment.

            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!

            1 Reply Last reply Reply Quote 0
            • V
              Vinay @Sebastian Roth
              last edited by Jan 16, 2018, 1:05 PM

              @sebastian-roth
              Thanks for the heads up.
              However, i did add the chroot in the script, still it does not work.
              Could you help me with adding this chroot command to my fog.sh script, how i can apply here.

              1 Reply Last reply Reply Quote 0
              • S
                Sebastian Roth Moderator
                last edited by Jan 16, 2018, 4:27 PM

                @Vinay Please post current script code and error on screen again so we know what we are at.

                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

                V 1 Reply Last reply Jan 17, 2018, 7:23 AM Reply Quote 0
                • V
                  Vinay @Sebastian Roth
                  last edited by Jan 17, 2018, 7:23 AM

                  @sebastian-roth
                  Would you help me with the procedure to include chroot in my below mentioned script as i messed it up adding multiple things.?

                  W 1 Reply Last reply Jan 18, 2018, 2:43 PM Reply Quote 0
                  • W
                    Wayne Workman @Vinay
                    last edited by Wayne Workman Jan 18, 2018, 8:44 AM Jan 18, 2018, 2:43 PM

                    @vinay said in Post Install Script does not work while deploying ubuntu 16.04 image using FOG.:

                    @sebastian-roth
                    Would you help me with the procedure to include chroot in my below mentioned script as i messed it up adding multiple things.?

                    I looked over your script. Looks like you’d put the chroot related lines at the start of your script. You should play around with chroot before doing this though. On a linux VM, boot to a live Ubuntu disk or something - then try to chroot from the Ubuntu disk to the local disk. Once you do this a couple times you’ll understand what chroot does and how to work with it. Also you should Google search it (or duckduckgo search it) too. We can’t do all your work for you, we rather show you the way.

                    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!
                    Daily Clean Installation Results:
                    https://fogtesting.fogproject.us/
                    FOG Reporting:
                    https://fog-external-reporting-results.fogproject.us/

                    1 Reply Last reply Reply Quote 1
                    • 1 / 1
                    1 / 1
                    • First post
                      8/9
                      Last post

                    213

                    Online

                    12.0k

                    Users

                    17.3k

                    Topics

                    155.2k

                    Posts
                    Copyright © 2012-2024 FOG Project