765686189 发表于 2020-4-9 19:35:08

pxe推centos8无法切换根


几个感觉有问题的日志截图


765686189 发表于 2020-4-9 20:01:06

那个问题解决了,initrd拷贝错了......但是似乎有个新问题


765686189 发表于 2020-4-9 21:05:33

需要加inst.stonge2:shutup:,不过此刻有个新问题,%pre节用不了,手动写ks似乎也不行



botang 发表于 2020-4-9 21:32:23

765686189 发表于 2020-4-9 21:05
需要加inst.stonge2,不过此刻有个新问题,%pre节用不了,手动写ks似乎也不行

一个可用的kickstart.cfg:
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
nfs --server=192.168.0.254 --dir=/var/ftp/pub/BaseOS
# Use CDROM installation media
# Use graphical install
text
# Run the Setup Agent on first boot
firstboot --disable
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

# Network information
network--bootproto=dhcp

# Root password
rootpw --plaintext redhat123
# System services
services --enabled="chronyd,sshd"
# System timezone
timezone Asia/Shanghai --isUtc
# X Window System configuration information
xconfig--startxonboot
# System bootloader configuration
# Partition clearing information
# Disk partitioning information
%include /tmp/disk.txt
#%end
reboot
%packages

@^graphical-server-environment
@base
@core
#@desktop-debugging
#@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@hardware-monitoring
@input-methods
@internet-browser
@multimedia
@print-client
chrony
kexec-tools
%end

repo --name=appstream --baseurl=nfs://192.168.0.254:/var/ftp/pub/AppStream

%post
KS_IPADDR=$(ifconfig | head -n 2 | tail -n 1 | cut -c 14- | cut -d ' ' -f 1)
KS_IPADDR_SHORT=$(ifconfig | head -n 2 | tail -n 1 | cut -c 14- | cut -d ' ' -f 1 | cut -d '.' -f 4)
KS_DEVICE=$( ls /etc/sysconfig/network-scripts/ifcf* | grep -v ifcfg-lo | cut -d '/' -f 5)
KS_DEVICE_SHORT=$( ls /etc/sysconfig/network-scripts/ifcf* | grep -v ifcfg-lo | cut -d '/' -f 5 | cut -d '-' -f 2)
cat > /etc/sysconfig/network-scripts/$KS_DEVICE <<EOF
DEVICE=$KS_DEVICE_SHORT
IPADDR=$KS_IPADDR
NETMASK=255.255.255.0
GATEWAY=192.168.0.254
EOF
[ $KS_IPADDR_SHORT -le 100 ] && echo "desktop$KS_IPADDR_SHORT.example.com" >/etc/hostname
[ $KS_IPADDR_SHORT -gt 100 ] && echo "server$[ $KS_IPADDR_SHORT - 100 ].example.com" >/etc/hostname
[ $KS_IPADDR_SHORT -le 100 ] && echo "$KS_IPADDRdesktop$KS_IPADDR_SHORT.example.comdesktop$KS_IPADDR_SHORT" >> /etc/hosts
[ $KS_IPADDR_SHORT -gt 100 ] && echo "$KS_IPADDRserver$[ $KS_IPADDR_SHORT -100 ].example.comserver$[ $KS_IPADDR_SHORT -100 ]" >> /etc/hosts

echo "search example.com" > /etc/resolv.conf
echo "nameserver 192.168.0.254" >> /etc/resolv.conf

cp -rp /etc/yum.repos.d /etc/yum.repos.d.ori
rm -rf /etc/yum.repos.d/*

cat >> /etc/yum.repos.d/base.repo <<EOF

name=BaseOS
baseurl=http://192.168.0.254/pub/BaseOS
gpgcheck=0

name=AppStream
baseurl=http://192.168.0.254/pub/AppStream
gpgcheck=0
EOF

# ZB: Replace with wget of file?Seems like a better solution in the long run.
#wget -q ftp://server1/pub/gls/server1.repo -O /etc/yum.repos.d/server1.repo

# Install the pub keys
%end
%pre
# Partition Total 19028M
echo "Starting PRE" > /dev/tty2

DISKTYPE=$(cut -c 26-/proc/partitions   |head -n 3 | tail -n 1)
# Partition clearing information
# Disk partitioning information
cat <<EOF >/tmp/disk.txt

ignoredisk --only-use=$DISKTYPE

bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=$DISKTYPE
#CLASSROOM MACHINE(c) NEED A DISK OF: 20G
clearpart --all--initlabel
part swap --fstype="swap"--ondisk=$DISKTYPE --size=1024
part pv.350 --fstype="lvmpv" --ondisk=$DISKTYPE --size=18500
part /boot --fstype="xfs" --ondisk=$DISKTYPE --size=300
volgroup RAC12crhel7 --pesize=4096 pv.350
logvol /--fstype="xfs" --size=18400 --name=root --vgname=RAC12crhel7
EOF

%end

765686189 发表于 2020-4-10 01:10:59

botang 发表于 2020-4-9 21:32
一个可用的kickstart.cfg:

谢谢老师,我再去试试
页: [1]
查看完整版本: pxe推centos8无法切换根