{"id":15406304,"url":"https://github.com/jantman/raspberry-pi-imager","last_synced_at":"2026-02-07T00:13:11.849Z","repository":{"id":176362926,"uuid":"655815839","full_name":"jantman/raspberry-pi-imager","owner":"jantman","description":"An example/template for baking a base Raspberry Pi image using Packer and pre-seeding a script for further customization.","archived":false,"fork":false,"pushed_at":"2024-08-25T12:17:34.000Z","size":40,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-18T14:07:38.984Z","etag":null,"topics":["packer","raspberry-pi","raspberrypi"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jantman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-19T16:52:47.000Z","updated_at":"2024-09-22T07:44:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"89cb6760-c5e7-4fae-9ede-fbd7d9c7b1eb","html_url":"https://github.com/jantman/raspberry-pi-imager","commit_stats":null,"previous_names":["jantman/raspberry-pi-imager"],"tags_count":13,"template":true,"template_full_name":null,"purl":"pkg:github/jantman/raspberry-pi-imager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jantman%2Fraspberry-pi-imager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jantman%2Fraspberry-pi-imager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jantman%2Fraspberry-pi-imager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jantman%2Fraspberry-pi-imager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jantman","download_url":"https://codeload.github.com/jantman/raspberry-pi-imager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jantman%2Fraspberry-pi-imager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29181271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T23:15:33.022Z","status":"ssl_error","status_checked_at":"2026-02-06T23:15:09.128Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["packer","raspberry-pi","raspberrypi"],"created_at":"2024-10-01T16:20:49.577Z","updated_at":"2026-02-07T00:13:11.844Z","avatar_url":"https://github.com/jantman.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# raspberry-pi-imager\n\n[![Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows.](https://www.repostatus.org/badges/latest/inactive.svg)](https://www.repostatus.org/#inactive)\n\nAn example/template for baking a base Raspberry Pi image using [Packer](https://www.packer.io/) and pre-seeding a script for further customization.\n\n## Why and What?\n\nI've got a bunch of Raspberry Pis, as does a local non-profit that I work with. Setting up a new Pi involves a lot of identical steps to get the image ready, and then some device-specific steps to set the hostname, generate SSH keys, etc. Frankly, all of this is a pain, especially when you're setting up a bunch of Pis or something goes wrong and you want to re-image. This repo is intended to reduce much of that work.\n\nWe use [HashiCorp Packer](https://www.packer.io/) and the [ARM image plugin](https://github.com/solo-io/packer-plugin-arm-image) to download an official Raspberry Pi OS image and then add in our own customizations, such as WiFi configuration, timezone, locale, default username/password, etc. As opposed to just mounting the image and adding files to it, the ARM image plugin uses `qemu-arm-static` emulation and a [chroot](https://en.wikipedia.org/wiki/Chroot) into the image to allow us run native commands inside the Pi OS such as `apt install` and `raspi-config`.\n\nThe final step of customization is seeding a customization script into the image. Once the image is written to a SD card and put in a Pi, this script will be run interactively as root to perform the device-specific customization.\n\n## Getting Started (Forking)\n\n1. Fork this repository to a **private** repository.\n2. Configure as described in [Configuration](#configuration), below.\n\n## Usage\n\n1. Obtain the newest base image, either via the \"Releases\" for this repository (if used) or via [Building Locally](#locally).\n   * If downloading from GitHub Releases, be sure to download both the `.img.tar.gz` and `.img.sha256sum` files. First extract the image (`tar -xzvf 2023-05-03-raspios-bullseye-arm64-lite_custom.img.tar.gz`) and then verify its checksum (`sha256sum -c 2023-05-03-raspios-bullseye-arm64-lite_custom.img.sha256sum`).\n2. Plug a SD card into your computer and note the device (``/dev/sdX`` in the next step) that it's assigned to (i.e. via `sudo dmesg`).\n3. Write the image from Step 1 (``foo.img`` in this example) to the SD card: ``sudo dd if=foo.img of=/dev/sdX bs=4M conv=fsync status=progress``\n4. Put the SD card in the Pi and boot it up. Either watch the on-screen output or your network's DHCP server to find its IP address.\n5. SSH to the Pi with the default username and password (`pi:raspberry` in this repo) and `sudo su -` to root.\n6. Run `./configure-pi.sh` to set the hostname, change (if desired) the password for the default user, create root SSH keys, and be prompted to update packages and reboot.\n7. Follow your specific post-installation steps (such as adding the root SSH key to a private GitHub repo and configuring via Puppet).\n\n## Configuration\n\nNote that while Packer used JSON templates in early versions, it now uses HCL2 and certain new features _require_ HCL templates. See [HCL Templates | Packer](https://developer.hashicorp.com/packer/docs/templates/hcl_templates) for more information.\n\nFor configuring the WiFi SSID and passphrase, default username and password, and other variables in the `.pkr.hcl` files:\n\n* **If building locally,** copy [variables.auto.pkrvars.EXAMPLE.hcl](variables.auto.pkrvars.EXAMPLE.hcl) to `variables.auto.pkrvars.hcl` and edit its content. Note that this file is in [.gitignore](.gitignore) by default.\n* **If building via GitHub Actions**, define [repository secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) with the appropriate names for each required variable: ``PKR_VAR_wifi_name``, ``PKR_VAR_wifi_password``, ``PKR_VAR_default_username`` and ``PKR_VAR_default_password``.\n\n## Building Base Images\n\nThe first step is to build a base image, which will be written to the SD card for every Pi we manage. This can either be done locally, or via [GitHub Actions](https://docs.github.com/en/actions) automatically every time the repository is changed and then saved as a Release on the repository. The latter is recommended as it will preserve the image in one central place (GitHub Releases), but note that this should **only be used on private repositories**.\n\n### GitHub Actions\n\n**IMPORTANT: ONLY USE ON PRIVATE REPOSITORIES!** This will expose your Pi username/password, WiFi SSID and passphrase, and everything else in the image to anyone who can access the repository. This is ONLY recommended for private repos!\n\nJust push a new commit to the repo and it will be built. If it's on the `main` branch, it will be uploaded as a Release.\n\n### Updating to the Latest Raspberry Pi OS\n\nRun `./update_raspios.sh` to automatically update `32bit.pkr.hcl` and `64bit.pkr.hcl` to the latest Raspberry Pi OS Lite release. The script fetches the newest image listing from `downloads.raspberrypi.com`, retrieves the SHA256 checksum, and updates the `iso_url`, `iso_checksum`, `output_filename`, and post-processor output paths in both files. If the files already reference the latest release, no changes are made.\n\n### Locally\n\nTo build locally with Docker, run `./build_docker.sh` which is based on the example in the [packer-plugin-arm-image README](https://github.com/solo-io/packer-plugin-arm-image#running-with-docker) with slight modifications. **NOTE** that `./packer_cache/` will contain root-owned files.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjantman%2Fraspberry-pi-imager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjantman%2Fraspberry-pi-imager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjantman%2Fraspberry-pi-imager/lists"}