GrubEnv - file /boot/grub2/grubenv
¶
This parser reads the GRUB environment block file. The file is laid out in a key=value format similar to an ini file except it doesn’t have any headers.
The parser stores the key/value pairs in itself which inherits a dict. This
file is only used in Grub 2, but in RHEL8 with BLS being the default. There
were several variables added that are referenced in the
/boot/loader/entries/*.conf
files.
- class insights.parsers.grubenv.GrubEnv(context)[source]¶
Bases:
insights.core.Parser
,dict
Parses the /boot/grub2/grubenv file and returns a dict of the grubenv variables.
Sample output of the file:
saved_entry=295e1ba1696e4fad9e062f096f92d147-4.18.0-305.el8.x86_64 kernelopts=root=/dev/mapper/root_vg-lv_root ro crashkernel=auto resume=/dev/mapper/root_vg-lv_swap rd.lvm.lv=root_vg/lv_root rd.lvm.lv=root_vg/lv_swap console=tty0 console=ttyS0,115200 boot_success=0 boot_indeterminate=2 tuned_params=transparent_hugepages=never tuned_initrd=
- has_kernelopts¶
Returns True/False depending on if kernelopts key is in the dict.
- Type
bool
- kernelopts¶
Returns the string of kernelopts from the dict.
- Type
bool
- has_tuned_params¶
Returns True/False depending of if the tuned_params key is in the dict.
- Type
str
- tuned_params¶
Returns the string of tuned_params from the dict.
- Type
str
Examples
>>> type(grubenv) <class 'insights.parsers.grubenv.GrubEnv'> >>> grubenv.has_kernelopts True >>> grubenv.kernelopts 'root=/dev/mapper/root_vg-lv_root ro crashkernel=auto resume=/dev/mapper/root_vg-lv_swap rd.lvm.lv=root_vg/lv_root rd.lvm.lv=root_vg/lv_swap console=tty0 console=ttyS0,115200' >>> grubenv.has_tuned_params True >>> grubenv.tuned_params 'transparent_hugepages=never' >>> grubenv['saved_entry'] '295e1ba1696e4fad9e062f096f92d147-4.18.0-305.el8.x86_64'