解决OpenStack虚拟机没有console.log输出的问题
如果你在OpenStack中启动了cirros或者fedora的虚拟机后,有些虚拟机在Horizon中的启动日志log是空的,但是其他没问题。原因是虚拟机的kernel启动参数需要修改。
--------------------------------------------------------------
【Centos7.0】
以我用的fedora为例, image是F17-x86_64-cfntools
1. vim /etc/default/grub
2. 添加一行
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"
3. grub2-mkconfig -o /boot/grub2/grub.cfg
Ubuntu的话是sudo update-grub
4. 重启VM即可
------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
【Centos6.5】
编辑/boot/grub/menu.lst
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
serial --unit=0 --speed=115200
terminal --timeout=10 serial console
hiddenmenu
title CentOS (2.6.32-431.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=2ffe79af-6116-4434-832f-26d839a8a68e rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet console=tty0 console=ttyS0,115200
initrd /initramfs-2.6.32-431.el6.x86_64.img
注解:
#serial --unit=0 --speed=115200
#terminal --timeout=10 serial console
这两行配置文件来配置grub同时使用serial和console, 这里的使用的COM1(--unit=0,GRUB 里serial port是从0开始计数,所以--unit=0是使用com1),波特率为115200。所以,serial port和console(这是是连接的键盘和显示器)会同时等待最多—timeout ,以等待用户输入。
对于console=tty0 console=ttyS0,115200设置,kernel的信息会同时出现在tty0和ttyS0上,但是init进程的输出信息仅出现在ttyS0上,直到login: 提示信息出现在console和tty0上为止。
---------------------------------------------------------------------------------------------------------------
本文暂时没有评论,来添加一个吧(●'◡'●)