본문 바로가기

리눅스

KVM Virsh Console Access On CentOS 7

반응형

KVM Virsh Console Access On CentOS 7

Enable Serial Console on the Virtual Machine

1. console=ttyS0 추가

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0 crashkernel=auto rhgb quiet console=ttyS0
vi /etc/default/grub
$ vi /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0 crashkernel=auto rhgb quiet console=ttyS0"
GRUB_DISABLE_RECOVERY="true"

 

2. grub2-mkconfig 명령어 실행

grub2-mkconfig -o /boot/grub2/grub.cfg
$ grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-514.26.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.26.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-5de8b61aa93e42d1ad9231d4b5035ed7
Found initrd image: /boot/initramfs-0-rescue-5de8b61aa93e42d1ad9231d4b5035ed7.img
done

Enable Serial Console Access on the KVM host - 1

수정

    <console type='pty' tty='/dev/pts/6'>
      <source path='/dev/pts/6'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
728x90
virsh edit ANSIBLEmn01
$ virsh edit ANSIBLEmn01
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
...
    <console type='pty' tty='/dev/pts/6'>
      <source path='/dev/pts/6'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>

 

2. VM 서버 다운

virsh shutdown ANSIBLEmn01
$ virsh shutdown ANSIBLEmn01
도메인 ANSIBLEmn01가 종료됨

 

3. VM 서버 기동

virsh start ANSIBLEmn01
$ virsh start ANSIBLEmn01
도메인 ANSIBLEmn01가 시작됨

 

4. 콘솔 접속

virsh console ANSIBLEmn01
$ virsh console ANSIBLEmn01
도메인 ANSIBLEmn01에 연결되었습니다
Escape character is ^]

CentOS Linux 7 (Core)
Kernel 3.10.0-514.26.2.el7.x86_64 on an x86_64

ANSIBLEmn01 login: root
암호:
Last login: Thu Aug  3 17:04:06 from 10.20.12.88
[root@ANSIBLEmn01 ~]#

Enable Serial Console Access on the KVM host - 2

systemctl start serial-getty@ttyS0
systemctl enable serial-getty@ttyS0

 

참고URL

- https://linuxadmin.io/enable-virsh-console-kvm/

- http://www.geekpills.com/operating-system/linux/kvm-virtualization-enable-kvm-virsh-console-access-ubuntu-linux-vm

 

728x90
반응형