Probe Current sda Disk and Install GRUB. Debian 12. Part.2.
Probe Current sda Disk and Install GRUB. Debian 12. Part.2.
GRUB Configuration Guide
My current situation is this:
[
root@debian:/home/user001# sudo os-prober
/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
/dev/sda6:Debian GNU/Linux 12 (bookworm):Debian:linux
/dev/sda7:Debian GNU/Linux 12 (bookworm):Debian:linux
]
/dev/sda7
is the current /
;
I am using it just now;
Setup grub accordingly.
Given that
/dev/sda7
is currently my root (/
) partition, you can set up GRUB to use/dev/sda7
as the default boot option. Here’s how to configure GRUB to ensure it prioritizes/dev/sda7
and includes entries for both/dev/sda6
and/dev/sda1
as detected by os-prober.Step 1: Set /dev/sda7 as the Default Entry in GRUB
Edit
/etc/default/grub
:Open the GRUB configuration file:
sudo nano /etc/default/grub
Set
GRUB_DEFAULT
to the Debian entry on/dev/sda7
:Since both
/dev/sda6
and/dev/sda7
contain Debian, specify/dev/sda7
as the default entry by using the name detected by os-prober.Find the line that begins with
GRUB_DEFAULT=
and set it as follows:
GRUB_DEFAULT="Debian GNU/Linux 12 (bookworm) (on /dev/sda7)"
If specifying the entry by name doesn’t work, you can try setting it by index. To find the index, you could restart to see where sda7 is in the GRUB menu.
Save and Close the File.
Step 2: Update GRUB
Run the following command to update the GRUB configuration with the new settings:
sudo update-grub
Step 3: Reinstall GRUB on /dev/sda
Reinstalling GRUB on
/dev/sda
ensures that it loads correctly with the updated configuration:sudo grub-install /dev/sda
Step 4: Reboot to Test
Reboot the system to confirm that GRUB now prioritizes
/dev/sda7
as the default boot entry:sudo reboot
After rebooting, GRUB should default to booting from the OS on
/dev/sda7
.
Subscribe to my newsletter
Read articles from user1272047 directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by