Virtual-Machines

virt-install KVM “無法打開顯示”

  • May 26, 2016

所以我正在嘗試使用 KVM(在 CentOS 6.3 上)創建一個 VM,我使用的命令如下:

virt-install  --connect qemu:///system  --virt-type kvm  --name ffVM32  --ram 1024 --disk path=/home/datastore/images/ffVM32.img,size=10  --vnc  --cdrom  /home/datastore/backups/CentOS-6.4-i386-minimal.iso   --bridge bridge0

我得到的輸出是:

Starting install...
Allocating 'ffVM32.img'                                             |  10 GB     00:00     
Creating domain...                                                  |    0 B     00:00     
Cannot open display: 
Run 'virt-viewer --help' to see a full list of available command line options
Domain installation still in progress. You can reconnect to 
the console to complete the installation process.

我已經完成了“X Windows System”的組安裝,但沒有幫助。我正在嘗試通過執行 Ubuntu 13..04 的筆記型電腦訪問它。奇怪的是,當我在另一台裝有 PCLinuxOS 的機器上嘗試相同的操作時,virt-viewer 打開,我可以繼續安裝。

在列出所有虛擬機時,我發現虛擬機正在執行

[root@ts3 ~]# virsh list --all
Id    Name                           State
----------------------------------------------------
8     ffVM32                         running

我錯過了什麼?

您可能還沒有使用-Xssh 開關登錄到您的硬體節點。

[root@yourmachine]# ssh -X root@<your-hardware-node-ip>

man頁面:

        Enables X11 forwarding.  This can also be specified on a per-host 
        basis in a configuration file.

        X11 forwarding should be enabled with caution.  Users with the
        ability to bypass file permissions on the remote host (for the
        user's X authorization database) can access the local X11 display
        through the forwarded connection.  An attacker may then be able
        to perform activities such as keystroke monitoring.

        For this reason, X11 forwarding is subjected to X11 SECURITY
        extension restrictions by default.  Please refer to the ssh -Y
        option and the ForwardX11Trusted directive in ssh_config(5) for
        more information.

要禁用 X11 轉發,您可以使用-x開關。

要啟用 X11 轉發,請編輯位於/etc/ssh/sshd_config以下行的 conf 文件並取消註釋:

X11Forwarding Yes

並使用重新啟動服務service sshd restart

希望這可以幫助。

引用自:https://serverfault.com/questions/537667