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

    Feature Request: Central software package cache for WinGet

    Scheduled Pinned Locked Moved Feature Request
    7 Posts 2 Posters 84 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.
    • W
      wbg
      last edited by

      Hi everyone,

      First of all, thank you for your great work on the FOG Project!

      I recently upgraded our school’s FOG server from 1.5.10 to 1.6.1 and am really impressed by the new features, especially the new FOG Agent and the integrated software management with WinGet. As a school IT administrator managing 138 Windows 11 computers, these improvements make my daily work much easier.

      Feature request: Central software package cache

      As far as I understand, each client currently downloads its installation packages directly from the internet when using WinGet. It would be very useful to have a central software package cache on the FOG server, similar to the existing agent update cache.

      Ideally:

      • The FOG server automatically checks for new software versions.
      • Each installer is downloaded only once and its integrity is verified.
      • Clients download the installers from the local FOG server.
      • Existing software management and reporting remain unchanged.
      • Outdated cached packages are automatically removed.
      • Caching can optionally be enabled per software package.

      This would significantly reduce internet bandwidth usage, especially in larger school environments.

      Is there already a way to achieve this with FOG 1.6.1? Is such a feature planned, or would you recommend using a separate local WinGet repository?

      Thanks again to the entire FOG team for developing and maintaining such a valuable open-source solution. The progress made with FOG 1.6 is really impressive!

      Best regards from Germany!

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

        @wbg 1.6.1 has no WinGet cache yet. Each Software entry has a Source field. The agent passes it to winget as --source. So you can point an entry at a local source today, but the client must already have that source registered.

        Two options now:

        • Chocolatey with an internal feed. A folder or a share is a valid Chocolatey source. Set the backend to Chocolatey and put the share path in Source.
        • A self-hosted WinGet REST source (for example rewinged), with installer URLs that point at a local web server. Register it on the clients with winget source add (a snapin works). Then put the source name in Source.

        A built-in cache on the FOG server is a reasonable request. We are tracking it here: https://github.com/FOGProject/fogproject/issues/2236

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

          @wbg The WinGet cache is built. It is on dev-branch now, and it reaches stable on December 11.

          How it works: the FOG server downloads the installer once. It checks each file against the SHA-256 in the WinGet manifest. Hosts then install from the FOG server, not from the internet, and WinGet checks the SHA-256 again before it installs.

          To use it:

          • Update the server to dev-branch and run the installer. The installer creates the cache folder (/opt/fog/softwarecache) and adds the PHP modules the cache needs.
          • Hosts need FOG Agent 0.1.31 or later. It is released, so agents that update from your server get it. An older agent ignores the cache and installs from the internet, as before.
          • Edit a WinGet entry and turn on Cache on this server. The edit page shows the cache state.
          • Keep the FOG Agent Release Sync service on. It runs the cache, on its normal schedule.

          Limits:

          • Only packages from the public winget source. The server shares the cached files over plain HTTP with no sign-in, so do not use it for a package that holds a license key.
          • The server keeps every installer variant that a version lists (x64, ARM, MSI, EXE), because WinGet picks one on each host. The files go in /opt/fog/softwarecache, and the server stops new downloads when less than 5 GiB is free. To use a bigger disk, mount it at that path and run the installer again.
          • If a check fails, hosts get the last cached version, with a warning in the Software Status details.

          Docs: https://docs.fogproject.org/en/latest/management/web/software/#caching-the-installer-on-the-fog-server

          If you test it, please post what you see here, good or bad.

          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

          W 1 Reply Last reply Reply Quote 0
          • W
            wbg
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • W
              wbg @Tom Elliott
              last edited by

              Hi @Tom-Elliott ,

              I switched our FOG server to dev-branch and started testing the new WinGet cache.

              Test environment:

              • FOG Server 1.6.1.349 (dev-branch)
              • FOG Agent 0.1.39
              • Ubuntu 22.04.5 LTS
              • 93 Windows 11 computers assigned to the 7-Zip software package
              • 165 GB of free disk space

              The upgrade completed successfully. All 12 FOG services are running, the required PHP extensions are installed, and the cache directories were created correctly.

              Issue: Cached installers are immediately removed

              I enabled caching for 7-Zip (Latest, Present, default source, architecture x64).

              All six installer variants of version 26.06 were downloaded successfully. However, the service immediately removed all six installers and the generated manifest.

              The final log entry was:
              Software cache: 6 downloaded, 0 failed, 7 removed

              The cache directories and the softwareCache database table are empty afterwards. The General tab also does not display any cache state information.

              I reproduced this behaviour multiple times.

              Possible root cause

              After investigating src/Agent/SoftwareCache.php, I noticed that _record() uses the named PDO parameter :now twice in the INSERT statement:
              :sha,:path,:state,:msg,:now,:now

              However, src/Db/PDODB.php explicitly disables prepared statement emulation:
              \PDO::ATTR_EMULATE_PREPARES => false

              I verified this behaviour with two read-only PHP/PDO queries directly on the FOG server:

              • SELECT :now, :now — SQLSTATE[HY093]: Invalid parameter number
              • SELECT :now, :cachedAt — OK

              My assumption is that the cache database record is not saved successfully. Consequently, _plan() finds no referenced manifests or installers, and _prune() removes all downloaded files.
              Using a separate parameter such as :cachedAt might resolve the issue.

              Additional findings

              LibreOffice caching currently reports:
              TheDocumentFoundation.LibreOffice: has package dependencies; caching is not supported for it yet

              Regular WinGet software management appears to continue working.

              Thank you again for your work on this feature.

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

                @wbg Thanks, your diagnosis is right, and the two PDO queries made it quick to confirm.

                The cause. The FOG database layer turns prepared statement emulation off, so MySQL refuses a statement that uses the same named placeholder twice. The cache record used :now for both the check time and the cache time. The database layer logs that error and carries on, so the service never saw it. That is why your log says 0 failed. With no row stored, the cleanup found nothing that needed the files and removed all six installers plus the manifest. That is the 7 removed.

                The fix. Each value now has its own placeholder. The same bug was in the code that records a closed user session, so that is fixed too. The test database now refuses a repeated placeholder the same way MySQL does, so this cannot slip through again.

                Fix: https://github.com/FOGProject/fogproject/pull/2317

                To test once it is on dev-branch. Update the server to dev-branch. No schema update and no agent update are needed. You do not need to clean anything up either, because the cache is already empty. On its next run the Release Sync service downloads 7-Zip again and keeps it. The General tab on the 7-Zip entry then shows the cache state.

                LibreOffice. That message is expected. A package with dependencies is not cached yet, so it installs from the internet as before.

                Thanks again for digging into the code. Please post what you see after the update.

                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

                W 1 Reply Last reply Reply Quote 0
                • W
                  wbg @Tom Elliott
                  last edited by

                  @Tom-Elliott The server-side cache is working perfectly now.
                  I have successfully cached five packages with 20 installers, totaling approximately 1.1 GB.

                  However, I encountered another issue during client-side testing.

                  Test environment:
                  FOG Server: 1.6.1.376 (dev)
                  FOG Agent: 0.1.39
                  WinGet: 1.29.380

                  All three assigned packages with caching enabled (7-Zip, Firefox ESR and VLC) fail with exit code 2316632068 (0x8A150004), while uncached packages update successfully.
                  Enabling LocalManifestFiles and restarting the agent did not resolve the issue.

                  I investigated the cached 7-Zip manifest and found:
                  ManifestType: merged
                  ManifestVersion: 1.28.0

                  I copied the original cached manifest to the Windows client and validated it independently of the FOG Agent:
                  winget validate --manifest “C:\Temp\7zip-test.yaml”

                  Result:
                  Manifest Error: Field value is not supported.
                  [ManifestType] Value: merged

                  I then changed the manifest type to singleton in a local test copy. This resulted in another validation error:
                  Error context: <root>[Installers]
                  Description: Array should contain no more than 1 elements.

                  The 7-Zip manifest contains six installer variants.
                  Looking at SoftwareCache.php, the rewriteManifest() function replaces the installer URLs but preserves the original manifest type and structure.

                  It appears that the merged CDN manifest may need to be converted into a supported local manifest format, possibly a multi-file manifest to preserve WinGet’s automatic installer selection.

                  The HTTP cache is accessible from the client, but I have not observed any installer downloads during the failed attempts.

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

                  56

                  Online

                  12.8k

                  Users

                  17.7k

                  Topics

                  157.6k

                  Posts
                  Copyright © 2012-2026 FOG Project