# Orphaned workstations and recovery

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> An orphaned workstation is a virtual machine your computer keeps after its record at Ringleader is gone, so its disk isn't lost.


An orphaned workstation is a virtual machine your computer keeps after its record at Ringleader
is gone, so its disk isn't lost. A computer can also lose its own records of the node-bound
workstations it runs, or never come back. This page explains each case and how to recover.

## Orphaned workstations

Your computer turns a node-bound workstation into an orphan in three cases:

- Someone who doesn't own the computer deleted its record.
- Someone deleted the computer's node.
- You asked for it after logging out.

An orphan is an ordinary workstation stored on your computer. `rl get workstations` lists it
with an `Orphaned` condition saying why. When its old name is taken, it gets the name
`<name>-orphan`. Keep using it, or copy what you need off it and delete it with
`rl workstation delete`, which deletes its virtual machine and its disk. Nothing brings an orphan
back to Ringleader: to have the workstation there again, create a new one.

When you log out of Ringleader, or switch to another Ringleader service, the node-bound
workstations of the old one keep running.
[Keep a workstation as an orphan](#keep-a-workstation-as-an-orphan) shows how to list them, and
keep one.

## Records your computer keeps

Your computer records which node-bound workstations it created in `state.db`, a file in its data
directory (`~/.ringleader` unless you set `RINGLEADER_HOME`). If that file is lost, Ringleader
still holds those workstations, and their virtual machines and disks stay on your computer. But
your computer no longer runs them. Each one shows a `HeldByDevice` condition until you adopt
it, as [Adopt a workstation after your computer loses its records](#adopt-a-workstation-after-your-computer-loses-its-records)
shows.

## Keep a workstation as an orphan

Your computer may still run node-bound workstations for a Ringleader service it is no longer
logged in to. To list them, run this while the daemon is running:

```bash
rl workstation orphan
```

To keep one of them, with its virtual machine and disk, name it:

```bash
rl workstation orphan my-box -n team
```

It becomes an [orphaned workstation](#orphaned-workstations), which you can then use or delete.

## Adopt a workstation after your computer loses its records

To run a workstation that shows `HeldByDevice` again, adopt it on that computer while the daemon
is running:

```bash
rl workstation adopt my-box -n team
```

`rl` asks your providers whether they have the workstation's virtual machine before it takes the
workstation back, and `adopt` fails when none does. If your computer still holds the
workstation's host access, the workstation keeps it. Otherwise, it runs with none until you
apply its file again on this computer with `rl apply`.

<div class="callout callout-note">
  <p class="callout-title">Workstations moved with an earlier release</p>
  <div class="callout-body">
    An earlier release of <code>rl</code> could move a workstation from your computer to Ringleader. Such a
workstation runs on the virtual machine it had before the move, under that virtual machine&rsquo;s
name. When nothing on your computer still records that name, <code>adopt</code> fails and asks you for it
with <code>--machine</code>. Nothing on your computer can confirm a name you give, so <code>adopt</code> asks you to
confirm it, and without a terminal it needs <code>--yes</code>. Any other workstation&rsquo;s virtual machine is
found without <code>--machine</code>.
  </div>
</div>


## Delete a computer that isn't coming back

If a computer that runs node-bound workstations is never coming back, delete its node at
Ringleader. `rl workstation delete` and the application's Delete dialog print the command when
the computer isn't active:

```bash
rl node delete <node> --force-to <control-plane>
```

<div class="callout callout-warning">
  <p class="callout-title">Deleting a node deletes its workstations</p>
  <div class="callout-body">
    This deletes the node and everything bound to it, including its workstations. If the computer
does come back, it keeps their virtual machines as orphaned workstations.
  </div>
</div>


## Next steps

- [`rl workstation orphan`](https://docs-stg.ringleader.dev/reference/cli/commands/workstation-access/#rl-workstation-orphan-name) and
  [`rl workstation adopt`](https://docs-stg.ringleader.dev/reference/cli/commands/workstation-access/#rl-workstation-adopt-name) list
  each command's flags.
- [Deletion and delete deadlines](https://docs-stg.ringleader.dev/workstations/lifecycle/deletion-deadlines/)
  describes what happens to the virtual machine when a node-bound workstation is deleted.
- [Node-bound workstations](https://docs-stg.ringleader.dev/workstations/basics/#node-bound-workstations)
  explains what a node-bound workstation is.

