Cobbler部署之FAQ处理
通过cobbler check检查出现的报错
红色标注为报错关键信息
9.1 报错一
- # cobbler check
- httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:
- Traceback (most recent call last):
- File "/usr/lib/python2.4/site-packages/cobbler/cli.py", line 184, in check_setup
- s.ping()
- File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__
- return self.__send(self.__name, args)
- File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request
- verbose=self.__verbose
- File "/usr/lib64/python2.4/xmlrpclib.py", line 1129, in request
- self.send_content(h, request_body)
- File "/usr/lib64/python2.4/xmlrpclib.py", line 1243, in send_content
- connection.endheaders()
- File "/usr/lib64/python2.4/httplib.py", line 804, in endheaders
- self._send_output()
- File "/usr/lib64/python2.4/httplib.py", line 685, in _send_output
- self.send(msg)
- File "/usr/lib64/python2.4/httplib.py", line 652, in send
- self.connect()
- File "/usr/lib64/python2.4/httplib.py", line 636, in connect
- raise socket.error, msg
- error: (111, 'Connection refused')
解决启动httpd服务
- service httpd start
- Starting httpd: Syntax error on line 10 of /etc/httpd/conf.d/cobbler.conf:
- Invalid command 'WSGIScriptAliasMatch', perhaps misspelled or defined by a module not included in the server configuration
- [FAILED]#启动httpd时的报错,解决方法如下
解决
- vim /etc/httpd/conf.d/wsgi.conf
- 去掉注释
- LoadModule wsgi_module modules/mod_wsgi.so
- 再启动httpd服务
- service httpd start
- Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using x.x.x.x for ServerName
- [ OK ]
再进行一些针对apache ServerName参数配置的处理
- egrep "ServerName|Listen" /etc/httpd/conf/httpd.conf |grep -v '#'
- Listen 172.17.10.14:80
- ServerName 80
官方相关资料https://github.com/cobbler/cobbler/wiki/Cobbler web interface
9.2 报错二
此步共修复七个需要处理的提示,一个一个解决
- # cobbler check
- The following are potential configuration items that you may want to fix:
- 1 : service dhcpd is not running
- 解决:DHCP先不处理
- 2 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
- 解决:执行 cobbler get-loaders,系统将自动下载loader程序,完成提示2的修复工作。
- # cobbler get-loaders
- task started: 2013-03-10_103017_get_loaders
- task started (id=Download Bootloader Content, time=Sun Mar 10 10:30:17 2013)
- downloading http://dgoodwin.fedorapeople.org/loaders/README to /var/lib/cobbler/loaders/README
- downloading http://dgoodwin.fedorapeople.org/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
- downloading http://dgoodwin.fedorapeople.org/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
- downloading http://dgoodwin.fedorapeople.org/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
- downloading http://dgoodwin.fedorapeople.org/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
- downloading http://dgoodwin.fedorapeople.org/loaders/yaboot-1.3.14-12 to /var/lib/cobbler/loaders/yaboot
- downloading http://dgoodwin.fedorapeople.org/loaders/pxelinux.0-3.61 to /var/lib/cobbler/loaders/pxelinux.0
- downloading http://dgoodwin.fedorapeople.org/loaders/menu.c32-3.61 to /var/lib/cobbler/loaders/menu.c32
- downloading http://dgoodwin.fedorapeople.org/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
- downloading http://dgoodwin.fedorapeople.org/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
- *** TASK COMPLETE ***
- 3 : debmirror package is not installed, it will be required to manage debian deployments and repositories
- 解决:提示说debmirror没安装。如果不是安装 debian之类的系统,此提示可以忽略,如果需要安装,
- 安装 debmirror
- yum -y install debmirror
- 编辑注释
- 修改 /etc/debmirror.conf 配置文件,注释掉 @dists 和 @arches 两行
- sed -i 's|@dists=.*|#@dists=|' /etc/debmirror.conf
- sed -i 's|@arches=.*|#@arches=|' /etc/debmirror.conf
- 4 : ksvalidator was not found, install pykickstart
- 解决:安装ksvalidator
- yum install pykickstart -y
- 5 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
- 解决:修改cobbler用户的默认密码,可以使用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings中 default_password_crypted 的密码。
- 生成密码命令:
- #openssl passwd -1 -salt 'random-phrase-here' '[任意密码]'
- openssl passwd -1 -salt 'random-phrase-here' 'hexun'
- $1$random-p$Q1IN9LaNg7yhRKJuY50fV1
- 6 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
- 解决:安装cman工具用于电源管理
- yum -y install cman
- Restart cobblerd and then run 'cobbler sync' to apply changes.
- 修复完毕重启cobbler服务,然后运行cobbler sync
- 7:修复完成以上问题后,同步信息再检查
- /etc/init.d/cobblerd restart
- Stopping cobbler daemon: [ OK ]
- Starting cobbler daemon: [ OK ]
- 再次检查,又报错
- cobbler check
- The following are potential configuration items that you may want to fix:
- 1 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
- Restart cobblerd and then run 'cobbler sync' to apply changes.
- 报错原因是上面的第五个问题没完全解决,仅仅生成了密钥,没有放入cobbler主配置文件
- vim /etc/cobbler/settings
- default_password_crypted: "$1$random-p$Q1IN9LaNg7yhRKJuY50fV1"
- 再重启服务
- /etc/init.d/cobblerd restart
- Stopping cobbler daemon: [ OK ]
- Starting cobbler daemon: [ OK ]
- cobbler check
- No configuration problems found. All systems go.
- 执行cobbler sync
- cobbler sync
- task started: 2013-03-10_105055_sync
- task started (id=Sync, time=Sun Mar 10 10:50:55 2013)
- running pre-sync triggers
- cleaning trees
- removing: /tftpboot/pxelinux.cfg/default
- 略
- received on stdout: Shutting down dhcpd: [ OK ]
- Starting dhcpd: [ OK ]
- received on stderr:
- running shell triggers from /var/lib/cobbler/triggers/sync/post/*
- running python triggers from /var/lib/cobbler/triggers/change/*
- running python trigger cobbler.modules.scm_track
- running shell triggers from /var/lib/cobbler/triggers/change/*
- *** TASK COMPLETE ***
- 执行cobbler sync会重启相关服务,DHCP服务也会启动了,第一个提示也就解决了,下面也有说明
9.3 报错三
- [root@cobbler-1014 x86_64]# /etc/init.d/cobblerd restart
- Stopping cobbler daemon: [FAILED]
- Starting cobbler daemon: [ OK ]
- [root@cobbler-1014 x86_64]# cobbler check
- The following are potential configuration items that you may want to fix:
- 1 : service dhcpd is not running
- Restart cobblerd and then run 'cobbler sync' to apply changes.
执行cobbler sync即可启动dhcp服务
- cobbler sync
9.4 报错四
使用koan重装系统时报错
- koan --server=172.17.10.14 --list=profiles
- Traceback (most recent call last):
- File "/usr/bin/koan", line 18, in ?
- import koan.app as app
- File "/usr/lib/python2.4/site-packages/koan/app.py", line 64, in ?
- import configurator
- File "/usr/lib/python2.4/site-packages/koan/configurator.py", line 36, in ?
- import simplejson as json
- ImportError: No module named simplejson
解决:需要安装simplejson软件包,
最新版下载地址:http://pypi.python.org/pypi/simplejson/
最新版的simplejson要求python 2.6+以上的,CntOS5.8是Python 2.4.3,所以下载的simplejson-2.0.9.tar.gz版本
https://pypi.python.org/packages/source/s/simplejson/simplejson-2.0.9.tar.gz
安装步骤:
访问外网下载文件setuptools-0.6c7-py2.4.egg
如没有外网可以通过其他机器下载https://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c7-py2.4.egg
然后上传至客户机再继续安装
- tar zxf simplejson-2.0.9.tar.gz
- cd simplejson-2.0.9
- python setup.py install
建议CentOS5.8 安装此版本的koan使用可以避免此问题
ftp://rpmfind.net/linux/epel/5/i386/koan-1.6.6-1.el5.noarch.rpm
9.5 报错五
- koan --server=172.17.10.14 --virt-name=testvm --virt --profile=centos5.8-xen-x86_64
- - looking for Cobbler at http://172.17.10.14:80/cobbler_api
- - reading URL: http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64
- install_tree: http://172.17.10.14/cblr/links/centos5.8-xen-x86_64
- xen package needs to be installed
Xen 宿主机安装虚拟机时提示没有安装xen软件包
解决:
- yum install xen -y
执行此命令会安装一共9个软件包,如下
- Running Transaction
- Installing : bridge-utils 1/9
- Installing : cyrus-sasl-md5 2/9
- Installing : ebtables 3/9
- Installing : e4fsprogs-libs 4/9
- Installing : xen-libs 5/9
- Installing : libvirt 6/9
- Installing : libvirt-python 7/9
- Installing : python-virtinst 8/9
- Installing : xen 9/9
9.6 报错六
- koan --server=172.17.10.14 --virt-name=testvm --virt --profile=centos5.8-xen-x86_64
- - looking for Cobbler at http://172.17.10.14:80/cobbler_api
- - reading URL: http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64
- install_tree: http://172.17.10.14/cblr/links/centos5.8-xen-x86_64
- xend needs to be started
解决:
报错原因是xend服务没有启动,执行以下命令处理
- chkconfig xend on
- /etc/init.d/xend start
- #注意此过程会自动桥接网卡,可能出现短暂断网
9.7 报错七
- koan --server=172.17.10.14 --virt-name=testvm --virt --profile=centos5.8-xen-x86_64
- - looking for Cobbler at http://172.17.10.14:80/cobbler_api
- - reading URL: http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64
- install_tree: http://172.17.10.14/cblr/links/centos5.8-xen-x86_64
- libvirtd is stopped
- libvirtd needs to be running
解决:
- chkconfig libvirtd on
- /etc/init.d/libvirtd start
9.8 报错八
- koan --server=172.17.10.14 --virt-name=testvm --virt --profile=centos5.8-xen-x86_64
- - looking for Cobbler at http://172.17.10.14:80/cobbler_api
- - reading URL: http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64
- install_tree: http://172.17.10.14/cblr/links/centos5.8-xen-x86_64
- libvirtd (pid 3772) is running...
- downloading initrd initrd.img to /var/lib/xen/initrd.img_koan
- url=http://172.17.10.14/cobbler/images/centos5.8-xen-x86_64/initrd.img
- - reading URL: http://172.17.10.14/cobbler/images/centos5.8-xen-x86_64/initrd.img
- downloading kernel vmlinuz to /var/lib/xen/vmlinuz_koan
- url=http://172.17.10.14/cobbler/images/centos5.8-xen-x86_64/vmlinuz
- - reading URL: http://172.17.10.14/cobbler/images/centos5.8-xen-x86_64/vmlinuz
- - warning: old python-virtinst detected, a lot of features will be disabled
- - adding disk: /var/lib/xen/images//testvm-disk0 of size 5 (driver type=raw)
- - ['virt-install', '--connect', 'xen:///', '--name', 'testvm', '--ram', '512', '--vcpus', '1', '--uuid', '42559fd2-385f-2435-80f1-9f5005a02a81', '--autostart', '--vnc', '--paravirt', '--boot', 'kernel=/var/lib/xen/vmlinuz_koan,initrd=/var/lib/xen/initrd.img_koan,kernel_args=ks=http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64 ksdevice=link kssendmac lang= text ', '--os-variant', 'rhel5', '--disk', 'path=/var/lib/xen/images//testvm-disk0,size=5', '--network', 'bridge=xenbr0', '--wait', '0', '--noautoconsole']
- usage: virt-install --name NAME --ram RAM STORAGE INSTALL [options]
- virt-install: error: no such option: --autostart
解决
- 我安装的
- 系统版本:CentOS5.8 64bit
- koan版本:koan-2.2.3-2.el5
- xen版本:xen-3.0.3-142.el5_9.2
- 通过EPEL安装的koan版本为koan-2.2.3-2.el5,使用中报错较多,后更换为koan-1.6.6-1.el5此版本比较稳定,下载链接:ftp://rpmfind.net/linux/epel/5/i386/koan-1.6.6-1.el5.noarch.rpm
9.9 报错九
- cobbler check
- The following are potential configuration items that you may want to fix:
- 1 : comment 'dists' on /etc/debmirror.conf for proper debian support
- 2 : comment 'arches' on /etc/debmirror.conf for proper debian support
- Restart cobblerd and then run 'cobbler sync' to apply changes.
解决
关于debmirror编辑注释
修改 /etc/debmirror.conf 配置文件,注释掉 @dists 和 @arches 两行
- sed -i 's|@dists=.*|#@dists=|' /etc/debmirror.conf
- sed -i 's|@arches=.*|#@arches=|' /etc/debmirror.conf
9.10 报错十
- /usr/bin/ipmitool power status
- Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
- Unable to get Chassis Power Status
解决
- /etc/init.d/ipmi start
- Starting ipmi drivers: [ OK ]
- /etc/rc.d/init.d/ipmievd start
- Starting ipmievd:
- ipmievd: using pidfile /var/run/ipmievd.pid0
- chkconfig ipmi on
- chkconfig ipmievd on
再执行查看电源状态
- /usr/bin/ipmitool power status
- Chassis Power is on
9.11 报错十一
- obbler system edit --name=host-188116 --power-address=172.17.11.20 --power-type='ipmitool' --power-user=root --power-pass=djxxxx
- usage: cobbler [options]
- cobbler: error: option --power-type: invalid choice: 'ipmitool' (choose from 'ack_manual', 'apc', 'apc_snmp', 'bladecenter', 'brocade', 'bullpap', 'cisco_mds', 'cisco_ucs', 'drac', 'drac5', 'egenera', 'ifmib', 'ilo', 'ilo_mp', 'ipdu', 'ipmilan', 'lpar', 'manual', 'mcdata', 'node', 'rhevm', 'rps10', 'rsa', 'rsb', 'sanbox2', 'scsi', 'scsi_test', 'tool', 'virsh', 'vixel', 'vmware', 'vmware_helper', 'vmware_soap', 'wti', 'xvm', 'xvmd')
解决
选择合适的power类型,报错后面已经列出可选参数,我这里使用的DELL PE1950应该选择ipmilan
- cobbler system edit --name=host-188116 --power-address=172.17.11.20 --power-type='ipmilan' --power-user=root --power-pass=djxxxx
9.12 报错十二
电源管理相关的报错
- cobbler system edit --name host-xxx --power-address=172.17.11.20 --power-type="ipmitool" --power-user=root --power-pass=passwd
- power management type must be one of:
- cobbler system powerstatus --name=host-xx
- task started: 2013-03-28_115206_power
- task started (id=Power management (status), time=Thu Mar 28 11:52:06 2013)
- Exception occured: cobbler.cexceptions.CX
- Exception value: 'no power type set for system'
- Exception Info:
- File "/usr/lib/python2.4/site-packages/cobbler/utils.py", line 126, in die
- raise CX(msg)
- Exception occured: cobbler.cexceptions.CX
- Exception value: 'no power type set for system'
- Exception Info:
- File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 89, in run
- rc = self._run(self)
- File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 259, in runner
- self.remote.power_system(object_id,self.options.get("power",""),token,logger=self.logger)
- File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 1919, in power_system
- rc=self.api.power_status(obj, user=None, password=None, logger=logger)
- File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 1041, in power_status
- return action_power.PowerTool(self._config, system, self, user, password, logger = logger).power("status")
- File "/usr/lib/python2.4/site-packages/cobbler/action_power.py", line 74, in power
- utils.die(self.logger,"no power type set for system")
- File "/usr/lib/python2.4/site-packages/cobbler/utils.py", line 134, in die
- raise CX(msg)
- !!! TASK FAILED !!!
- cobbler system powerstatus --name=host-188116
- task started: 2013-03-28_124153_power
- task started (id=Power management (status), time=Thu Mar 28 12:41:53 2013)
- cobbler power configuration is:
- type : ipmilan
- address: 172.17.11.20
- user : root
- id :
- running: /usr/sbin/fence_ipmilan
- received on stdout: Getting status of IPMI:172.17.11.20...Chassis power = On
- Done
- received on stderr:
- Exception occured: cobbler.cexceptions.CX
- Exception value: "command succeeded (rc=0), but output ('Getting status of IPMI:172.17.11.20...Chassis power = On\nDone\n') was not understood"
- Exception Info:
- File "/usr/lib/python2.4/site-packages/cobbler/utils.py", line 126, in die
- raise CX(msg)
- Exception occured: cobbler.cexceptions.CX
- Exception value: "command succeeded (rc=0), but output ('Getting status of IPMI:172.17.11.20...Chassis power = On\nDone\n') was not understood"
- Exception Info:
- File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 89, in run
- rc = self._run(self)
- File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 259, in runner
- self.remote.power_system(object_id,self.options.get("power",""),token,logger=self.logger)
- File "/usr/lib/python2.4/site-packages/cobbler/remote.py", line 1919, in power_system
- rc=self.api.power_status(obj, user=None, password=None, logger=logger)
- File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 1041, in power_status
- return action_power.PowerTool(self._config, system, self, user, password, logger = logger).power("status")
- File "/usr/lib/python2.4/site-packages/cobbler/action_power.py", line 116, in power
- utils.die(self.logger,"command succeeded (rc=%s), but output ('%s') was not understood" % (rc, output))
- File "/usr/lib/python2.4/site-packages/cobbler/utils.py", line 134, in die
- raise CX(msg)
- !!! TASK FAILED !!!
解决方法详见步骤8.2、8.3,详细如下:
8.2 安装电源管理工具cman
yum install cman -y
Cobbler代码维护者jimi告知:某些系统版本将执行程序安装在/sbin/目录下,通过rpm -ql cman查看,CentOS5.8下如此解决即可
ln -s /sbin/fence_* /usr/sbin/
8.3 修改电源管理python脚本
备份
cp /usr/lib/python2.4/site-packages/cobbler/action_power.py /usr/lib/python2.4/site-packages/cobbler/action_power.py.$(date +%F)
编辑
vim /usr/lib/python2.4/site-packages/cobbler/action_power.py
删除或注释此文件如下代码
utils.die(self.logger,"command succeeded (rc=%s), but output ('%s') was not understood" % (rc, output))
删除文件action_power.pyo 、 action_power.pyc
这两个文件在目录/usr/lib/python2.4/site-packages/cobbler/下
重启cobbler,注意一定是重启cobbler
cobbler reboot
步骤8.2、8.3是我在使用电源管理中发现的问题,后通过github与Cobbler代码维护者jimi沟通解决的,非常感谢他的帮助,详见
https://github.com/cobbler/cobbler/issues/426
《Cobbler部署指南》参考资料:
https://github.com/cobbler/cobbler/wiki
cobbler、koan man手册及help命令帮助
转自: http://blog.sina.com.cn/s/blog_61c07ac50101d0b7.html