• General
  • Prefetching the factory image file to use later with the web installer

I want to install GrapheneOS on a Pixel using an existing GrapheneOS device and the web installer. I don't have access to another device to perform the installation using the command-line method.

I want to perform the installation at a remote location. I could use a public Wi-Fi network but the network is slow and takes a very long time to download the factory image file. I want to avoid the time it takes to wait for that download.

How can I prefetch the factory image file ahead of time and later use it in the Web installer when I am performing the installation?

  • de0u replied to this.

    gos8086238 How can I prefetch the factory image file ahead of time and later use it in the Web installer when I am performing the installation?

    I think that would require changes to the web installer. Obviously it's not mathematically possible for it to work from a local file, but it would be more code. And part of the point of the web installer is that the user doesn't need to make choices, e.g., "Do I press 'download' or 'open local file'?". And if a user can provide the wrong file, some user will do so. Overall I can imagine that adding the feature could harm more users than would be helped.

      You can try it, connect the phone pull the image, hibernate, disconnect the phone (once fully powered down) then resume on another network see what happens.

      Obviously I am not saying it will work, but it does not cost you much to try it. Report back afterwards.

        de0u And if a user can provide the wrong file, some user will do so. Overall I can imagine that adding the feature could harm more users than would be helped.

        It would be trivial for the installer to forbid the wrong file from being flashed.

        There are many GrapheneOS users that would benefit from a fast, private installation. If a user doesn't have access to a fast public Wi-Fi network, it's difficult to install GrapheneOS in a way that doesn't result in the device connecting to cellular towers (which leaks location and device identifiers) at a potentially sensitive location (such as a user's home).

        • de0u replied to this.

          0xsigsev

          I didn't mention this, but the overall goal here is to avoid having a Google Android phone (even in airplane mode) at my home and avoid a GrapheneOS device without airplane mode enabled at my home.

          I want to purchase a phone, connect the new device to a public Wi-Fi network (even a slow one) to enable OEM unlocking, install GrapheneOS from another GrapheneOS device, turn on airplane mode, and then go home.

          gos8086238 It would be trivial for the installer to forbid the wrong file from being flashed.

          I believe the source for the web installer is here: https://github.com/GrapheneOS/grapheneos.org/blob/main/static/install/web.html

          It refers to a script that does the heavy lifting: https://github.com/GrapheneOS/grapheneos.org/tree/main/static/js/fastboot/ffe7e270

          I suspect it is possible to run a personally-tweaked copy of the installer on whichever browsers are able to run the official installer from the project web site.

            de0u

            Those are the correct code links.

            de0u And if a user can provide the wrong file, some user will do so. Overall I can imagine that adding the feature could harm more users than would be helped.

            This is not possible.

            The web-install.js code already has logic that, after the factory image file has been downloaded, ensures the file name is correct before proceeding with flashing.

            https://github.com/GrapheneOS/grapheneos.org/blob/7a150800bd6d792ff69cd5655683297c05f43010/static/js/web-install.js#L291-L299

            This alone already be sufficient enough. Additionally, fastboot.js verifies the require board value within the android-info.txt file contained in a factory image file to ensure the destination device is correct.

            https://github.com/kdrag0n/fastboot.js/blob/5b613332aa9d66cca5bebb49f147cd084a76c464/src/factory.ts#L131-L185

            de0u I suspect it is possible to run a personally-tweaked copy of the installer on whichever browsers are able to run the official installer from the project web site.

            The code changes seem easy, and this feature request could be implemented in a way that doesn't complicate the user experience. I'd make a custom installer myself, but I don't have another device to test the flash process on. I also don't know if there are limitations with loading HTML and JS locally using file://. Those files might need to be served from an HTTP server to ensure correct behavior. That makes the process more complicated.

            For more context, the Pixel 9 factory image file is about 1.7 GiB. Downloading a file that large over a slow network connection can take a very long time. On a 200 KiB/s connection, the download would take almost 2.5 hours.

            I would create a feature request on Github for this, but I unfortunately don't have a Github account. If someone with a Github account sees value in this, I'd appreciate it if you could create a feature request.

            other8026

            That Github issue requests an offline web installer. That would be great, but I'm looking for a way to just prefetch the factory image file even an Internet connection is required later to perform the installation.

            You can already download an image and use it later via the cache for the web installer.

            That quote appears to refer to this BlobStore cache logic in the web-install:

            https://github.com/GrapheneOS/grapheneos.org/blob/7a150800bd6d792ff69cd5655683297c05f43010/static/js/web-install.js#L139-L155

            In order to have a factory image added to the cache, you'd need to already have a separate Pixel phone connected that matches the Pixel model you later want to install to. Is that correct? I don't see another way to add to the cache with the current code.