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

    Feature request: a way to handle USB Ethernet adapters shared between many hosts

    Scheduled Pinned Locked Moved Feature Request
    14 Posts 2 Posters 180 Views
    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.
    • L
      lperoma
      last edited by

      Hi all, and thanks for FOG.

      We run it in a school (about 280 hosts, FOG 1.6.0.14) and we have a problem that I think many schools with laptops share. A lot of our laptops have no Ethernet port, so for imaging we plug in a USB Ethernet adapter and PXE boot from it. The same few adapters get moved from laptop to laptop, and since FOG identifies a host by the MAC it boots with, it always sees the adapter’s MAC and therefore always the same host.

      What we do today is move that MAC by hand: delete it from the previous host, add it to the laptop we are about to image, and mark it as primary. It works, but it is easy to forget a step. If the MAC stays on two hosts, getHostByMacAddresses falls back on the primary flag, and if that does not settle it, the log shows multiple hosts.

      The ignore flags don’t help either. From what I read in parseMacList (I might be wrong), IMI / IMC are looked up across all the rows with that MAC, not per host, so marking the adapter as ignored for imaging on one host hides it for everybody, including the laptop you actually want to image.

      What would make this much easier is some way to tell FOG that a MAC belongs to a shared or removable adapter. When a MAC flagged like that PXE boots, FOG would not bind it to a fixed host, but let you choose the host at boot (a list of hosts that have a task queued, or typing a hostname), or pick the one that has a pending task. Another option would be to let a task carry the MAC it should be matched with, only for that task, so you could schedule the deploy for the laptop with the adapter’s MAC and nothing else would need to change in the host.

      Another way to look at it, which might be simpler to build: let us define a MAC as an installation MAC (or “multi-host” MAC), one that is allowed to be linked to a host only for the duration of a task. You would attach it to the laptop you are about to image, run the deploy or capture, and when the task finishes FOG would detach it automatically, so it is free for the next machine and never ends up on two hosts at once. That would also remove the need for the ignore flags in this case, since the MAC would only live on a host while a task is running.

      I’m happy to test anything on our side. And if there is already a recommended way to handle shared USB adapters that I have missed, I’d be glad to hear it.

      Tom ElliottT 2 Replies Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott @lperoma
        last edited by

        @lperoma 1.6.0 can already identify a host by its firmware instead of its MAC. That is the case a shared USB adapter breaks.

        At boot, iPXE sends the SMBIOS UUID, the system serial, the board serial and the asset tag. The server matches them against the inventory of every host. The setting FOG Configuration > FOG Settings > FOG_HOST_IDENTIFY_SMBIOS controls what happens with the result:

        • off: the MAC decides, as before.
        • log (the default): the MAC still decides. Each disagreement goes to the web server error log as a FOG host identity line.
        • enforce: when the firmware points at exactly one host, that host wins over the MAC.

        Set it to enforce. Then a laptop that FOG already knows by its firmware boots as itself, even with the adapter’s MAC. No MAC moves by hand, and the adapter MAC on another host no longer matters for that boot. A tie (for example two VMs with one UUID) is never trusted. FOG falls back to the MAC in that case.

        The precondition: each laptop needs its firmware identity in its host’s inventory. A full FOS inventory or a full registration stores it.

        One gap we know about: registering a brand-new laptop through an adapter whose MAC is already on another host. The MAC finds the other host first, so registration says “already registered”. We are looking at that case now. If you can test enforce on a few laptops that are already registered, the FOG host identity lines in the Apache/PHP error log show what FOG decided for each boot.

        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

        L 1 Reply Last reply Reply Quote 0
        • Tom ElliottT
          Tom Elliott @lperoma
          last edited by

          @lperoma A follow-up. While I checked this case, I found a bug that affects shared adapters. It is now fixed.

          The bug: at each boot, FOG records the firmware identity onto the host it resolved. With a shared adapter, the MAC resolves to the host the adapter is registered on. So the laptop that booted wrote its UUID onto that other host. In the default log mode this happened on every boot through the adapter. Over time, it corrupts the identity data that enforce mode matches on.

          The fix: FOG now compares the serial numbers first. When the stored system serial and the reported one differ, it is a different machine. FOG writes nothing to that host and logs one FOG host identity line that says “another machine, nothing recorded”. A motherboard swap that keeps the service tag still updates the UUID as before.

          To get it: the fix is on the patches channel (dev-branch, PR #2100). Run the updater on that channel, or wait for the next release.

          After you update: run a full inventory on any host that a shared adapter booted as. That puts its own serials and UUID back. Then enforce matches each laptop reliably.

          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

          L 1 Reply Last reply Reply Quote 0
          • L
            lperoma @Tom Elliott
            last edited by

            @Tom-Elliott Thanks so much!

            1 Reply Last reply Reply Quote 0
            • L
              lperoma @Tom Elliott
              last edited by

              @Tom-Elliott Thanks a lot, Tom. I tested it today on 1.6.0.14, with the two files from PR #2100 applied by hand (SmbiosIdentity.php and IpxeBootMenu.php) and FOG_HOST_IDENTIFY_SMBIOS set to enforce.

              I used two Proxmox VMs, both already registered, each with its own UUID. I gave one of them the MAC of the other and booted it by PXE. The menu said Host is registered as bios-test!, which is the right one, and the log shows what happened:

              FOG host identity (enforce): MAC resolved "uefi-test" (id 658); SMBIOS resolved "bios-test" (id 659) on sysuuid=795efc04-...; SMBIOS wins
              

              Both inventories were left alone and the MAC stayed on the first host. Without the patch the same thing overwrote the UUID of the host that owned the MAC, as you described.

              I also hit the gap you mentioned, with a machine FOG did not know yet. Before registering the second VM I gave it the MAC of the first, and FOG took it for the first host. The agent did the same: the enrollment request of the second VM got attached to the first host (reason known-host-no-agent). I don’t know if that last part is worth a look on your side.

              I have only tested VMs so far. The real case is a few laptops that share one USB adapter,

              Tom ElliottT 2 Replies Last reply Reply Quote 0
              • Tom ElliottT
                Tom Elliott @lperoma
                last edited by

                @lperoma Thank you for testing this so thoroughly. The SMBIOS wins line and the untouched inventories are exactly the expected result.

                The agent part is worth a look, yes. Agent enrollment falls back to the MAC when the firmware matches no host. So an unregistered machine with a known MAC lands on that MAC’s host. Within the deploy window after an image (FOG_AGENT_ENROLL_DEPLOY_WINDOW, 24 hours by default), that request can be approved without an admin click. I am fixing that so a machine whose serial contradicts the host is never bound to it by MAC.

                Until the fix is out, set FOG_AGENT_ENROLL_DEPLOY_WINDOW to 0 if you image through shared adapters. Every enrollment then waits for an approval or a token.

                Your last post looks cut off after “a few laptops that share one USB adapter,”. Did you mean to add more?

                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 @lperoma
                  last edited by

                  @lperoma The agent fix is done (PR #2104).

                  What changes: suppose the firmware of an enrolling machine matches no host, and only its MAC finds one. If the machine’s serial contradicts the serial stored for that host, FOG no longer binds it as that host’s first agent. The request is recorded as an identity conflict. The deploy window never approves a conflict, so it waits for an admin. An admin can still approve it on purpose, for example after a real motherboard swap. The directory identity check treats the same case as a conflict too.

                  What does not change:

                  • An enroll token still approves the request. A token is an admin’s explicit vouch.
                  • A host with no inventory row has no stored serial to compare, so its MAC still binds as before. Run a full inventory on hosts that share an adapter.
                  • A request that was already pending before you update keeps its old reason. Deny any such request that you do not recognize.

                  To get it: it reaches the patches channel when the PR merges. After you update, you can set FOG_AGENT_ENROLL_DEPLOY_WINDOW back to its default (24) if you set it to 0.

                  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

                  L 1 Reply Last reply Reply Quote 0
                  • L
                    lperoma @Tom Elliott
                    last edited by

                    @Tom-Elliott Thanks a lot Tom, that was fast.

                    I’m still on 1.6.0.14, and I couldn’t apply #2104 by hand like I did with #2100: it patches MachineIdentity.php, which doesn’t exist in my version, and the change in Enrollment.php calls it. So I’ll wait for the update instead. Do you know which stable release is expected to include it?

                    I’ll also run a full inventory on the hosts that share an adapter, as you suggest, so they have a serial stored. And I’ll report back once I’ve tried it with real laptops.

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

                      @lperoma The next stable will be auto promoted from dev-branch -> stable on December 11th at some point in the day.

                      11th of every month is when dev-branch fixes get pulled into stable.

                      As to the “Version” it will be, it’s however many commits since.

                      Right now .14 means there were 14 commits after master containing 1.6.0, 158 is the current stable branch meaning 158 total commits since it’s original release.

                      Some months will be less, some will be much more.

                      If you wanted you can install dev-branch but I understand the feeling of “well it’s not stable”.

                      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

                      L 1 Reply Last reply Reply Quote 0
                      • L
                        lperoma @Tom Elliott
                        last edited by lperoma

                        @Tom-Elliott

                        Thanks for #2104. The case that is still open for us is PXE registration and the PXE menu.

                        A new laptop (not in FOG) boots through the shared USB adapter whose MAC is still on another host Y. Its firmware matches no host, so FOG falls back to the MAC and answers “This machine already registered as Y”.

                        Could the identification order be simply this? Always check UUID and serial first. Use the MAC only when the machine reports no usable firmware data (empty or placeholder values). If it does report firmware data and it matches no host, it is a new machine: offer registration, without moving any MAC and without giving the new host the adapter’s MAC.

                        It could be a new value of FOG_HOST_IDENTIFY_SMBIOS so enforce stays as it is.

                        We understand that iPXE already sends the UUID and serial numbers with every PXE request (sysuuid, sysserial, mbserial), also when booting through a USB adapter, since the firmware is read from the laptop and not from the NIC. Please correct us if that is wrong for registration.

                        In our case the laptops that boot only through a USB adapter are recent and always report UUID and serial.

                        Happy to test a patch.

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

                          @lperoma 1.6.0.14 is an early 1.6.0 build. The current stable release is 1.6.0.158 (November 11), and it has MachineIdentity.php. #2100 and #2104 are on the patches channel now. They reach stable with the next monthly release on the 11th.

                          On the registration question: yes, iPXE sends sysuuid, sysserial and mbserial with every boot, through any NIC. They come from the laptop’s firmware, not from the adapter.

                          PR #2111 adds what you asked for, as a new value for FOG_HOST_IDENTIFY_SMBIOS: register. It works like enforce, plus one rule. Suppose a laptop boots on an adapter whose MAC belongs to host Y, and the laptop’s serial is different from Y’s stored serial. Then:

                          • The boot shows the “not registered” menu, so the laptop never runs Y’s task.
                          • Registration creates a new host for the laptop. Y keeps its MAC.
                          • The new host gets a generated MAC that starts with 02:. During a task, FOS identifies itself to the server by the host’s MAC, so every host needs one of its own. The network never sees the generated MAC.
                          • After that, the laptop is found by its firmware through any adapter.

                          Two things to know:

                          • Y needs a stored serial, so run a full inventory on hosts that share an adapter. With no stored serial, the MAC still decides.
                          • In register mode, a motherboard swap that changes the system serial looks like a new machine.

                          It is on the patches channel now. It reaches stable with the next monthly release on December 11.

                          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

                          L 2 Replies Last reply Reply Quote 0
                          • L
                            lperoma @Tom Elliott
                            last edited by

                            @Tom-Elliott

                            Quick update: we’ve tested PR #2111 and it works perfectly for us.

                            Setup

                            • We also updated from 1.6.0.14 to 1.6.0.158 (stable).
                            • On top of it we applied #2100, #2104 and #2111 by hand (we skipped the schema 462 step, since it only changes a setting description).
                            • FOG_HOST_IDENTIFY_SMBIOS is set to register.

                            Test (two Proxmox VMs)

                            We moved the MAC of an already registered host onto a different machine. The machine with the different serial was not taken for the registered host: it booted as unregistered and registered as a new host, and the original host kept its MAC. Exactly the shared USB adapter case from this thread.

                            Real laptops with the shared adapter are the next step, and I’ll report back if anything behaves differently. We’ll switch to the stable release on December 11.

                            Thanks, Tom, this solves our problem.

                            1 Reply Last reply Reply Quote 0
                            • L
                              lperoma @Tom Elliott
                              last edited by

                              @Tom-Elliott

                              Hi Tom, thanks again for the shared-adapter work.

                              We hit a case with the new agent that your replies in this thread don’t spell out, and while reproducing it we found a few more things, so here are the details.

                              Setup: FOG 1.6.0.158 stable with #2100, #2104 and #2111 applied by hand, FOG_HOST_IDENTIFY_SMBIOS=register, agent 0.1.24, Windows 10 IoT LTSC images, HP laptops that boot from the shared USB-C Ethernet adapter.

                              What worked yesterday and what doesn’t today: yesterday, with #2104 and #2111 already applied, we tested two VMs with a duplicated MAC and FOG handled it fine at PXE (register, firmware first). Today, when we reinstall hosts whose firmware is already registered, it is the agent’s enrollment that fails when a MAC belongs to another host.

                              The laptop that could never enroll

                              The laptop’s host has a full inventory (system serial, UUID, board serial), and no other host has any of those values. Boot worked: PXE identified it correctly through the shared adapter, since in register a unique firmware match wins over the MAC. But the agent tried to enroll every 5 minutes and always got HTTP 409 with status "error", 16 times in a row. Each attempt left this in faults-web.log:

                              Database save failed: Class: AgentEnrollment ... SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`fog`.`agentEnrollment`, CONSTRAINT `fk_agentEnrollment_aeHostID` FOREIGN KEY (`aeHostID`) REFERENCES `hosts` (`hostID`) ON DELETE CASCADE)
                              

                              The agent sends two MACs: the shared adapter’s, still stored on another laptop’s host, and one of its own that no host had. Reading the code, MachineIdentity::choose() returns conflict with host_id 0 when the firmware points to one host and a MAC points to a different one. Enrollment::enroll() then sets the reason to conflict and saves the row with hostID 0, which doesn’t exist in hosts, so the foreign key fails and nothing is stored. Nothing shows up in All Pending Agents, so the admin never sees it. The agent enrollment code only checks whether the setting is off, so register and enforce make no difference there.

                              We worked around it by deleting the adapter’s MAC from the other host. The very next attempt enrolled fine (known-host-no-agent).

                              Reproducing it with a VM

                              We gave a VM the MAC of another VM’s host (approved, hmPending=0). Its firmware UUID names its own host. This time the conflict was stored: All Pending Agents shows it as identity-conflict (the enroll got a 202) and the agent logs:

                              directory rejoin: this machine's MAC addresses or SMBIOS identity match more than one FOG host; ...
                              this state was made on another machine (a cloned or reimaged disk); generated a new key and enrolling as this machine
                              pending approval on the server (identity-conflict); waiting
                              

                              That row has no _directoryIdentity. After the agent restarted, every enroll got HTTP 409 with status "error" again, but with no database error in faults-web.log. We approved the pending row, restarted the VM, and the agent still gets 409 while the row stays issued with its certificate uncollected. As far as we can tell from MachineIdentity::enrollmentGate(), it returns upgrade_blocked: the stored row doesn’t have _directoryIdentity and the new request declares it, and that check runs before the row’s state is looked at. We haven’t confirmed that part on the agent side.

                              So the same mismatch seems to end in two different 409 loops. If the agent declares the directory-identity feature from its first contact (the laptop, whose rows all have {"required": true}), the conflict goes through MachineIdentity::resolve() and ends with host 0 and the foreign key error. If it doesn’t declare it at the first contact (the VM), the conflict is stored, but the agent is locked out as soon as it starts declaring it, even after the admin approves.

                              What we expected

                              A shared MAC shouldn’t be a conflict at all when the firmware identifies a different machine, which is what enforce/register already do at boot. So:

                              1. Could agent enrollment follow the same rule as boot, so that a unique firmware match wins over the MAC?
                              2. If a conflict is meant to apply there anyway, the row should be saved with the host the firmware matched (or none) instead of host 0, so it doesn’t fail on the foreign key.
                              3. All Pending Agents only shows the Windows name, the reason, the IP and the UUID. It would help to show which host the conflict is with, so the admin can tell it’s another machine before approving.
                              4. Approving a conflict should let the agent collect its certificate, even if the stored row was created before the agent started declaring the feature.

                              Happy to send full log lines or test a patch. We’re posting a second, unrelated problem (the “Clear directory operation review” button leaving a host unable to join) separately.

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

                                @lperoma Thanks for the detail. There are two server fixes and one agent fix.

                                Please update instead of copying files this time. This fix changes the database (schema step 465), and the code depends on it. Copied files without that step make enrollment saves fail in a new way. Your server is also now several changes past 1.6.0.158. Run the updater on the patches channel. It installs the files and runs the schema update together. Or wait for the stable release on December 11.

                                Server (FOG PRs #2116 and #2118):

                                • Agent enrollment now follows the boot rule for a shared adapter. The firmware names one host, and the adapter’s MAC is on another host. If that other host’s stored serial differs from the reported serial, the firmware’s host wins. Your laptop then enrolls as its own host, with the normal “known-host-no-agent” reason.
                                • The firmware host must match the serial too. A copied UUID alone never wins over a MAC.
                                • Any other disagreement stays an identity conflict. The row is now saved with no host, instead of host 0, so the foreign key no longer refuses it. The agent gets “pending”, not 409, and the row shows in All Pending Agents.
                                • For a conflict, All Pending Agents now shows which other host has the MAC. After you remove the cause (for example the stray MAC), the next agent poll binds the request to the right host. Then you approve it. A conflict is never approved automatically, not by a token and not by a recent deploy (#2118 closes this for older agents too).

                                Agent (fog-agent PR FOGProject/fog-agent#52): a key whose first request went in without the directory feature cannot add the feature later. That is deliberate on the server. The agent now makes a new key once when the server answers enrollment_upgrade_requires_new_key, and enrolls again. This is in agent v0.1.28. Agents update to it on their own.

                                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

                                31

                                Online

                                12.8k

                                Users

                                17.7k

                                Topics

                                157.5k

                                Posts
                                Copyright © 2012-2026 FOG Project