baremetal: use grub.cfg file for kernel arguments
While the kernel arguments can be set for PXE, they have not been
applied to the final installation.
Use the /usr/share/oem/grub.cfg file to permanently set the kernel
arguments, so that on each boot the final installation uses the
kernel arguments provided by the user.
MODIFY
assets/terraform-modules/matchbox-flatcar/profiles.tf
assets/terraform-modules/matchbox-flatcar/profiles.tf
@@ -27,6 +27,7 @@ resource "matchbox_profile" "flatcar-install" {
container_linux_oem = var.container_linux_oem
ssh_keys = jsonencode(var.ssh_keys)
install_to_smallest_disk = var.install_to_smallest_disk
+ kernel_args = join(" ", var.kernel_args)
# only cached-container-linux profile adds -b baseurl
baseurl_flag = ""
})
@@ -63,6 +64,7 @@ resource "matchbox_profile" "cached-flatcar-linux-install" {
container_linux_oem = var.container_linux_oem
ssh_keys = jsonencode(var.ssh_keys)
install_to_smallest_disk = var.install_to_smallest_disk
+ kernel_args = join(" ", var.kernel_args)
# profile uses -b baseurl to install from matchbox cache
baseurl_flag = "-b ${var.http_endpoint}/assets/flatcar"
})

MODIFY
assets/terraform-modules/matchbox-flatcar/templates/install.yaml.tmpl
assets/terraform-modules/matchbox-flatcar/templates/install.yaml.tmpl
@@ -30,6 +30,8 @@ storage:
contents:
inline: |
#!/bin/bash -ex
+ # unmount any leftovers at the beginning before we modify the disk the mount uses
+ umount /tmp/oemfs || true
curl --retry 10 "${ignition_endpoint}?{{.request.raw_query}}&os=installed" -o ignition.json
flatcar-install \
%{~ if install_to_smallest_disk ~}
@@ -43,6 +45,12 @@ storage:
${baseurl_flag} \
-i ignition.json
udevadm settle
+ OEM_DEV="$(blkid -t "LABEL=OEM" -o device)"
+ mkdir -p /tmp/oemfs
+ mount "$${OEM_DEV}" /tmp/oemfs
+ # append to file on newly created partition, do not remove the defaults
+ echo 'set linux_append="${kernel_args}"' >> /tmp/oemfs/grub.cfg
+ umount /tmp/oemfs
systemctl reboot
passwd:
users:

MODIFY
assets/terraform-modules/matchbox-flatcar/variables.tf
assets/terraform-modules/matchbox-flatcar/variables.tf
@@ -41,7 +41,7 @@ variable "container_linux_oem" {
variable "kernel_args" {
type = list(string)
- description = "Additional kernel arguments to provide at PXE boot."
+ description = "Additional kernel arguments to provide at PXE boot and in /usr/share/oem/grub.cfg."
default = []
}

MODIFY
docs/configuration-reference/platforms/baremetal.md
docs/configuration-reference/platforms/baremetal.md
@@ -190,7 +190,7 @@ os_version = var.custom_default_os_version
| `ignore_x509_cn_check` | Ignore check of common name in x509 certificates. If any application is built pre golang 1.15 then API server rejects x509 from such application, enable this to get around apiserver. | false | bool | false |
| `install_to_smallest_disk` | Installs Flatcar Container Linux to the smallest disk. | false | bool | false |
| `install_disk` | Disk device where Flatcar Container Linux should be installed. | "/dev/sda" | string | false |
-| `kernel_args` | Additional kernel args to provide at PXE boot. | ["kvm-intel.nested=1"] | list(string) | false |
+| `kernel_args` | Additional kernel args to provide at PXE boot and in /usr/share/oem/grub.cfg. | [] | list(string) | false |
| `download_protocol` | Protocol iPXE uses to download the kernel and initrd. iPXE must be compiled with crypto support for https. Unused if `cached_install` is true. Use `http` if the iPXE boot using `https` is slow or does not work due to SSL settings. | "https" | string | false |
| `network_ip_autodetection_method` | Method to detect host IPv4 address. Accepted values include 'first-found', 'can-reach=<DESTINATION>', 'interface=<INTERFACE-REGEX>', 'skip-interface=<INTERFACE-REGEX>, 'cidr=<CIDR>'. | "first-found" | string | false |
| `oidc` | OIDC configuration block. | - | object | false |

baremetal: use grub.cfg file for kernel arguments

While the kernel arguments can be set for PXE, they have not been
applied to the final installation.
Use the /usr/share/oem/grub.cfg file to permanently set the kernel
arguments, so that on each boot the final installation uses the
kernel arguments provided by the user.