virsh console hangs at the escape character “^]”
I am trying to kickstart a newly built VM. I am stuck with the following. Want to start with a console so that I can include username and other info for this VM:
@vmhost02 ~]$ sudo virsh start --console testengine
Domain testengine started
Connected to domain testengine
Escape character is ^]
It hangs up in there and doesn't listen to any keys except "^]"
1)
You can try to edit /etc/default/grub in the guest, and make sure you have:
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
Then execute:
# update-grub
# reboot
2)
If that does not work, try to replace quiet with console=ttyS0 in GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="... console=ttyS0"
Then again:
# update-grub
# reboot
3)
You may still need to try:
# systemctl enable serial-getty@ttyS0.service
# systemctl start serial-getty@ttyS0.service
# reboot
4)
You would need to define a tty to be used as a virtual console. In case you have access to your vm either using vnc or ssh create the following file
vi /etc/init/ttyS0.conf
The content should be something like
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /sbin/getty -L 38400 ttyS0 vt102 # This is your term type vt102
Save these settings and subsequently from your host machine
virsh destroy [vm-name]; service libvirtd stop; service libvirtd start; virsh start [vm-name]
I'm doing here a stop/start of libvirt, because it sometimes tend to not send a SIGTERM to libvirt.
Finally try
virsh console [vm-name]
5)
May be simpler than the solution of val0x00ff, you shall add the console=ttyS0 at the end of the kernel lines in the /boot/grub2/grub.cfg file of the VM (this is not done by default it seems):
(vm)$> grubby --update-kernel=ALL --args="console=ttyS0"
(vm)$> reboot
Then virsh console shall work as expected
6)
The virsh console command connects you to the virtual serial port in the guest. If you see nothing on this console this indicates that the guest OS has not setup anything on the serial port. Typically in Linux you'd want to make it run an 'agetty' process on the serial port. If you want to see kernel boot messages on this serial console you also need to edit the guest boot loader to add console=tty0 console=ttyS0 to the kernel command line - this should get boot messages on both the serial and graphical consoles.
7)
I think you should start a console (e.g. ttyS0 ). For example on my Debian 8 I enable it with systemd:
systemctl enable getty@tty1.service
Enable Serial Console on CentOS/RHEL 7
On the virtual machine, add ‘console=ttyS0‘ at the end of the kernel lines in the /boot/grub2/grub.cfg file:
grubby --update-kernel=ALL --args="console=ttyS0"
Note: Alternatively, you can edit the /etc/default/grub file, add console=ttyS0 to the GRUB_CMDLINE_LINUX variable and execute
grub2-mkconfig -o /boot/grub2/grub.cfg
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial –speed115200 –unit=0 –word=8 –parity=no –stop=1"
随机推荐
- vs未能正确加载CSharpPackage包,未能正确加载“Microsoft.VisualStudio.Editor.Implementation.EditorPackage”包
VS2017打开项目时提示未能正确加载CSharpPackage包, 可以使用 devenv命令工具来解决,操作如下 打开vs2017开发人员命令提示符(请使用管理员身份运行),如图 敲入 deve ...
- Python【day 15-3】函数部分
'''''' ''' 一.函数 1.函数定义 对功能或者动作的封装 在类中定义,就是方法 在类之外定义,就是函数 2.函数写法 1.定义或者申明函数 def 函数名(形参列表): 函数体(return ...
- 在Vue-cli3.x中引入element-ui的新方式
今天登上element官网,发现element对vue-cli3.x的项目做了特殊定制: 这意味着即使是按需引入,也无需像过去那样手动安装babel-plugin-component,配置babel. ...
- 移动端适配方案(rem+flex)
为什么用rem不用px? 主流:各大网站的移动版绝大多数都是用的rem. 移动端屏幕分辨率差别太大:最低适配的iPhone6,分辨率仅为750*1334.而现在市面上大多数手机,都达到了1080* ...
- 一则SQL优化案例
原始sql: select CASE ) counts ,) else deadline end as deadline from t_product_credit) c group by sort ...
- 微信小程序初体验遇到的坑
今天,2017年1月9日凌晨,微信小程序如约上线.2007年1月9日,整整10年前的今天,苹果的iPhone手机正式问世! 经不起新技术的诱惑了,想试着开发一下看看.刚开始遇到很多坑,在这里记录一下, ...
- 024.微服务架构之服务注册与发现(kubernetes / SpringCloud)
微服务 微服务是一种架构模式,一种分布式的架构风格. 顾名思义,micro service,将一个庞大的单体应用拆分成若干个“微小”的服务,服务间通过进程通讯完成原本在单体应用中的调用. 其中必要的六 ...
- go构建脚本ansible分发时出现的问题总结“non-zero return code”
背景介绍: 在Jenkins服务器配置go项目发布脚本,编译完成后,使用ansible分发到部署服务器上,然后将启动项目脚本start_coachcore.sh发布到目标服务器上,执行启动,目标服务器 ...
- 解决汉化pycharme之后设置打不开的问题
首先进入安装pycharme目录下lib目录下,将汉化包移出去,只留下英文包 然后打开pycharme即可打开设置 在你改完设置之后,可以再将汉化包放进来 英文包:https://pan.baidu. ...
- 精选傻X错误 && 自己的套路
声明 参考课件由Accelerator汇编 1. 随手注意的细节 你写的main 真的是 main 么? 在无向图或者网络流找反向边的时候,编号 \(xor 1\) 的前提是,你的第一条边编号是 2或 ...