Page 1 of 1

delete Grub title

Posted: 2020/12/31 04:45:05
by hachouri
Hello,
Is there a way using sed command to delete all menuentry title in grub.
the section should be
menuentry title OS version ...
{
kernel and initial ramdisk parameter line1
kernel and initial ramdisk parameter line2
...
}

I want to delete the line menuentry and what is after between the brackets

Re: delete Grub title

Posted: 2020/12/31 14:12:47
by TrevorH
This sounds like an XY question. What do you really want to do and why?

Re: delete Grub title

Posted: 2021/01/06 06:12:39
by hachouri
I want to delete all existing entries then use the command new-kernel-pkg to make custom titles with only the latest kernel. deleting manually the entries works but I want something to use in a scripts

Re: delete Grub title

Posted: 2021/01/06 09:51:16
by jlehtone
Installation of a new kernel creates a menuentry for it.
Removal of (unused) kernel package removes its menuentry too.

It is usually safer to have at least two kernels installed, should one of them become unbootable.

Re: delete Grub title

Posted: 2021/01/06 10:15:05
by hachouri
I'll not remove the kernel I just want to remove the menuentry section in the grub and add custom section

Re: delete Grub title

Posted: 2021/01/06 10:43:48
by TrevorH
What you're intending to do will probably break future kernel updates as it will attempt to modify the file to remove old kernels that are about to be removed (and won't exist in the file so at a minimum it's going to produce an error message which may be purely cosmetic or it may break). Any new kernels will be added with a similar title and will probably undo the things you just did.