[Bug 1876319] [NEW] save_env prepends \0 to grubenv, causing "error: invalid environment block."

Clara Short 1876319 at bugs.launchpad.net
Fri May 1 14:38:36 UTC 2020


Public bug reported:

Reported upstream as https://savannah.gnu.org/bugs/index.php?58283 .

= Configuration =
grub> echo $package_version $grub_cpu $grub_platform
2.02-2ubuntu8.15 i386 pc

== 1. Initial conditions ==
# rm /boot/grub/grubenv
# grub-editenv - create
# grub-editenv - set foo=bar
# grub-editenv - list
foo=bar
# hexdump -C /boot/grub/grubenv
00000000  23 20 47 52 55 42 20 45  6e 76 69 72 6f 6e 6d 65  |# GRUB Environme|
00000010  6e 74 20 42 6c 6f 63 6b  0a 66 6f 6f 3d 62 61 72  |nt Block.foo=bar|
00000020  0a 23 23 23 23 23 23 23  23 23 23 23 23 23 23 23  |.###############|
00000030  23 23 23 23 23 23 23 23  23 23 23 23 23 23 23 23  |################|
*
00000400
# reboot

== 2. Drop to GRUB shell ==
grub> list_env
foo=bar
grub> baz=quux
grub> save_env baz
grub> list_env
error: invalid environment block.
grub> reboot

== 3. Boot into Linux ==
$ grub-editenv - list
grub-editenv: error: invalid environment block.
$ hexdump -C /boot/grub/grubenv
00000000  00 23 20 47 52 55 42 20  45 6e 76 69 72 6f 6e 6d  |.# GRUB Environm|
00000010  65 6e 74 20 42 6c 6f 63  6b 0a 66 6f 6f 3d 62 61  |ent Block.foo=ba|
00000020  72 0a 62 61 7a 3d 71 75  75 78 0a 23 23 23 23 23  |r.baz=quux.#####|
00000030  23 23 23 23 23 23 23 23  23 23 23 23 23 23 23 23  |################|
*
00000400
$

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: grub-common 2.02-2ubuntu8.15
ProcVersionSignature: Ubuntu 4.15.0-99.100-generic 4.15.18
Uname: Linux 4.15.0-99-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.14
Architecture: amd64
CurrentDesktop: XFCE
Date: Fri May  1 10:35:28 2020
SourcePackage: grub2
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: grub2 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug bionic

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub2 in Ubuntu.
https://bugs.launchpad.net/bugs/1876319

Title:
  save_env prepends \0 to grubenv, causing "error: invalid environment
  block."

Status in grub2 package in Ubuntu:
  New

Bug description:
  Reported upstream as https://savannah.gnu.org/bugs/index.php?58283 .

  = Configuration =
  grub> echo $package_version $grub_cpu $grub_platform
  2.02-2ubuntu8.15 i386 pc

  == 1. Initial conditions ==
  # rm /boot/grub/grubenv
  # grub-editenv - create
  # grub-editenv - set foo=bar
  # grub-editenv - list
  foo=bar
  # hexdump -C /boot/grub/grubenv
  00000000  23 20 47 52 55 42 20 45  6e 76 69 72 6f 6e 6d 65  |# GRUB Environme|
  00000010  6e 74 20 42 6c 6f 63 6b  0a 66 6f 6f 3d 62 61 72  |nt Block.foo=bar|
  00000020  0a 23 23 23 23 23 23 23  23 23 23 23 23 23 23 23  |.###############|
  00000030  23 23 23 23 23 23 23 23  23 23 23 23 23 23 23 23  |################|
  *
  00000400
  # reboot

  == 2. Drop to GRUB shell ==
  grub> list_env
  foo=bar
  grub> baz=quux
  grub> save_env baz
  grub> list_env
  error: invalid environment block.
  grub> reboot

  == 3. Boot into Linux ==
  $ grub-editenv - list
  grub-editenv: error: invalid environment block.
  $ hexdump -C /boot/grub/grubenv
  00000000  00 23 20 47 52 55 42 20  45 6e 76 69 72 6f 6e 6d  |.# GRUB Environm|
  00000010  65 6e 74 20 42 6c 6f 63  6b 0a 66 6f 6f 3d 62 61  |ent Block.foo=ba|
  00000020  72 0a 62 61 7a 3d 71 75  75 78 0a 23 23 23 23 23  |r.baz=quux.#####|
  00000030  23 23 23 23 23 23 23 23  23 23 23 23 23 23 23 23  |################|
  *
  00000400
  $

  ProblemType: Bug
  DistroRelease: Ubuntu 18.04
  Package: grub-common 2.02-2ubuntu8.15
  ProcVersionSignature: Ubuntu 4.15.0-99.100-generic 4.15.18
  Uname: Linux 4.15.0-99-generic x86_64
  ApportVersion: 2.20.9-0ubuntu7.14
  Architecture: amd64
  CurrentDesktop: XFCE
  Date: Fri May  1 10:35:28 2020
  SourcePackage: grub2
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1876319/+subscriptions



More information about the foundations-bugs mailing list