kvm下无法console登录ubuntu虚拟机的设置方法
kvm下无法console登录ubuntu虚拟机的设置方法
1、问题现象:
console之后无任何反应
Id Name State ---------------------------------------------------- 4 myfirstvm running [root@localhost ~]# virsh console myfirstvm setlocale: No such file or directory Connected to domain myfirstvm Escape character is ^]
2、需要在虚拟机里面修改如下配置:
(1)、修改 /etc/securetty :在最后添加 ttyS0
echo ttyS0 >>/etc/securetty
(2)、修改/boot/grub/grub.cfg
找到下面:
linux /boot/vmlinuz-4.18.0-15-generic root=UUID=58c53fe9-6542-4df9-abcc-539ee3256b64 ro quiet splash $vt_handoff initrd /boot/initrd.img-4.18.0-15-generic 修改成: linux /boot/vmlinuz-4.18.0-15-generic root=UUID=58c53fe9-6542-4df9-abcc-539ee3256b64 ro consoleblank=0 console=tty1 console=ttyS0,115200n8 quiet splash $vt_handoff initrd /boot/initrd.img-4.18.0-15-generic
3、然后重启虚拟机
4、测试console登录
[root@localhost ~]# virsh console myfirstvm setlocale: No such file or directory Connected to domain myfirstvm Escape character is ^] Ubuntu 18.04.2 LTS myfirstvm ttyS0 myfirstvm login: Ubuntu 18.04.2 LTS myfirstvm ttyS0 myfirstvm login: myvm 密码: 上一次登录: 日 9月 20 14:45:48 CST 2020 ttyS0 上 Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.18.0-15-generic x86_64)
已正常console。
针对centos和redhat系列的机器可以参考:
https://blog.51cto.com/559000/1580113
浙公网安备 33010602011771号