How to Boot Linux from GRUB Command Line

Posted on

The article written as a media to describe an experience acquired through an accident happened editing grub file configuration named menu.lst located in ‘/boot/grub’ which exist in a Linux based operating system. The operating system’sĀ distribution is Linux Slacko-6.3.2.

After editing the file and restarting the operating system, it is suddenly failed on entering the operating system itself, for an example activating the XWindow. There is an error caused by previously editing menu.lst which in the end preventing the whole operating system to be booted.

So, in order to be able to boot the operating system, it needs to be manually booted. For the operating system itself to be manually booted, it can be done by accessing GRUB command console or prompt.

There are several steps which is needed for an operating system can be manually booted using a several command executed via GRUB command console.

1. Identify and notify through a command which is precisely inform the location of the root partition using the following command :

root device_type(device_number,partition_number)

Description : 
root : It is a label definition, reserved definition or a command for defining the root partition
device_type : It is for indicating device type
device_number : It is for indicating device number
partition_number : It is for indicating partition number

For an example, below is the command executed to give further explanation :

grub> root hd(0,0)

Notify or define that the root partition exist in hd device type in the first device specifically in the first partition.

2. Identify and notify the location of the kernel which is going to be loaded in the boot process.

kernel [device_type(device_number,partition_number)]/path/to/kernel/file

Description : 
kernel : It is a label definition, reserved keyword or command indicating on defining kernel which is specifically the kernel location
device_type : It is for indicating device type 
device_number : It is for indicating device number 
partition_number : It is for indicating partition number
/path/to/kernel/file : It is the location which is specifying kernel file 

*[device_type(device_number,partition_number)] : It is actually enclosed with a bracket means optional, other reference just point out that it can be executed without having to specify the physical device since it might has already been mounted or identified. In case the kernel definition fail to load the kernel, just add the physical device information before specifying the kernel path location. 

In the above syntax pattern command, it can be actually defined as :

kernel </path/to/kernel> <option-1> <option-N>

It specifies the kernel file to load when booting the operating system. Replace </path/to/kernel> where the /path/to/kernel/file above isĀ  an absolute path from the partition specified by the root directive to the kernel file. As shown in the above part of kernel definition :

<option-1> <option-N>

It is actually considered as multiple options that can be passed to the kernel when it is loaded. Below is an example to show how to define it :

grub> kernel hd(0,0)/boot/vmlinuz
  1. The last step is to just type ‘boot’ so that the process of mounting the root partitioni and loading the kernel file will be initialized as follows :
grub> boot

The above steps are actually can be performed or executed in other different Linux operating system distribution. Maybe there are some syntax pattern which is different from one another or there is another command which must be executed in order the boot process to start successfully but in the end the above steps are giving rough detail process on how to do it.

2 thoughts on “How to Boot Linux from GRUB Command Line

Leave a Reply