Categories
Linux Mastering Development Ubuntu

How to fix a grub boot error : “symbol ‘grub_calloc’ not found

Just ran the latest batch of updates on 20.04 (Xubuntu), and now I’m getting a GRUB error:

symbol 'grub_calloc' not found

I’m dropped into the ‘grub rescue’ shell, but have no idea what to do there that might be useful. To me, ‘symbol not found’ implies some sort of build error with the grub package, but I don’t really know how grub works. I noticed that this update also included ‘firmware’, not sure if that could be related. Is my best bet just to boot from a live CD and see if I can roll back the update to grub somehow?

Editted to add :

OK, thanks to lots of people ! Here’s what I think I now understand.

  1. On ‘non-UEFI’ systems, grub is installed in two seperate parts. The first, most basic, part is the part that is started on bootup. But for most of it’s functionality, it needs the second part. These parts must be aligned – neither part must require any functionality from the other part which is not actually there.

The visible, run-time problem occurs when these parts are not aligned, and the function grub_calloc is not supplied. It’s not 100% clear to me if grub_calloc belongs in the second, larger part or the first. I would have expected the second, but the grub build system is a work of considerable art, so I don’t know :).

  1. The root cause of the problem is that the grub update has not ensured that both parts have been updated. Ideally, failure to do this should cause grub installation to fail, and the system should be reverted to a safe state. This does not happen.

This is actually still a bit of a mystery to me. All that the update needs to do by default is put each part where the current parts are, because obviously that worked. If the install locations/drives are configuration – driven, and one of these locations can’t be reached, then somehow a mismatch has arisen between that configuration data and reality. This might not show up as a problem as long as no new dependency was introduced between the parts.

All flavours of solution involve reinstalling grub to ensure that the two parts are aligned. It’s not actually necessary to go back to the previous version ( although that will work ), because it’s not the grub runtime per se that is broken. There are numerous ways to achieve this, depending on your environment, but running the Boot-repair live disk worked for me.

It may be useful, for the purpose of avoiding such a misalignment in future, to ensure that the grub installer on your system is configured to install to the correct devices.

This update resolves some important bugs ( https://ubuntu.com/security/notices/USN-4432-1 ). If you have reverted grub to resolve this problem, be aware that you are exposed to these issues.

Leave a Reply

Your email address will not be published. Required fields are marked *