CSM(bios legacy) mode stuck in grub menu when use keyb for navigation in grub

My pc stuck at grub menu randomly if i use keyboard for navigation in grub menu. Sometimes if i change bios settings for ram “power down mode” from enable to disable then issue with stuck in grub go away, i can reboot 10 times in a row and use keyboard for navigation in grub menu without any issue. But after few period if i try to navigate in grub menu then i stuck again. Sometimes if i change “PSS support” from auto to enable or disable then it also help with stuck at grub menu, but again after few period i can stuck in grub menu again. I use csm bios legacy mode with mbr sata hdd. I cant test uefi mode with gpt sata hdd cuz i dont have other hard drive. Also i tested prev bios and got the same result. After that i back to latest bios and now i always stuck in grub menu when i try to navigate in grub menu, i cant chose other OS to launch/ or launch other boot options. If i dont touch my keyboard then default grub menu entry [0] load and linux system working. Only one way to boot other OS or use other boot option is edit /etc/default/grub and set number for default menu entry and update-grub. But this impossible cuz i need to switch to other OS many times in a day and load other programs from boot grub menu. Seems this bug related to csm mode only, cuz if i boot from uefi usb key then i dont have problems in grub, but if i boot from usb key or hdd then i got stuck in grub menu. So problem can be in bios firmware or in linux kernel. Can anyone one help me?

Would you mind formatting your text so that it is readable?


Welcome to Manjaro! :smiling_face_with_three_hearts:

  1. Please read the information behind this link. It will help you to post necessary information.
  1. Please press the three dots below your post and then press the :pencil2:
  • If you give us information about your system, we can see what we’re talking about and make better suggestions.
  • You can do this by using inxi in a terminal or in console.
sudo inxi --verbosity=8 --filter --width 
  • Personally identifiable information such as serial numbers and MAC addresses are filtered out by this command
  • Presenting the information in this way allows everyone to be familiar with the format and quickly find the items they need without missing anything.
  1. Copy the output from inxi (including the command) and paste it into your post.
  • To make it more readable, add 3 backticks ``` on an extra line before and after the pasted text.

Have you already :mag: for your problem in the forum ? (Wisdom lies in asking → listening → reading :wink: )

Welcome to the forum! :vulcan_salute:

Short explanation

If you boot in legacy BIOS emulation mode (CSM), then you need to make sure that “legacy USB support” is enabled in the UEFI/BIOS settings.

Long explanation

When booting in CSM mode, the processor is switched from 64-bit long mode into so-called real mode, which is the 16-bit, DOS-compatible mode of the x86 processor architecture.

In this mode, the processor has no privilege separation, does not support multitasking — and therefore, you will only be using one core and one thread — and has no access to the memory management unit. Its maximum address range is then limited to 1088 KiB of RAM.

Also, in this mode, only legacy hardware is supported, i.e. PS/2-connected or RS-232-port-connected keyboards and mice. This means that USB keyboards and mice will need to emulate PS/2 keyboards and mice. The firmware routine for emulating PS/2 input devices requires access to memory locations above that 1088 KiB barrier, because the address range between 640 KiB and 1024 KiB is reserved for legacy peripherals.

By enabling “legacy USB support”, you enable this emulation routine in the firmware, which will then switch the boot processor into so-called unreal mode. Like real mode, this is still a 16-bit single-tasking mode, but it is initialized after first setting up pagetables — as would be the case for 32-bit protected mode or 64-bit long mode — and then switching the processor back into real mode without a full processor reset.

This in turn allows the processor to access higher memory locations above the 1088 KiB barrier from within real mode, and thus, the firmware will be able to load and execute the routines for making your USB input devices appear to the boot loader as being PS/2 input devices. Without it, your USB keyboard and mouse won’t work for as long as the legacy version of GRUB is in control of the processor.

3 Likes

legacy usb support is enabled. If i boot grub from bios menu with override option then i can navigate at grub menu without any issue. So i dont understand why i stuck at grub menu when i use normal boot?! Where is a problem? Seems its a linux issue not a bios issue. Am i right?

No, you’re not. Linux — the kernel — isn’t even loaded into memory yet when GRUB is on the screen, and the legacy boot version of GRUB completely relies on the information about the hardware provided to it by the BIOS, or in this case, the CSM module of the UEFI firmware.

I don’t know what that “override option” is that you’re talking about, but apparently your firmware needs this enabled to emulate a PS/2 keyboard from a USB keyboard and allow GRUB to use it as a PS/2 keyboard.

found also on archlinux forum post with id=279261, people have same issue

Well, if you don’t understand these things, then you will indeed run into this issue, and others have been asking about it here at the Manjaro forum just the same. :man_shrugging:

Either way, you now know why it happens, and you also know how to circumvent it. And of course, it would be a non-issue if you were to have installed your system in native UEFI mode, because the UEFI runs in 64-bit long mode — the only exception being 32-bit UEFIs, which run in 32-bit protected mode or 32-bit PAE mode.

1 Like

if i dont press keys on keyboard linux boot without any issue. So why signals from keyboard block linux kernel from booting?

They don’t.

If you don’t press any keys on the keyboard, then the default GRUB timer will expire, and then GRUB will boot the default menu entry. If on the other hand you do press a key and the keyboard is recognized by GRUB — actually, by the legacy BIOS emulation of the firmware — then the timer is interrupted.

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.