John E. Krokes
2022-Aug-02 17:50 UTC
[Pkg-xen-devel] Bug#1016547: /etc/default/grub.d/xen.cfg: Extraneous output line causes error message at boot
Package: xen-hypervisor-common Version: 4.14.5+24-g87d90d511c-1 Severity: minor File: /etc/default/grub.d/xen.cfg Dear Maintainer, When invoked via grub-mkconfig, xen.cfg outputs this as its first line: Including Xen overrides from /etc/default/grub.d/xen.cfg The output of grub-mkconfig is expected to be redirected into a grub.cfg file. Grub will read the grub.cfg at boot. Unfortunately, "Including" is not a valid grub command. So when booting, grub emits this error message before displaying its menu: error: can't find command `Including'. The error message is obscured very quickly. It does not affect functionality in any way. It requires booting on a VERY slow machine in order to read the error message at all. If I add a '#' to the start of the "Including", the resulting grub config file boots with no error. echo "#Including Xen overrides from /etc/default/grub.d/xen.cfg" I'm not sure if this line was intended to go into the generated config file as a comment, or if it was intended to be shown to the user while grub-mkconfig is running. I have observed this and tested my fix against version 4.14.5+24-g87d90d511c-1 of xen-hypervisor-common. I have also checked with the debian git at https://salsa.debian.org/xen-team/debian-xen/-/blob/master/debian/tree/xen-hypervisor-common/etc/default/grub.d/xen.cfg. This line has not changed in a very long time. I can also duplicate the behavior using grub-emu, with the output redirected to a file. I am running devuan, and originally reported this to their BTS but was redirected to debian. So my version number does not match. Apologies for that. Thanks for your time. -Mag -- System Information: Debian Release: 10.0 Architecture: amd64 (x86_64) Kernel: Linux 5.10.0-16-amd64 (SMP w/2 CPU threads) Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init) LSM: AppArmor: enabled -- Configuration Files: /etc/default/grub.d/xen.cfg changed: echo "#Including Xen overrides from /etc/default/grub.d/xen.cfg" XEN_OVERRIDE_GRUB_DEFAULT=0 if [ "$XEN_OVERRIDE_GRUB_DEFAULT" = "" ]; then echo "WARNING: GRUB_DEFAULT changed to boot into Xen by default!" echo " Edit /etc/default/grub.d/xen.cfg to avoid this warning." XEN_OVERRIDE_GRUB_DEFAULT=1 fi if [ "$XEN_OVERRIDE_GRUB_DEFAULT" = "1" ]; then GRUB_DEFAULT=$( \ printf "$(gettext "%s, with Xen hypervisor")" \ "$GRUB_DISTRIBUTOR GNU/Linux") fi -- no debconf information
Hans van Kranenburg
2022-Aug-03 15:03 UTC
[Pkg-xen-devel] Bug#1016547: Bug#1016547: /etc/default/grub.d/xen.cfg: Extraneous output line causes error message at boot
Hi John, On 8/2/22 19:50, John E. Krokes wrote:> Package: xen-hypervisor-common > Version: 4.14.5+24-g87d90d511c-1 > Severity: minor > File: /etc/default/grub.d/xen.cfg > > Dear Maintainer, > > When invoked via grub-mkconfig, xen.cfg outputs this as its first line: > Including Xen overrides from /etc/default/grub.d/xen.cfg > > The output of grub-mkconfig is expected to be redirected into a grub.cfg file. > Grub will read the grub.cfg at boot. Unfortunately, "Including" is not a > valid grub command. So when booting, grub emits this error message before > displaying its menu: > error: can't find command `Including'.Aha! Nice catch. That's indeed something that should be improved.> [...] > > The error message is obscured very quickly. It does not affect functionality > in any way. It requires booting on a VERY slow machine in order to read > the error message at all. > > > If I add a '#' to the start of the "Including", the resulting grub config file > boots with no error. > echo "#Including Xen overrides from /etc/default/grub.d/xen.cfg" > > I'm not sure if this line was intended to go into the generated config > file as a comment, or if it was intended to be shown to the user while > grub-mkconfig is running.I'm sure it's the latter, yes. Just some 'hey! I'm doing this now' message.> I have observed this and tested my fix against version > 4.14.5+24-g87d90d511c-1 of xen-hypervisor-common. I have also checked > with the debian git at https://salsa.debian.org/xen-team/debian-xen/-/blob/master/debian/tree/xen-hypervisor-common/etc/default/grub.d/xen.cfg. This line > has not changed in a very long time. > > > I can also duplicate the behavior using grub-emu, with the output redirected > to a file. > > > I am running devuan, and originally reported this to their BTS but was > redirected to debian. So my version number does not match. Apologies for > that.It's ok. The changes/improvements for this will end up in the Xen 4.16 package that's in Debian unstable now, anyway. So, in our grub.d/xen.cfg file, there's two places that cause text output: the 'Including Xen overrides ...' informational one, and the notification/warning about overriding GRUB_DEFAULT. The grub.d/* files are executed (sourced) in the context of the grub-mkconfig itself using '.'. In there, I can see that similar status messages are just redirected to stderr. We can do the same here. For the warning, there's a grub_warn helper function, which we can use. So, that results in the follow changes I have here now: diff --git a/default/grub.d/xen.cfg b/default/grub.d/xen.cfg index d35744e..42670eb 100644 --- a/default/grub.d/xen.cfg +++ b/default/grub.d/xen.cfg @@ -5,7 +5,7 @@ # The configuration in here makes it possible to have different options set # for the linux kernel when booting with or without Xen. -echo "Including Xen overrides from /etc/default/grub.d/xen.cfg" +echo "Including Xen overrides from /etc/default/grub.d/xen.cfg" >&2 ####################################################################### # Xen Hypervisor Command Line Options @@ -83,8 +83,8 @@ GRUB_CMDLINE_LINUX_XEN_REPLACE="earlyprintk=xen console=hvc0 noresume" #XEN_OVERRIDE_GRUB_DEFAULT # if [ "$XEN_OVERRIDE_GRUB_DEFAULT" = "" ]; then - echo "WARNING: GRUB_DEFAULT changed to boot into Xen by default!" - echo " Edit /etc/default/grub.d/xen.cfg to avoid this warning." + grub_warn "GRUB_DEFAULT changed to boot into Xen by default!" \ + "Edit /etc/default/grub.d/xen.cfg to avoid this warning." XEN_OVERRIDE_GRUB_DEFAULT=1 fi if [ "$XEN_OVERRIDE_GRUB_DEFAULT" = "1" ]; then None of this output will now be mixed with the generated config any more. This will be in the next package upload. https://salsa.debian.org/xen-team/debian-xen/-/commits/wip/sid Thanks, Hans
Debian Bug Tracking System
2022-Aug-23 12:39 UTC
[Pkg-xen-devel] Bug#1016547: marked as done (/etc/default/grub.d/xen.cfg: Extraneous output line causes error message at boot)
Your message dated Tue, 23 Aug 2022 12:34:36 +0000 with message-id <E1oQT76-005gaQ-Os at fasolo.debian.org> and subject line Bug#1016547: fixed in xen 4.16.2-1 has caused the Debian Bug report #1016547, regarding /etc/default/grub.d/xen.cfg: Extraneous output line causes error message at boot to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact owner at bugs.debian.org immediately.) -- 1016547: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1016547 Debian Bug Tracking System Contact owner at bugs.debian.org with problems -------------- next part -------------- An embedded message was scrubbed... From: "John E. Krokes" <mag at netherworld.org> Subject: /etc/default/grub.d/xen.cfg: Extraneous output line causes error message at boot Date: Tue, 02 Aug 2022 13:50:50 -0400 Size: 4382 URL: <http://alioth-lists.debian.net/pipermail/pkg-xen-devel/attachments/20220823/cac92aab/attachment.eml> -------------- next part -------------- An embedded message was scrubbed... From: Debian FTP Masters <ftpmaster at ftp-master.debian.org> Subject: Bug#1016547: fixed in xen 4.16.2-1 Date: Tue, 23 Aug 2022 12:34:36 +0000 Size: 7497 URL: <http://alioth-lists.debian.net/pipermail/pkg-xen-devel/attachments/20220823/cac92aab/attachment-0001.eml>