admrl device exit
:::note Private beta
admrl device exit is in private beta. To use it, contact Admiral. Leaving by hand works on every device today and does not depend on this command. See Leaving by hand.
:::
admrl device exit replaces a device's whole disk with an image you name, without anyone at the device. The device downloads the image, checks its hash, and writes it over its own disk from the first sector. When the write finishes, Admiral removes the device from your organisation and the device reboots into your image.
The workload stops when the device reboots into exit mode. The download is written to the end of the disk, which destroys the end of the workload volume. Copy your data off before you start.
Before You Start
- Host the image. Any disk image the device can download over HTTPS. A pre-signed URL works. The device keeps the full URL only on its own disk and in memory. Every report, log line and audit record shows the URL without its query string or credentials.
- Compute the SHA-256. Of the file exactly as the server delivers it. For a compressed image, that is the hash of the compressed file.
- Use a supported format. Raw, gzip, zstd or xz. The device recognises the format from the file contents, not from the file name.
- Check the image fits. The decompressed image must be no larger than the device's disk. You can pass
--sizewith the decompressed size in bytes. If you leave it out, the device counts the size while it downloads, and refuses to write if the image turns out larger than the disk. - Check the device has enough RAM. See Memory.
- Check the device can reach the image. The device must be online and have a route to the image host. Sites that can only reach the Admiral relay have no route out, and should use Leaving by hand.
- Have the permission to remove the device. You need the same permission as for removing a device.
Memory requirement
The device runs from RAM while it writes, because the disk it runs from is the disk being overwritten. It needs at least:
size of the active boot slot + data used on ADMRL-DATA + 512 MB
With the default 600 MB boot slot, that is more than 1.1 GB plus whatever ADMRL-DATA holds. The command prints the required and available amounts when it starts, and refuses to continue if the device has too little.
Syntax
admrl device exit <device> --image URL --sha256 HEX [--size BYTES] [--yes]
admrl device exit <device> --confirm | --abort | --retry | --status
| Flag | Meaning |
|---|---|
--image URL | HTTPS URL of the image. Plain http is refused unless the host is a private or loopback address, for a mirror on your own network. |
--sha256 HEX | 64 lowercase hexadecimal characters: the hash of the file as the server delivers it. |
--size BYTES | Optional. Decompressed size of the image in bytes. |
--yes | Confirm automatically once the image is staged and verified. Without it, the command asks you first. See Confirming the write. |
--confirm | Confirm a staged image. For a second operator, or after you detached. |
--abort | Cancel the exit before the write starts. |
--retry | Download the image again after a failed hash check. |
--status | Print the current phase and progress. |
<device> accepts a name or an ID, as in the rest of the CLI.
What Happens
The command arms the device, then follows it through each phase. The device is the authority on the phase, and every phase shows in the command's output as it happens.
| Phase | What is happening |
|---|---|
| armed | The device passed its checks and has been told to exit. It saves the request and reboots. The workload stops at this reboot. |
| staging | The device is running from RAM with the workload, OS updates and the main partition all switched off. It downloads your image to the end of the disk and verifies it. If the download is interrupted it resumes where it left off. |
| verify_failed | The downloaded image does not match your SHA-256. Nothing has been written to the start of the disk. Retry the download or abort. |
| staged | The image is downloaded and verified. The device is waiting for you to confirm. |
| writing | The device is writing your image over the whole disk, starting at the first sector. Progress is reported every few seconds. This phase cannot be aborted. |
| written | The write finished and the disk's partition table was re-read. Admiral removes the device from your organisation, deletes its escrowed disk key, and the device reboots into your image. |
| write_failed | The write failed part way. See If the write fails. |
| aborted | You cancelled before the write started. The device returns to Admiral OS. |
Before arming, the device checks that its OS build supports exit, that it has enough RAM, that the image URL answers and reports a size, and that the image fits the disk. If any check fails, it reports the reason and changes nothing.
Start an exit
admrl device exit my-device \
--image https://images.example.com/my-os-image.img.xz \
--sha256 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
The command prints the preflight result, then streams the phases until the image is staged.
Confirming the write
When the phase reaches staged, the command stops and asks:
Type the device name to erase it
Type the device name to start the write.
With --yes, the device confirms by itself as soon as the image is verified. This works even if the device loses its connection to Admiral before that point: the device confirms from the request it saved, and no timeout applies. Use --yes only when you are certain of the image and the device.
You can also confirm from another terminal, or hand over to a colleague:
admrl device exit my-device --confirm
Ctrl-C detaches, it does not abort
Pressing Ctrl-C stops the command from following the device. The exit carries on on the device. Check on it with:
admrl device exit my-device --status
Abort
admrl device exit my-device --abort
You can abort in armed, staging, verify_failed and staged. The device deletes its exit request and reboots into Admiral OS. It stays in your organisation.
Staging has overwritten the end of the workload volume. After an abort, the device may find the volume damaged and reformat it. The workload then deploys again from the fleet configuration. Data on the workload volume may be lost.
Retry
If the phase is verify_failed, check the --sha256 value and the file at the URL, then download again:
admrl device exit my-device --retry
If the write fails
If the write fails after it started, the device reports write_failed with the error and the disk offset it reached. It stays up in RAM so you can read the error. You cannot abort. The disk no longer holds a working Admiral OS, and the only recovery is to reflash the device from USB. See Leaving by hand.
Boot attempts
The device counts how many times it has booted into exit mode. After three attempts it ignores the request and boots Admiral OS normally, so a bad request cannot trap a device in a reboot loop.
What Happens to the Device Record
When the phase reaches written, Admiral removes the device from your organisation: the device record, its identity and access grants, its secret files and its escrowed disk recovery key are deleted, and a fleet.node.removed webhook is sent. See Removing the device for what removal does. You do not need to remove the device yourself.
If you abort, or the exit fails before the write, the device stays in your organisation.
Limits
- Online only. The device must be connected to Admiral Cloud for the command to arm it and report progress.
- Egress to the image host. Sites that reach only the Admiral relay, with no access to the image host, use Leaving by hand.
- One device at a time. Each device is armed with its own command. Exit as a fleet rollout is not available yet.
- Whole disk only. The command writes the disk that holds the active boot slot, and no other disk.