中文日本語

Docs · 1.0

The keel command line

Most of what the web page does can also be done on the command line: keel is keelOS's management program, and the web page, the API and the command line are all the same keel. This chapter covers where to run it, how to reach another host, and the commands you will use most. keel help prints the full list.

1. Where to run it

Run keel as root on the host. It talks to the keel service through the local Unix socket (/var/run/keel.sock) and needs no token:

  • on the host's own screen or serial console (IPMI SOL), logged in as root with the admin password;
  • in the web page under System → Host console, see System: maintenance, time and host console;
  • over ssh: ssh [email protected], with the admin password or a key. ssh can be switched off under Services in System → Maintenance.

A few conventions:

  • A virtual machine's ID can be its name (alias), its UUID, or a unique beginning of the UUID.
  • List commands take -j for JSON output, handy in scripts.
  • keel help lists every command; running a command such as keel console -h, keel image or keel migrate without arguments or with -h prints its usage.
  • Write operations go into the audit log just like those in the web page.

2. Reaching another host

On a keelOS host you can also manage another host with --host. This goes through that host's HTTPS API and needs a token from that host (see Accounts, tokens and permissions):

keel --host https://192.168.1.20 --token keel_… --fingerprint 3f:a1:… vm list
  • --fingerprint is the SHA-256 fingerprint of that host's own certificate, which proves you reached the right host. It is shown on that host's System → Manager page. To skip the check use --insecure (only on a network you trust).
  • The environment variables KEEL_HOST, KEEL_TOKEN and KEEL_FINGERPRINT can replace these three options.
  • The command can do what the token may do; without the permission it fails with an error.

Note: 1.0 has no separate keel download for Windows or Linux computers. On your own computer, log in to the host with ssh and run keel there, or call the HTTP API directly.

3. Virtual machines

Command What it does
keel vm list lists the virtual machines and their state
keel vm show ID one virtual machine's full configuration and state
keel template list the templates for new virtual machines
keel vm create --template TEMPLATE --alias win11 --ram 8G --disk 80G --iso ISO-PATH creates a virtual machine; -n only checks, --pool picks the storage pool, more options in keel help
keel vm start ID starts it
keel vm stop [-t SECONDS] ID presses the power button, then stops it hard after the timeout
keel vm kill ID cuts the power at once
keel vm reset ID resets it (like the reset button)
keel vm suspend ID / keel vm resume ID suspends it to disk / resumes it. The web page has no buttons for these
keel vm delete [--force] ID deletes the virtual machine with its disks and snapshots, for good; a running one must be shut down first, or --force stops it hard
keel console [VM] the virtual machines' serial consoles. After Ctrl-A: n/p next/previous, l the list, t take over the keyboard, q quit, ? help

Snapshots, clones and migration:

Command What it does
keel vm snapshot [--note TEXT] ID NAME a snapshot of all disks, the configuration and the UEFI variables at once
keel vm snapshots ID lists the snapshots
keel vm rollback [--stop] ID NAME goes back to the snapshot (--stop powers a running guest off first; --force also destroys newer snapshots)
keel vm snapshot-delete ID NAME deletes a snapshot
keel vm clone [--from SNAPSHOT] [--full] ID NEWNAME a new virtual machine from a snapshot (linked by default, --full makes an independent copy)
keel vm move ID POOL moves it to another storage pool of this host, also while it runs
keel vm migrate ID --to https://HOST --token T --fingerprint F cold migration to another keelOS host; the copy here is kept for 24 hours, keel vm migrate-rollback ID takes it back
keel migrate esxi scan / keel migrate proxmox scan imports virtual machines from ESXi or Proxmox VE hosts (scan first, then import); see Virtual machines

Images and background jobs:

Command What it does
keel image list the ISO library and disk images
keel image download / import / delete downloads an ISO; converts qcow2, vmdk, ova and the like into keel disk images; deletes. Run it without arguments for the usage
keel job list / keel job wait ID / keel job cancel ID background jobs such as downloads, imports and exports

4. The host

Command What it does
keel version keel's version
keel host net the management network settings; keel host net setup asks for them again line by line on the console, keel host net set … sets them in one go (--test SECONDS: rolled back unless confirmed in time)
keel host time [ZONE] shows or sets the time zone; --zones lists all zones
keel host screens which virtual machine Ctrl-Alt-F2…F12 shows on the host's monitor
keel host hardware board, firmware, CPUs, memory modules, disks (with SMART), ports, BMC sensors
keel host cpus the CPU layout: NUMA nodes, cores, threads, which virtual machine uses which CPUs
keel host pci PCI devices and passthrough
keel host check [--cpu 2m] [--memory quick\|full] [--disks all] the host check, Ctrl-C stops it; keel host checks shows the reports
keel pools list keel's storage pools, which one is the default, free space
keel host hyp-try / keel host hyp-off the next boot through the firmware tries hyp once / starts without hyp (native mode); see Upgrade and restart
keel screenshot host FILE.png saves the host's own screen as a picture

Network:

Command What it does
keel port list / keel port probe PORT the physical ports; listen on a port for a while to find its VLANs, LLDP neighbours and DHCP
keel net list the networks, on which ports each one is and which virtual machines use it
keel switch list the virtual switches
keel switch show running-config / keel switch configure / keel switch commit view and change the virtual switches' ports and VLANs in Arista EOS syntax; commit timer 2m rolls back unless confirmed again in time
keel switch show monitor / monitor session N source interface Ethernet1 [rx\|tx\|both] + destination file NAME [limit MB] mirror a port's frames into a pcap file (under capture/ in the host's state directory, stops at 100 MB by default); interface Ethernet1-4 changes a range of ports at once

5. Upgrades

Command What it does
keel upgrade --status the versions in both slots, which one runs, the result of the last switch
keel upgrade --from keelos-X.iso writes a new version into the slot that does not run, without restarting
keel upgrade --switch A\|B [--at 03:00] switches to that slot now or at a time; --cancel cancels a planned switch
keel upgrade --apply confirms a major version after its trial (no way back afterwards)

As in the web page, keel decides itself whether a switch is a reload or a full restart, and the host returns to the old slot if the new version does not come up. See System: upgrade and restart.

6. Tokens, audit and logs

Command What it does
keel token create --name NAME --scope SCOPE creates a token, shown only once. --scope is read, monitor, operate, manage, rdp, admin, or permissions separated by commas (vm:read,vm:power); --vm ID and --tag K=V limit it to some virtual machines; --cidr NET limits where it may come from; --expires 30d
keel token list / keel token revoke ID lists, revokes tokens
keel token sessions web logins; keel token sessions revoke … ends one
keel audit [-n 50] [--since 1h] [--action …] the audit log
keel logs the host's and the virtual machines' log files
keel logs show [-n 50] [-f] [--grep TEXT] [--level warn\|err] [--vm ID] FILE the end of a log, live follow, filters
keel support-bundle [-o FILE] [--anonymize] makes a support bundle; --anonymize replaces addresses, MACs, host names, serial numbers and email addresses with stand-ins
keel hyp log / keel hyp log --boot the hypervisor's log / the record of its last two boots
keel admin reset only on the host's local console: clears the admin password and all tokens; whoever opens the web page next sets a new password

The --scope levels match the Use choices under New token in the web page: rdp is a remote desktop client, monitor only looks (logs included), operate adds power, consoles and snapshots, manage is what a manager uses (everything except tokens and the host shell), admin is everything.

7. Limits in 1.0

  • Some commands only work as root on the host itself (keel admin reset, keel screenshot host, keel support-bundle, keel hyp log), not through --host.
  • keel help also lists commands for the boot scripts and for debugging (keel serve, keel bootconfig, keel format …); you will not need them.