LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 09-20-2012, 02:19 PM   #1
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Rep: Reputation: Disabled
problem in connection to console of VM via virsh


Hi all,

I'm trying to connect to my VM's console but I after getting:
Code:
virsh # console kvm2
Connected to domain kvm2
Escape character is ^]
nothing is displayed and it's stuck.
and this is the kvm2 info:
Code:
<console type='pty' tty='/dev/pts/2'>
      <source path='/dev/pts/2'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
Any help is appreciated

Last edited by sanaz; 09-20-2012 at 02:22 PM.
 
Old 09-21-2012, 01:17 AM   #2
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
did you add the console to the guest's grub?
 
Old 09-21-2012, 08:54 AM   #3
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
No. How can I do that?

Quote:
Originally Posted by dyasny View Post
did you add the console to the guest's grub?
 
Old 09-21-2012, 11:27 AM   #4
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
add 'console=ttyS0' to the kernel line in grub.conf

the libvirt XML should contain this:

<serial type='pty'>
<target port='0'/>
</serial>

<console type='pty'>
<target type='serial' port='0'/>
</console>
 
Old 09-21-2012, 12:52 PM   #5
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
It looks like:

Code:
<serial type='pty'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/2'>
      <source path='/dev/pts/2'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
which seems fine.

and also I don't have grub.conf, instead there is /etc/grub2.cfg, should I add them to it?
 
Old 09-21-2012, 01:25 PM   #6
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
console=ttyS0 should be in the kernel boot line. however your specific distro defines it
 
Old 09-21-2012, 02:01 PM   #7
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
should I add it to the Os I'm running hypervisor on it, or the virtual machines os?

Quote:
Originally Posted by dyasny View Post
console=ttyS0 should be in the kernel boot line. however your specific distro defines it
 
Old 09-22-2012, 02:55 AM   #8
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
the guest os
 
Old 09-22-2012, 08:38 AM   #9
docent.net
LQ Newbie
 
Registered: Mar 2008
Posts: 1

Rep: Reputation: 0
It really depend on distro. Normally on the guest You should:

Code:
echo ttyS0 >> /etc/securetty
And now You should add this to Your kernel boot params in grub.conf (location of this file depends on Your distro, try /boot/grub2/grub.cfg and If You don't find there then 'locate grub.conf'):

Code:
console=ttyS0
so Your kernel boot param looks like:

Code:
kernel /vmlinuz-2.6.32-220.23.1.el6.x86_64 ro root=/dev/mapper/vg_main-root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_main/root rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto rd_LVM_LV=vg_main/swap  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM console=ttyS0
And finally enter this:

Code:
echo "S0:12345:respawn:/sbin/agetty ttyS0 115200" >> /etc/inittab && init q
Reboot Your guest and You should have working console
 
Old 09-25-2012, 09:25 AM   #10
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
But How can I do it on guest OS(VM), while I cannot connect to its console??
 
Old 09-25-2012, 03:23 PM   #11
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
use another type of console at first, or deploy the VM with this setting preconfigured via kickstart. Or use a graphical console
 
Old 10-01-2012, 06:06 PM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Actually, i just hit <Rtn/Enter> at that point to get the login prompt
Code:
 virsh console vm1
Connected to domain vm1
Escape character is ^]

< now hit Rtn/Enter key ... et voila the prompt :) >

CentOS release 6.3 (Final)
Kernel 2.6.32-279.el6.x86_64 on an x86_64

vm1 login:
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
qemu virsh serial console stuck at 80x25 linux_user_123 Linux - Virtualization and Cloud 0 09-13-2012 04:04 PM
Shutdown, Reboot does not work through virsh Mohan.Sundar Linux - Virtualization and Cloud 2 05-10-2011 03:39 PM
qemu/kvm virsh networking help zoran119 Linux - Virtualization and Cloud 2 12-02-2010 01:43 AM
Xen, xendomain and virsh matiasquestions Linux - Software 0 12-04-2007 12:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 03:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration