KVM 通过virsh console连入虚拟机
新安装一台虚拟机后,是无法通过virsh console 命令连入虚拟机中的,这时我们需要开启虚拟机的console功能。
一、添加ttyS0的许可,允许root登陆
[root@localhost ~]# echo "ttyS0" >> /etc/securetty
二、编辑/etc/grub.conf中加入console=ttyS0
[root@localhost ~]# less /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-431.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=128M rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet console=ttyS0
initrd /initramfs-2.6.32-431.el6.x86_64.img
[root@localhost ~]#
三、编辑/etc/inittab,在最后一行加入内容 S0:12345:respawn:/sbin/agetty ttyS0 115200
[root@localhost ~]# less /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:
S0:12345:respawn:/sbin/agetty ttyS0 115200
[root@localhost ~]#
四、重启服务器
[root@localhost ~]# reboot
五、在宿主机上测试连接
[root@study ~]# virsh list
Id Name State
----------------------------------------------------
4 centos running
[root@study ~]# virsh console 4
Connected to domain centos
Escape character is ^]
CentOS release 6.5 (Final)
Kernel 2.6.32-431.el6.x86_64 on an x86_64
localhost.localdomain login: root
Password:
Last login: Thu Oct 13 02:51:30 on ttyS0
[root@localhost ~]#
注:按 ctrl+] 组合键退出virsh console
对于centos 7
在虚机里运行
[root@localhost ~]# grubby --update-kernel=ALL --args="console=ttyS0"
then
[root@localhost ~]# reboot
即可
KVM 通过virsh console连入虚拟机的更多相关文章
- KVM使用virsh console无法连接的解决办法(转)
一.问题描述: KVM中宿主机通过console无法连接客户机,卡在这里不动. # virsh console vm01 Connected to domain vm01 Escape charact ...
- virsh console使用方法
How to use virsh console virsh 是libvirt 开源函数库中的一个命令行工具,用来在命令行下通过libvirt发布管理虚拟机的各种命令,现在介绍一下其中一个命令的使用方 ...
- virsh 命令行管理虚拟机
重用命令和选项 1:查看运行的虚拟机 virsh list 2:查看所有的虚拟机(关闭和运行的虚拟机) virsh list --all 3:连接虚拟机 virsh console +域名(虚 ...
- KVM virsh console
(1) 查看正在运行的虚拟机 root@kvm:~# virsh list Id Name State ------------------------------------------------ ...
- 五十.KVM简介、 Virsh管理 、 自定义虚拟机、虚拟设备管理
1.virsh基本管理操作 列出当前正在运行的虚拟机 查看虚拟机的信息 管理虚拟机 设置虚拟机开机自动运行 1.1 virsh基本操作 查看kvm节点(服务器)信息 ] virsh nodei ...
- CentOS 7下宿主机使用virsh console访问KVM的设置
在CentOS 6下要实现宿主机使用virsh console访问KVM可以说是非常麻烦,但这一问题在CentOS 7已经解决了,只需要两条命令在KVM下即可实现. 1.在KVM(客户机)下开机启动并 ...
- 通过virsh console进入虚拟机
1.virsh启动一个虚拟机.执行脚本test_qga.sh 2.virsh vncdisplay <vm_ID> 3.vnc登录到vm里面,执行#systemctl start seri ...
- kvm介绍、安装及创建虚拟机
kvm虚拟化介绍 一.虚拟化分类 1.虚拟化,是指通过虚拟化技术将一台计算机虚拟为多台逻辑计算机.在一台计算机上同时运行多个逻辑计算机,每个逻辑计算机可运行不同的操作系统,并且应用程序都可以在相互独立 ...
- KVM虚拟化技术(五)虚拟机管理
一.为了提高内存.硬盘.网络的性能,需要支持半虚拟化:virtio半虚拟化驱动 二.对虚拟机的管理都是通过libvirt:所有必须要启用一个守护程序libvirtd. 三.virt-manager ① ...
随机推荐
- UEditor在asp.netMVC4中的使用,包括上传功能,粘贴表格不显示边框问题
网页编程中在线编辑器的使用还是很重要的,最近研究了一下百度出的UEditor编辑器,把它结合到刚学的asp.netMVC+EF中,同时实现上传资料(包括图片,视频等)功能,下面就以一个最简单的新闻管理 ...
- Android实现夜间模式
如今非常多App都有夜间模式,特别是阅读类的App.夜间模式如今已经是阅读类App的标配了,其实,日间模式与夜间模式就是给App定义并应用两套不同颜色的主题,用户能够自己主动或者手动的开启,今天用An ...
- win10 快速访问关闭
1. 右键 --- 选项 2. 选择:此电脑
- Cookiecutter: 更好的项目模板工具:(2)安装及基础使用
安装 通过python包管理工具 命令行输入 $pip install cookiecutter 或者 # mac os经常会禁止用户全局安装python包 $pip install --user c ...
- linux搭建mysql集群
一.公共配置 请在三个虚拟机上分别配置此处的配置项. 1. 安装虚拟机 虚拟机操作系统安装CentOS 6.5的x86_64版本. 2. 拷贝mysql cluster 下载以下版本的MySQL-Cl ...
- Nestjs 获取cookie
Docs yarn add cookie-parser main.ts import { NestFactory } from '@nestjs/core'; import { AppModule } ...
- js substr和substring
substr(start[,end]) 字符串截取 start从那里裁,end裁切为数 substring(start[,end = str.length]) // start和end会先处理数值较大 ...
- STL之template类模板
#include <iostream> using namespace std; template<class T>//类模板 class Person{ public://构 ...
- PHP7.1安装xdebug
一.前言1. Xdebug 简介Xdebug 是一个开放源代码的 PHP 程序调试器(即一个Debug工具),可以用来跟踪,调试和分析PHP程序的运行状况.当前最新版本为 Xdebug 2.5.0. ...
- HttpClient学习记录-系列2(源码学习)
如何阅读第三方工具源码? 存在多个入口,而且整个类图存在很多孤岛,自上而下的分析策略貌似不行,还是从use case入手,针对单个面分析.难点是如何做范围界定?不至于陷入黑洞 HttpGet -- ...