You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu下QEMU使用-nographic无终端输出问题求助

Why QEMU -nographic Fails to Output DOS Content Over SSH on Ubuntu (But Works on macOS)

Let's break down why you're seeing this discrepancy and walk through actionable fixes:

Root Causes

The issue stems from two key differences between your macOS and Ubuntu setups:

1. QEMU Version Behavior Differences

Your Ubuntu system uses QEMU 2.3.0—a much older release compared to macOS's 2.12.0. Older QEMU versions had distinct default behavior for the -nographic flag:

  • Newer QEMU versions (like 2.12.0 on macOS) automatically route the guest's serial port output to the host's stdio (your terminal), which is why DOS output appears as expected.
  • In QEMU 2.3.0, -nographic only disables the GUI window—it doesn't by default redirect the guest's output to your SSH terminal.

2. SSH Terminal Environment Variables

When connecting to Ubuntu over SSH, your TERM environment variable might be set to a minimal or incompatible value (like dumb). Older QEMU versions rely on this variable to determine if the terminal supports the VT100 escape sequences DOS uses for output. If it doesn't recognize the terminal type, it may suppress output entirely.

Fixes to Try

Here are tested solutions to get DOS output working over SSH with -nographic:

Fix 1: Explicitly Redirect Serial Port to Stdio

Add the -serial stdio parameter to your QEMU command. This forces the guest's serial output to be routed directly to your terminal, bypassing version-specific defaults.

Example command:

qemu-system-i386 -nographic -serial stdio -hdc dos.img

(Adjust the architecture and disk image path to match your setup)

Fix 2: Set a Compatible Terminal Type

Before running QEMU, set the TERM variable to a standard, supported type like xterm:

export TERM=xterm
qemu-system-i386 -nographic -hdc dos.img

This tells QEMU your terminal can handle the escape sequences DOS uses for output.

Fix 3: Use -curses Instead of -nographic

Older QEMU versions often handle the -curses flag more reliably for remote text-mode output. This enables a curses-based interface optimized for terminal environments:

qemu-system-i386 -curses -hdc dos.img

To exit this mode: press Ctrl+Alt+G to release the cursor, then Ctrl+C to quit QEMU.

Verification

After applying any of these fixes, you should see the familiar DOS output (e.g., MSCDEX Version 2.23... and A:\>) in your SSH terminal, matching the behavior you see on macOS.

内容的提问来源于stack exchange,提问作者xinnjie

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 06:58:11