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

    "Saving Partitions" - GPT to MBR issue

    Scheduled Pinned Locked Moved Solved
    Feature Request
    3
    19
    4.9k
    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.
    • Tom ElliottT
      Tom Elliott
      last edited by

      https://github.com/FOGProject/fogproject/blob/bad33be289a64419607b666b066f2e9887344c43/src/buildroot/package/fog/scripts/usr/share/fog/lib/partition-funcs.sh#L648

      This is the function calls the runFixparts function.

      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

      1 Reply Last reply Reply Quote 1
      • Tom ElliottT
        Tom Elliott
        last edited by

        https://github.com/FOGProject/fogproject/blob/bad33be289a64419607b666b066f2e9887344c43/src/buildroot/package/fog/scripts/bin/fog.upload#L130

        Here’s where the saveOriginalPartitions is called.

        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

        1 Reply Last reply Reply Quote 1
        • Tom ElliottT
          Tom Elliott
          last edited by

          That should cover the “testable” elements. I’m telling you though, this isn’t an easy thing to figure out.

          The gpt or mbr parts work perfectly but it get’s stuck if it’s not that.

          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

          1 Reply Last reply Reply Quote 0
          • Tom ElliottT
            Tom Elliott @Wayne Workman
            last edited by

            @Wayne-Workman Stuck commands are literally that. The only way to “test” and kill would be to put the task into background, get the started pid. Then do the loop.

            The problem with that approach is you need to know which elements and why it’s being caused.

            I think it’s simply waiting for some input on “what to do” and we just need to let it through by saying no when it’s stuck.

            I haven’t got a good mechanism, though, to reliably detect the “bad gpt-mbr” state.

            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

            1 Reply Last reply Reply Quote 0
            • Tom ElliottT
              Tom Elliott @Wayne Workman
              last edited by

              @Wayne-Workman said in "Saving Partitions" - GPT to MBR issue:

              @Tom-Elliott said in "Saving Partitions" - GPT to MBR issue:

              As for a “timeout” it won’t work because it’s “stuck”

              There’s ways to do it. I don’t know the function names, but say the function to save the partitions is called save_partitions, it would look like this in it’s flow:

              #Start the saving partitions process, when it is done, create a file indicating it's done, and background this process.
              (save_partitions;touch /savingPartitionsDone) &
              
              #Start a loop that looks for this file. If it finds it, exit loop. 
              #If it does not find it, increment the counter and sleep for 1 second. 
              #If the counter reaches 60, kill the command that is hanging and start fixparts and then exit the loop.
              
              counter=0
              while true
              do
                  if [[-f /savingPartitionsDone]]; then
                      break
                  else
                      sleep 1
                      counter=$((counter + 1))
                      if [[$counter -gt 60]]; then
                          #Kill hanging command here.
                          #Start fixparts next here.
                          #exit the loop
                          break
                      fi
                  fi
              done
              

              And looking at this now, it’s probably not necessary to wait 60 seconds. Probably 15 would do fine.

              Your code should look more like: – Within the “checking part” (within the function saveSfdiskPartitions from partition funcs.sh)

              local sfdiskcount=0
              (sfdisk -d $disk 1>$file) &
              local sfpid=$!
              sleep 15
              if ps -p $sfpid>/dev/null; then
                  kill -9 $sfpid >/dev/null
                  false
              else
                  true
              fi
              

              This would replace the sfdisk call itself and happen before the status check.

              Of course this doesn’t make it truly dependent upon if sfdisk errors out or not. We kind of lose the ability to detect what the exit status was because we background it.

              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

              Wayne WorkmanW 1 Reply Last reply Reply Quote 0
              • Tom ElliottT
                Tom Elliott
                last edited by Tom Elliott

                Just for fun and good to know information:

                DD - Destroyer of disks

                I frequently reference this site when dealing with the dd command but near the bottom or more directly:
                DD - Destroyer of disks | Show progress status statistics of dd

                This is one way of “looping” to get the pid and information if you really want to loop and test.

                I say, test it after a sleep is the most elegant way. Looping would be more if you wanted to return output for status/progress information.

                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

                1 Reply Last reply Reply Quote 0
                • Wayne WorkmanW
                  Wayne Workman @Tom Elliott
                  last edited by

                  @Tom-Elliott said in "Saving Partitions" - GPT to MBR issue:

                  We kind of lose the ability to detect what the exit status was because we background it.

                  You can have the backgrounded process echo it’s exit code, like this:

                  (save_partitions;echo $? > /exitCode) &

                  Again I’ve not dug in yet. But I will.

                  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/

                  Tom ElliottT 1 Reply Last reply Reply Quote 0
                  • Tom ElliottT
                    Tom Elliott @Wayne Workman
                    last edited by

                    @Wayne-Workman The problem with it is the program get’s stuck. So you’d never get a return code.

                    I still thinking finding out the “why” is the best approach. If we can get the “why” it’s stuck then we can figure out a way to get out of it.

                    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

                    Wayne WorkmanW 1 Reply Last reply Reply Quote 0
                    • Wayne WorkmanW
                      Wayne Workman @Tom Elliott
                      last edited by

                      @Tom-Elliott said in "Saving Partitions" - GPT to MBR issue:

                      The problem with it is the program get’s stuck. So you’d never get a return code.

                      That’s where the timer comes into play. No exit code after a specified amount of time means you need to kill the hanging process and do fixparts, then retry.

                      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/

                      Tom ElliottT 1 Reply Last reply Reply Quote 0
                      • Tom ElliottT
                        Tom Elliott @Wayne Workman
                        last edited by

                        @Wayne-Workman I know where you’re headed, and I do understand. But I really think we’re “stuck” because it’s waiting for confirmation or input.

                        Programs typically don’t get stuck in that sense.

                        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

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post

                        218

                        Online

                        12.0k

                        Users

                        17.3k

                        Topics

                        155.2k

                        Posts
                        Copyright © 2012-2024 FOG Project