Friday, September 12, 2025

How to Fix a Linux Kernel Freeze on Boot

How to Fix a Linux Kernel Freeze on Boot: A Universal Guide

Have you ever installed a new Linux update, only for your system to freeze right after you select a kernel from the boot menu? It's a frustrating problem that points to an incompatibility between the new kernel and your specific hardware. The good news is, there's a simple, universal fix that works across most Linux distributions, including Oracle Linux, Ubuntu, Fedora, and more.

This guide will walk you through the steps to get your system back up and running smoothly.

The Root Cause: Why It's Not GRUB

Before we dive into the fix, let's understand the problem. A freeze during the boot process, after you've selected a kernel, isn't a problem with GRUB (your bootloader). Instead, it’s almost always a kernel-related issue.

The new kernel version likely contains a bug or a driver regression that conflicts with a piece of your hardware, such as your graphics card, Wi-Fi adapter, or a storage controller. The proof is in the pudding: your older kernel still boots perfectly.


Step 1: Find and Boot the Working Kernel

Your first priority is to get your system into a functional state.

  1. Access the GRUB Menu: When your computer starts, use the arrow keys to stop the automatic boot timer.

  2. Locate the Stable Kernel: Use the arrow keys to navigate the list of boot options. The entries are numbered starting from 0. The problematic kernel is usually the first option. Look for the older kernel version, which might be in a submenu called "Advanced options".

  3. Boot the System: Select the working kernel and press Enter. Your system should now boot without any issues.

Pro Tip: Make a note of the working kernel's name and its position in the list (e.g., the third entry is index 2). This will be important for the next step.


Step 2: Choose the Right Method for Your Distribution

Modern Linux distributions have moved away from a single method for managing boot entries. We'll cover the two most common approaches.

If you're using...Use This MethodExamples
A newer enterprise or desktop distributionThe BLS Method (Boot Loader Specification)Oracle Linux, RHEL 8+, Fedora, CentOS 7+
A traditional or older systemThe Traditional MethodUbuntu, Debian, Pop!_OS, Linux Mint

Step 3: Fix Your Boot Order (The BLS Method)

The BLS method is the modern and robust way to set the default kernel. It works by using the kernel's unique name rather than a potentially changing index number.

A. Find the Kernel's Configuration File

The bootloader configuration files are located in /boot/loader/entries/. You need to find the file that corresponds to your working kernel.

Open a terminal and run this command:

Bash
ls -l /boot/loader/entries/

This will list files with long names like b26b3848149e4d0cb5a90d40523f46f4-5.14.0-570.41.1.0.1.el9_6.x86_64.conf. Find the one that matches the version number of your working kernel.

B. Set the Default Flag

Use the grub2-set-bootflag command, providing the full filename of your working kernel's configuration file (without the .conf extension).

Bash
sudo grub2-set-bootflag default <Kernel_Filename_Base>

Example:

Bash
sudo grub2-set-bootflag default b26b3848149e4d0cb5a90d40523f46f4-5.14.0-570.41.1.0.1.el9_6.x86_64

This command permanently updates your system's boot configuration to favor the stable kernel.


Step 4: Fix Your Boot Order (The Traditional Method)

If you're on a distribution that doesn't use the BLS method (like Ubuntu), you'll likely use the grub-set-default command.

  1. Use grub-set-default:

    Use the index number of the working kernel you noted in Step 1.

    Bash
    sudo grub-set-default <Index_Number>
    

    Example: sudo grub-set-default 2

  2. Manually Edit (If grub-set-default fails):

    If the command doesn't work, you can edit the main GRUB configuration file.

    Bash
    sudo nano /etc/default/grub
    

    Find the line GRUB_DEFAULT=... and change it to the index number of your working kernel.

    # Change this line:
    GRUB_DEFAULT=saved
    # TO this line:
    GRUB_DEFAULT=2
    

    Finally, you must update the GRUB configuration to apply your changes:

    • For Ubuntu/Debian: sudo update-grub

    • For RHEL/Fedora/Oracle: sudo grub2-mkconfig -o /boot/grub2/grub.cfg


Step 5: Reboot and Enjoy!

After running the correct command for your system, reboot. You'll find that your computer now automatically boots into the stable, working kernel without any further issues.

You can safely keep the problematic kernel installed and simply wait for a future update from your distribution. Often, a subsequent version will contain the necessary fixes for the bug that was causing your problem.


If problem still persist you can try following:

Based on the grub2-mkconfig and cat /boot/grub2/grub.cfg output you provided, the GRUB configuration is set up to use the Boot Loader Specification (BLS). This is the modern and recommended approach for managing boot entries on many Linux distributions, including RHEL, CentOS Stream, and Fedora.

The key line that confirms this is blscfg within the 10_linux section of the grub.cfg file. This command instructs GRUB to read boot entries from the BLS files located in /boot/loader/entries/, instead of hard-coding them directly into grub.cfg.


How BLS Works

Instead of a single, monolithic grub.cfg file, the Boot Loader Specification uses individual .conf files for each bootable kernel or operating system. These files are typically stored in the /boot/loader/entries/ directory.

  • File Naming: Each file is named using a unique identifier, usually in the format <machine-id>-<kernel-version>.conf.

  • File Content: Each .conf file contains a simple key-value pair for the kernel's title, version, command-line arguments, and initial ramdisk.

This design makes it easier to manage boot entries because:

  1. Atomicity: Installing or removing a kernel simply involves adding or removing a single file. You don't need to regenerate the entire grub.cfg.

  2. Centralized Control: The /etc/default/grub file and the grub2-mkconfig tool are still used to set global GRUB options (like GRUB_DEFAULT, GRUB_TIMEOUT), but the individual boot entries are managed separately.


Implications for Your System

Since your system is using the Boot Loader Specification, you should not manually edit the grub.cfg file. Instead, you need to use the grubby tool to manage your default boot entry.

  • To list the available boot entries:

    Bash
    sudo grubby --info=ALL
    
  • To set a new default boot entry:

    Bash
    sudo grubby --set-default /boot/vmlinuz-<your-new-kernel-version>
    
  • Example: To set the kernel with the ID ba1effc5dd9e4578a78c5f9730dba361-5.14.0-570.41.1.0.1.el9_6.x86_64.conf as the default, you would use a command similar to:

    Bash
    sudo grubby --set-default-index=1 
    

    or, more specifically, using the kernel's path:

    Bash
    sudo grubby --set-default /boot/vmlinuz-5.14.0-570.41.1.0.1.el9_6.x86_64
    

Using grubby is the correct and supported method for managing GRUB boot entries on your system. It automatically updates the necessary BLS files and the GRUB environment.

Tuesday, January 7, 2025

H5P in your lessons

This is custom h5p content created with lumi from portal https://app.lumi.education/


Sunday, January 7, 2024

Setup MAMP (Mac Apache MySQL/MySQL DB PHP) on Mac OS Sonoma on Macbook (Silicon Chip)

Introduction

Apple MacBook has gained popularity among developers in recent past. Many young developers are switching to Mac from Windows and Linux Environment. This article is an guide for developers who recently switched from differnet environment (specially Linux) to help them set up local MAMP (MacOS Apache MySQL PHP/Perl/Python) Environment

Friday, January 5, 2024

Setup inbuilt Apache in MacOS Sonoma

Setting Up a Web Development Environment on Mac

Many developers use Macs for web development. I myself have seen several tutorials where the trainer used an Apple system for training, but when I bought a MacBook, I found it a bit difficult to set up the environment. I believe that many new developers face such issues, so I decided to write this tutorial to help them. I had been using Linux (mostly Ubuntu/Linux Mint) for quite some time prior to switching to Mac.


Set Up Web Server (Apache)

Apache is the most popular web server, and the good news is that macOS comes pre-installed with Apache and you just need to start the web services. Run the following command to start Apache:

sudo apachectl start

To test if Apache is working, just open your favorite web browser and type "localhost" on its address bar. If you see the page as follows, your web server is working perfectly.


For those who are familiar with Apache, I would like to inform you that Apache2 is installed at /etc/apache2 and the default document root is /Library/WebServer/Documents.

The document root is the location where you need to save all your files that you want to share through the web server. Please be noted that when you save any file at the default document root, you may need to give additional permissions so that they can be served through the web server. The easier method is to set up a folder in your home directory (i.e., /users/<yourUserName>). I have created a folder named "Web" for this purpose in my home directory.

So, if you want to change the default document root, you need to edit /etc/apache/httpd.conf (you will require to open Macintosh HD and navigate to the "etc" folder. If the folder is not visible, press Command + Shift + . (period) to display hidden files). Then open httpd.conf in your favorite text editor (many blogs recommend VI or nano, so if you are comfortable with these tools or like working with the terminal, that will also do).

Locate "DocumentRoot" (in my case, it was on line No. 255) and change the folder from /Library/WebServer/Documents to the directory you created in your home directory (in my case, it was /Users/isthakur/Web). 

Now you need to give permission to the Apache web server to access this folder, so run the following command on your home directory:

chmod +a "_www allow execute" ~

...followed by the command:

sudo apachectl restart

Create an HTML file named index.html in your selected folder and test by opening "localhost" in your favorite web browser. The output in my case is as follows:



We have successfully configured Apache on Mac. Wish you all the success!


Important Notes

The in-built Apache server works perfectly fine if you do not intend to use PHP. But if you plan to develop using PHP as a server-side language, you must know that macOS deprecated PHP and stopped supporting it implicitly since macOS Monterey. So if you are a PHP lover like me, you must stop the in-built Apache.

Note:

  • Show Hidden Files: Click the Finder icon in your dock to open Finder. Navigate to the folder where you want to find hidden files. Press Command + Shift + . (the period key). This will show hidden files in the folder.

  • Show Macintosh HD: It's really easy to show the hard drive on your Desktop Mac. Open the Finder and select the main Finder menu. Then, click Settings. Under the "General" tab, under the "Show these items on the Desktop" section, ensure "Hard disks" is selected.

Wednesday, August 30, 2023

Dear Sister, Thankyou for being in my life


 

Dear Sister,

As Rakshabandhan dawns upon us once again, my heart swells with a flood of memories, and I find myself traversing the corridors of time back to our cherished childhood. From the days of innocence when we shared our dreams under the same roof to the moments that have woven the tapestry of our lives, you have been a constant source of love, support, and unwavering companionship.

Do you remember those carefree summer afternoons when we used to chase butterflies in the garden? The laughter that echoed through the house as we concocted imaginative tales, and the secret hideouts we built together, they are all etched in my heart. Each thread of these memories forms a bond that time cannot fade.

From sharing our tiffin boxes at school to facing the world's challenges side by side, you've been more than a sister; you've been a confidante, a partner in crime, and my pillar of strength. Through all the ups and downs, your unwavering belief in me has lifted me up even in my darkest hours. Your unconditional love has been my guiding light.

As I stand at this juncture of life, I am filled with gratitude for every single precious moment we've shared. The late-night conversations, the giggles over silly jokes, and even the occasional squabbles have shaped our relationship into an unbreakable bond. Your presence has been a blessing, a constant reminder that no matter how rough the seas of life get, there's a safe harbor in your embrace.

On this Rakshabandhan, I want to express my heartfelt gratitude to you, dear sister. Thank you for being the most wonderful part of my life's journey. Thank you for believing in me when I had doubts, for cheering me on when I needed courage, and for holding my hand when I faltered. You are not just a sister, but a treasure I hold dearer than life itself.

As we tie another rakhi this year, let it symbolize the unbreakable bond that time and distance cannot diminish. Let it remind us of the love, care, and affection we've shared, and the promise to continue walking this beautiful journey hand in hand.

Happy Rakshabandhan, dear sister. May our bond continue to shine as a beacon of love and companionship.

With all my love,

Inder Singh Thakur

Monday, August 14, 2023

Irony of Indian Education System

The Irony of India's Education System

This article critically analyzes the Indian education system, arguing that despite its large and well-defined structure, it falls short in providing quality education that truly prepares students for the professional world. The author highlights several key flaws:

  • Rote Learning Over Understanding: The system rewards students who memorize facts over those who genuinely understand concepts, as exemplified by a scene from the movie "3 Idiots."

  • Outdated Curriculum: The syllabus is slow to be updated, resulting in students learning obsolete information that is no longer relevant in today's world.

  • Flawed Evaluation: The examination system primarily tests a student's ability to recall information rather than their analytical and problem-solving skills, leading to a generation of "qualified" but unemployed youth.

  • Call for Change: The author concludes that while systemic changes are needed, teachers and students can make a difference by prioritizing understanding and application of concepts over simple memorization.

भारतीय शिक्षा प्रणाली की विडंबना

भारत में प्राचीन काल में, छात्र गुरुकुलों में जाते थे जहां वे अपने शिक्षकों (गुरु) के साथ रहते थे और अध्ययन करते थे। शिक्षक उन्हें सबक देते हैं और काम का अभ्यास करते हैं। घर-काम की कोई अवधारणा नहीं थी। छात्रों को अपनी पाठ्य पुस्तकों में कुछ लिखने की आवश्यकता नहीं है, बल्कि उन्हें अवधारणा को समझना और याद रखना था। हम अपनी होली की किताबों और पवित्र साहित्य में अनगिनत संदर्भ पा सकते हैं, जो कहते हैं कि छात्र शिक्षा की अवधि के लिए शिक्षक के साथ रहे। समय बीतने के साथ, हमारी शिक्षा प्रणाली ने गुरुकुलों को विद्यालयों (स्कूल), महाविद्यालय (कॉलेज) और विश्वविद्यालय (विश्वविद्यालय) में परिवर्तित कर दिया।

How to Fix a Linux Kernel Freeze on Boot

How to Fix a Linux Kernel Freeze on Boot: A Universal Guide Have you ever installed a new Linux update, only for your system to freeze right...