• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. mstabrin
    M
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 42
    • Best 8
    • Controversial 0
    • Groups 0

    mstabrin

    @mstabrin

    10
    Reputation
    1
    Profile views
    42
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    mstabrin Unfollow Follow

    Best posts made by mstabrin

    • RE: Add Host Primary Disk to registration form

      Ok I also found the answer to my search question:
      https://forums.fogproject.org/topic/10036/api/2
      The search syntax is slightly different to the news article.

      So here would be an example command for completion:

      curl -H 'fog-api-token: TOKEN' -H 'fog-user-token: TOKEN' -X GET  http://FOG-PXE-SRV.mpi-dortmund.mpg.de/fog/host | jq '.hosts[] | select(.name == "HOSTNAME") | .name'
      

      Thanks again for letting me do my inner monologue on your platform! πŸ™‚

      Best,
      Markus

      posted in FOG Problems
      M
      mstabrin
    • RE: BTRFS postdownloadscript

      Hello @sebastian-roth ,

      So far I did not encounter any problems imaging and deploying resizable BTRFS images πŸ™‚

      However, I β€œonly” tested simple examples, i.e., one SSD with EFI, BTRFS, SWAP partitioning.

      But no problems with this setup.
      However, more complex examples will follow soon and I will come back to you in case I encounter some problems.

      posted in Linux Problems
      M
      mstabrin
    • RE: Using git inside FOS

      @Sebastian-Roth I successfully finished the FOS kernel build including git πŸ™‚
      I started with the FOS 1.5.9 TAG. I already started the build before I read your message.

      I installed the following packages:

      • CA Certificates <- Necessary for git https authentification
      • git
      • git-crypt <- We use this, so I was happy it is as easy as checking it πŸ™‚

      And things work great πŸ™‚
      Thank you for the guidance! It was actually very straight forward.

      @george1421 Thank you for the input. As far as I understand it is required to have the FOG client up and running in order to deploy snapins? That actually might be something I will look into as well!
      Actually during the FOS rebuild I had a similar idea, but instead of using snapins I was thinking of chrooting into the deployed system and run everything from there.
      However, I am not sure if that would be a robust solution.

      posted in General
      M
      mstabrin
    • RE: Tasktypeedit setup or getting Wake on Lan to work

      @Sebastian-Roth Sorry for that question, it turned out that I was just too impatient and did not wait long enough for the reboot to happen…

      Rebooting works great now πŸ™‚
      On monday I will provide a short feedback if the wake-on-lan function is working properly πŸ™‚

      Have a great weekend!

      Best,
      Markus

      posted in FOG Problems
      M
      mstabrin
    • RE: ProxyDHCP responding to PXE boot in different subnet

      Hello @george1421 ,

      I looked into the error message and found an actual solution here: https://dnsmasq-discuss.thekelleys.org.narkive.com/3JlGMO6e/dhcp-proxy-problem

      I needed to specify the dhcp-range for both subnets:

      So instead of using:

      dhcp-range=141.5.200.57,proxy
      

      in the /etc/dnsmasq.d/ltsp.conf, I added the second subnet with the respective netmasks:

      dhcp-range=141.5.200.255,proxy,255.255.240.0
      dhcp-range=10.65.0.255,proxy,255.255.252.0
      

      and everything seems to work now πŸ™‚

      Thank you so much for the help!

      posted in General Problems
      M
      mstabrin
    • RE: BTRFS postdownloadscript

      Hello @Sebastian-Roth and @george1421 ,
      Thank you for all the information!

      I am using FOG version 1.5.9.
      Before I did any further testing I resolved my partition mess:
      The allocation of the discs sectors was actually in the correct order, just the naming was messed up by a random allocation order during installation.

      sda1 - EFI
      sda2 - btrfs
      sda3 - swap

      However I still get a similar error with - No resizable partitions found):
      Screenshot_2021-02-09_11-39-15.png
      (I looked at a lot of related threads and those people also posted screenshots of their problems and solutions. However, most of them are unavailable nowadays and therefore the thread not informative anymore. Is posting a screenshot here actually the best method in this case or do you prefer another solution?)

      So I played around with btrfs resizing and came up with the following inside of the debug mode based on https://unix.stackexchange.com/questions/424758/resize-btrfs-filesystem-to-the-minimum-size-in-a-single-step

      mount /dev/sda2 /mnt/bt
      
      free_size_original=$(btrfs filesystem usage -b /mnt/bt | grep unallocated | grep -Eo '[0-9]+')
      
      mult_val=0.95
      free_size=$(echo "scale=0;(${mult_val}*${free_size_original})/1" | bc -l)
      while ! btrfs filesystem resize -${free_size} /mnt/bt
      do
          if [[ ${mult_val} -le 0 ]]
          then
              break
          else
              mult_val=$(${mult_val} - 0.05)
          fi
          free_size=$(echo "scale=0;(${mult_val}*${free_size_original})/1" | bc -l)
      done
      

      To bring it back to full size it only needs a:

      btrfs filesystem resize max /mnt/bt
      

      I guess the tricky part now is to allocate the correct partition sizes after the shrink and before the max.

      @george1421 I tried to use fthe fog command within the debug mode but only got:

      Screenshot_2021-02-09_14-33-33.png

      And the next enter sends me back to the command line.

      Best,
      Markus

      posted in Linux Problems
      M
      mstabrin
    • RE: BTRFS postdownloadscript

      Hello everybody,
      I needed to get myself into the FOS environment yesterday, BUT it works now πŸ™‚ (At least for my usecase πŸ˜‰ )

      @george1421

      Are you using a FOS Linux USB boot drive? I would expect to only see the β€œUnknown request type :: Null” when booted from a USB stick into FOS Linux without having a corresponding task scheduled on the FOG server. I also noticed that your kernel parameters are incomplete for a capture or deploy (which would also lead to that error message).

      This happened because I used the normal Debug task and not the Capture - Debug task.
      Using the Caputer - Debug made things work as you described them πŸ™‚

      @Tom-Elliott
      I needed to make some minor changes to your suggested changes, but it was amazingly helpful to know which parts to look at πŸ™‚

      funcs.sh (based on what you send me):

      --- funcs.sh_ori	2021-02-10 13:25:08.000000000 +0100
      +++ funcs.sh	2021-02-11 09:08:31.660652070 +0100
      @@ -255,15 +255,15 @@
                           fi
                           echo "Done"
                           ;;
                   esac
                   ;;
      -        extfs)
      +        btrfs)
                   # Based on info from @mstabrin on forums.fogproject.org
                   if [[ ! -d /tmp/btrfs ]]; then
                       mkdir /tmp/btrfs >>/tmp/btfrslog.txt 2>&1
      -                if [[$? -gt 0 ]]; then
      +                if [[ $? -gt 0 ]]; then
                           echo "Failed"
                           debugPause
                           handleError "Could not create /tmp/btrfs (${FUNCNAME[0]})\n   Info: $(cat /tmp/btrfslog.txt)\n   Args Passed: $*"
                       fi
                   fi
      @@ -625,11 +625,11 @@
               btrfs)
                   # Based on info from @mstabrin on forums.fogproject.org
                   # https://forums.fogproject.org/topic/15159/btrfs-postdownloadscript/3
                   if [[ ! -d /tmp/btrfs ]]; then
                       mkdir /tmp/btrfs >>/tmp/btfrslog.txt 2>&1
      -                if [[$? -gt 0 ]]; then
      +                if [[ $? -gt 0 ]]; then
                           echo "Failed"
                           debugPause
                           handleError "Could not create /tmp/btrfs (${FUNCNAME[0]})\n   Info: $(cat /tmp/btrfslog.txt)\n   Args Passed: $*"
                       fi
                   fi
      @@ -638,16 +638,18 @@
                       echo "Failed"
                       debugPause
                       handleError "Could not mount $part to /tmp/btrfs (${FUNCNAME[0]})\n   Info: $(cat /tmp/btrfslog.txt)\n   Args Passed: $*"
                   fi
                   local free_size_original=$(btrfs filesystem usage -b /tmp/btrfs | grep unallocated | grep -Eo '[0-9]+')
      -            local mult_val=0.95
      -            local free_size=$(echo "scale=0;(${mult_val}*${free_size_original})/1" | bc -l)
      -            while ! btrfs filesystem resize -${free_size} /tmp/btrfs; do
      -                [[ ${mult_val} -le 0 ]] && break || mult_val=$(${mult_val} - 0.05)
      -                free_size=$(echo "scale=0;(${mult_val}*${free_size_original})/1" | bc -l)
      +            local fsize_pct=$(calculate_float "${percent}/100")
      +            local mult_val=$(calculate_float "1-${fsize_pct}")
      +            local free_size=$(calculate "${mult_val}*${free_size_original}")
      +            while ! btrfs filesystem resize -${free_size} /tmp/btrfs >>/tmp/btrfslog.txt 2>&1; do
      +            [[ $(echo "${mult_val} <= 0" | bc -l) -gt 0 ]] && break || mult_val=$(calculate_float "${mult_val}-0.05")
      +                free_size=$(calculate "${mult_val}*${free_size_original}")
                   done
      +            umount /tmp/btrfs >>/tmp/btrfslog.txt 2>&1
                   ;;
               *)
                   echo " * Not shrinking ($part $fstype)"
                   ;;
           esac
      @@ -2421,5 +2423,8 @@
       }
       # Calculates information
       calculate() {
           echo $(awk 'BEGIN{printf "%.0f\n", '$*'}')
       }
      +calculate_float() {
      +    echo $(awk 'BEGIN{printf "%f\n", '$*'}')
      +}
      

      Small changelog:

      • I needed to add a new calculate_float function to make the float calculations work
      • Minor syntax problems in the if statements and missing whitespaces
      • btrfs instead of extfs in shrinkPartition
      • Fixed the if condition inside the loop.
      • Used the calculate and calculate_float instead of my suggested bc -l
      • Used a fixed decrement of 5%, as we try to be as close to the percent value as possible. Otherwise the mechanism would break if the percent value is large.
      • Unmount the btrfs file system after shrinking to allow for partition shrinking later.

      fog.sh (based on what you send me):

      --- fog.upload_ori	2021-02-10 13:22:20.000000000 +0100
      +++ fog.upload	2021-02-11 08:44:34.415100613 +0100
      @@ -42,11 +42,12 @@
                   part_number=0
                   for part in $parts; do
                       fsTypeSetting "$part"
                       getPartitionNumber "$part"
                       case $fstype in
      -                    ntfs|extfs)
      +                    ntfs|extfs|btrfs)
      +                    #ntfs|extfs)
                               continue
                               ;;
                           *)
                               fixed_size_partitions="$fixed_size_partitions:$part_number"
                               ;;
      
      • Added btrfs to the shrinkable partition list

      Thank you for all the help πŸ™‚
      If you need more information from me, feel free to ask πŸ™‚

      posted in Linux Problems
      M
      mstabrin
    • RE: FOG client certificates removed on mono update

      @Sebastian-Roth It did containing

       04/13/2021 11:58:30 Installer Settings successfully saved in /opt/fog-service/settings.json
       04/13/2021 11:58:30 Middleware::Communication Download: http://fog-pxe-srv.XXX.de/fog/management/other/ca.cert.der
      
      posted in Linux Problems
      M
      mstabrin

    Latest posts made by mstabrin

    • RE: FOG client certificates removed on mono update

      @Sebastian-Roth It did containing

       04/13/2021 11:58:30 Installer Settings successfully saved in /opt/fog-service/settings.json
       04/13/2021 11:58:30 Middleware::Communication Download: http://fog-pxe-srv.XXX.de/fog/management/other/ca.cert.der
      
      posted in Linux Problems
      M
      mstabrin
    • RE: FOG client certificates removed on mono update

      @Sebastian-Roth i checked the mono certificates and I did not see any fog ones anymore πŸ™‚

      I also checked the other issues, but I could only see beautiful green PASS messages πŸ™‚

      posted in Linux Problems
      M
      mstabrin
    • RE: BTRFS postdownloadscript

      @Tom-Elliott @george1421 @Sebastian-Roth A quick follow up, so I deployed the image to many different PCs now and so far I did only have minor issues which might not actually be related to BTRFS in the first place.

      I used to have the partition order:

      1. EFI
      2. BTRFS
      3. SWAP 2GB
        on a VM with a 50GB HDD.

      Image options: Single Disk - Resizable - Everything

      Everything worked great if I deployed to HDDs with >=50GB.
      However, it failed when I tried the deployment to an HDD with 40GB.

      It seemed to be something like: The SWAP starting block on the original HDD is on a starting block that is not even present on the 40GB HDD.

      So I moved the partition order to:

      1. EFI
      2. SWAP 2GB
      3. BTRFS

      And everything works as intended.

      I will play around with different approaches though.
      Like separate the partitioning from the actual image deployment.
      We have many different systems requiring different amounts of SWAP space and/or dual/triple/many boot.
      So my idea would be to deploy the partitioning first and afterwards only image the BTRFS partition itself and distribute it to a specified aim partition on the aim PC.

      Thanks again for the help!

      posted in Linux Problems
      M
      mstabrin
    • RE: Using git inside FOS

      @george1421 @Sebastian-Roth I just wanted to let you know that I moved to snapins and never regreted it for one second πŸ™‚
      It is indeed much more flexible and involves way less maintenance on FOG updates.

      Thanks again!

      posted in General
      M
      mstabrin
    • RE: FOG client certificates removed on mono update

      @Sebastian-Roth It even worked with my custom FOGMontior wrapper script and I did not receive any errors πŸ™‚

      Best,
      Markus

      posted in Linux Problems
      M
      mstabrin
    • RE: FOG client certificates removed on mono update

      @Sebastian-Roth Hello, so I tested the installer and did not receive any errors.

      posted in Linux Problems
      M
      mstabrin
    • RE: Remove FOG task

      @sebastian-roth It sure is! 😸
      But I love how flexible FOG is with its postinit and postdownload scripts and the API functionality.
      I can really create everything I need, really things as complex as this problem here, by simple using the FOS binaries as building blocks.

      I have to say that FOG is indeed an amazing product!

      posted in Linux Problems
      M
      mstabrin
    • RE: Remove FOG task

      For completeness, I will also provide the postinitscript I wrote to ignore the task on reboot.
      It is the same condition I used above

      condition
      return_value=${?}
      if [[ ${return_value} -eq 0 ]]
      then
        # Continue with normal imaging
        :
      elif [[ ${return_value} -eq 1 ]]
      then
        # Continue with normal imaging
        :
      elif [[ ${return_value} -eq 2 ]]
      then
        # Abort imaging
        . /bin/fog.nonimgcomplete ${mac}
        exit 0
      else
        echo 'Return value not yet known'
        exit 1
      fi
      
      posted in Linux Problems
      M
      mstabrin
    • RE: Remove FOG task

      @Sebastian-Roth Yeah I made it work and let me explain to you why I wanted it πŸ˜„
      I say wanted, because it is just making the whole process easier for us to maintain and execute.

      We have a bunch of laptops that we use for workshops and borrow to students.
      They are stored in a laptop charging cart with an attached switch so that they are exposed to the FOG server and WoL is used for imaging.
      Afterwards, the laptops are actually used within the same network that has a connection to the FOG server.

      Now we could have done the tedious and possibly error prone way:

      1. On demand, select the laptops needed and that are still in the cage according to some documentation material manually and add them to a new FOG group.
      2. Setup a deploy task; wait to finish
      3. Provide the laptop to the user
      4. Receive the laptop from the user after usage
      5. Choose the same group and provide the β€œcoming home” image that does wipe the laptop from all data

      While this is a possible way of doing it, I fear the β€œworst case” scenario: By accident add an already provided laptop to the group and somewhere in the building you will hear a very loud scream because somebodies PhD Thesis just got remove from the harddrive due to a FOG task formatting the drive.

      Therefore, I want those laptops to completely ignore FOG when they left the switch located in the cart, but are available for the next imaging round by just plugging it into the correct switch.
      My FOGMonitor job is constantly checking the switch that the laptop is attached to and is ignoring all incoming tasks by ignoring them and additionally delete the task from the FOG server.

      This has the additional benefit that the workflow changes as follows:

      1. Select the laptop group containing all laptops at the FOG server
      2. Deploy the image to every laptop, but only those attached to the switch will listen
      3. Provide the laptops
      4. Reiceve the laptops
      5. Send all laptops the coming home signal
        You might need to remove pending tasks from the laptops that are not conneted to the network at all.

      This should work great for us, since we barely have to image different laptops for different purposes exactly at the same time,
      And since imaging is so fast, it is also not that bad if all of them are imaged or only the subset that is actually needed.

      I hope this makes things a bit more clear πŸ™‚

      best,
      Markus

      posted in Linux Problems
      M
      mstabrin
    • RE: Remove FOG task

      @Sebastian-Roth Ideally every incoming task just gets ignored by the client and gets marked as done at the server.

      I checked how it is done within the FOS in bin/fog.nonimagecomplete and figured everything out!
      Thank you for pointing me to the part of the code that does the snapin part!
      I will leave my setup here for reference on a Kubuntu 20.04 LTS system (Bash v 5.0.17(1)):

      FOG Client running OS

      Systemctl settings

      # Disable FOGService on startup
      systemctl disable FOGService.service
      # Enable FOGMonitor on startup (manages FOGService)
      systemctl enable FOGMonitor.timer
      

      Systemctl setup

      /lib/systemd/system/FOGMonitor.service

      [Unit]
      Description=FOGMonitor job; Manages the status of the FOGService.service
      Before=FOGService.service
      
      [Service]
      ExecStart=bash /opt/fog-service-monitor/monitor.sh
      
      [Install]
      WantedBy=multi-user.target
      

      /lib/systemd/system/FOGMonitor.timer

      [Unit]
      Description=Check required FOG status every minute
      
      [Timer]
      OnBootSec=0
      OnCalendar=minutely
      
      [Install]
      WantedBy=basic.target
      

      /opt/fog-service-monitor/monitor.sh

      #!/usr/bin/bash
       
      function condition(){
        if [[ # PUT YOUR ENABLE FOG SERVICE AND STOP TIMER SERVICE CONDITION HERE ]]
        then
          # This is the behaviour like systemctl enable FOGService
          return 0
        elif [[ # PUT YOUR ENABLE FOG SERVICE CONDITION HERE ]]
        then
          # This is the ENABLE FOG SERVICE condition
          return 1
        else
          # This is the DISABLE FOG SERVICE condition
          return 2
        fi
      }
      
      # Run the condition check and do things based on the return value
      condition
      return_value=${?}
      if [[ ${return_value} -eq 0 ]]
      then
        # Just like systemctl enable FOGService.service
        systemctl stop FOGMonitor.timer
        systemctl start FOGService.service
        exit 0
      elif [[ ${return_value} -eq 1 ]]
      then
        mode=start
        ignore_incoming=false
      elif [[ ${return_value} -eq 2 ]]
      then
        mode=stop
        ignore_incoming=true
      else
        # Consistency check between the return values of the condition function and this
        echo "Situation not defined, yet. Define it here after you added more conditions to the condition function"
        exit 1
      fi
      
      systemctl ${mode} FOGService.service
      web=http://FOG_SERVER_ADDRESS/fog
      if [[ ${ignore_incoming} == true ]]
      then
        for interface_name in /sys/class/net/*
        do
      	mac_address=$(cat ${interface_name}/address)
      	if echo ${mac_address} | grep -q '00:00:00:00:00'
      	then
      		continue
      	fi
              uuid=$(dmidecode -s system-uuid)
              # Post_Wipe seems also be able to mark every tasks as complete which is not a snapin.
              curl -Lks --data "sysuuid=${uuid,,}&mac=${mac_address}" ${web}/service/Post_Wipe.php
      
             # Remove possible snapin tasks
             snapin_id=$(
               curl -Lks --data "mac=${mac_address}" ${web}/service/snapins.checkin.php \
               | grep -o 'JOBTASKID=[0-9]*' \
               | grep -o [0-9]*
             )
             if [[ ${?} -eq 0 ]]
             then
               curl -Lks --data "mac=${mac_address}&taskid=${snapin_id}&exitcode=0" ${web}/service/snapins.checkin.php
             fi
             
        done
      fi
      

      Best,
      Markus

      posted in Linux Problems
      M
      mstabrin