First Boot

This page documents the provisioning steps that run the first time OpenNMC starts.

Expected Flow

On first boot the system should:

  1. boot from the active root slot
  2. create the persistent userdata partition after the last root partition
  3. mount userdata
  4. bind /home onto persistent storage under userdata
  5. provision the onboard ESP32 if it is still blank or unprovisioned
  6. mark the booted RAUC slot as good once the system is up

The init-script sequence is:

  • S20userdata-part
  • S21home-on-userdata
  • S25espflash
  • S90rauc-mark-good

BusyBox init runs these scripts in numeric order during system startup.

The first managed login path is the console root account, after which the operator sets the password of the default admin user and can use the web UI.

Data That Should Survive Updates

  • datalogger data
  • configuration files
  • any user content explicitly stored in userdata
  • /home via the bind mount on persistent storage

During RAUC slot updates, the following existing data is copied forward into the new rootfs:

  • /etc/hostname
  • /etc/NetworkManager
  • /etc/ssh
  • /etc/nut
  • /var/lib/seedrng

The user migration hook also preserves managed users, groups, and passwords for local accounts with UID >= 1000. No additional per-user directories are migrated by the current hooks beyond the account database and copied config paths.

Implementation

  • userdata is created by sgdisk -N=4 /dev/mmcblk1 and formatted as ext4, so its size is the remaining free space after partition 3
  • the ESP32 flash step is automatic unless the factory-flash script determines the module is already provisioned
  • the RAUC slot hook chain is driven by /etc/rauc/pre-install.sh, /etc/rauc/post-install.sh, and the hooks under /etc/rauc/migrate.d