在 CentOS 上使用 Cobbler 时出现报错,通常需要先看具体报错信息,不同错误对应不同原因。下面我按常见报错场景 + 排查思路 + 解决办法给你一个实用的排查指南,你可以对照看看。
cat /etc/redhat-release
cobbler --version
systemctl status cobblerd
systemctl status httpd
systemctl status tftp
⚠️ Cobbler 依赖:httpd、tftp、rsync、dhcp、SELinux 配置
cobbler check 报错(最典型)运行:
cobbler check
① SELinux 未关闭或配置错误
SELinux is enabled but not in permissive mode
解决:
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
② 未设置 server 和 next_server
server and next_server fields must be set
解决(编辑配置):
vi /etc/cobbler/settings.yaml
修改:
server: 192.168.1.10
next_server: 192.168.1.10
然后:
systemctl restart cobblerd
cobbler sync
③ TFTP 目录权限问题
TFTP directory /var/lib/tftpboot is not world readable
解决:
chmod -R 755 /var/lib/tftpboot
systemctl start cobblerd
Job for cobblerd.service failed
查看日志:
journalctl -xe
cat /var/log/cobbler/cobbler.log
常见问题:
cobbler sync 报错Exception occurred: <type 'exceptions.IOError'>
原因:
解决:
cobbler sync --verbose
检查:
cat /etc/dhcp/dhcpd.conf
systemctl start dhcpd
常见错误:
示例:
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
filename "pxelinux.0";
next-server 192.168.1.10;
}
检查:
ls /var/lib/tftpboot/
应有:
如果没有:
cobbler get-loaders
cobbler sync
cobbler check
cobbler sync
systemctl restart cobblerd httpd tftp dhcpd
setenforce 0
firewall-cmd --state
如果你愿意,请直接把具体报错内容贴出来,例如:
cobbler check 输出cobbler sync 报错我可以精准定位并给你一步一步的命令。