> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mirurobotics.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Reprovision a device

export const ProvisionerBadge = ({size = "md"}) => {
  return <Tooltip tip="Members with the provisioner role can execute this action." cta="Workspace roles" href="/admin/users/access-control">
            <Badge icon="bot" color="purple" size={size}>provisioner</Badge>
        </Tooltip>;
};

export const Framed = ({image, background, link, alt = "Framed content", borderWidth = "24px", outerRadius = "10px", innerRadius = "6px"}) => {
  const parseShorthand = value => {
    const values = String(value).trim().split(/\s+/);
    switch (values.length) {
      case 1:
        return [values[0], values[0], values[0], values[0]];
      case 2:
        return [values[0], values[1], values[0], values[1]];
      case 3:
        return [values[0], values[1], values[2], values[1]];
      default:
        return values.slice(0, 4);
    }
  };
  const isZero = v => parseFloat(v) === 0;
  const padding = parseShorthand(borderWidth);
  const outer = parseShorthand(outerRadius);
  const cornerMasks = [];
  if (isZero(padding[0]) && isZero(padding[3])) {
    cornerMasks.push(`radial-gradient(circle at 0% 0%, transparent ${outer[0]}, black ${outer[0]})`);
  }
  if (isZero(padding[0]) && isZero(padding[1])) {
    cornerMasks.push(`radial-gradient(circle at 100% 0%, transparent ${outer[1]}, black ${outer[1]})`);
  }
  if (isZero(padding[2]) && isZero(padding[1])) {
    cornerMasks.push(`radial-gradient(circle at 100% 100%, transparent ${outer[2]}, black ${outer[2]})`);
  }
  if (isZero(padding[2]) && isZero(padding[3])) {
    cornerMasks.push(`radial-gradient(circle at 0% 100%, transparent ${outer[3]}, black ${outer[3]})`);
  }
  const backgroundMask = cornerMasks.length > 0 ? cornerMasks.join(", ") : undefined;
  const innerImage = <img src={image} alt={alt} noZoom={link ? true : false} style={{
    display: "block",
    width: "100%",
    margin: 0,
    borderRadius: 0
  }} />;
  return <div style={{
    display: "inline-block",
    position: "relative",
    borderRadius: outerRadius,
    overflow: "hidden"
  }}>
            {}
            {background && <div style={{
    position: "absolute",
    inset: 0,
    backgroundImage: `url(${background})`,
    backgroundSize: "cover",
    maskImage: backgroundMask,
    WebkitMaskImage: backgroundMask,
    maskComposite: "intersect",
    WebkitMaskComposite: "source-in"
  }} />}
            {}
            <div style={{
    position: "relative",
    padding: borderWidth
  }}>
                <div style={{
    borderRadius: innerRadius,
    overflow: "hidden",
    lineHeight: 0
  }}>
                    {link ? <a href={link}>{innerImage}</a> : innerImage}
                </div>
            </div>
        </div>;
};

<Framed background="https://assets.mirurobotics.com/docs/v04/images/devices/background.jpeg" image="https://assets.mirurobotics.com/docs/v04/images/devices/provisioning/header:reprovision-dialog.png" innerRadius="12px" outerRadius="16px" />

Reprovisioning a device is the process of reassociating a physical machine with a Miru device. This can be the same physical machine that the Miru device was initially provisioned on, or a different physical machine.

Reprovisioning a Miru device does the following:

1. Invalidates the device's current authentication session.
2. Creates a new authentication session for the device.
3. Redeploys the device's current deployment.

If you reprovision a Miru device on a different physical machine, the old machine's authentication session is immediately invalidated and no longer connected to your workspace.

Reprovisioning fully maintains the device's deployment history in Miru. After reprovisioning, the device's deployment history picks up where it left off before reprovisioning occurred.

## Use cases

Reprovisioning a device is useful for:

* Removing the `miru-agent` and cleanly reinstalling it
* Transferring a Miru device to a different physical machine

Reprovisioning is NOT meant to be used to upgrade the `miru-agent` package. If you simply want to upgrade the `miru-agent` package, follow the Miru Agent [upgrade documentation](/developers/agent/install#upgrade).

## Dashboard  <ProvisionerBadge />

Reprovisioning a device is only supported via the Miru dashboard. Support for programmatically reprovisioning devices is coming soon.

To reprovision a device, click the ellipsis (...) next to the device you want to reprovision, then select **Reprovision**.

<Frame>
  ![Reprovision device dropdown](https://assets.mirurobotics.com/docs/v04/images/devices/ellipses-dropdown.png)
</Frame>

### Install the `miru-agent` package

A dialog will appear prompting you to install the Miru Agent. If the device already has a compatible Miru Agent installed, you can skip this step.

<Frame>
  ![Install Miru Agent Dialog](https://assets.mirurobotics.com/docs/v04/images/devices/provisioning/install-dialog.png)
</Frame>

<Note>
  For more information about installing the `miru-agent` package, visit the [agent installation](/developers/agent/install) documentation.
</Note>

### Reprovision the device

Once the `miru-agent` package is installed, continue to the reprovisioning step.

The dialog will present a pre-authenticated command that invokes the `miru-agent` binary with a short-lived (5 minutes) token to reprovision the device for your workspace.

<Frame>
  ![Reprovision Miru Agent Dialog](https://assets.mirurobotics.com/docs/v04/images/devices/provisioning/reprovision-dialog.png)
</Frame>

* `sudo systemctl stop miru` stops the `miru-agent` service.
* `sudo -u miru` sets the command to run as the `miru` user.
* `MIRU_PROVISIONING_TOKEN=<token>` authenticates the request.
* `/usr/sbin/miru-agent reprovision` executes the `miru-agent` binary with the `reprovision` command.
* `sudo systemctl start miru` starts the `miru-agent` service.

To reprovision the device, copy the command from the dialog and paste it into the terminal of the machine you want to reprovision.

<Tip>
  For more information about Miru's authentication model, visit the [agent security](/developers/agent/security) documentation.
</Tip>
