Bug 1683128
Summary: | [RHEL-8] grub2-editenv: error: environment block too small | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 8 | Reporter: | zguo <zguo> |
Component: | grub2 | Assignee: | Bootloader engineering team <bootloader-eng-team> |
Status: | CLOSED DUPLICATE | QA Contact: | Release Test Team <release-test-team-automation> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 8.0 | CC: | fmartine, mpitt, rhbugs |
Target Milestone: | rc | ||
Target Release: | 8.0 | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2020-06-17 08:52:37 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
zguo
2019-02-26 10:00:24 UTC
(In reply to zguo from comment #0) > Description of problem: > > I have a system only with 4.18.0-64.el8.x86_64 installed initially. When I > tried to install another kernel, see "grub2-editenv: error: environment > block too small." as below. What's the reason maybe? > > $ rpm -ivh kernel-core-4.18.0-70.el8.test.x86_64.rpm > Verifying... ################################# > [100%] > Preparing... ################################# > [100%] > Updating / installing... > 1:kernel-core-4.18.0-70.el8.test ################################# > [100%] > grub2-editenv: error: environment block too small. > > Did you modify the /boot/grub2/grubenv without using grub2-editenv? The grubenv is a fixed size and grub2-editenv expect it to be filled with # characters up to 1024 bytes. So manually editing will break that assumption. If you modify it externally, you can fix this by doing: $ grub2-editenv create $ grub2-mkconfig Then your kernel should be able to install again. While trying to add a workaround for bug 1690765 for RHEL 8.0, I stumbled over the same thing on our Cockpit test VMs. These never manually touch grubenv. The default content is # cat /boot/grub2/grubenv # GRUB Environment Block saved_entry=0 kernelopts=root=/dev/mapper/rhel-root ro rd_NO_PLYMOUTH crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap console=ttyS0,115200 net.ifnames=0 biosdevname=0 #################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################### (kernel options were supplied via kickstart). Now, if I need to add a new argument: # opts=$(grub2-editenv - list | grep kernelopts) # grub2-editenv - set "$opts foo=bar" grub2-editenv: error: environment block too small. Apparently grub2-editenv does not properly adjust the number of `#` in the file? Bumping severity as this affects systems without manual grubenv edits and blocks working around bug 1690765 which in turn blocks an important feature for changing kernel options through the UI. Hello Martin, (In reply to Martin Pitt from comment #2) > While trying to add a workaround for bug 1690765 for RHEL 8.0, I stumbled > over the same thing on our Cockpit test VMs. These never manually touch > grubenv. The default content is > > # cat /boot/grub2/grubenv > # GRUB Environment Block > saved_entry=0 > kernelopts=root=/dev/mapper/rhel-root ro rd_NO_PLYMOUTH crashkernel=auto > resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap > console=ttyS0,115200 net.ifnames=0 biosdevname=0 > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ################## > So this is the default after a fresh RHEL8 install? I see that the file size is 1019 bytes instead of the 1024 expected by grub2-editenv, and that's why it fails. > (kernel options were supplied via kickstart). Now, if I need to add a new > argument: > > # opts=$(grub2-editenv - list | grep kernelopts) > # grub2-editenv - set "$opts foo=bar" > grub2-editenv: error: environment block too small. > > Apparently grub2-editenv does not properly adjust the number of `#` in the > file? > Yes, it could be. I'll investigate how Anaconda creates the content of this file. > Bumping severity as this affects systems without manual grubenv edits and > blocks working around bug 1690765 which in turn blocks an important feature > for changing kernel options through the UI. @Javier: We use virt-install to install the image: https://github.com/cockpit-project/cockpit/blob/master/bots/images/scripts/rhel-8-0.bootstrap https://github.com/cockpit-project/cockpit/blob/master/bots/images/scripts/virt-install-fedora The kickstart provides some arguments: bootloader --location=mbr --append="console=ttyS0,115200 rd_NO_PLYMOUTH" and the others via grub: sed -i 's/GRUB_TIMEOUT.*/GRUB_TIMEOUT=0/; /GRUB_CMDLINE_LINUX=/ s/"$/ net.ifnames=0 biosdevname=0"/' /etc/default/grub grub2-mkconfig -o /boot/grub2/grub.cfg But this isn't yet what breaks it, in this very configuration it looks like this: # cat /boot/grub2/grubenv # GRUB Environment Block saved_entry=0 kernelopts=root=/dev/mapper/rhel-root ro rd_NO_PLYMOUTH crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap console=ttyS0,115200 net.ifnames=0 biosdevname=0 ######################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################### and it's exactly 1024 bytes. In that failing case I ran several editenvs, mkconfigs, etc., and one of these must have broken it. But I can't reproduce this any more, so moving back to the original priority. (In reply to Martin Pitt from comment #4) > @Javier: We use virt-install to install the image: > > > https://github.com/cockpit-project/cockpit/blob/master/bots/images/scripts/ > rhel-8-0.bootstrap > > https://github.com/cockpit-project/cockpit/blob/master/bots/images/scripts/ > virt-install-fedora > > The kickstart provides some arguments: > > bootloader --location=mbr --append="console=ttyS0,115200 rd_NO_PLYMOUTH" > > and the others via grub: > > sed -i 's/GRUB_TIMEOUT.*/GRUB_TIMEOUT=0/; /GRUB_CMDLINE_LINUX=/ s/"$/ > net.ifnames=0 biosdevname=0"/' /etc/default/grub > grub2-mkconfig -o /boot/grub2/grub.cfg > > But this isn't yet what breaks it, in this very configuration it looks like > this: > > # cat /boot/grub2/grubenv > # GRUB Environment Block > saved_entry=0 > kernelopts=root=/dev/mapper/rhel-root ro rd_NO_PLYMOUTH crashkernel=auto > resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap > console=ttyS0,115200 net.ifnames=0 biosdevname=0 > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ############################################################################# > ####################### > > and it's exactly 1024 bytes. In that failing case I ran several editenvs, > mkconfigs, etc., and one of these must have broken it. But I can't reproduce > this any more, so moving back to the original priority. Thanks a lot for the information. I'll see if I can reproduce the issue. *** This bug has been marked as a duplicate of bug 1761496 *** |