我正尝试在KVM(RHEL 6)上使用命令行(pipe理程序和来宾)安装完全虚拟客户机(Fedora 14 x86_64)。 它没有错误,没有明显的结果。 我想知道如何做一个纯文本的安装。
所以,这是我所做的:
# virt-install \ --name=FE --ram=756 --vcpus=1 \ --file=/var/lib/libvirt/images/FE.img --network bridge:br0 \ --nographics --os-type=linux \ --extra-args='console=tty0' -v \ --cdrom=/media/usb/Fedora-14-x86_64-Live-Desktop.iso Starting install... Creating domain... | 0 B 00:00 Connected to domain FE Escape character is ^] ÿ
怎么办? 据我了解谷歌search几天后,我应该看到从文本安装的客人的输出,但没有任何反应。 virt-viewer无法连接到它,好心build议我通过添加–help(我做了)探索所有的选项。 如果我与virsh重新连接,我看到这个:
Domain installation still in progress. You can reconnect to the console to complete the installation process. [root@v ~] # virsh console FEConnected to domain FE Escape character is ^]
这表明虚拟机正在运行
# virsh list Id Name State ---------------------------------- 8 FE running
Qemu日志:
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin /usr/libexec/qemu-kvm -S -M rhel6.0.0 -enable-kvm -m 756 -smp 1,sockets=1,cores=1,threads=1 -name FE -uuid 6989d008-7c89-424c-d2d3-f41235c57a18 -nographic -nodefconfig -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/FE.monitor,server,nowait -mon chardev=monitor,mode=control -rtc base=utc -no-reboot -boot d -drive file=/var/lib/libvirt/images/FE.img,if=none,id=drive-ide0-0-0,format=raw,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive file=/media/usb/Fedora-14-x86_64-Live-Desktop.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=20,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:0a:65:8d,bus=pci.0,addr=0x2 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 char device redirected to /dev/pts/1
/etc/libvirt/qemu/FE.xml的输出
# cat /etc/libvirt/qemu/FE.xml <domain type='kvm'> <name>FE</name> <uuid>6989d008-7c89-424c-d2d3-f41235c57a18</uuid> <memory>774144</memory> <currentMemory>774144</currentMemory> <vcpu>1</vcpu> <os> <type arch='x86_64' machine='rhel6.0.0'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/libexec/qemu-kvm</emulator> <disk type='file' device='disk'> <driver name='qemu' type='raw' cache='none'/> <source file='/var/lib/libvirt/images/FE.img'/> <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' unit='0'/> </disk> <disk type='block' device='cdrom'> <driver name='qemu' type='raw'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> <controller type='ide' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='bridge'> <mac address='52:54:00:0a:65:8d'/> <source bridge='br0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </interface> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target port='0'/> </console> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </memballoon> </devices> </domain>
我明显错过了许多其他人不知道的事情,但是这是什么? 感谢提前!
我上次从互联网--extra-args='console=ttyS0'
某个地方复制了--extra-args='console=ttyS0'
,它工作正常!
请参阅: http : //anaconda-installer.readthedocs.io/en/latest/boot-options.html
--nographics
使用统计信息,除了tty0控制台外,您还没有在客人机中设置控制台。 如果你想要一个graphics控制台,特别是远程可用,你需要启用vga和vnc,或者qxl和spice。 这是一个例子: http : //www.linux-kvm.com/content/tip-how-run-headless-guest-machine-using-vnc-kvm
在尝试执行纯文本CentOS安装时,我遇到了类似的问题。 这一切都归结为添加内核参数指定串行输出控制台console=ttyS0
以便您可以连接到它时,使用--graphics none
或--nographics
。 从virt-install
的手册:
– 图片没有
没有graphics控制台将分配给客人。 完全虚拟化的guest虚拟机(Xen FV或QEmu / KVM)需要在guest虚拟机的第一个串行端口上configuration一个文本控制台(可以通过–extra-args选项完成)。 Xen PV会自动设置它。 命令“virsh console NAME”可用于连接到串行设备。
我已经设法解决它在两个方面:
--cdrom
选项 --extra-args
的--location
选项 1.修改图像
为了修改iso安装盘上的内核参数:
isolinux/isolinux.cfg
文件,打开它,findinitrd=
的第一行,并将console=ttyS0
附加到它以及所有其他具有上述参数的行。 像往常一样使用virt-install
修改后的映像,例如:
$ sudo virt-install --name centos-vm --ram 1024 --disk path=/home/user/domains/centos-vm --cdrom /home/user/images/centos-modified.iso --os-type linux --nographics --accelerate
完成。
2.使用NFS共享
挂载图像:
$ sudo mount -o loop,unhide -t iso9660 -r /home/user/images/CentOS.iso /home/user/mnt/cdrom
如果没有运行,请启动NFS服务: service nfs start
在/etc/exports
添加以下行以使其可供客户端使用:
/home/user/mnt/cdrom *(ro,insecure,all_squash)
使用以下命令刷新系统的导出表:
$ exportfs -r
使用与virt-install
共享,确保包含--extra-args
,例如:
$ sudo virt-install --name centos-vm --ram 1024 --disk path=/home/user/domains/centos-vm --location /home/user/mnt/cdrom --os-type linux --nographics --accelerate --extra-args="console=ttyS0"
在安装CentOS的过程中,您会收到一个提示,询问安装文件的位置。 您必须键入您的机器的地址和共享的完整path。
完成。
您需要以文本模式运行Fedora安装程序。 尝试添加“文本”额外的参数。 或者,你可以尝试添加“vnc”,一旦它启动,你就可以通过VNC连接到安装程序
我已经使用皮匠和公仔做了一段时间的安装。 在补鞋匠里面,我的CentOS60-x86_64configuration文件中设置了我的内核选项:
Kernel Options: serial console=ttyS0,115200 Kernel Options (Post Install): console=ttyS0,115200
开机后,您可以使用console = tty0 console = ttS0,115200来获取两台设备上显示的控制台; 这不适用于安装。 如果您编辑/ etc / grub下的grub选项并重新生成grub.conf,则串行控制台设置将在内核升级后生效。 将“文本”添加到内核命令行以防止安装程序启动GUI。
当我的KVM访客实例启动时,我在login到KVM主机后连接到他们,并连接到客户的控制台,如下所示:
[root@vmhost ~]# virsh console guestvm
然后我在我的shell中看到这个:
Connected to domain guestvm Escape character is ^] CentOS Linux release 6.0 (Final) Kernel 2.6.32-71.el6.x86_64 on an x86_64 guestvm login:
最后一点,当我告诉Koan开始构build我的一个KVM客人时,我使用–nogfx开关来调用它,如下所示:
koan --server 192.168.1.1 --virt --nogfx --system=guestvm
我猜你会看到一个错误configuration的控制台。
也许尝试这个或类似的:
首先,我添加控制台线到我的grubconfiguration,例如一个拱客人:kernel / vmlinuz26 root = / dev / vda2 ro console = ttyS0,115200然后我编辑/ etc / inittab启用ttyS0(相同的客人):co:23 :respawn:/ sbin / agetty -8 115200 ttyS0 linux。 并确保你的/ etc / securetty中有ttyS0。
更多信息: http : //www.linux-kvm.com/content/running-kvm-nographics-no-console-output
– 编辑 –
你可以尝试console=ttyS0,115200
并检查其他可能的控制台参数。