[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#814318: grub-installer: /etc/default/grub is reported as changed by ucfq with install from console



Package: grub-installer
Version: 1.117+deb8u1
Severity: normal
Tags: d-i patch

Dear Maintainer,

When installing Jessie via serial console once the installation has
completed successfully one can observe the file /etc/default/grub
being reported as changed by ucfq.

    root@cumulus:/etc/default# ucfq /etc/default/grub
    Confguration file                Package   Exists  Changed
    /etc/default/grub                 grub-pc   Yes     Yes

This presents a minor yet potentially difficult problem to fix. The
problem presents itself when there is an update for grub-pc as now
ucf will ask the user what to do. An naive user (machine, think
automation) might simply request the new maintainer's version be taken,
because thats what was used in the original install (the naive part).
This results in the loss of out-of-band management configuration for the
box and if the system is a headless server possibly very difficult to fix
if the network interface card did not come back up.

The user possibly could preseed away ucf asking this question but what
is the correct choice in a heterogeneous install base? Why not instead
avoid the problem in the first place?

Proposed Solution:
Why can't grub-installer create a new file in /etc/default/grub.d/*.cfg?
This allows us to avoid involving ucf until a user knowingly makes a change
to /etc/default/grub.

-- System Information:
Debian Release: 8.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable'), (350, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: powerpc, armel, i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
>From 1b454ca77b24d34ae033a6748d8460d0b218fc6e Mon Sep 17 00:00:00 2001
From: Jonathan Toppins <jtoppins@cumulusnetworks.com>
Date: Tue, 9 Feb 2016 15:30:11 -0500
Subject: [PATCH grub-installer master] put grub-installer modifications in
 grub.d

To prevent loss of config when grub-pc is updated and the user naively
chooses to take the maintainer's version any intelligent modifications
done during installation will be lost.

Instead we take advantage of the fact that the grub-pc package in
Debian since tag 2.00-10 contained some version of reading
/etc/default/grub.d/*.cfg to read additional configuration without
triggering a ucf missmatch.

Reported-by: Curt Brune <curt@cumulusnetworks.com>
Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
---

Please consider this for backport to Jessie, I was able to cherry-pick
this patch cleanly on top of version 1.117+deb8u1. Also of note I only
tested with a rebuilt Jessie installer using monolithic and localudebs
version of grub-installer udeb.

Thanks!

 grub-installer | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/grub-installer b/grub-installer
index 8b4531231e09..c6d911e882d8 100755
--- a/grub-installer
+++ b/grub-installer
@@ -1151,16 +1151,9 @@ if [ "$serial" ] ; then
 		mv $ROOT/boot/grub/$menu_file.new $ROOT/boot/grub/$menu_file
 		;;
 	    grub-pc|grub-efi*)
-		if grep -q "^GRUB_TERMINAL=" $ROOT/etc/default/grub; then
-			sed -i $ROOT/etc/default/grub -e "s/^\(GRUB_TERMINAL\)=.*/\1=serial/g"
-		else
-			echo "GRUB_TERMINAL=serial" >> $ROOT/etc/default/grub
-		fi
-		if grep -q "^GRUB_SERIAL_COMMAND=" $ROOT/etc/default/grub ; then
-			sed -i $ROOT/etc/default/grub -e "s/^\(GRUB_SERIAL_COMMAND\)=.*/\1=\"`grub_serial_console $serial`\"/g"
-		else
-			echo "GRUB_SERIAL_COMMAND=\"`grub_serial_console $serial`\"" >> $ROOT/etc/default/grub
-		fi
+		mkdir -p $ROOT/etc/default/grub.d
+		echo "GRUB_TERMINAL=serial" > $ROOT/etc/default/grub.d/00-installer-defaults.cfg
+		echo "GRUB_SERIAL_COMMAND=\"`grub_serial_console $serial`\"" >> $ROOT/etc/default/grub.d/00-installer-defaults.cfg
 		update_grub # propagate to grub.cfg
 		;;
 	esac
-- 
2.1.4


Reply to: