KevCaz's Website

Within the last two weeks, I ran into serious issues with my Debian machine. Two weeks ago, just as I described in a previous post, after some updates, I was not able to boot anymore. Given that everything was working very well before, I was convinced that this was an issue with GRUB2, but was not able to fix it despite a very demanding quest for a solution. I was so desperate that I decided to reinstall Debian (which turned out to be a good thing as it fixed minor issues I had with my hardware.

After the re-installation (2 weeks ago) on my system, I worked without rebooting the system untill today as I decided to try to reboot. But sadly, I ran into the same issue… After a couple of minutes of intense disappointment, I rolled up my sleeves and looked for a solution once again. First thing first, I had to get a bootable stick with the Debian installer for my Levono ThinkPad. If you don’t know how to proceed, there are several tutorials online that explain how to do so:

On the MacOSX machine I had access, I used the following command line:

1
$ dd bs=4m if=Downloads/debian-testing-amd64-DVD-1.iso of=/dev/disk1 && sync

With Debian installer on my USB stick, I was able to use a GRUB2 terminal and found this post on HowtoForge to better understand what I was doing. Basically, I needed to set the path to properly boot, after checking where was my file system (using the GRUB’s ls command I found that it was (hd0,gpt2) in my case), I followed these guidelines 🇫🇷 and typed:

1
2
3
4
5
6
grub> prefix=(hd0,gpt2)/boot/grub
grub> set root=(hd0,gpt2)
grub> insmod linux
grub> insmod boot
grub> insmod normal
grub> normal

Afterwards, I was then able to access my Debian partition on the boot menu (and new entry was added to the menu displayed by the installer). Now, with this USB stick I am now able to boot even if the GRUB on my hard drive is not working properly.

The last step was to reinstall GRUB on my hard drive (the steps about is just a work around to boot with a broken GRUB). After several unsuccessful attempts, I ended up checking out the GRUB manual and it turned out that all I had to do was to reinstall GRUB with a simple command line. First, I needed to locate the partition where the EFI system was installed:

1
2
3
4
5
6
7
$ fdisk -l
[...]
Device              Start        End    Sectors   Size Type
/dev/nvme0n1p1       2048    1050623    1048576   512M EFI System
/dev/nvme0n1p2    1050624 1967138815 1966088192 937.5G Linux filesystem
/dev/nvme0n1p3 1967138816 2000408575   33269760  15.9G Linux swap
[...]

and then I used grub-install:

1
$ grub-install /dev/nvme0n1p1

And now my computer boots properly 🎆 🏆!

After this experience, I came to realize that one of the major issue to fix this issue was the abundance of resources that lack accuracy. On such topics, a quick search on the Internet may not be enough as there are many tutorials/answers on different websites that solve similar issues but that do not provide enough information to let the reader realize that it is actually not the very same issue. On such topics (quite advanced for somebody like me), one shall recall this: “just read to the manual” 😄.