Enable text console for HVM Domu
Is there any way to change Graphical console[vnc] to the non-graphical console (xen console)?
For HVM guest, you need to enable serial port on domU config file (example here: http://pastebin.com/fb6fe631), and setup domU to use serial port (ttyS0 on Linux) by modifying (for Linux domU) /boot/grub/menu.lst, /etc/inittab, and /etc/securetty.
If it's PV guest, you need to set up domU to use xen console (which is xvc0 on current xen version, hvc0 on pv_ops kernel). It's similar to setting up domU for serial console, you just need to change ttyS0 to hvc0. An example of domU setup that can use both xvc0 and vnc console is here : http://pastebin.com/f6a5022bf
Referenece 1:
----------------
Part 2, converting HVM guest to PV guest
#=======================================================================
First we need to install kernel-xen with correct initrd
- yum install kernel-xen
- edit /boot/grub/menu.lst so it looks like this
#=================================================
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title CentOS (2.6.18-128.1.6.el5xen)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.1.6.el5xen ro root=/dev/VolGroup00/LogVol00 console=xvc0
initrd /initrd-2.6.18-128.1.6.el5xen.img
title CentOS (2.6.18-128.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/VolGroup00/LogVol00 console=ttyS0 ide0=noprobe
initrd /initrd-2.6.18-128.el5.img
#=================================================
- edit /etc/sysconfig/kernel so it looks like this
#=================================================
UPDATEDEFAULT=yes
DEFAULTKERNEL=kernel-xen
#=================================================
- edit /etc/modprobe.conf so it looks like this
#=================================================
alias eth0 xennet
alias scsi_hostadapter xenblk
#=================================================
-recreate initrd
cd /boot
mv initrd-2.6.18-128.1.6.el5xen.img initrd-2.6.18-128.1.6.el5xen.img.bak
mkinitrd -v --builtin=xen_vbd --preload=xenblk initrd-2.6.18-128.1.6.el5xen.img 2.6.18-128.1.6.el5xen
Next we need to allow login from xvc0 (the default console)
- edit /etc/inittab and add a line like this near the end
#=================================================
xvc:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav
#=================================================
- add "xvc0" to the end of /etc/securetty
- shutdown domU
Next we start the PV domU
- create PV domU config. Mine looks like this
#=================================================
memory = "500"
maxmem = "8000"
vcpus=8
vcpu_avail=1
disk = [
'phy:/dev/rootVG/testlv,hda,w',
]
vif = [
'mac=00:16:3E:49:CA:65, bridge=br6',
]
vfb =['type=vnc,vnclisten=0.0.0.0']
bootloader="/usr/bin/pygrub"
#=================================================
- startup domU, connect to it's console (xm create -c ...)
#=======================================================================
End of part 2
Reference 2:
-------------
Part 1. Creating a Centos HVM domU with working PV drivers
#=======================================================================
start with standard Centos 5.3 x86_64 HVM install.
- my HVM domU config file :
#=================================================
memory = 500
vif = [ 'mac=00:16:3E:49:CA:65, bridge=br6' ]
disk = [
'phy:/dev/rootVG/testlv,hda,w',
'file:/data/iso/centos.iso,hdc:cdrom,r',
]
boot="cd"
device_model = '/usr/lib64/xen/bin/qemu-dm'
kernel = "/usr/lib/xen/boot/hvmloader"
builder='hvm'
sdl=0
vnc=1
vnclisten="0.0.0.0"
#vncunused=0
vncpasswd=''
#stdvga=0
serial='pty'
#localtime=1
usbdevice='tablet'
acpi=1
apic=1
pae=1
vcpus=1
#=================================================
Note boot="cd". With this config if you're using "fresh" LVM or image file, the harddisk will be unbootable initally and it will boot from CD. After installation it will automatically boot from harddisk.
- if you want serial text console (like I do), on DVD installation splash screen start installation with
linux text console=vga console=ttyS0
- during package selection, unselect "desktop GNOME" if you want text login like I do. Although not required, this will reduce resource needs (e.g. memory) and make subsequent setup easier.
- proceed untill installation finished
activate PV drivers
- edit /boot/grub/menu.lst so it looks like this (note ide0=noprobe)
#=================================================
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title CentOS (2.6.18-128.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/VolGroup00/LogVol00 console=ttyS0 ide0=noprobe
initrd /initrd-2.6.18-128.el5.img
#=================================================
- edit /etc/modprobe.conf so it looks like this
#=================================================
#alias eth0 8139cp
blacklist 8139cp
blacklist 8139too
alias scsi_hostadapter ata_piix
# xen HVM
alias eth0 xen-vnif
alias scsi_hostadapter1 xen-vbd
#=================================================
-recreate initrd
cd /boot
mv initrd-2.6.18-128.el5.img initrd-2.6.18-128.el5.img.bak
mkinitrd -v initrd-2.6.18-128.el5.img 2.6.18-128.el5
- init 6
- reconnect to domU console (with either "xm console" or vncviewer)
- login, check whether xen-vbd activates correctly
# ls -la /sys/class/net/eth0/device
lrwxrwxrwx 1 root root 0 Apr 25 11:50 /sys/class/net/eth0/device -> ../../../devices/xen/vif-0
# ls -la /sys/block/hda/device
lrwxrwxrwx 1 root root 0 Apr 25 11:50 /sys/block/hda/device -> ../../devices/xen/vbd-768
#=======================================================================
End of part 1.
Reference 3:
--------------
Xen has a built in console when creating paravirtualized DOMU's, but this does not extend to hardware virtualized ones. In this case, we need to modify the configuration file, then set the DOM0 up to send messages and allow logins from the serial console.
This is basically like setting up a computer with a serial console and connecting to it via a serial cable.
Instructions for centos.
in configuration file for DOMU (on DOM0), add the line:
serial='pty'
In DOMU
edit /etc/inittab and find line which starts with co:2345 and
comment any line that looks like ??:2345 by adding a pound sign in front (#)
Find the line which say
sT0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
and uncomment it by removing the pound sign in front of it
To make the changes immediate, without rebooting the server, enter the command
init q # or kill -HUP 1
to tell init to reload. At this point, you should be able to execute the command xm console domainname from the DOM0
- edit /boot/grub/menu.lst so it looks like this (note ide0=noprobe)
#=================================================
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title CentOS (2.6.18-128.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/VolGroup00/LogVol00 console=ttyS0 ide0=noprobe
initrd /initrd-2.6.18-128.el5.img
- add "ttys0" to the end of /etc/securetty.
-Reboot the server.
For Ubuntu,
3). edit /etc/default/grub. At the bottom of the file, add the following three lines
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,38400n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"
Execute command grub-mkconfig > /boot/grub/grub.cfg
reboot DOMU and you should be able to access console via xm console. NOTE: this is a very basic console, so don't expect pretty
For HVM guest, you need to enable serial port on domU config file (example here: http://pastebin.com/fb6fe631), and setup domU to use serial port (ttyS0 on Linux) by modifying (for Linux domU) /boot/grub/menu.lst, /etc/inittab, and /etc/securetty.
If it's PV guest, you need to set up domU to use xen console (which is xvc0 on current xen version, hvc0 on pv_ops kernel). It's similar to setting up domU for serial console, you just need to change ttyS0 to hvc0. An example of domU setup that can use both xvc0 and vnc console is here : http://pastebin.com/f6a5022bf
Referenece 1:
----------------
Part 2, converting HVM guest to PV guest
#=======================================================================
First we need to install kernel-xen with correct initrd
- yum install kernel-xen
- edit /boot/grub/menu.lst so it looks like this
#=================================================
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title CentOS (2.6.18-128.1.6.el5xen)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.1.6.el5xen ro root=/dev/VolGroup00/LogVol00 console=xvc0
initrd /initrd-2.6.18-128.1.6.el5xen.img
title CentOS (2.6.18-128.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/VolGroup00/LogVol00 console=ttyS0 ide0=noprobe
initrd /initrd-2.6.18-128.el5.img
#=================================================
- edit /etc/sysconfig/kernel so it looks like this
#=================================================
UPDATEDEFAULT=yes
DEFAULTKERNEL=kernel-xen
#=================================================
- edit /etc/modprobe.conf so it looks like this
#=================================================
alias eth0 xennet
alias scsi_hostadapter xenblk
#=================================================
-recreate initrd
cd /boot
mv initrd-2.6.18-128.1.6.el5xen.img initrd-2.6.18-128.1.6.el5xen.img.bak
mkinitrd -v --builtin=xen_vbd --preload=xenblk initrd-2.6.18-128.1.6.el5xen.img 2.6.18-128.1.6.el5xen
Next we need to allow login from xvc0 (the default console)
- edit /etc/inittab and add a line like this near the end
#=================================================
xvc:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav
#=================================================
- add "xvc0" to the end of /etc/securetty
- shutdown domU
Next we start the PV domU
- create PV domU config. Mine looks like this
#=================================================
memory = "500"
maxmem = "8000"
vcpus=8
vcpu_avail=1
disk = [
'phy:/dev/rootVG/testlv,hda,w',
]
vif = [
'mac=00:16:3E:49:CA:65, bridge=br6',
]
vfb =['type=vnc,vnclisten=0.0.0.0']
bootloader="/usr/bin/pygrub"
#=================================================
- startup domU, connect to it's console (xm create -c ...)
#=======================================================================
End of part 2
Reference 2:
-------------
Part 1. Creating a Centos HVM domU with working PV drivers
#=======================================================================
start with standard Centos 5.3 x86_64 HVM install.
- my HVM domU config file :
#=================================================
memory = 500
vif = [ 'mac=00:16:3E:49:CA:65, bridge=br6' ]
disk = [
'phy:/dev/rootVG/testlv,hda,w',
'file:/data/iso/centos.iso,hdc:cdrom,r',
]
boot="cd"
device_model = '/usr/lib64/xen/bin/qemu-dm'
kernel = "/usr/lib/xen/boot/hvmloader"
builder='hvm'
sdl=0
vnc=1
vnclisten="0.0.0.0"
#vncunused=0
vncpasswd=''
#stdvga=0
serial='pty'
#localtime=1
usbdevice='tablet'
acpi=1
apic=1
pae=1
vcpus=1
#=================================================
Note boot="cd". With this config if you're using "fresh" LVM or image file, the harddisk will be unbootable initally and it will boot from CD. After installation it will automatically boot from harddisk.
- if you want serial text console (like I do), on DVD installation splash screen start installation with
linux text console=vga console=ttyS0
- during package selection, unselect "desktop GNOME" if you want text login like I do. Although not required, this will reduce resource needs (e.g. memory) and make subsequent setup easier.
- proceed untill installation finished
activate PV drivers
- edit /boot/grub/menu.lst so it looks like this (note ide0=noprobe)
#=================================================
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title CentOS (2.6.18-128.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/VolGroup00/LogVol00 console=ttyS0 ide0=noprobe
initrd /initrd-2.6.18-128.el5.img
#=================================================
- edit /etc/modprobe.conf so it looks like this
#=================================================
#alias eth0 8139cp
blacklist 8139cp
blacklist 8139too
alias scsi_hostadapter ata_piix
# xen HVM
alias eth0 xen-vnif
alias scsi_hostadapter1 xen-vbd
#=================================================
-recreate initrd
cd /boot
mv initrd-2.6.18-128.el5.img initrd-2.6.18-128.el5.img.bak
mkinitrd -v initrd-2.6.18-128.el5.img 2.6.18-128.el5
- init 6
- reconnect to domU console (with either "xm console" or vncviewer)
- login, check whether xen-vbd activates correctly
# ls -la /sys/class/net/eth0/device
lrwxrwxrwx 1 root root 0 Apr 25 11:50 /sys/class/net/eth0/device -> ../../../devices/xen/vif-0
# ls -la /sys/block/hda/device
lrwxrwxrwx 1 root root 0 Apr 25 11:50 /sys/block/hda/device -> ../../devices/xen/vbd-768
#=======================================================================
End of part 1.
Reference 3:
--------------
Xen has a built in console when creating paravirtualized DOMU's, but this does not extend to hardware virtualized ones. In this case, we need to modify the configuration file, then set the DOM0 up to send messages and allow logins from the serial console.
This is basically like setting up a computer with a serial console and connecting to it via a serial cable.
Instructions for centos.
in configuration file for DOMU (on DOM0), add the line:
serial='pty'
In DOMU
edit /etc/inittab and find line which starts with co:2345 and
comment any line that looks like ??:2345 by adding a pound sign in front (#)
Find the line which say
sT0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
and uncomment it by removing the pound sign in front of it
To make the changes immediate, without rebooting the server, enter the command
init q # or kill -HUP 1
to tell init to reload. At this point, you should be able to execute the command xm console domainname from the DOM0
- edit /boot/grub/menu.lst so it looks like this (note ide0=noprobe)
#=================================================
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title CentOS (2.6.18-128.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/VolGroup00/LogVol00 console=ttyS0 ide0=noprobe
initrd /initrd-2.6.18-128.el5.img
- add "ttys0" to the end of /etc/securetty.
-Reboot the server.
For Ubuntu,
1) Create a file called /etc/init/ttyS0.conf containing the following:
# ttyS0 - getty # # This service maintains a getty on ttyS0 from the point the system is # started until it is shut down again. start on stopped rc or RUNLEVEL=[12345] stop on runlevel [!12345] respawn exec /sbin/getty -L 115200 ttyS0 vt102
2) Ask upstart to start the getty
sudo start ttyS0
3). edit /etc/default/grub. At the bottom of the file, add the following three lines
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,38400n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"
Execute command grub-mkconfig > /boot/grub/grub.cfg
reboot DOMU and you should be able to access console via xm console. NOTE: this is a very basic console, so don't expect pretty
Comments
Post a Comment