Console and TTY Types
The -t
command-line option controls how you interact with the VM's serial console. vftool
offers two distinct modes suitable for different use cases: interactive sessions and automated scripting.
Pseudo-Terminal (PTY) Mode: -t 1
This is the default and recommended mode for interactive use.
When you start vftool
with -t 1
, it creates a pseudo-terminal device on the host system. It then prints the path to this device and pauses execution, waiting for a client to connect.
$ vftool -k ...
...
+++ fd 3 connected to /dev/ttys018
+++ Waiting for connection to: /dev/ttys018
You must then open a separate terminal and connect to this device path using a terminal emulator like screen
or minicom
.
screen /dev/ttys018
Once you connect, vftool
resumes and starts the VM, with all console input and output appearing in your screen
session. This provides a reliable, fully interactive terminal experience.
Pros:
- Fully interactive console.
- Separates the VM's lifecycle from its console I/O.
Cons:
- Requires manual connection from a second terminal.
- Not suitable for automation.
Standard I/O Mode: -t 0
This mode is designed for scripting and automation.
When you run vftool
with -t 0
, it directly connects the VM's serial console to its own standard input, output, and error streams. The VM starts immediately, and you will see kernel boot messages directly in the same terminal where you launched vftool
.
$ vftool -k ... -t 0
# VM starts immediately and boot messages appear here
...
This mode is less ideal for interactive use, as terminal state management (e.g., raw mode) can be tricky, and there are known issues when running inside multiplexers like tmux
. However, it's perfect for launching VMs from scripts or for simple, non-interactive tasks.
Pros:
- Excellent for scripting and automation.
- No extra steps required to see VM output.
Cons:
- Less robust for interactive sessions.
- May have issues with terminal multiplexers.