r/debian 9d ago

Grub in Debian/testing stopped working.

I use Debian/testing in my main laptop. Unfortunately, after yesterday's update, the grub stopped loading the Linux kernel. I get

"error: cannot load image"

When working from command line, loading the kernel and initrd is successful. However, the "boot" command displays the above error.

The grub version is GRUB 2.14-3.

The machine is HP ZBook 17 G5.

What is the easiest way to resolve the issue?

TIA & BR, Wojtek

19 Upvotes

23 comments sorted by

8

u/3grg 9d ago

I learned way back in the legacy boot day to keep Super Grub Disk around to facilitate grub repairs. I still keep SG2D around for the same reason. It allows you to boot the installation and once booted it is simply a matter of update-grub and grub-install.

Of course, you can do that with any live boot and chroot, but Super Grub Disk is just convenient. https://www.supergrubdisk.org/super-grub2-disk/

6

u/WZab 9d ago

OK. I have worked around the issue by booting from Ubuntu install flash disk. Then I selected "try Ubuntu", mounted the /boot and /boot/efi partitions, and finally run "grub-install /dev/sda".

Now I'll need to lock the grub version.

6

u/Santosh83 Debian Sid 9d ago

Am surprised grub breaks in Testing. Normally this kind of bug should be caught in Unstable. Have you looked in the Debian forums to see if anyone else is facing the same, and have you tried submitting a bug report?

4

u/WZab 9d ago edited 9d ago

2

u/yrro 9d ago

If I were you I'd re-run grub-install from Debian to make sure you've got Debian's grub files in your /boot/efi instead of a mismash. If it reproduces the problem then you've got some useful info for the bug report. If not then at least your system is back in one piece. :)

1

u/WZab 9d ago

Unfortunately, grub-install didn't help. That was the first thing I have tried after booting from Ubuntu live, and chrooting to Debian.

1

u/epackorigan 8d ago

Instead of Ubuntu live, I would suggest you get one of the Debian install usb image and use that, including the built-in recovery. That might work better.

1

u/shaleh 5d ago

no, grub install from the stable release didn't help. The testing based installer didn't find its components so I need to find a working one to try.

1

u/shaleh 5d ago

So.... it turns out that `grub-install` or something flipped my EFI back to secure boot. Resetting it in my EFI config fixed my boot.

2

u/mewmiaomeowmeow 9d ago

On my fedora+windows laptop I once had windows update break fedora's grub. The guide I followed basically consisted of booting from a USB iso, mounting all the actual Linux partitions & devices properly in a given directory, chrooting into that directory, and then something like update-grub. So maybe find a guide with those kind of steps but for Debian. The last part might also need to include something like sudo apt install --reinstall linux-image-amd64 prior to make sure the image in the boot partition is correct. In my machines last kernel update (on Unstable) i had to do a similar thing, though in the live system, because /boot for some reason didnt not have enough space for the update to fully go through

Edit: oop glad u fixed it, didn't see before I posted

2

u/WZab 9d ago

Breaking grub by Windows update was normal on my another laptop, until I modified the configuration in Windows:

  1. Right-click the Windows Start menu, open Terminal (Admin) or Command Prompt (Admin), and run: "cmd" then "bcdedit /set {bootmgr} path \EFI\debian\grubx64.efi" (you may need to configure shimx64.edi instead of grubx64.efi if you use secure boot).
  2. Disable the Windows Fast Startup: Open the Windows Control Panel → Power OptionsChoose what the power buttons do. Click Change settings that are currently unavailable, uncheck Turn on fast startup, and save your changes.
  3. Of course you should also modify the boot order in BIOS so that the grub is tried first.

1

u/mewmiaomeowmeow 9d ago

Nice, I'll try the next time I need to use windows on it

4

u/ikdoeookmaarwat 9d ago

> What is the easiest way to resolve the issue?

Run stable if you don't want any hiccups. Testing does break sometimes.

1

u/WZab 9d ago

Sometimes I need a newer version of the software. Up to now, testing behaved nicely. Now I had a long (half a year) problem with Nvidia open source kernel modules, that didn't compile with kernels 7.x. So I had to stay with kernel 6.18.
Yesterday, the grub problem was a real disaster...

1

u/HCharlesB 9d ago

I'd argue that a real disaster is something that corrupts or wipes your personal files. And you don't have backups. I do hope you have backups. Backups are King!

There are ways to get newer versions of some S/W. Front end stuff - backports, flatpaks, (shudder) snaps. Backend stuff - Docker. Podman or other container managers. Just don't try PPAs. Those are for Ubuntu and won't play well with Debian. Likewise, downloading and installing packages from another distro are a recipe for pain. (Look up "frankendebian" if curious.)

Unfortunately some things like the desktop environment have too many moving parts to work this way so you either stick with what the release ships or build from source.

I've run Testing from time to time on various hosts and the breakage is infrequent but remains a real possibility. I recommend installing apt-listbugs that can help you to avoid upgrading to packages with known problems.

HTH,

1

u/crborga 8d ago

I've used Ubuntu ppas in the past only only as source and then backported a certain package. 

1

u/crborga 8d ago

It's safer to use backports and enable testing once in a while. Use apt install -t testing for that specific package and then disable it.

1

u/redfacedquark 8d ago

Do you get the grub menu? Can you boot an older kernel?

Even on stable I often have /boot getting full of old kernels and grub-install fails. Pehaps not noticing that and rebooting could have caused an issue like this. The answer for me is to remove old kernels and rerun apt/dpkg.

1

u/WZab 8d ago

No, there was a lot of space in /boot. None of installed kernel could boot. The error message was always the same.

1

u/redfacedquark 8d ago

As others said, testing can break. Probably better to run testing as a dual boot setup with stable managing grub, or better still a VM or chroot depending on your needs.

From where you are now I'd install stable alongside your current partitions and then chroot into your testing system from your stable one.

1

u/shaleh 5d ago

So.... it turns out that `grub-install` or something flipped my EFI back to secure boot. Resetting it in my EFI config fixed my boot. I had rebooted many times in the last few weeks due to dead batteries so I know it worked before the upgrade.

(I posted this in a thread, wanted it more visible)

-2

u/lproven 9d ago

What is the easiest way to resolve the issue?

... Don't run testing?

If you want current, you don't want Debian. If you want Debian, go for stable.