Skip to content

Device images

If you build devices from one disk image, such as gateways, kiosks, appliances or edge boxes, put Agent Functual in the image. Each device then enrolls itself on its first boot, with its own key and its own name. Your support team can reach any of them on demand, and none of them needs an open inbound port.

Never enroll the machine you build the image on. Every copy of an enrolled image shares one identity. Functual would flag the copies as clones, and you couldn’t tell them apart. With first-boot enrollment, the image only carries an install token, and each device makes its own key when it first starts.

First-boot enrollment is for Linux with systemd (amd64 and arm64). Windows and macOS images aren’t supported yet.

At my.functual.com, open Agents → Install and create a token:

  • Valid for: No expiry, or 1 year. Devices may sit in a warehouse for months before their first boot.
  • Machines: Several machines.
  • Label: the batch, for example Gateway batch 2027-03. A device that names itself (step 3) keeps its own name instead.

Use one token per production batch. Revoke it in Agents → Install once the batch has shipped and every device has come online. Devices already enrolled keep working; only new enrollments stop. If an image leaks, revoking its token is all it takes.

To cap the token at the batch size, create it with the API and set max_uses to the number of devices. expires_in_days: null makes it never expire.

On the machine or in the chroot you build the image from, as root:

Terminal window
curl -fsSL https://get.functual.com | sudo sh -s -- <token> --first-boot

This installs the agent and saves the token in /etc/functual/enroll-token, readable by root only. It does not enroll. It refuses a machine that is already enrolled. It works in a chroot or container build too, where you’re already root: leave out sudo (... | sh -s -- <token> --first-boot). The services are set up to start at first boot.

To install by hand instead, add the package from Functual’s repository, then write the token into /etc/functual/enroll-token as one line, mode 0600.

Without a name, every device shows up under the token’s label. To give each its own name, add --label with a template:

Terminal window
curl -fsSL https://get.functual.com | sudo sh -s -- <token> --first-boot --label "Acme Gateway {serial}"

The template is saved in /etc/functual/enroll-label and is the same in every copy of the image. Each device fills it in at its first boot:

Placeholder Becomes
{serial} The device’s hardware serial number: from the firmware (DMI) on x86, from the device tree on ARM boards such as the Raspberry Pi
{hostname} The device’s host name at first boot

So one image gives you Acme Gateway PF3ABCDE, Acme Gateway PF3ABCDF, and so on. Your support team can find a device by the serial number on its sticker, in the console or with functual ssh "Acme Gateway PF3ABCDE".

A device whose firmware reports no serial number, or only a placeholder such as “To be filled by O.E.M.” or all zeros, doesn’t enroll with a {serial} template, so you never get a batch with the same name. Check one unit of new hardware before you ship the batch. Names don’t need to be unique, and you can rename any device in the console.

  • Don’t boot the build machine again before you capture the image: if it boots with network, it enrolls itself.
  • Clear the machine ID so each device gets its own: truncate -s 0 /etc/machine-id (systemd makes a new one at first boot). Functual uses it to spot copied machines.
  • Give each device its own SSH host keys, so your team’s SSH clients can tell devices apart: delete /etc/ssh/ssh_host_* and let your distribution generate new ones at first boot.
  1. functual-enroll.service starts once the network is up, if /etc/functual/enroll-token exists and the device isn’t enrolled yet.
  2. The device makes its own key, fills in its name and enrolls with the token.
  3. It deletes the token file and starts the agent. The device appears in Agents, online.

After that, the enrollment service never runs again, also not after a reboot.

No network yet, or the clock is wrong? Devices without a battery-backed clock can boot with the wrong time until they sync it. The service tries again every 30 seconds until it succeeds, so a device that first boots offline enrolls as soon as it’s connected.

Token refused? If the token was revoked, has expired or is used up, the service tries once, logs why and stops until the next boot. The same applies to a name it can’t fill in. See the log with journalctl -u functual-enroll.

  • Console: Agents lists every device with its name, host name, system and when it last checked in. Search matches the name, so with a {serial} template you can search by serial number.
  • Command line: functual agents "Acme Gateway" lists the matching devices; functual agents --json gives scripts the full rows.

Then connect with the command line or the console. See Remote access for plans and network requirements: devices need outbound HTTPS (TCP 443) only.

Remote access is priced per connection your team has open at the same time, not per device. Free covers up to 250 devices with one connection at a time. Pro and Business have no device limit. See Remote access: Plans.