Image Creation Process

Document writer <olivier.nicolas@insa-lyon.fr>
v1.0, 2022-05-02

Process to prepare a device and create an image.

Step 1: Install OS

- Make the size of your image as small as possible (but still big enough to update/upgrade the system), and a round number of MiBs.
- The system is tailored to work on *nix systems only.


Examples of devices already installed on the platform:

NUC micro PCs

  • Set one partition up: "/" (1.5GB on debian, 3GB on mint; at time of write up).

  • Install through usual PC install process.

Jetson Nano

Jetson Nano Mate Cluster

  • To be done

Tinker Edge R

  • To be done (similar to Tinker Edge T)

Raspberry pis

Step 2: Set Device up

General Information/Requirements

  • optional:

    • configure locales

    • enable/setup or disable swap (left to user’s preference)

  • Mandatory

    • (apt-get) update/upgrade system

    • install:

      • rsync

      • prometheus-node-exporter

    • set admin user up

      • create user

      • set user up for passwordless sudo

      • copy proper .ssh/ configuration to admin’s home directory

    • remove temporary installation user (or pi user for raspberries)

Concrete Cases

NUC micro PCs

Jetson Nano

Jetson Nano Mate Cluster

Tinker Edge T

Raspberries

This section includes both the setup of the system and the image creation process.

A set of scripts were developed that take care of flashing the downloaded image, and setting everything up for both a client image and a raspberry development server image. It can be replicated/adapted for a production server.

The process involves swapping the microSD card back and forth between your computer and the pi. Description of the (mostly) automated image creation process:

  • Flash the base image to microSD card.

  • Increase the card’s root partition size to allow for update/upgrade of the OS.

  • Mount card once flashed to make modifications to the system:

    • Prevent the automatic card resize during first boot.

    • Copy setup files (.ssh, update script , admin user’s files).

    • Change network configuration from DHCP to static.

  • Swap card to pi and boot up:

  • Launch update script.

    • Update/upgrade the OS.

    • Create and setup the admin user.

    • Create gordon's ssh keys.

  • Remove user pi.

  • Retrieve gordon's ssh keys.

  • Swap card to PC

    • Create basic update image of minimal useful size (not the whole card).
      cf: Disk Information Retrieval

    • Copy image to create the final raspberry image.

    • Modify final image to:

      • Restore automatic resize process.

      • Copy gordon's public ssh key to .ssh/authorized_keys.

  • Flash that image to the microSD card to prepare the creation of the raspberry development server image.

    • Mount card’s root partition to make modifications:

      • Set gordon's home directory up.

  • Swap card to pi and boot up:

  • Launch update script.

    • Install server specific tools.

    • Create user gordon and set it up, using previously generated ssh keys.

  • Swap card to PC

    • Restore a few files

    • Create server image.

Step 3: Create/Flash Image

General Information

  • For non-raspberry devices

    • boot from live CD (in case of a "non-removable" drive) or remove installed "media" and plug it to your computer (As for the raspberry pi’s microSD card).

    • dd with "proper size" to external drive.

We need to know the last used sector on the disk so as not to dd the full drive but only the minimal/useful part.
See: Disk Information Retrieval