制作DomainU时碰到的一些问题
这两天制作了hvm,其中碰到了一些问题。
首先是启动不起来,后来发现是自己改错了配置
本来是:
device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
结果我画蛇添足改成了:
device_model = '/usr/' + arch_libdir + '/usr/lib64/xen/bin/qemu-dm'
后来才看懂,arch_libdir在本地其实就是lib64,所以device_model本来就是
/usr/lib64/xen/bin/qemu-dm,加入/usr/lib64就使结果变为:
/usr/lib64/usr/lib64/xen/bin/qemu-dm
解决这个问题后就可以正常启动了。
下面show一下我的第一个hvm的配置:
# -*- mode: python; -*-
arch = os.uname()[4]
if re.search('64', arch):
arch_libdir = 'lib64'
else:
arch_libdir = 'lib'
#----------------------------------------------------------------
# hvmloader in place of a kernel image
kernel = "/usr/lib/xen/boot/hvmloader"
# guest domain build function (for HVM guests we use 'hvm')
builder='hvm'
device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
# memory allocation at boot in MB
memory = 512
# shadow pagetable memory,
#should be at least 2KB per MB of memory plus a few MB per vcpu
shadow_memory = 8
name = "cs.fv.win" # name for the domain
# number of CPUs guest has available (default=1)
vcpus=2
# HVM guest PAE support (default=0 disabled)
#pae=0
# HVM guest ACPI support (default=0 disabled)
#acpi=0
# HVM guest APIC support (default=0 disabled)
#apic=0
#----------------------------------------------------------------
# 1 NIC, auto-assigned MAC address
vif = [ 'type=ioemu, bridge=eth0' ]
# first device is LVM partition to use as hard disk,
# second device is an image of an installation CD-ROM
#disk = ['phy:/dev/XenGuests/hvm1,hda,w', 'tap:aio:/root/winxp.iso,hdc:cdrom,r']
disk = ['file:/home/cs/xen/images/win/winxp.img,hda,w', 'file:/home/cs/Desktop/WindowsXP.iso,hdc:cdrom,r']
# boot order (a=floppy, c=hard disk, d=CD-ROM; default=cda)
#boot="cda"
boot="d"
# function to execute when guest wishes to power off
#on_poweroff = 'destroy'
# function to execute when guest wishes to reboot
#on_reboot = 'restart'
# function to execute if guest crashes
#on_crash = 'restart'
#----------------------------------------------------------------
# SDL library support for graphics (default=0 disabled)
sdl=0
# VNC library support for graphics (default=0 disabled)
vnc=1
#------------------------VNC-------------------------------------
# address for VNC server to listen on,
# (default is to use the 'vnc-listen'
# setting in /etc/xen/xend-config.sxp)
vnclisten="0.0.0.0"
# set the VNC display number (default=domid)
vncdisplay=44
# find an unused port for the VNC server (default=1 enabled)
vncunused=1
# spawn vncviewer for domain's console (default=0 disabled)
#vncconsole=0
#------------------------VGA-------------------------------------
# no graphics, only serial (do not enable for Windows guests)
#nographic=0
# stdvga (cirrus logic model, default=0 disabled)
stdvga=0
# start in full screen (default=0 no)
#full-screen=1
#------------------------USB-------------------------------------
# USB support
#(devices may be specified through the monitor window)
#usb=1
# normal/relative mouse
#usbdevice='mouse'
# tablet/absolute mouse
#usbdevice='tablet'
#------------------------MISC------------------------------------
# serial port re-direct to pty device,
# allows xm console or minicom to connect
#serial='pty'
# sound card support (sb16, es1370, all; default none)
#soundhw='sb16'
# set real time clock to local time (default=0 UTC)
localtime=1
后来装了个Debian,先创建一个磁盘镜像(一个文件对应一个硬盘),不必格式化,把iso文件当作光驱,从iso文件启动,接下来像在物理机上安装一样。我从网络安装Debian,有几种方式,可以用grub引导linux和initrd.gz后安装,也可以从mini.iso(估计就是linux和initrd.gz的集成)启动安装。安装时选择一个速度快的站点,从上面下载安装文件。整个过程在很大程度上取决于网速,装好后在虚拟机配置文件中改为从硬盘启动,重新启动虚拟机即可。
进入fv的Debian后,居然只有update-rc.d,没有sysvconfig也没sysv-rc-conf,所以干脆手动改。其间把avahi服务给mv掉了(在前面加了个点),结果上不了网,最后mv回去就号好了。
其间还查了下umask,一般设置文件中umask 22,表示创建的文件默认属性为755(022取反)。
后记1:
# -*- mode: python; -*-
arch = os.uname()[4]
if re.search('64', arch):
arch_libdir = 'lib64'
else:
arch_libdir = 'lib'
#----------------------------------------------------------------
# hvmloader in place of a kernel image
kernel = "/usr/lib/xen/boot/hvmloader"
# guest domain build function (for HVM guests we use 'hvm')
builder='hvm'
device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
# memory allocation at boot in MB
memory = 512
# shadow pagetable memory,
#should be at least 2KB per MB of memory plus a few MB per vcpu
shadow_memory = 8
name = "cs.fv.deb" # name for the domain
# number of CPUs guest has available (default=1)
vcpus=2
# HVM guest PAE support (default=0 disabled)
#pae=0
# HVM guest ACPI support (default=0 disabled)
#acpi=0
# HVM guest APIC support (default=0 disabled)
#apic=0
#----------------------------------------------------------------
# 1 NIC, auto-assigned MAC address
vif = [ 'type=ioemu, bridge=eth0' ]
# first device is LVM partition to use as hard disk,
# second device is an image of an installation CD-ROM
#disk = ['phy:/dev/XenGuests/hvm1,hda,w', 'tap:aio:/root/winxp.iso,hdc:cdrom,r']
#disk = ['file:/home/cs/xen/images/debian/fv.deb.img,hda,w', 'file:/home/cs/Desktop/mini.iso,hdc:cdrom,r']
disk = ['file:/home/cs/xen/images/debian/fv.deb.img,hda,w']
# boot order (a=floppy, c=hard disk, d=CD-ROM; default=cda)
boot="cda"
# function to execute when guest wishes to power off
#on_poweroff = 'destroy'
# function to execute when guest wishes to reboot
#on_reboot = 'restart'
# function to execute if guest crashes
#on_crash = 'restart'
#----------------------------------------------------------------
# SDL library support for graphics (default=0 disabled)
sdl=0
# VNC library support for graphics (default=0 disabled)
vnc=1
#------------------------VNC-------------------------------------
# address for VNC server to listen on,
# (default is to use the 'vnc-listen'
# setting in /etc/xen/xend-config.sxp)
vnclisten="0.0.0.0"
# set the VNC display number (default=domid)
vncdisplay=46
# find an unused port for the VNC server (default=1 enabled)
vncunused=1
# spawn vncviewer for domain's console (default=0 disabled)
#vncconsole=0
#------------------------VGA-------------------------------------
# no graphics, only serial (do not enable for Windows guests)
#nographic=0
# stdvga (cirrus logic model, default=0 disabled)
stdvga=0
# start in full screen (default=0 no)
#full-screen=1
#------------------------USB-------------------------------------
# USB support
#(devices may be specified through the monitor window)
usb=1
# normal/relative mouse
usbdevice='mouse'
# tablet/absolute mouse
usbdevice='tablet'
#------------------------MISC------------------------------------
# serial port re-direct to pty device,
# allows xm console or minicom to connect
#serial='pty'
# sound card support (sb16, es1370, all; default none)
#soundhw='sb16'
# set real time clock to local time (default=0 UTC)
localtime=1
以上是可以从46号端口用vnc连接的配置
后记2:
在连接时碰到过
read/select connection aborted 10053
的问题
查了下,网上有的说是客户端或防火墙或网络之类的问题,于是把vncviewer换成了tightvnc,一连接就可以了,果然是本地的vncviewer的问题!
后记3:
对了,除了10053错误之外,还有一个现象:有一个屏幕一闪而过,看不清楚是什么。估计是传过来一帧之后就断开了
后记4:
今天装rhel5的全虚拟化镜像虚拟机,结果不管咋样都卡在安装过程中,最后据说是vcpu的原因:不能用多核,只能设置成单核,于是试了一下,果然。
后记5:
今天通过全虚拟化镜像制作半虚拟化镜像,启动后系统只读,后来发现是fstab没正确配置的原因,最后在/etc/fstab中只留下这一行就ok了:
/dev/sda1 / ext3 defaults 1 1
Labels: Linux, Operation and Maintenance
3 Comments:
# -*- mode: python; -*-
arch = os.uname()[4]
if re.search('64', arch):
arch_libdir = 'lib64'
else:
arch_libdir = 'lib'
#----------------------------------------------------------------
# hvmloader in place of a kernel image
kernel = "/usr/lib/xen/boot/hvmloader"
# guest domain build function (for HVM guests we use 'hvm')
builder='hvm'
device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
# memory allocation at boot in MB
memory = 512
# shadow pagetable memory,
#should be at least 2KB per MB of memory plus a few MB per vcpu
shadow_memory = 8
name = "cs.fv.deb" # name for the domain
# number of CPUs guest has available (default=1)
vcpus=2
# HVM guest PAE support (default=0 disabled)
#pae=0
# HVM guest ACPI support (default=0 disabled)
#acpi=0
# HVM guest APIC support (default=0 disabled)
#apic=0
#----------------------------------------------------------------
# 1 NIC, auto-assigned MAC address
vif = [ 'type=ioemu, bridge=eth0' ]
# first device is LVM partition to use as hard disk,
# second device is an image of an installation CD-ROM
#disk = ['phy:/dev/XenGuests/hvm1,hda,w', 'tap:aio:/root/winxp.iso,hdc:cdrom,r']
#disk = ['file:/home/cs/xen/images/debian/fv.deb.img,hda,w', 'file:/home/cs/Desktop/mini.iso,hdc:cdrom,r']
disk = ['file:/home/cs/xen/images/debian/fv.deb.img,hda,w']
# boot order (a=floppy, c=hard disk, d=CD-ROM; default=cda)
boot="cda"
# function to execute when guest wishes to power off
#on_poweroff = 'destroy'
# function to execute when guest wishes to reboot
#on_reboot = 'restart'
# function to execute if guest crashes
#on_crash = 'restart'
#----------------------------------------------------------------
# SDL library support for graphics (default=0 disabled)
sdl=0
# VNC library support for graphics (default=0 disabled)
vnc=1
#------------------------VNC-------------------------------------
# address for VNC server to listen on,
# (default is to use the 'vnc-listen'
# setting in /etc/xen/xend-config.sxp)
vnclisten="0.0.0.0"
# set the VNC display number (default=domid)
vncdisplay=46
# find an unused port for the VNC server (default=1 enabled)
vncunused=1
# spawn vncviewer for domain's console (default=0 disabled)
#vncconsole=0
#------------------------VGA-------------------------------------
# no graphics, only serial (do not enable for Windows guests)
#nographic=0
# stdvga (cirrus logic model, default=0 disabled)
stdvga=0
# start in full screen (default=0 no)
#full-screen=1
#------------------------USB-------------------------------------
# USB support
#(devices may be specified through the monitor window)
usb=1
# normal/relative mouse
usbdevice='mouse'
# tablet/absolute mouse
usbdevice='tablet'
#------------------------MISC------------------------------------
# serial port re-direct to pty device,
# allows xm console or minicom to connect
#serial='pty'
# sound card support (sb16, es1370, all; default none)
#soundhw='sb16'
# set real time clock to local time (default=0 UTC)
localtime=1
以上是可以从46号端口用vnc连接的配置
在连接时碰到过
read/select connection aborted 10053
的问题
查了下,网上有的说是客户端或防火墙或网络之类的问题,于是把vncviewer换成了tightvnc,一连接就可以了,果然是本地的vncviewer的问题!
对了,除了10053错误之外,还有一个现象:有一个屏幕一闪而过,看不清楚是什么。估计是传过来一帧之后就断开了
Post a Comment
Subscribe to Post Comments [Atom]
<< Home