系统环境:
[OS]: Ubuntu 22.04 LTS
很多时候我们需要修改 Linux 系统的启动项或者 Command line 来达到在系统启动前才能完成的一些操作。而这些操作大多是与内存相关,因此会经常导致出现这样的局面。
当我们修改完 Command line 后保存并执行 reboot 命令重启发现会有这样一句错误提示,“error: environment block too small.”,出现这个则说明修改的部分导致启动环境检测到内存分配的较小。然后开局就报错,这可咋整!
我们可以通过恢复启动环境来消除该错误。事实上通过以下方法同样可以解决启动时报错 “Error: invalid environment block.” 这个问题。
imaginemiracle:~$ cd /boot/grub/ imaginemiracle:grub$ sudo rm grubenv imaginemiracle:grub$ sudo grub-editenv grubenv create imaginemiracle:grub$ sudo grub-editenv grubenv set default=0 imaginemiracle:grub$ sudo grub-editenv grubenv list default=0 imaginemiracle:grub$ sudo update-grub Sourcing file `/etc/default/grub' Sourcing file `/etc/default/grub.d/init-select.cfg' Generating grub configuration file ... Found linux image: /boot/vmlinuz-5.15.0-33-generic Found initrd image: /boot/initrd.img-5.15.0-33-generic Found linux image: /boot/vmlinuz-5.15.0-25-generic Found initrd image: /boot/initrd.img-5.15.0-25-generic Found memtest86+ image: /boot/memtest86+.elf Found memtest86+ image: /boot/memtest86+.bin Warning: os-prober will not be executed to detect other bootable partitions. Systems on them will not be added to the GRUB boot configuration. Check GRUB_DISABLE_OS_PROBER documentation entry. done3. 重启,问题解决!



