Bug#737820: grub-pc: postinst fails when ‘grub-mkconfig’ has non-zero exit status

Ben Finney ben+debian at benfinney.id.au
Thu Feb 6 22:10:52 UTC 2014


On 06-Feb-2014, Colin Watson wrote:
> On Thu, Feb 06, 2014 at 06:59:47PM +1100, Ben Finney wrote:
> > […] the process is aborted when ‘grub-mkconfig’ exits with status 1.
> > This is apparently not an error, though, and the process should not
> > fail.
> 
> Could you please expand on your chain of reasoning here?

I say “apparently not an error” because the output doesn't indicate any
kind of error, even though the exit status is non-zero:

=====
$ sudo /etc/kernel/postinst.d/zz-update-grub
Generating grub.cfg ...
Found background: /usr/local/share/backgrounds/grub/winkler-gnu-blue.1024.tga

$ echo $?
1
=====

> grub-mkconfig exiting non-zero is absolutely an error as far as I'm
> concerned - it might for instance mean that it was unable to generate a
> syntactically-correct configuration file - and we should find out why
> that's happening

Okay. I mistakenly assumed that an error would normally result also in an
error message, but in a ‘set -e’ shell script that won't necessarily be the
case.

> (for instance, by looking through the error output of
> "sh -x /usr/sbin/grub-mkconfig >/dev/null").

Attached is a ‘script’ session.

* ‘/usr/sbin/grub-mkconfig’ exits with status 1, because
* ‘/etc/grub.d/05_debian_theme’ exits with status 1, because
* ‘test -d "${GRUB_PREFIX}"’ exits with status 1, because
* ‘GRUB_PREFIX’ is empty.

I can't see where that variable should be getting its value from, nor why
it's empty in this case.

-- 
 \         “I went over to the neighbor's and asked to borrow a cup of |
  `\       salt. ‘What are you making?’ ‘A salt lick.’” —Steven Wright |
_o__)                                                                  |
Ben Finney <ben at benfinney.id.au>
-------------- next part --------------
Script started on Fri 07 Feb 2014 08:48:55 EST

$ sudo sh -x /usr/sbin/grub-mkconfig > /dev/null
+ set -e
+ transform=s,x,x,
+ prefix=/usr
+ exec_prefix=/usr
+ datarootdir=/usr/share
+ prefix=/usr
+ exec_prefix=/usr
+ sbindir=/usr/sbin
+ bindir=/usr/bin
+ sysconfdir=/etc
+ PACKAGE_NAME=GRUB
+ PACKAGE_VERSION=2.00-22
+ host_os=linux-gnu
+ datadir=/usr/share
+ [ x = x ]
+ pkgdatadir=/usr/share/grub
+ grub_cfg=
+ grub_mkconfig_dir=/etc/grub.d
+ basename /usr/sbin/grub-mkconfig
+ self=grub-mkconfig
+ echo grub-probe
+ sed s,x,x,
+ grub_probe=/usr/sbin/grub-probe
+ sed s,x,x,
+ echo grub-editenv
+ grub_editenv=/usr/bin/grub-editenv
+ sed s,x,x,
+ echo grub-script-check
+ grub_script_check=/usr/bin/grub-script-check
+ export TEXTDOMAIN=grub
+ export TEXTDOMAINDIR=/usr/share/locale
+ . /usr/share/grub/grub-mkconfig_lib
+ transform=s,x,x,
+ prefix=/usr
+ exec_prefix=/usr
+ datarootdir=/usr/share
+ datadir=/usr/share
+ bindir=/usr/bin
+ sbindir=/usr/sbin
+ pkgdatadir=/usr/share/grub
+ test x/usr/sbin/grub-probe = x
+ test x = x
+ sed s,x,x,
+ echo grub-mkrelpath
+ grub_mkrelpath=/usr/bin/grub-mkrelpath
+ which gettext
+ :
+ test 0 -gt 0
+ fgrep -qs ${GRUB_PREFIX}/video.lst /etc/grub.d/00_header
+ [ x = x ]
+ id -u
+ EUID=0
+ [ 0 != 0 ]
+ set /usr/sbin/grub-probe dummy
+ test -f /usr/sbin/grub-probe
+ :
+ /usr/sbin/grub-probe --target=device /
+ GRUB_DEVICE=/dev/sda1
+ /usr/sbin/grub-probe --device /dev/sda1 --target=fs_uuid
+ GRUB_DEVICE_UUID=7423af23-7742-41da-a662-0e66d631aa62
+ /usr/sbin/grub-probe --target=device /boot
+ GRUB_DEVICE_BOOT=/dev/sda1
+ /usr/sbin/grub-probe --device /dev/sda1 --target=fs_uuid
+ GRUB_DEVICE_BOOT_UUID=7423af23-7742-41da-a662-0e66d631aa62
+ /usr/sbin/grub-probe --device /dev/sda1 --target=fs
+ GRUB_FS=ext2
+ test -f /etc/default/grub
+ . /etc/default/grub
+ GRUB_DEFAULT=0
+ GRUB_TIMEOUT=5
+ lsb_release -i -s
+ GRUB_DISTRIBUTOR=Debian
+ GRUB_CMDLINE_LINUX_DEFAULT=quiet
+ GRUB_CMDLINE_LINUX=
+ GRUB_FONT=/boot/grub/dejavu-sans-mono.16.pf2
+ GRUB_GFXMODE=640x480x16;1280x1024x32;1024x768x32;800x600x16;640x480
+ GRUB_GFXPAYLOAD_LINUX=keep
+ GRUB_BACKGROUND=/usr/local/share/backgrounds/grub/winkler-gnu-blue.1024.tga
+ [ -e /etc/default/grub.d/*.cfg ]
+ [ x != x ]
+ termoutdefault=0
+ [ x = x ]
+ GRUB_TERMINAL_OUTPUT=gfxterm
+ termoutdefault=1
+ GRUB_ACTUAL_DEFAULT=0
+ [ x0 = xsaved ]
+ [ x = x ]
+ GRUB_RECOVERY_TITLE=recovery mode
+ export GRUB_DEVICE GRUB_DEVICE_UUID GRUB_DEVICE_BOOT GRUB_DEVICE_BOOT_UUID GRUB_FS GRUB_FONT GRUB_PRELOAD_MODULES GRUB_ACTUAL_DEFAULT
+ export GRUB_DEFAULT GRUB_HIDDEN_TIMEOUT GRUB_HIDDEN_TIMEOUT_QUIET GRUB_TIMEOUT GRUB_TIMEOUT_STYLE GRUB_DEFAULT_BUTTON GRUB_HIDDEN_TIMEOUT_BUTTON GRUB_TIMEOUT_BUTTON GRUB_TIMEOUT_STYLE_BUTTON GRUB_BUTTON_CMOS_ADDRESS GRUB_BUTTON_CMOS_CLEAN GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_CMDLINE_LINUX_DEFAULT GRUB_CMDLINE_XEN GRUB_CMDLINE_XEN_DEFAULT GRUB_CMDLINE_LINUX_XEN_REPLACE GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT GRUB_CMDLINE_NETBSD GRUB_CMDLINE_NETBSD_DEFAULT GRUB_CMDLINE_GNUMACH GRUB_TERMINAL_INPUT GRUB_TERMINAL_OUTPUT GRUB_SERIAL_COMMAND GRUB_DISABLE_LINUX_UUID GRUB_DISABLE_RECOVERY GRUB_VIDEO_BACKEND GRUB_GFXMODE GRUB_BACKGROUND GRUB_THEME GRUB_GFXPAYLOAD_LINUX GRUB_DISABLE_OS_PROBER GRUB_INIT_TUNE GRUB_SAVEDEFAULT GRUB_ENABLE_CRYPTODISK GRUB_BADRAM GRUB_RECORDFAIL_TIMEOUT GRUB_RECOVERY_TITLE
+ test x != x
+ gettext Generating grub.cfg ...
Generating grub.cfg ...+ echo

+ cat
+ grub_file_is_not_garbage /etc/grub.d/00_header
+ test -f /etc/grub.d/00_header
+ return 0
+ test -x /etc/grub.d/00_header
+ echo
+ echo ### BEGIN /etc/grub.d/00_header ###
+ /etc/grub.d/00_header
Found background: /usr/local/share/backgrounds/grub/winkler-gnu-blue.1024.tga
+ echo ### END /etc/grub.d/00_header ###
+ grub_file_is_not_garbage /etc/grub.d/05_debian_theme
+ test -f /etc/grub.d/05_debian_theme
+ return 0
+ test -x /etc/grub.d/05_debian_theme
+ echo
+ echo ### BEGIN /etc/grub.d/05_debian_theme ###
+ /etc/grub.d/05_debian_theme

bignose at pansy:~$ echo $?
1

$ sudo sh -x /etc/grub.d/05_debian_theme > /dev/null
+ set -e
+ . /usr/share/grub/grub-mkconfig_lib
+ transform=s,x,x,
+ prefix=/usr
+ exec_prefix=/usr
+ datarootdir=/usr/share
+ datadir=/usr/share
+ bindir=/usr/bin
+ sbindir=/usr/sbin
+ pkgdatadir=/usr/share/grub
+ test x = x
+ echo grub-probe
+ sed s,x,x,
+ grub_probe=/usr/sbin/grub-probe
+ test x = x
+ echo grub-mkrelpath
+ sed s,x,x,
+ grub_mkrelpath=/usr/bin/grub-mkrelpath
+ which gettext
+ :
+ test -d

bignose at pansy:~$ echo $?
1

bignose at pansy:~$ exit

Script done on Fri 07 Feb 2014 08:50:44 EST
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20140207/f0d239b4/attachment.sig>


More information about the Pkg-grub-devel mailing list