lost and found ( for me ? )

Linux KVM : connect to a Linux Mint12 VM via virsh console


small tips


how to use virsh console.

KVM host : Ubuntu 11.10
VM : Linux Mint 12

[ on the KVM host (Ubuntu 11.10 ) ]

confirm the VM has serial ports.
# virsh dumpxml Mint12-64-1 | less
   <serial type='pty'>
     <source path='/dev/pts/5'/>
     <target port='0'/>
     <alias name='serial0'/>
   </serial>
   <console type='pty' tty='/dev/pts/5'>
     <source path='/dev/pts/5'/>
     <target type='serial' port='0'/>
     <alias name='serial0'/>


[ on the VM ( Linux Mint 12 ) ]

make /etc/init/ttyS0.conf file
# cat /etc/init/ttyS0.conf
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec /sbin/getty -L 115200 ttyS0 vt 102


“start ttyS0”
# start ttyS0
ttyS0 start/running, process 703


edit /boot/grub/grub.cfg

By default , grub.cfg is read-only permission.
add write permission.
# chmod u+w /boot/grub/grub.cfg


edit grub.cfg ( add red lines )
menuentry 'Linux Mint 12 64-bit, 3.0.0-16-generic (/dev/vda1)' --class linuxmint
--class gnu-linux --class gnu --class os {
       recordfail
       set gfxpayload=$linux_gfx_mode
       insmod gzio
       insmod part_msdos
       insmod ext2
       set root='(hd0,msdos1)'
       search --no-floppy --fs-uuid --set=root e1679c23-ba3c-4d9f-9d02-b2a3d69b
5af4
       linux   /boot/vmlinuz-3.0.0-16-generic root=UUID=e1679c23-ba3c-4d9f-9d02
-b2a3d69b5af4 ro   quiet splash vt.handoff=7 console=ttyS0,115200n8
       initrd  /boot/initrd.img-3.0.0-16-generic


reboot the VM.

connect to the VM via virsh console
virsh # console Mint12-64-1
Connected to domain Mint12-64-1
エスケープ文字は  ^] です

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.