Skip to content

Instantly share code, notes, and snippets.

@lpenz
Created August 27, 2023 13:09
Show Gist options
  • Select an option

  • Save lpenz/ef21bb38a7aa12ebde17fa719a8546b5 to your computer and use it in GitHub Desktop.

Select an option

Save lpenz/ef21bb38a7aa12ebde17fa719a8546b5 to your computer and use it in GitHub Desktop.
custom.toml example for Raspberry Pi OS
# Raspberry PI OS config.toml
# This file is used for the initial setup of the system on the first boot, if
# it's s present in the boot partition of the installation.
#
# This file is loaded by firstboot, parsed by init_config and ends up
# as several calls to imager_custom.
# The example below has all current fields.
#
# References:
# - https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/master/usr/lib/raspberrypi-sys-mods/firstboot
# - https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/master/usr/lib/raspberrypi-sys-mods/init_config
# - https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/master/usr/lib/raspberrypi-sys-mods/imager_custom
# Required:
config_version = 1
[system]
hostname = "raspberrypi"
[user]
# If present, the default "rpi" user gets renamed to this "name"
name = "rpi"
# The password can be encrypted or plain. To encrypt, we can use "openssl passwd -5 raspberry"
password = "$5$pN7oRnie.WDOHoJY$aWEYmKUytN/S/bxMza5ksBiurbSJmcvcysBKHSmYa45"
password_encrypted = true
[ssh]
# ssh_import_id = "gh:user" # import public keys from github
enabled = true
password_authentication = false
# We can also seed the ssh public keys configured for the default user:
# authorized_keys = [ "ssh-rsa ... user@host", ... ]
[wlan]
ssid = "mywifi"
password = "$5$pN7oRnie.WDOHoJY$aWEYmKUytN/S/bxMza5ksBiurbSJmcvcysBKHSmYa45"
password_encrypted = true
hidden = false
# The country is written to /etc/default/crda
# Reference: https://wireless.wiki.kernel.org/en/developers/Regulatory
country = "IE"
[locale]
keymap = "gb"
timezone = "Europe/London"
@boelle
Copy link

boelle commented Jun 9, 2025

i gave up and used the imager tool for ssh enabled and a initial wifi config

after boot i added the extra wifi configs in /etc/NetworkManager/system-connections/

take care that owner/group is root and that the file is chmod 600 or else network manager will not load them

@gitbls
Copy link

gitbls commented Sep 11, 2025

This is pretty sweet, but definitely lacking in capabilities (e.g., static IP, and a bazillion other configuration options). sdm has a structured method of customizing pretty much everything (incl multiple networks, install apps, etc) and if there's something it happens to be missing, you can easily add your own customization code via a simple plugin.

sdm's key drawback is that the customization (sdm itself) runs on Linux (X64 and ARM32/64), Mac (via use of bash) and Windows (via Windows Subsystem for Linux (WSL)), and for best results requires using sdm to burn the resulting disk, since some host-specific changes are done after the burn has completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment