Skip to main content

Loading Linux from GRUB Command Line

 GRUB (GRand Unified Bootloader) is a powerful boot loader that is used by many Linux distributions. GRUB allows you to manually load and boot kernels, initrd files, and other operating system components. This can be useful for troubleshooting boot problems or for booting into a custom or recovery environment.

Loading the Linux Kernel

To load the Linux kernel from the GRUB command line, use the following command:

linux /boot/vmlinuz

Replace /boot/vmlinuz with the actual path to the Linux kernel on your system. You can use ls command to display files in current folder or use tab to list items matching the partically typed name (if it exists).

Loading the Initrd File

The initrd file is a compressed file system that contains the initial RAM disk image. The initrd file is used to load the necessary drivers and modules before the root file system is mounted.

To load the initrd file, use the following command:

initrd /boot/initrd.img

Replace /boot/initrd.img with the actual path to the initrd file on your system.

Booting the Loaded Kernel

Once you have loaded the Linux kernel and initrd file, you can boot the loaded kernel by entering the following command:

boot

Example

Here is an example of how to load the Linux kernel and initrd file from the GRUB command line and boot the loaded kernel:

linux /boot/vmlinuz initrd /boot/initrd.img boot

Additional Options

You can also specify additional options when loading the Linux kernel. For example, you can specify the root device, the kernel parameters, and the initrd file to use.

To specify the root device, use the root= parameter. For example, to specify that the root device is /dev/sda1, you would use the following command:

linux /boot/vmlinuz root=/dev/sda1

To specify the kernel parameters, use the append= parameter. For example, to specify that the kernel should use the "quiet" boot option, you would use the following command:

linux /boot/vmlinuz append=quiet

To specify the initrd file to use, use the initrd= parameter. For example, to specify that the initrd file is /boot/my-initrd.img, you would use the following command:

linux /boot/vmlinuz initrd=/boot/my-initrd.img

Conclusion

Loading Linux from the GRUB command line can be a useful troubleshooting technique or for booting into a custom or recovery environment. By following the steps outlined in this post, you can gain more control over the boot process and resolve boot problems more effectively.

Comments

Archive

Show more

Topics

Show more