我想centos7从uefi启动,于是修改了镜像里的/EFI/BOOT/grub.efi文件和添加了一些自动安装程序。但是在最后安装的时候报错了:bootloader setup failed:failed to find a suitable stage1 device.文件内容如下。
ks文件内容:
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
# Network information
#network --bootproto=dhcp --hostname=node1
# Root password
rootpw --iscrypted $6$XkzDasuirsQ.OTjQ$EA5gU9NNZvfZU7343dSgEPYDalEw1ifGKXZiP4MF8eYWqXvToWGxGntTugI.57FRqHjvshGPHgdgtVhabxUz3.
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
reboot
# System bootloader configuration
#bootloader --append=" crashkernel=auto net.ifnames=0 biosdevname=0 " --location=mbr --boot-drive=sda
bootloader --append=" crashkernel=auto " --location=mbr --boot-drive=sda
# Partition clearing information
clearpart --none --initlabel
# Disk partitioning information
#part /boot --fstype="ext4" --ondisk=sda --size=500
#part pv.194 --fstype="lvmpv" --ondisk=sda --size=19979
#volgroup ar_node1 --pesize=4096 pv.194
#logvol / --fstype="ext4" --grow --maxsize=51200 --size=1024 --name=root --vgname=ar_node1
#logvol swap --fstype="swap" --size=2047 --name=swap --vgname=ar_node1
%post --interpreter=/bin/bash --nochroot
mkdir -p /mnt/source
#mount -o loop /dev/cdrom /mnt/source
mount -L LyServer /mnt/source
#\cp -rf /mnt/source/amazingrex_installer /mnt/sysimage/root/
#----------------------add_shell_script--------------------------------------------------------------------------------------------
\cp -rf /mnt/source/amazingrex_installer_shell/* /mnt/sysimage/root/
#--------------------------add_end-------------------------------------------------------------------------------------------------
#\cp -rf /mnt/source/ar /mnt/sysimage/
%end
%post
sed -i s@"#UseDNS\ yes"@"UseDNS\ no"@g /etc/ssh/sshd_config
sed -i s@"SELINUX=.*"@"SELINUX=disabled"@g /etc/selinux/config
echo "sleep 20 && cd /root && /usr/bin/bash -x ./voi_install.sh" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
%end
%packages
@^minimal
@core
kexec-tools
%end
grub.cfg内容:
set default="3"
function load_video {
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod all_video
}
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set timeout=60
### END /etc/grub.d/00_header ###
search --no-floppy --set=root -l 'CentOS 7 x86_64'
### BEGIN /etc/grub.d/10_linux ###
menuentry 'uefi Install centos' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=LyServer inst.updates=hd:LABEL=LyServer:/images/product.img inst.kdump_addon=off inst.ks=hd:LABEL=LyServer:/images/anaconda-ks.cfg quiet nomodeset biosdevname=0 net.ifnames=0
initrdefi /images/pxeboot/initrd.img
}
ks文件内容:
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
# Network information
#network --bootproto=dhcp --hostname=node1
# Root password
rootpw --iscrypted $6$XkzDasuirsQ.OTjQ$EA5gU9NNZvfZU7343dSgEPYDalEw1ifGKXZiP4MF8eYWqXvToWGxGntTugI.57FRqHjvshGPHgdgtVhabxUz3.
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
reboot
# System bootloader configuration
#bootloader --append=" crashkernel=auto net.ifnames=0 biosdevname=0 " --location=mbr --boot-drive=sda
bootloader --append=" crashkernel=auto " --location=mbr --boot-drive=sda
# Partition clearing information
clearpart --none --initlabel
# Disk partitioning information
#part /boot --fstype="ext4" --ondisk=sda --size=500
#part pv.194 --fstype="lvmpv" --ondisk=sda --size=19979
#volgroup ar_node1 --pesize=4096 pv.194
#logvol / --fstype="ext4" --grow --maxsize=51200 --size=1024 --name=root --vgname=ar_node1
#logvol swap --fstype="swap" --size=2047 --name=swap --vgname=ar_node1
%post --interpreter=/bin/bash --nochroot
mkdir -p /mnt/source
#mount -o loop /dev/cdrom /mnt/source
mount -L LyServer /mnt/source
#\cp -rf /mnt/source/amazingrex_installer /mnt/sysimage/root/
#----------------------add_shell_script--------------------------------------------------------------------------------------------
\cp -rf /mnt/source/amazingrex_installer_shell/* /mnt/sysimage/root/
#--------------------------add_end-------------------------------------------------------------------------------------------------
#\cp -rf /mnt/source/ar /mnt/sysimage/
%end
%post
sed -i s@"#UseDNS\ yes"@"UseDNS\ no"@g /etc/ssh/sshd_config
sed -i s@"SELINUX=.*"@"SELINUX=disabled"@g /etc/selinux/config
echo "sleep 20 && cd /root && /usr/bin/bash -x ./voi_install.sh" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
%end
%packages
@^minimal
@core
kexec-tools
%end
grub.cfg内容:
set default="3"
function load_video {
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod all_video
}
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set timeout=60
### END /etc/grub.d/00_header ###
search --no-floppy --set=root -l 'CentOS 7 x86_64'
### BEGIN /etc/grub.d/10_linux ###
menuentry 'uefi Install centos' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=LyServer inst.updates=hd:LABEL=LyServer:/images/product.img inst.kdump_addon=off inst.ks=hd:LABEL=LyServer:/images/anaconda-ks.cfg quiet nomodeset biosdevname=0 net.ifnames=0
initrdefi /images/pxeboot/initrd.img
}