grub : how to edit grub config by command / script ?

Chris Murphy lists at
Thu Nov 27 06:12:46 UTC 2014

On Wed, Nov 26, 2014 at 1:40 PM, santosh <santosh.iitg at> wrote:
> I am using CentOS 6 and grub 0.97
> 1.  Launched a Virtual Machine (VM) with CentOS 6.   (This step is done.)
> 2.  After the VM comes up,  copy latest kernel and initrd from remote
> server to /boot
>      through a script present at /etc/init.d/ (This step is done)
> 3.  How to edit grub config file either by command or by script (but
> not manually), to update
>      the new kernel and initrd so that next time it boots up with the
> new kernel  ?

Put the kernel and kernel-modules rpms in a directory, cd to that
directory, then

# yum install *rpm

The post-install scripts will call grubby which will insert the proper
GRUB menu entry.

FWIW, there is no GRUB legacy equivalent for GRUB2's grub-mkconfig
command so there isn't a way to generate a new one from scratch.

Chris Murphy

More information about the users mailing list