# Proxmox and virtual machines

A virtual machine on Proxmox VE is a tile of its own: its screen, whether it runs, and its power buttons, through Proxmox's API with an API token. Nothing is installed in the guest or on the host.

## Make a token

In Proxmox, under *Datacenter > Permissions*:

1. Add a user for the wall, `wall@pve` say, in the realm *Proxmox VE authentication server*. It needs no password.
2. Add a role with the privileges below.
3. Add a pool with the guests the wall is to show, and give the role on it (path `/pool/<name>`).
4. Add an API token for the user. With *Privilege Separation* on, give the token the role on the pool as well. Its secret is shown once.

| Privilege | What it allows |
|---|---|
| `VM.Audit` | See the guests and whether they run |
| `VM.Console` | Their screens and keys |
| `VM.PowerMgmt` | The power buttons; leave it out for a wall that only looks |
| `VM.Config.CDROM`, `VM.Config.Disk` | Virtual media: an ISO in the CD-ROM drive, and the boot order |
| `Datastore.Audit` on each ISO storage | Virtual media: list the images there |

## Add guests

1. In *Add KVMs*, choose *Virtual machines on Proxmox VE*.
2. Type the host's address (`192.168.1.5`, with `:port` where it is not 8006), the token ID (`wall@pve!wall`) as the user name and its secret as the password.
3. Tick the guests to put on the wall. To add one at once, type its number after the address: `192.168.1.5/100`.

## What the tile gives

- Running, paused or stopped, asked every five seconds.
- The screen while it runs, enlarged and live with keyboard and mouse. The guest's keyboard layout decides typed text.
- *Power on*, *Shut down* (ACPI or the guest agent), *Hold power button* (stop) and *Press reset button*.
- *Open console*, on Proxmox's own page.
- Virtual media, for an admin: an ISO image from a Proxmox storage. See [Virtual media](https://qkvm.com/docs/web/virtual-media).

**Light on Proxmox.** Each console opened is a task in the node's task log, and each one held takes about 120 MB of the host's memory. So qKVM holds one console per guest while somebody looks, and lets go of it five minutes after.

## Troubleshooting

| Problem | What to do |
|---|---|
| No screen, with Proxmox's words about a permission | Give the token `VM.Console`. |
| Power buttons refused | Give the token `VM.PowerMgmt`. |
| *Shut down* does nothing | Nothing in the guest hears ACPI. Install the guest agent, or use *Hold power button*. |
| Another virtual machine has this number | The guest was deleted and a new one got its number, so nothing is sent to it. If it is the right guest now, edit the tile and type the token's secret. |
| Containers are missing | LXC containers are not shown: their console is a terminal. |

## libvirt, QEMU and Unraid guests

Add them as [VNC servers](https://qkvm.com/docs/web/vnc-servers):

- `virsh vncdisplay <guest>` gives the display: `:0` is port 5900, `:1` is 5901.
- `virsh dumpxml --security-info <guest>` shows the `<graphics type='vnc'>` line, with `port`, `listen` and `passwd`.
- It listens on `127.0.0.1` as it comes: let it listen where the wall can reach it, or tunnel.
- Give the guest a fixed `port` (`autoport='no'`), so another guest cannot get it after a restart.
- On Unraid, the VM's *XML view* has the same line, and its *VNC Password* is `passwd`.

XCP-ng and Citrix Hypervisor are not supported.

## Related

- [Devices](https://qkvm.com/docs/web/devices)
- [VNC servers](https://qkvm.com/docs/web/vnc-servers)
- [Virtual media](https://qkvm.com/docs/web/virtual-media)
- [Supported hardware and limits](https://qkvm.com/docs/web/limits)

[Full reference](https://github.com/qkvm/qkvm/blob/main/GUIDE.md#proxmox-and-virtual-machines)
