Skip to content

feat: disable kernel lockdown mode for azurelinux 3.0 aks image#7990

Draft
miz060 wants to merge 1 commit intomainfrom
mitchzhu/disable_kernel_lockdown_packer-pr
Draft

feat: disable kernel lockdown mode for azurelinux 3.0 aks image#7990
miz060 wants to merge 1 commit intomainfrom
mitchzhu/disable_kernel_lockdown_packer-pr

Conversation

@miz060
Copy link
Member

@miz060 miz060 commented Feb 27, 2026

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:

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>
Copilot AI review requested due to automatic review settings February 27, 2026 22:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 lockdown cmdline argument using grubby.
  • Invoked this helper during pre-install-dependencies.sh for 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"
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants