Bug#824875: /etc/init.d/grub-common uses file from initscripts without a dependency

Martin Pitt martin.pitt at ubuntu.com
Fri May 20 17:07:51 UTC 2016


Package: grub-common
Version: 2.02~beta2-36
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch yakkety

There is some ongoing effort to stop installing "initscripts" by
default, as it's not necessary under systemd [1].

I noticed that without initscripts, the only failed service at boot is /etc/init.d/grub-common:

| ● grub-common.service - LSB: Record successful boot for GRUB
|    Loaded: loaded (/etc/init.d/grub-common; bad; vendor preset: enabled)
|    Active: failed (Result: exit-code) since Fr 2016-05-20 18:17:46 CEST; 23s ago
|      Docs: man:systemd-sysv-generator(8)
|   Process: 761 ExecStart=/etc/init.d/grub-common start (code=exited, status=2)
| 
| Mai 20 18:17:46 donald systemd[1]: Starting LSB: Record successful boot for GRUB...
| Mai 20 18:17:46 donald grub-common[761]: /etc/init.d/grub-common: 17: .: Can't open /lib/init/vars.sh
| Mai 20 18:17:46 donald systemd[1]: grub-common.service: Control process exited, code=exited status=2
| Mai 20 18:17:46 donald systemd[1]: Failed to start LSB: Record successful boot for GRUB.
| Mai 20 18:17:46 donald systemd[1]: grub-common.service: Unit entered failed state.
| Mai 20 18:17:46 donald systemd[1]: grub-common.service: Failed with result 'exit-code'.

Indeed /etc/init.d/grub-common unconditionally sources /lib/init/vars.sh
without depending on initscripts. Of course we don't actually want to add this
dependency, but robustify the init.d script to get along without vars.sh.

It only uses this to conditionalize the log_action_msg call. I think
this is unjustified -- the backend/consumer of these log messages,
(like plymouth or just console) should decide what to do with the
messages, and most other packages that I know unconditionally do the
log_* LSB calls.

I attach a patch which removes the /lib/init/vars.sh sourcing and thus
the initscripts dependency.

Thanks,

Martin


[1] https://bugs.debian.org/cgi-bin/pkgreport.cgi?users=pkg-systemd-maintainers@lists.alioth.debian.org;dist=unstable;tag=initscripts-dep

-- 

Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
  * debian/grub-common.init: Don't source /lib/init/vars.sh, we don't depend
    on initscripts (and don't want to). There is no reason why we would not
    use the LSB log_action_msg in non-verbose (default) mode, most other
    packages use it unconditionally. (LP: #1584134)
diff -Nru grub2-2.02~beta2/debian/grub-common.init grub2-2.02~beta2/debian/grub-common.init
--- grub2-2.02~beta2/debian/grub-common.init	2016-03-15 19:08:17.000000000 +0100
+++ grub2-2.02~beta2/debian/grub-common.init	2016-05-20 18:33:30.000000000 +0200
@@ -13,20 +13,17 @@
 
 which grub-editenv >/dev/null 2>&1 || exit 0
 
-# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
-
 # Define LSB log_* functions.
 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
 . /lib/lsb/init-functions
 
 case $1 in
     start|restart|force-reload)
-	[ "$VERBOSE" != no ] && log_action_msg "Recording successful boot for GRUB"
+	log_action_msg "Recording successful boot for GRUB"
 	[ -s /boot/grub/grubenv ] || rm -f /boot/grub/grubenv
 	mkdir -p /boot/grub
 	grub-editenv /boot/grub/grubenv unset recordfail
-	[ "$VERBOSE" != no ] && log_end_msg $?
+	log_end_msg $?
 	;;
     stop)
 	;;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20160520/262d3c6a/attachment.sig>


More information about the Pkg-grub-devel mailing list