feat: disable kernel lockdown mode for azurelinux 3.0 aks image#7990
feat: disable kernel lockdown mode for azurelinux 3.0 aks image#7990
Conversation
The AzureLinux 3.0 kernel auto-enables lockdown when secure boot is detected via an OOT patch. Disable kernel lockdown by default to enable AKS customer installing their own custom GPU driver when using azurelinux 3.0. Signed-off-by: Mitch Zhu <mitchzhu@microsoft.com>
There was a problem hiding this comment.
Pull request overview
Disables the Azure Linux 3.0 kernel cmdline lockdown=integrity setting during VHD build, to prevent lockdown being forced on in scenarios where customers need to install custom GPU drivers.
Changes:
- Added a Mariner/Azure Linux helper function to remove the kernel
lockdowncmdline argument usinggrubby. - Invoked this helper during
pre-install-dependencies.shfor Azure Linux 3.0 builds.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
vhdbuilder/scripts/linux/mariner/tool_installs_mariner.sh |
Adds disableKernelLockdownCmdline() to remove lockdown args from the kernel cmdline. |
vhdbuilder/packer/pre-install-dependencies.sh |
Calls disableKernelLockdownCmdline for Mariner/Azure Linux when OS_VERSION is 3.0. |
| disableKernelLockdownCmdline() { | ||
| echo "Removing lockdown=integrity from kernel cmdline..." | ||
| dnf_install 120 5 25 grubby || exit $ERR_APT_INSTALL_TIMEOUT | ||
| grubby --update-kernel=ALL --remove-args="lockdown" |
There was a problem hiding this comment.
disableKernelLockdownCmdline prints that it is removing lockdown=integrity, but the command uses --remove-args="lockdown" and does not check the grubby exit code. This can either remove more than intended (e.g., other lockdown modes) or silently fail to remove the specific lockdown=integrity arg, leaving the VHD in the problematic state. Please (1) remove the exact arg you intend (e.g., lockdown=integrity) and/or validate the resulting cmdline, and (2) fail the build if the grubby update fails (consistent with the dnf_install error handling).
| grubby --update-kernel=ALL --remove-args="lockdown" | |
| grubby --update-kernel=ALL --remove-args="lockdown=integrity" || exit $ERR_APT_INSTALL_TIMEOUT | |
| # Verify that lockdown=integrity has been removed from all kernels' cmdlines. | |
| if grubby --info=ALL | grep -q 'lockdown=integrity'; then | |
| echo "Failed to remove lockdown=integrity from kernel cmdline." | |
| exit $ERR_APT_INSTALL_TIMEOUT | |
| fi |
What this PR does / why we need it:
The AzureLinux 3.0 kernel auto-enables lockdown when secure boot is detected via an OOT patch. Disable kernel lockdown by default to enable AKS customer installing their own custom GPU driver when using azurelinux 3.0.
Which issue(s) this PR fixes:
Fixes #
Validation: