CentOS 7 Dual Boot - Can't find command 'save_env'

General support questions
Post Reply
McRender
Posts: 2
Joined: 2014/07/23 08:20:03

CentOS 7 Dual Boot - Can't find command 'save_env'

Post by McRender » 2014/07/23 09:03:20

Hi there CentOS Community

I've just managed to get my dual boot (Win7x64 / CentOs 7) EFI configuration up and running properly. Now I'm at a point where I'd like to change the default behaviour of the grub2 boot manager to automatic select the last chosen boot option. Like written in the official GNU GRUB Manual,I've added

Code: Select all

GRUB_SAVEDEFAULT=true
to the file located in

Code: Select all

/etc/default/grub

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="vconsole.font=latarcyrheb-sun16 vconsole.keymap=sg crashkernel=auto  rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
After running

Code: Select all

grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
I have the following grub configuration file on my boot partition

Code: Select all

/boot/efi/EFI/centos/grub.cfg

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set pager=1

if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

terminal_output console
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'CentOS Linux, with Linux 3.10.0-123.el7.x86_64' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-123.el7.x86_64-advanced-91e43ac8-8ad4-4246-b75b-80f6cd87dafa' {
	savedefault
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt 
	insmod xfs
	set root='hd0,gpt4'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4  ce6135c7-27b8-4b0e-b450-b689d56c3d4a
	else
	  search --no-floppy --fs-uuid --set=root ce6135c7-27b8-4b0e-b450-b689d56c3d4a
	fi
	linuxefi /vmlinuz-3.10.0-123.el7.x86_64 root=UUID=91e43ac8-8ad4-4246-b75b-80f6cd87dafa ro vconsole.font=latarcyrheb-sun16 vconsole.keymap=sg crashkernel=auto  rhgb quiet 
	initrdefi /initramfs-3.10.0-123.el7.x86_64.img
}
menuentry 'CentOS Linux, with Linux 0-rescue-acf42b38b0764bce97a9f5d31209a59f' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-acf42b38b0764bce97a9f5d31209a59f-advanced-91e43ac8-8ad4-4246-b75b-80f6cd87dafa' {
	savedefault
	load_video
	insmod gzio
	insmod part_gpt 
	insmod xfs
	set root='hd0,gpt4'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4  ce6135c7-27b8-4b0e-b450-b689d56c3d4a
	else
	  search --no-floppy --fs-uuid --set=root ce6135c7-27b8-4b0e-b450-b689d56c3d4a
	fi
	linuxefi /vmlinuz-0-rescue-acf42b38b0764bce97a9f5d31209a59f root=UUID=91e43ac8-8ad4-4246-b75b-80f6cd87dafa ro vconsole.font=latarcyrheb-sun16 vconsole.keymap=sg crashkernel=auto  rhgb quiet 
	initrdefi /initramfs-0-rescue-acf42b38b0764bce97a9f5d31209a59f.img
}
if [ "x$default" = 'CentOS Linux, with Linux 3.10.0-123.el7.x86_64' ]; then default='Advanced options for CentOS Linux>CentOS Linux, with Linux 3.10.0-123.el7.x86_64'; fi;
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-efi-52D4-C3F1' {
	savedefault
	insmod part_gpt 
	insmod fat
	set root='hd0,gpt1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  52D4-C3F1
	else
	  search --no-floppy --fs-uuid --set=root 52D4-C3F1
	fi
	chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
After restarting and selecting one of the boot options in the grub text prompt I get the following error message

Code: Select all

error: can't find command 'save_env'
Press any key to continue..
Booting in to all operating systems works like a charm but grub can't read out the previously saved entry from the environment block located in

Code: Select all

/boot/grub/grubenv

# GRUB Environment Block
saved_entry=CentOS Linux, with Linux 3.10.0-123.el7.x86_64
#######################################################
The GNU Grub Manual states
For safety reasons, this storage is only available when installed on a plain disk (no LVM or RAID), using a non-checksumming filesystem (no ZFS), and using BIOS or EFI functions (no ATA, USB or IEEE1275).

but I do whether use LVM nor running a RAID configuration.

Does anyone else has run into similar problems like me or has already found a solution? Would be very happy to hear your voice...

Post Reply