Skip to content

Commit

Permalink
fix(bootstrap): correct some bugs on ubuntu 24.04 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
HoKim98 committed Aug 18, 2024
1 parent 8c81d97 commit 5da834d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 14 deletions.
2 changes: 1 addition & 1 deletion templates/ipxe/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ RUN mkdir /src && cd /src \
&& git checkout "${IPXE_VERSION}" \
&& mkdir /ipxe \
# Patch DHCP settings
&& sed -i 's/^\(#define DHCP_DISC_END_TIMEOUT_SEC [0-9]\+$/\132/g' './config/dhcp.h' \
&& sed -i 's/^\(#define DHCP_DISC_END_TIMEOUT_SEC \)[0-9]\+$/\132/g' './config/dhcp.h' \
# Build each iPXE platforms
# * usage: make [platform]/[driver].[extension]
### ARCH [0x00] - BIOS
Expand Down
2 changes: 1 addition & 1 deletion templates/kiss/assets/boot/boot-ubuntu2404.ipxe
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ kernel --name vmlinuz ${repo}/netboot/${arch}/linux || goto kernel
initrd --name initrd ${repo}/netboot/${arch}/initrd || goto initrd

:initargs
imgargs vmlinuz initrd=initrd autoinstall ip=dhcp url=${repo}/ubuntu-${os_ver}-live-server-${arch}.iso cloud-config-url=${cloud_config_url}
imgargs vmlinuz initrd=initrd autoinstall ip=dhcp modprobe.blacklist=rndis_host url=${repo}/ubuntu-${os_ver}-live-server-${arch}.iso cloud-config-url=${cloud_config_url}

:boot
boot || goto boot
26 changes: 23 additions & 3 deletions templates/kiss/assets/boot/cloud-init_ubuntu_24.04.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ autoinstall:
users:
- name: kiss
groups: docker, sudo, users, wheel
lock_passwd: true
passwd: "$6$rBhSuMvNSgbLh2H/$1rCRSowuivSwaXvjmBaGLOYp5ad5EFuxw78YTx3I3TrhyduLmw2fpmA9QxNTHq.OAIJmkO/KHZH/ImalRwpaP1" # TODO: remove after debugging
lock_passwd: false
passwd: $6$Tt5aacrWjfFz/v6l$lfIW/m1.dYdoJlRnYrtx/pKDyfUTJg8Sh/rbsOcMD2vJa.4rAzSZy7Lp89Q/3ijK97RQUm/zS0cApJmLFLwyx0
shell: /bin/bash
ssh_authorized_keys:
- "ENV_SSH_AUTHORIZED_KEYS"
Expand All @@ -66,6 +66,25 @@ autoinstall:
DNS=10.64.0.3
EOF
systemctl restart systemd-resolved.service
- |
mkdir -p /etc/NetworkManager/conf.d/
cat <<EOF >/etc/NetworkManager/conf.d/99-systemd.conf
[main]
dns=default
rc-manager=resolvconf
EOF
- rm -f /etc/netplan/50-cloud-init*
- |
cat <<EOF >/etc/netplan/50-cloud-init.yaml
network:
version: 2
renderer: NetworkManager
ethernets:
alleths:
match:
name: en*
dhcp4: true
EOF
- >
apt-get update && apt-get install -y network-manager
&& systemctl disable --now systemd-networkd.service systemd-networkd.socket
Expand All @@ -74,7 +93,8 @@ autoinstall:
&& for dev in $(nmcli connection show --active | awk '{print $4}' | grep -P '^en'); do
nmcli connection down "${dev}" || true
; done
&& netplan apply
- until netplan apply; do sleep 3; done
- until curl "http://assets.kiss.svc.ops.openark"; do netplan apply || true; sleep 30; done
late-commands:
# Install dependencies
- >
Expand Down
24 changes: 15 additions & 9 deletions templates/kiss/assets/boot/cloud-init_ubuntu_24.04_post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,24 @@ _IS_NVIDIA_MANUAL="false"

# Advanced Network configuration
mkdir -p /etc/NetworkManager/system-connections/
## Wireless - WIFI
if [ "NETWORK_WIRELESS_WIFI_SSID" != "" ]; then
## Disable Power Saving Mode (iwlmvm)
cat <<EOF >/etc/modprobe.d/iwlmvm.conf

## Disable Kernel Module: rndis_host
cat <<EOF >/etc/default/grub.d/10-blacklist-rndis_host.cfg
GRUB_CMDLINE_LINUX="modprobe.blacklist=rndis_host"
EOF
cat <<EOF >/etc/modprobe.d/blacklist-rndis_host.conf
blacklist rndis_host
EOF

## Disable Power Saving Mode (iwlmvm)
cat <<EOF >/etc/modprobe.d/iwlmvm.conf
options iwlmvm power_scheme=1
EOF

## Disable Power Saving Mode (iwlwifi)
cat <<EOF >/etc/modprobe.d/iwlwifi.conf
## Disable Power Saving Mode (iwlwifi)
cat <<EOF >/etc/modprobe.d/iwlwifi.conf
options iwlwifi power_save=0
EOF
fi

## Disable Power Saving Mode on NetworkManager
mkdir -p /etc/NetworkManager/conf.d/
Expand Down Expand Up @@ -518,8 +524,8 @@ BOOT_NUM="$(
grep -P '\\EFI\\ubuntu\\shimx64.efi\)$' |
grep -Po '^Boot\K[0-9A-F]+'
)"
#sudo efibootmgr --bootnum "${BOOT_NUM}" --active
sudo efibootmgr --bootorder "${BOOT_NUM}"
#efibootmgr --bootnum "${BOOT_NUM}" --active
efibootmgr --bootorder "${BOOT_NUM}"

# Hostname
UUID="$(cat /sys/class/dmi/id/product_uuid)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@
when: kiss_allow_pruning_network_interfaces | default(False)
command: nmcli connection reload

- name: Reboot the boxes if network is changed (The task will be restarted)
when: kiss_allow_pruning_network_interfaces | default(False)
reboot:
reboot_timeout: 3600 # 1h (booting can take a long time)

- name: Assert rebooting
when: kiss_allow_pruning_network_interfaces | default(False)
fail:
msg: The nodes should be rebooted!

- name: Enable bonds now | NetworkManager
when:
- all_interfaces | length > 0
Expand Down

0 comments on commit 5da834d

Please sign in to comment.