When I ruined my laptop from starting - and fixed it.

Background and about GRUB boot menu

Most common is to have only one operating system on a computer. But on this laptop, Lenovo ThinkPad T430s, I have several operating systems. At this point I had six operating systems; Microsoft Windows and five variants of Linux operating systems. All on same SSD drive, but on different partitions of the drive.

Partition means that the physical drive is splitted into several parts softwarewise. This works so that when I start the laptop, it will not start an operating system directly. Instead it will open a menu with all operating systems listed and I can select which one to start. If I wait a couple of seconds, it will start the default one automatically.

This menu is called GRUB, GRand Unified Bootloader, or actually GRUB 2 for the second generation (first generation is now renamed to GRUB legacy).

If Windows is one of the operating systems, it is recommended to install Windows first followed by the Linux operating system(s). The GRUB menu is handled by the latest installed operating system.

The task

Below is my GRUB menu when I started this task. The information in brackets for each entry states which partition it is on. For any reason, the GRUB menu does not tell the partition for the first default operating system.

My GRUB menu before I started the task

So now to my task: To delete the operating systems I do not want anymore and by that free up space on the drive. It is the first time I do this. I have been hesitant to do this as I have been concerned for troubles, although I have tried to learn how to and not to do. Yeah...

It is sda5 (elementary 5) and sda7 (Mint 19) I plan to delete. The tool I use is GParted (here with menu in Swedish).

GParted with all my partitions

I start GParted from the latest installed operating system, i.e. Debian 11 on sda11. I delete sda5. However, when I try to execute the delete action, a pop-up message tells me (in Swedish): Please unmount all logical partitions higher than 5.

GParted with error message

This is impossible to do as I am working from sda11. I cannot figure out how I could move to a lower sda than 5 and execute from there. I believe it is possible to handle from it Windows which is on a lower number, but I have not explored how to do it from Windows.

So, as next step I instead start elementary 5 on sda5. From there I can without any problem delete Mint 19 on sda7, because all sda´s higher than 5 are unmounted. However, I did not foresee this would renumber the sda´s above sda7. Because automatically sda11, which holds the GRUB meny, becomes sda10.

If I now had started the terminal and executed "sudo update-grub", it had probably repaired the GRUB menu and the computer had worked. But it still had not solved how to delete partition sda5.

But I do not execute the "sudo update-grub"command. Instead I restart the laptop. Now the GRUB meny can not be found... because booting is looking for sda11 that does not exist. Instead GRUB rescue menu starts. But, I skip the GRUB rescue tool. Instead I insert a USB-memory with a live-version of Debian 11 and restart the computer. It actually is the same Debian 11 as I used when I installed Debian 11 a few days earlier, but any live-USB would do.

I open the terminal window to follow the instruction in the article "How to Fix Grub error: no such partition Grub Rescue". I know I should not type commands I find on the internet and do not understand. But I decide this is a credible source. Most steps works well. But in the latter steps, when I tabulate to select Yes, I cannot get it to accept and execute. Restart of the computer confirms my repair has not worked.

While pondering what to do, I leave the terminal and start GParted on the live-USB (I had to install it from the Debian repository, but no issue to do that). I delete sda5, which is no problem at all from the live-USB.

Now I am considering what to do to repair the GRUB. Should I ran the command instruction in the terminal again? Another option can likely been a USB/CD with repair tools (I have some CDs in a box).

However, I decide to test a simple and dirty method: The Debian 11 Bullseye on the drive was installed only a few days ago. Beside a few settings, nothing important. So I decide to install Debian again, overwriting on the same partition.

And yes, the new installation works and it also fix the GRUB issues! The reinstallation is the latest installed operating system and GRUB is connected to it.

For fun, I also test the command "sudo update-grub" from the terminal, and it works to refresh the GRUB meny.

Next time

My conclusion of how I believe I should have done this from start to avoid any problem:

  • Do all of the work from the live-USB from beginning.
  • Start the GParted on the live-USB and delete both sda´s I did not want any more.
  • Open the terminal and execute the command "sudo update-grub".

When I then restart the computer, I believe it all had worked properly.

At least this is my thought strategy for next time.

A final note. Before I started all above, all essential data on the whole drive was stored on backup. So even if everything had been lost on the drive, it would not have caused me any big trouble.

Henrik Hemrin

31 August 2021

Comments powered by CComment