mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-19 04:49:13 +08:00
centos: 修复没 ipv6 地址的甲骨文云安装 el9 掉线 (cloud-init 的 bug)
This commit is contained in:
parent
41b5ccc3ec
commit
b5122830c9
17
trans.sh
17
trans.sh
@ -2184,9 +2184,6 @@ install_qcow_by_copy() {
|
|||||||
mkswap /dev/$xda*3
|
mkswap /dev/$xda*3
|
||||||
swapon /dev/$xda*3
|
swapon /dev/$xda*3
|
||||||
|
|
||||||
# cloud-init
|
|
||||||
download_cloud_init_config /os
|
|
||||||
|
|
||||||
modify_el_ol() {
|
modify_el_ol() {
|
||||||
# resolv.conf
|
# resolv.conf
|
||||||
cp /etc/resolv.conf /os/etc/resolv.conf
|
cp /etc/resolv.conf /os/etc/resolv.conf
|
||||||
@ -2216,6 +2213,14 @@ install_qcow_by_copy() {
|
|||||||
chroot /os/ systemctl enable NetworkManager
|
chroot /os/ systemctl enable NetworkManager
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 修复 cloud-init 添加了 IPV*_FAILURE_FATAL
|
||||||
|
# 甲骨文 dhcp6 获取不到 IP 将视为 fatal,原有的 ipv4 地址也会被删除
|
||||||
|
insert_into_file $ci_file after '^runcmd:' <<EOF
|
||||||
|
- sed -i '/IPV4_FAILURE_FATAL/d' /etc/sysconfig/network-scripts/ifcfg-* || true
|
||||||
|
- sed -i '/IPV6_FAILURE_FATAL/d' /etc/sysconfig/network-scripts/ifcfg-* || true
|
||||||
|
- systemctl restart NetworkManager
|
||||||
|
EOF
|
||||||
|
|
||||||
# fstab 删除多余分区
|
# fstab 删除多余分区
|
||||||
# alma/rocky 镜像有 boot 分区
|
# alma/rocky 镜像有 boot 分区
|
||||||
# oracle 镜像有 swap 分区
|
# oracle 镜像有 swap 分区
|
||||||
@ -2401,11 +2406,17 @@ EOF
|
|||||||
restore_resolv_conf $os_dir
|
restore_resolv_conf $os_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# cloud-init
|
||||||
|
download_cloud_init_config /os
|
||||||
|
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
ubuntu) modify_ubuntu ;;
|
ubuntu) modify_ubuntu ;;
|
||||||
*) modify_el_ol ;;
|
*) modify_el_ol ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# 查看最终的 cloud-init 配置
|
||||||
|
cat /os/etc/cloud/cloud.cfg.d/99_*.cfg
|
||||||
|
|
||||||
# 删除installer分区,重启后cloud init会自动扩容
|
# 删除installer分区,重启后cloud init会自动扩容
|
||||||
swapoff -a
|
swapoff -a
|
||||||
parted /dev/$xda -s rm 3
|
parted /dev/$xda -s rm 3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user