Virt-Viewer(1)

โœจ Virt-Viewer(1) โ€” like, the graphical console era โœจ

okay so this is the manual for virt-viewer, part of the virtualization support squad, and honestly? it's giving "tiny tool, huge vibes" ๐Ÿ’… let's get into it bestie


๐ŸŒธ NAME ๐ŸŒธ

virt-viewer โ€” display the graphical console for a virtual machine ๐Ÿ–ฅ๏ธโœจ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

virt-viewer [OPTIONS] [ID|UUID|DOMAIN-NAME]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so virt-viewer is a minimal tool for showing you the graphical console of a virtual machine. no cap, minimal. the console gets accessed using the VNC or SPICE protocol ๐Ÿ”ฅ

you can point at your guest by its name, its ID, or its UUID โ€” pick your fighter. and if the guest isn't running yet? you can literally tell the viewer to wait until it starts before it even tries to connect to the console. patiently. like a good friend ๐Ÿซถ

the viewer can also connect to remote hosts to look up the console info, and then connect to that remote console using the same network transport. multitasking icon behavior โœจ

real talk though: in some circumstances the viewer may need to grab the mouse pointer. the default key sequence for releasing that grab is "Ctrl_L"+"Alt_L" โ€” but you can override that with the --hotkeys argument documented right down there ๐Ÿ‘‡

๐Ÿ’… OPTIONS ๐Ÿ’…

the following options are accepted when running virt-viewer:

  • -h, --help โ€” display the command line help summary. the "help me help you" option ๐ŸŽ€
  • -V, --version โ€” display the program version number. flex the build โœจ
  • -v, --verbose โ€” display information about the connection. she's chatty, we love her
  • -c URI, --connect=URI โ€” specify the hypervisor connection URI
  • -w, --wait โ€” wait for the domain to start up before attempting to connect to the console. patience is a virtue fr fr
  • -r, --reconnect โ€” automatically reconnect to the domain if it shuts down and restarts. she comes back. she always comes back ๐Ÿ’€
  • -z PCT, --zoom=PCT โ€” zoom level of the display window, in percentage. range is 10-400. yes, 400. go off ๐Ÿ”
  • -d, --direct โ€” do not attempt to tunnel the console over SSH, even if the main connection URI used SSH. straight there, no detours
  • -a, --attach โ€” instead of making a direct TCP/UNIX socket connection to the remote display, ask libvirt to provide a pre-connected socket for the display. this avoids needing to authenticate with the remote display server directly ๐Ÿ™ˆ this option will only work when connecting to a guest that is running on the same host as the virt-viewer program. and if attaching to the guest via libvirt fails, virt-viewer will automatically fallback to trying a regular direct TCP/UNIX socket connection. graceful queen ๐Ÿ‘‘
  • -f, --full-screen โ€” start with the window maximised to fullscreen. main character energy, occupying the whole screen ๐ŸŒˆ
    • if supported, the remote display will be reconfigured to match the physical client monitor configuration, by enabling or disabling extra monitors as necessary. this is currently implemented by the Spice backend only ๐Ÿ”ฅ
    • to specify which client monitors are used in fullscreen mode, see the CONFIGURATION section below ๐Ÿ‘€
  • --auto-resize <always|never> โ€” controls whether it's permitted to attempt to resize the remote framebuffer to match the local window size. this currently defaults to on, but note that not all servers will support this โš ๏ธ
  • -s, --shared โ€” permitted a shared session with multiple clients. sharing is caring ๐Ÿซถ
  • --cursor auto|local โ€” control how the mouse cursor is rendered. "auto" is the default behaviour, which will honour the behaviour requested by the remote server โ€” this may involve the server remote rendering the cursor into the framebuffer, or sending the cursor details to the client to render. "local" overrides this default to request that the local desktop cursor is always rendered regardless of what the server requests. the latter is rarely needed, but can be used if the server has a bad configuration that results in its own cursor being hidden ๐Ÿ’€
  • --debug โ€” print debugging information. forensic bestie ๐Ÿ”Ž
  • -H HOTKEYS, --hotkeys HOTKEYS โ€” set global hotkey bindings. by default, keyboard shortcuts only work when the guest display widget does not have focus. any actions specified in HOTKEYS will be effective even when the guest display widget has input focus โœจ
    • the format for HOTKEYS is <action1>=<key1>[+<key2>][,<action2>=<key3>[+<key4>]]
    • key-names are case-insensitive
    • valid actions are: toggle-fullscreen, release-cursor, zoom-in, zoom-out, zoom-reset, secure-attention, usb-device-reset, smartcard-insert and smartcard-remove
    • the "secure-attention" action sends a secure attention sequence (Ctrl+Alt+Del) to the guest
    • examples:
--hotkeys=toggle-fullscreen=shift+f11,release-cursor=shift+f12

--hotkeys=release-cursor=ctrl+alt
  • note that hotkeys for which no binding is given are disabled. and although the hotkeys specified here are handled by the client, it's still possible to send these key combinations to the guest via a menu item ๐Ÿ‘€
  • -K, --keymap โ€” remap and/or block supplied keypresses to the host. all key identifiers are case-sensitive and follow the naming convention as defined in gdkkeysyms.h without the GDK_KEY_ prefix
    • running the application with --debug will display keypress symbols in the following way:
"Key pressed was keycode='0x63', gdk_keyname='c'"
"Key pressed was keycode='0xffeb', gdk_keyname='Super_L'"
  • the format for supplying a keymap is:
<srcKeySym1>=[<destKeySym1>][+<destKeySym2][,<srckeySym2>=[<destKeySym1]
  • to block a keypress, simply assign an empty parameter to the srcKeySym
  • example:
--keymap=Super_L=,Alt_L=,1=Shift_L+F1,2=Shift_L+F2
  • this will block the Super_L (typically Windows Key) and ALT_L keypresses and remap key 1 to Shift F1, 2 to Shift F2. slay ๐ŸŽ€
  • -k, --kiosk โ€” start in kiosk mode. in this mode, the application will start in fullscreen with minimal UI. it will prevent the user from quitting or performing any interaction outside of usage of the remote desktop session ๐Ÿ”’
โš ๏ธ note that it can't offer a complete secure solution by itself. your kiosk system must have additional configuration and security settings to lock down the OS. in particular, you must configure or disable the window manager, limit the session capabilities, use some restart/watchdog mechanism, disable VT switching etc. don't skip this part bestie, fr fr
  • --kiosk-quit <never|on-disconnect> โ€” by default, when kiosk mode is enabled, virt-viewer will remain open when the connection to the remote server is terminated. by setting the kiosk-quit option to "on-disconnect" value, virt-viewer will quit instead. please note that --reconnect takes precedence over this option, and will attempt to do a reconnection before it quits ๐Ÿ‘‘
  • --id, --uuid, --domain-name โ€” connect to the virtual machine by its id, uuid or name. these options are mutual exclusive. for example the following command may sometimes connect to a virtual machine with the id 2 or with the name 2 (depending on the number of running machines):
virt-viewer 2

to always connect to the virtual machine with the name "2" use the "--domain-name" option:

virt-viewer --domain-name 2

๐ŸŽ€ CONFIGURATION ๐ŸŽ€

a small number of configuration options can be controlled by editing the settings file located in the user configuration directory:

<USER-CONFIG-DIR>/virt-viewer/settings

this file is a text file in INI format, with application options in the [virt-viewer] group and per-guest options in a group identified by the guest's UUID. the application options should not be edited manually ๐Ÿ™…โ€โ™€๏ธ there's also a special [fallback] group which specifies options for all guests that don't have an explicit group. cute, right?

for each guest, the initial fullscreen monitor configuration can be specified by using the monitor-mapping key. this configuration only takes effect when the -f/--full-screen option is specified ๐Ÿ‘€

the value of this key is a list of mappings between a guest display and a client monitor. each mapping is separated by a semicolon character, and the mappings have the format <GUEST-DISPLAY-ID>:<CLIENT-MONITOR-ID>.

for example, to map guest displays 1 and 2 to client monitors 2 and 3 for the guest with a UUID of e4591275-d9d3-4a44-a18b-ef2fbc8ac3e2, use:

[e4591275-d9d3-4a44-a18b-ef2fbc8ac3e2]
monitor-mapping=1:2;2:3
the monitor-mapping must contain ids of all displays from 1 to the last desired display id, e.g. monitor-mapping=3:3 is invalid because mappings for displays 1 and 2 are not specified. no skipping, bestie ๐Ÿ’€

๐ŸŒˆ EXAMPLES ๐ŸŒˆ

to connect to the guest called 'demo' running under Xen:

virt-viewer demo

to use GUI for connecting to a guest running under QEMU:

virt-viewer --connect qemu:///system

to connect to the guest with ID 7 running under QEMU:

virt-viewer --connect qemu:///system 7

to wait for the guest with UUID 66ab33c0-6919-a3f7-e659-16c82d248521 to startup and then connect, also reconnecting upon restart of VM:

virt-viewer --reconnect --wait 66ab33c0-6919-a3f7-e659-16c82d248521

to connect to a remote console using TLS:

virt-viewer --connect xen://example.org/ demo

to connect to a remote host using SSH, lookup the guest config and then make a tunnelled connection of the console:

virt-viewer --connect qemu+ssh://root@example.org/system demo
when using a SSH tunnel to connect to a SPICE console, it's recommended to have ssh-agent running to avoid getting multiple authentication prompts ๐Ÿซถ (iykyk, the prompt spam is real)

to connect to a remote host using SSH, lookup the guest config and then make a direct non-tunnelled connection of the console:

virt-viewer --direct --connect xen+ssh://root@example.org/ demo

๐Ÿงš AUTHOR ๐Ÿงš

written by Daniel P. Berrange, based on the GTK-VNC example program gvncviewer. king behavior ๐Ÿ‘‘


๐Ÿ’œ BUGS ๐Ÿ’œ

report bugs to https://gitlab.com/virt-viewer/virt-viewer/-/issues โ€” they will see your receipts ๐Ÿ‘€


Copyright (C) 2007-2020 Red Hat, Inc., and various contributors. this is free software. you may redistribute copies of it under the terms of the GNU General Public License "https://www.gnu.org/licenses/gpl-2.0.html". There is NO WARRANTY, to the extent permitted by law. (yes, the caps are theirs, and yes, they're serious about it ๐Ÿ˜ญ)


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

virsh(1), "virt-manager(1)", "spice-client(1)", the project website "http://gitlab.com/virt-viewer/virt-viewer"


okay that's the whole thing!! ๐Ÿ“ this is Virt-Viewer 11.0, dated 2025-05-23 โ€” go forth and view those consoles bestie, you're gonna slay ๐Ÿ’–โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from