I'm actually kind of surprised no one else has encountered this and it can be bad if you do.
The symptom is you boot up and you get the "Welcome to GRUB" "GRUB Loading" but then they are followed by "Out of memory error..." and then you're left to force a power off.
IF you're lucky, a previous kernel might boot. If not, you're left booting to a live USB and chroot-ing into your install to fix your kernel. Like I said, this can be kinda bad.
My encountering this included these relevant conditions:
4K monitor
nVidia driver in use
initrd.img larger than 100MB
EFI booting
TL/DR: there's a bug in GRUB-EFI that causes it to run out of memory if your GRUB_GFXMODE is too large. Basic solution is to set it to 640x480 in /etc/default/grub and update grub.
The other factors I listed above contribute to the problem and I had mixed results with various combinations.
My research revealed a probable cause was the initrd.img being too large. So I changed compression to "gzip" and modules to "dep".
My testing show very little change when changing compression types, but setting modules to "dep" (try and load only whats needed) instead of "most" (load everything) reduced the initrd.img size by -50MB.
This allowed -42 and -48 kernels to boot, but -52 was still just over 100MB - more than twice as large as the others.
This was where the nvidia driver came into play. I had not loaded the nvidia driver in the two older kernels. I had been reconfiguring and updating this laptop and had previously just been using the Intel video rather than nVidia.
So I was faced with removing the nVidia driver, which was possible as I don't game on this machine. But I like having options so I decided to continue digging.
Finally I found a comment regarding the screen size and GRUB. Apparently the 4k graphics size eats half the available 200MB RAM from GRUBs allotment. Thus any initrd.img larger than 100MB won't load.
Setting GRUB_GFXMODE=640x480 in grub's defaults seems to have resolved the issue for now. This bug is widely known and I am confident there will be a fix fairly soon. For now, I'll just have to tolerate a GIANT GRUB MENU.
The symptom is you boot up and you get the "Welcome to GRUB" "GRUB Loading" but then they are followed by "Out of memory error..." and then you're left to force a power off.
IF you're lucky, a previous kernel might boot. If not, you're left booting to a live USB and chroot-ing into your install to fix your kernel. Like I said, this can be kinda bad.
My encountering this included these relevant conditions:
4K monitor
nVidia driver in use
initrd.img larger than 100MB
EFI booting
TL/DR: there's a bug in GRUB-EFI that causes it to run out of memory if your GRUB_GFXMODE is too large. Basic solution is to set it to 640x480 in /etc/default/grub and update grub.
The other factors I listed above contribute to the problem and I had mixed results with various combinations.
- The nvidia driver makes initrd.img much larger
- The default initrmafs.conf has "MODULES=" set to "most"
- The default initramfs.conf has "COMPRESS=" set to "zstd"
- The default screen resolution my laptop is 4K which is a very large framebuffer
My research revealed a probable cause was the initrd.img being too large. So I changed compression to "gzip" and modules to "dep".
My testing show very little change when changing compression types, but setting modules to "dep" (try and load only whats needed) instead of "most" (load everything) reduced the initrd.img size by -50MB.
This allowed -42 and -48 kernels to boot, but -52 was still just over 100MB - more than twice as large as the others.
This was where the nvidia driver came into play. I had not loaded the nvidia driver in the two older kernels. I had been reconfiguring and updating this laptop and had previously just been using the Intel video rather than nVidia.
So I was faced with removing the nVidia driver, which was possible as I don't game on this machine. But I like having options so I decided to continue digging.
Finally I found a comment regarding the screen size and GRUB. Apparently the 4k graphics size eats half the available 200MB RAM from GRUBs allotment. Thus any initrd.img larger than 100MB won't load.
Setting GRUB_GFXMODE=640x480 in grub's defaults seems to have resolved the issue for now. This bug is widely known and I am confident there will be a fix fairly soon. For now, I'll just have to tolerate a GIANT GRUB MENU.
Comment