From ed1844eda127ab0b369ef354322413377e8368bb Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Tue, 17 Sep 2024 11:25:13 -0700 Subject: [PATCH] live-{server,desktop}: USE_KDUMP=0 only live layer kdump-tools uses ucf for config file management and naively modifying the config file meant for the target system directly will cause the file hash to not get updated in the ucf database. This will then cause later modifications to fail because "there's nothing to do". Although actually doing the modification to the ucf database is messy. Let's just modify the file in the live layer to get the behavior we want there. --- .../hooks/06-kdump-tools-disable.chroot | 22 +++++++++++++------ .../hooks/020-kdump-tools-disable.chroot | 21 +++++++++++++----- 2 files changed, 30 insertions(+), 13 deletions(-) mode change 100644 => 100755 live-build/ubuntu-server/hooks/06-kdump-tools-disable.chroot diff --git a/live-build/ubuntu-server/hooks/06-kdump-tools-disable.chroot b/live-build/ubuntu-server/hooks/06-kdump-tools-disable.chroot old mode 100644 new mode 100755 index aab32cbd..c65867a0 --- a/live-build/ubuntu-server/hooks/06-kdump-tools-disable.chroot +++ b/live-build/ubuntu-server/hooks/06-kdump-tools-disable.chroot @@ -1,19 +1,27 @@ #!/bin/bash -ex # We install kdump-tools in the minimal layer but it's enabled by default. -# We disable it here and let subiquity/curtin decide when to enable it later. -# This is also important so that it's not in some semi-enabled state in the -# live system where USE_KDUMP=1 but it's missing the crashkernel parameter on -# the kernel command line. Let's be doubly sure and set USE_KDUMP=0. +# subiquity/curtin will later decide to either keep it enabled or disable it +# in the target system, but let's ensure it's disabled in the live layer. +# We do this by manually modifying /etc/default/kdump-tools to use USE_KDUMP=0. +# Without this, kdump-tools is still technically disabled since it requires both: +# 1. crashkernel on the kernel command line +# 2. USE_KDUMP=1 in /etc/default/kdump-tools +# and the kernel command line in the live layer doesn't have the crashkernel +# parameter in the kernel command line, but this semi-disabled state isn't +# ideal. So let's be doubly sure and set USE_KDUMP=0. +# +# Note that kdump-tools relies on ucf for configuration file management. So +# while we could modify the value in the minimal layer, doing so in a way that +# doesn't make future dpkg-reconfigures hard is a huge hassle. You also have +# to make sure to do the same steps to every layer it may get included. case ${PASS} in - ubuntu-server-minimal) + ubuntu-server-minimal.ubuntu-server.installer.*) ;; *) exit 0 ;; esac -# kdump-tools relies on USE_KDUMP=1 to be enabled, set to USE_KDUMP=0 for off. sed -i 's/USE_KDUMP=1/USE_KDUMP=0/' /etc/default/kdump-tools - diff --git a/live-build/ubuntu/hooks/020-kdump-tools-disable.chroot b/live-build/ubuntu/hooks/020-kdump-tools-disable.chroot index 2a805c73..abe15a8d 100755 --- a/live-build/ubuntu/hooks/020-kdump-tools-disable.chroot +++ b/live-build/ubuntu/hooks/020-kdump-tools-disable.chroot @@ -3,19 +3,28 @@ set -eux # We install kdump-tools in the minimal layer but it's enabled by default. -# We disable it here and let subiquity/curtin decide when to enable it later. -# This is also important so that it's not in some semi-enabled state in the -# live system where USE_KDUMP=1 but it's missing the crashkernel parameter on -# the kernel command line. Let's be doubly sure and set USE_KDUMP=0. +# subiquity/curtin will later decide to either keep it enabled or disable it +# in the target system, but let's ensure it's disabled in the live layer. +# We do this by manually modifying /etc/default/kdump-tools to use USE_KDUMP=0. +# Without this, kdump-tools is still technically disabled since it requires both: +# 1. crashkernel on the kernel command line +# 2. USE_KDUMP=1 in /etc/default/kdump-tools +# and the kernel command line in the live layer doesn't have the crashkernel +# parameter in the kernel command line, but this semi-disabled state isn't +# ideal. So let's be doubly sure and set USE_KDUMP=0. +# +# Note that kdump-tools relies on ucf for configuration file management. So +# while we could modify the value in the minimal layer, doing so in a way that +# doesn't make future dpkg-reconfigures hard is a huge hassle. You also have +# to make sure to do the same steps to every layer it may get included. case ${PASS:-} in - minimal) + *.live) ;; *) exit 0 ;; esac -# kdump-tools relies on USE_KDUMP=1 to be enabled, set to USE_KDUMP=0 for off. sed -i 's/USE_KDUMP=1/USE_KDUMP=0/' /etc/default/kdump-tools