Installing a bit of FOG-Pi - the hackish way


  • Moderator

    Let me preface this with the following: Just because you can do something, it doesn’t mean you should.

    I’ll repeat that again: Just because you can do something, it doesn't mean you should.

    Please understand installing FOG on a Raspberry Pi is NOT recommended by the Developers of FOG. If you ask them for help they will only smile politely and tell you to move on, what you are doing is not supported. So don't ask them for help.

    I’ve wanted to for a while see if I could install fog on a Raspberry Pi. In my case I have a Raspberry Pi that my brother gave me. It is currently running my home voip PBX. I took it down for a bit to prove this project out. If I was to build a FOG-Pi mobile deployment server I would not use the Pi-2b that I currently have. This system has an OK processor but the network interface is 100Mb/s, which will clamp my overall throughput to 12MB/s. If given a choice I would use a Pi3 for the demo project. An $80 complete mobile FOG deployment server does have its allure.

    But in reality given a choice I would not use a Raspberry Pi, I would use a dual core Intel NUC with an built in SSD drive for about $280USD. Because of the scope of this project we’ll stick with a Pi2b.

    In addition to the Raspberry Pi you will need to pick up a decent micro SD card that will be used for storage. Depending on the size of your images a 32GB Samsung EVO Class 10 costs about $12USD from amazon. A 64GB EVO will cost you about $20USD from Amazon.

    For this project I used Raspbian Jessie downloaded from the official Raspberry Pi site: https://www.raspberrypi.org/downloads/raspbian/

    Follow the instructions on the following page to write the downloaded image file onto the micro sd card: https://www.raspberrypi.org/documentation/installation/installing-images/README.md

    After the image as been written to the micro sd card, move the card to the Pi and boot it up. You can either use the console to key in the remaining commands or you can use ssh and remote into the Pi once you determine its IP address.

    Before we start installing FOG, we need to execute a few steps to prepare the Pi.

    1. Run the Raspbain configuration tool sudo raspi-config
    2. Change these settings:
    1) expand filesystem to fill the storage device
    2) Change user password
    3) Boot options B1
    5) Internationalisation Options I1 *uncheck en_GB.UTF-8) check en_US.UTF-8 -> UTF-8 
    5) Internationalisation Options T2 Timezone
    5) Internationalisation Options T3 Keyboard layout 
    9) Advanced Options A2 Hostname
    
    1. Reboot the Pi
      reboot
    2. Log back in
    3. Update the Raspbian apt cache
      sudo apt-get update
    4. Install all of the current updates
      sudo apt full-upgrade
    5. By default Raspbian will boot into graphical mode. Since there is only 1GB of memory we need to conserve as much ram as possible. Execute the follow command to tell the Pi to boot into console mode.
      sudo systemctl set-default multi-user.target
    6. Reboot the Pi again to use the latest kernel and to boot into console mode.
      reboot
    7. The following directory is missing from the default Raspbian install that FOG uses, so we’ll create it so the installer doesn’t complain.
      sudo mkdir /usr/lib/systemd/system
    8. Now we need to install a couple default packages not installed by Raspbian by default
      sudo apt-get update sudo apt-get install git bc
    9. Now install FOG from the git repository
      sudo git clone https://github.com/FOGProject/fogproject.git /opt/fogproject

  • Senior Developer

    @Wayne-Workman the reason our installer shouldn’t support it is because it becomes yet another thing we are “expected” to manage and support. We’ve seen the issues just trying to keep up with Ubuntu. We’ve seen the issues with keeping up with the red hat variants. Mind you this is for the more common architectures of systems.now add in another form of os AND a new set of architecture to try to manage and it becomes even more difficult.

    What I will say, people can ask questions and we will try to give as helpful an answer and the best support we can to them for nearly any situation. No I don’t think we should add this device or OS in our core support installation though.


  • Senior Developer

    @george1421 said in Installing a bit of FOG-Pi - the hackish way:

    *[Dd][Ee][Bb][Ii][Aa][Nn]*|*[Bb][Uu][Nn][Tt][Uu]*|[Rr][Aa][Ss][Pp][Bb][Ii][Aa][Nn]|*)
    

    For that code line, what if it were changed to:

    *[Bb][Ii][Aa][Nn]*|*[Bb][Uu][Nn][Tt][Uu]*)
    

    This way you add any other OS that has the trailing “bian” which will more often than not be a form of Debian (E.g. Raspbian)


  • Moderator

    If those two things are the only modifications, I don’t see why the installer can’t just support Raspbian?

    Either way, very good work George. I messed with this for a little bit and quit after a while. I must have been very distracted.

    Here’s the git link for the mobile script - I don’t it will be too much work to get going, the tool now works on Fedora, CentOS, Debian, and presumably Ubuntu.

    https://github.com/wayneworkman/FOGUpdateIP


  • Moderator

    Now we are getting into tricking the FOG installer to install FOG on a Raspbian.

    Understand that these instructions are for hacking our way to install FOG on a Raspberry Pi. Since FOG 1.3.0 has not been released updates to the current FOG image may break these instructions. Don't as the Developers for help because these hacks fail to work correctly.

    1. We need the FOG installer to understand that Raspbian is a variant of Debian. So edit the following file:
      sudo vi /opt/fogproject/lib/ubuntu/config.sh
    2. Goto line 32 and look about for a line that contains:
        *[Dd][Ee][Bb][Ii][Aa][Nn]*|*[Bb][Uu][Nn][Tt][Uu]*)
    

    Replace that entire line with:

        *[Dd][Ee][Bb][Ii][Aa][Nn]*|*[Bb][Uu][Nn][Tt][Uu]*|[Rr][Aa][Ss][Pp][Bb][Ii][Aa][Nn]|*)
    
    1. Save and exit that file
    2. Now we need to comment out (disable) a repository that is not needed (and will stop the installer if not removed). Edit the following file:
      sudo vi /opt/fogproject/lib/common/functions.sh
    3. Goto line 573 (RC10) 601 (RC14) and look about for this line:
                        DEBIAN_FRONTEND=noninteractive $packageinstaller python-software-properties software-properties-common ntpdate >>$workingdir/error_logs/fog_error_${version}.log 2>&1
                        ntpdate pool.ntp.org >>$workingdir/error_logs/fog_error_${version}.log 2>&1
                        locale-gen 'en_US.UTF-8' >>$workingdir/error_logs/fog_error_${version}.log 2>&1
                        LANG='en_US.UTF-8' LC_ALL='en_US.UTF-8' add-apt-repository -y ppa:ondrej/${repo}>>$workingdir/error_logs/fog_error_${version}.log 2>&1
    
    1. Comment it out by putting a pound sign in front of the LANG. It should look something like this:
                        DEBIAN_FRONTEND=noninteractive $packageinstaller python-software-properties software-properties-common ntpdate >>$workingdir/error_logs/fog_error_${version}.log 2>&1
                        ntpdate pool.ntp.org >>$workingdir/error_logs/fog_error_${version}.log 2>&1
                        locale-gen 'en_US.UTF-8' >>$workingdir/error_logs/fog_error_${version}.log 2>&1
                        # LANG='en_US.UTF-8' LC_ALL='en_US.UTF-8' add-apt-repository -y ppa:ondrej/${repo}>>$workingdir/error_logs/fog_error_${version}.log 2>&1
    
    1. Save and exit this file
    2. Now we install FOG
      cd /opt/fogproject/bin
      sudo ./installfog.sh
    3. Complete the FOG installation as if this was a normal FOG server.
    4. Once the FOG installation is over we need to do a little cleanup. Since the Pi2b only has 1GB of Ram memory lets remove 2 FOG services that won’t typically be used in a Mobile FOG environment.
    5. First we will remove the startup file for the FOG Snapin Replicator startup
      sudo rm /usr/lib/systemd/system/FOGSnapinReplicator.service
    6. Next we’ll remove the startup file for the FOG Image Replicator
      sudo rm /usr/lib/systemd/system/FOGImageReplicator.service
    7. Reboot the server to ensure all of the services and functions come up like they should
      reboot

  • Moderator

    In this part we’ll install dnsmasq to augment the information being supplied by the local dhcp server. In many smaller or home locations the dhcp servers that are in use are soho routers that supply internet access as well as dhcp and dns forwarding to the local lan. These soho routers provide the basics of dhcp without the ability to modify some of the dhcp options required for pxe booting. Also if we are using our Pi as a mobile FOG server we can’t rely on the foreign network to have the facilities to support our pxe booting requirements. To that end we will install dnsmasq on our Pi to allow us to manage and supply the missing dhcp information.

    To install and configure dnsmasq please do the following.

    1. Login into the Pi console either directly or via ssh.
    2. Ensure we have the latest apt cache information and then install dnsmasq
      sudo apt-get update
      sudo apt-get install dnsmasq
    3. Now we need to configure our FOG dhcp settings in dnsmasq. Lets create the following file with our favorite text editor.
      sudo vi /etc/dnsmasq.d/ltsp.conf
    4. Insert the following section into the ltsp.conf file.
    # Don't function as a DNS server:
    port=0
    
    # Log lots of extra information about DHCP transactions.
    log-dhcp
    
    # Set the root directory for files available via FTP.
    tftp-root=/tftpboot
    
    # The boot filename, Server name, Server Ip Address
    dhcp-boot=undionly.kpxe,,<fog_server_IP>
    
    # Disable re-use of the DHCP servername and filename fields as extra
    # option space. That's to avoid confusing some old or broken DHCP clients.
    dhcp-no-override
    
    # PXE menu.  The first part is the text displayed to the user.  The second is the timeout, in seconds.
    pxe-prompt="Booting FOG Client", 1
    
    # The known types are x86PC, PC98, IA64_EFI, Alpha, Arc_x86,
    # Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI and X86-64_EFI
    # This option is first and will be the default if there is no input from the user.
    pxe-service=X86PC, "Boot to FOG", undionly
    
    # UEFI is not supported in this version of dnsmasq if it were you 
    # could uncomment the following line and the ipxe kernel would be delivered
    # to uefi clients automatically
    #pxe-service=X86-64_EFI, "Boot to FOG UEFI", ipxe
    
    dhcp-range=<fog_server_ip>,proxy
    
    1. Edit the above text replacing <fog_server_ip> with the IP address of your FOG-Pi server.
    2. Save and exit the text editor
    3. The dnsmasq group has made pretty good strides with updating dnsmasq to support uefi systems. Unfortunately most linux distributions have not been updated to the latest code released by Simon Kelley. The version of dnsmasq from the Raspbian site is version 2.72 (which is in line with what Debian Jessie ships). The version of dnsmasq that supports uefi systems is 2.76. You must upgrade to 2.76 to support uefi pxe booting. This is not a limitation of FOG but of the version of dnsmasq offered by distribution repositories.
    4. Now we need to create a symbolic link between the name that dnsmasq sends out and our iPXE kernel. I like to use symbolic links instead of just creating a static copy of these iPXE kernels. This way (with the symbolic link) if the iPXE kernel files get updated so will the files named by dnsmasq.
      sudo ln -s /tftpboot/undionly.kpxe /tftpboot/undionly.0
      sudo ln -s /tftpboot/ipxe.efi /tftpboot/ipxe.0
    5. Since Debian Jessie is a sysemd based we need to use systemctl to restart and enable the dnsmasq service.
      sudo systemctl restart dnsmasq.service
      sudo systemctl enable dnsmasq.service
    6. To confirm dnsmasq is running in memory we can use the ps command
      ps aux|grep dnsmasq
    7. The output of the above command should look similar to this:
    dnsmasq   6340  0.0  0.1   6296  1436 ?        S    19:31   0:00 /usr/sbin/dnsmasq -x /var/run/dnsmasq/dnsmasq.pid -u dnsmasq -r /var/run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service --trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5
    pi        6534  0.0  0.2   4276  1948 pts/0    S+   19:32   0:00
    
    1. We can also confirm that dnsmasq is listening for proxy dhcp requests by running the following command
      netstat -an|grep 4011
    2. The output should look like this
    udp        0      0 0.0.0.0:4011            0.0.0.0:*
    

    Now that we’ve confirm that dnsmasq is setup and litening its time to pxe boot our first bios (legacy client)


  • Moderator

    Things still to document

    1. Integration of Wayne’s mobile fog scripts
    2. Performance testing as it were

  • Moderator

    (place holder)


  • Moderator

    (place holder)


Log in to reply
 

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.