❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

Grub

By: Prasanth
31 March 2025 at 12:11

Grub: GRUb(GRand Unified Bootloader) is bootloader used in Linux system to load the operating system into primary memory RAM when computer starts. it is the first software that after runs firmware(BIOS/UEFi) complete the hardware initialization.

I.Grub2 configuration:-

  • main grub2 configuration file is /etc/default/grub
  • Actual grub2 bootloader configuration is stored in /boot/grub/grub.cfg file on Bios based machine UEFI is defer ,like /boot/efi/EFI/centos/grub.cfg ( do not edit manually it 'make trouble for when booting ),

Image description

*EFI not show why mine ? because i not generated to the exact location and my system is bios based machine.

II.Generate new grub configuration file

#grub2-mkconfig -o /boot/grub2/grub.cfg

grub2-mkconfig - generat the new grub2 config file
-o /boot/grub2/grub.cfg -specifies the output file location.

iii. check grub version

#grub-install --version

Image description

iv. view grub2 settings:-

#cat /etc/default/grub

/etc/grub.d/

Image description

/etc/grub.d/ useful fo grub detects and organizes boot entries and custom boot entry.

v. Editing Grub2 settings

*This part useful for set the boot menu timeout in second and grub boot entry and so on .

#sudo vim /etc/default/grub

Image description

let we see important only :-

i. GRUB_TIMEOUT=12

*It means 12 second delay before booting default Os in grub menu ,you can reduce time also.

ii. GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"

*Automatically sets linux distribution name in grub menu. /etc/system-release it helps to get os name with help sed command.

iii. GRUB_DEFAULT=saved

  • saves the last booted kernel and automatically boots the same one next time *You can also set GRUB_DEFAULT=0, which means the system will always boot into the first OS in the menu. Similarly, setting GRUB_DEFAULT=1 will boot into the second menu entry

iv. GRUB_TERMINAL_OUTPUT="console"

  • I force to grub display the output console mode ,that mean text mode not gui mode, you set also GRUB_TERMINAL_OUTPUT="gfxterm"

v. GRUB_DISABLE_RECOVERY="true"

  • Disable recovery mode in the boot menu ,preferred choice set as false ,incase of emergency it's useful.

vi.GRUB_ENABLE_BLSCFG=true

  • Enables loader specification ,BLS means modern boot entry format .

vii. #GRUB_HIDDEN_TIMEOUT=0

  • Uncommenting this line (by removing #) hides the GRUB menu and boots immediately after 0 seconds.

viii. GRUB_TIMEOUT_STYLE=menu

  • make sure always visible GRUB menu
  • You can set also =hidden, skipped the Grub menu immediately boot.

3.Apply the changes to grub

#sudo grub2-mkconfig -o /boot/grub2/grub.cfg

4.if grub corrupted or missing what can we do ?

1. Enter rescue mode from Grub menu

i. Restart your system
ii. press & hold Shift or press Esc for UEFI bios then GRUB menu show.

iii.select Advanced options , choose rescue mode or also called recovery mode and also c(command line interface) and e (edit) option available in grub menu.
iv press Enter to boot into rescue mode.
V. once you inside ,select into root shell prompt

2. manually Enter Rescue mode from GRUB

  • your system appeared on grub rescue at the time of problem occurred. after showed prompt you can fallow below steps. i. check all availability disk #ls

ii. find the linux root partition

=> #ls (hd0,1)/
=> #ls (hd0,2)/
=> #ls (hd0,3)/

when you see /boot/grub for like this is your boot partion.

iii. The correct the partition

*set root=(hd0,1) => set as root partion where to grub installed ,hd0 mean hard drive,1 is first partion
*set prefix=(hd0,1)/boot/grub = set the grub location
insmod normal = load grub normal mode
normal = load grub menu

3.fix the grub permanetly after booting into linux:-

sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo grub2-install /dev/sda # Replace sda with your disk
sudo reboot

then,

regenerate the config file:-

=> #sudo update-grub

4.Boot into rescue and Emergency mode:

if you system is running but u need rescue mode fallow below steps;-

=> #sudo systemctl rescue
=> #sudo systemctl emergency

5. Boot int rescue and emergency mode using grub menu:

1.Restart your system.
2.Grub menu , select your Linux kernel.
3.after selected, press e (edit) then ,find the line starting with linux ,add the end of line below line then Ctr +x or f10

systemd.unit=rescue.target

Image description

  • Follow same steps are emergency mode

systemd.unit=emergency.target

then,remount the root filesystem in emergency mode

mount | grep " / " -current filesystem mount status
mount -o remount,rw / -remount root file system in read-write
fsck -y /dev/sdX - -sdX(yours disk) , if you want fix the filesystem . we will see detail information upcoming device management blog, then reboot.

5. Reset Root passwd

1.Restart your system.
2.Grub menu , select your Linux kernel.
3.after selected, press e (edit) then ,find the line starting with linux ,add the end of line below the command line then Ctr +x or f10

init=/bin/bash

*After see the panel type below command ,default filesystem is read-only mode,you need to remount read-write mode.
mount -o remount,rw /
*touch /.autorelabel (if your system use SELinux - Security Enhanced linux) to proctecte files.
(touch /.autorelabel if not follow this step lables get damage or lost, you get error like permission denied, can not login in after resetting root password. After reboot linux look on this empty file /.autorelabel and automatically fix security label ,after fixing system will delete the .autorelabel file and reboots again. Note:create with name of autorelabel empty file otherwise linux not understand ,because linux desinged the linux.SELinux won’t detect it, and relabeling won’t happen.
.autorelabel works because it's hardcoded in SELinux.
passwd root
exec /sbin/init (reboot)

or reboot -f

https://www.gnu.org/software/grub/manual/grub/html_node/index

https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-working_with_the_grub_2_boot_loader#sec-Making_Temporary_Changes_to_a_GRUB_2_Menu

Linux Mint Installation Drive – Dual Boot on 10+ Machines!

24 February 2025 at 16:18

Linux Mint Installation Drive – Dual Boot on 10+Β Machines!

Hey everyone! Today, we had an exciting Linux installation session at our college. We expected many to do a full Linux installation, but instead, we set up dual boot on 10+ machines! πŸ’»βœ¨

πŸ’‘ Topics Covered:
πŸ›  Syed Jafer – FOSS, GLUGs, and open-source communities
🌍 Salman – Why FOSS matters & Linux Commands
πŸš€ Dhanasekar – Linux and DevOps
πŸ”§ Guhan – GNU and free software

Challenges We Faced


πŸ” BitLocker Encryption – Had to disable BitLocker on some laptops
πŸ”§ BIOS/UEFI Problems – Secure Boot, boot order changes needed
🐧 GRUB Issues – Windows not showing up, required boot-repair

πŸŽ₯ Watch the installation video and try it yourself! https://www.youtube.com/watch?v=m7sSqlam2Sk


β–Ά Linux Mint Installation Guide https://tkdhanasekar.wordpress.com/2025/02/15/installation-of-linux-mint-22-1-cinnamon-edition/

This is just the beginning!

❌
❌