Error: invalid environment block. Press any key to continue...

The error message appears immediately after the boot screen on purple background. Ubuntu 12.04.1 LTS.

  • Have you tried pressing a key to continue? Also, is this on the installation CD or after you install?
    – nanofarad
    Sep 22, 2012 at 19:57
  • This might help. Sep 22, 2012 at 19:59
  • After pressing a key, booting is continuing, even with pressing no key after few seconds. It's after install.
    – Tim
    Sep 22, 2012 at 20:02
  • If it continues to boot, there really is no serious problem, is there? "If it ain't[sic] broke, don't fix it!"
    – nanofarad
    Sep 22, 2012 at 20:39
  • On Ubuntu 12.04.4 there's no line saying save_env recordfail There's one saying just recordfail. Shall I delete it anyway? Apr 16, 2014 at 19:14

2 Answers 2


From http://ubuntuforums.org/showthread.php?t=1285098:

Press E at the GRUB menu. Find the line saying save_env recordfail and delete all of it with the Del or Backspace key. Press Ctrl+X to boot, and then open the Terminal by searching it in the dash(launcher menu).

Run the following command, and then when it asks for your password, type it, and press Enter. Your password will not be shown, not even asterisks.

sudo -i

Then, run each command, one-by-one.

cd /boot/grub
rm grubenv
grub-editenv grubenv create
grub-editenv grubenv set default=0
grub-editenv grubenv list

The second-to-last command should show default=0. If it does, run the last command, and let it finish. When it finishes, you should get the prompt /boot/grub# or something like that again(it's what you see after each command). Run exit twice, and then reboot.

  • How do I find the GRUB menu? Must I create sudo passwd root for sudo -i?
    – Tim
    Sep 22, 2012 at 20:18
  • 4
    The GRUB menu can be found by holding Shift while the system is in the early stages of booting (right through BIOS). The password you give to sudo -i is your USER password, not the root password.
    – nanofarad
    Sep 22, 2012 at 20:30
  • 1
    in my boot configuration there is only one line saying recordfail. I deleted it but still can't get it to boot up
    – phuclv
    Aug 19, 2014 at 3:52
  • 1
    @LưuVĩnhPhúc I know it's probably too late for you, but I just had the same problem as you. The options seem to have changed slightly in 14.04. I used help.ubuntu.com/community/Boot-Repair to get it to a state where it boots past the error message, and then followed the above instructions to permanently remove the error itself.
    – Martin KS
    Dec 20, 2015 at 21:40
  • @LưuVĩnhPhúc Same problem with my boot configurations. Anything you tried which worked for you? Please help...
    – Wazzzy
    Dec 13, 2017 at 7:51

This error message means that the grubenv file is > 1024 bytes. This is mostly caused by manually editing the file. (e.g. vi appends a newline on the last line)

To avoid this, you should never edit grubenv using anything other than grub-editenv.

Using grub-editenv <filename> set exiting_var=existing_value does not fix the file.

Speculation: You should be able to fix the file by deleting a character or two to get the size back to exactly 1024 bytes. If that does not work, you need to recreate the file using the instructions in this answer instead. (Get the correct values of the variables using grub-editenv grubenv list first and recreate a file with those values)

Not the answer you're looking for? Browse other questions tagged or ask your own question.