HOWMANY for Grub 2

One of the things lost in moving to Grub2 is the lack of the #HOWMANY option to limit the number of Kernels presented in the Grub Menu.  This was a great option especially if you dual boot otherwise every time a new Kernel is installed the Grub menu gets longer, and your default system does not load (as the default number is not updated).

Ages ago I found this item which fixes the problem.  It is a bit complex for a new user and that is a shame.  It also breaks when GRUB is updated (although I leave Grub alone when it asks).

To simplify things, you need to replace this line;

while [ "x$list" != "x" ] ; do

with these lines…..

found="0";
 
if [ "x${GRUB_HOWMANY}" = "x" ] || ! [ "x`echo ${GRUB_HOWMANY} | sed 's/^[0-9]\+\(\.[0-9]\+\)\?$//'`" = "x" ] ;then
	GRUB_HOWMANY=0
fi
 
while ( [ "x$list" != "x" ] && ( [ "${GRUB_HOWMANY}" -eq "0" ] || [ "$found" -lt "${GRUB_HOWMANY}" ] )); do
  found=$((found + 1));

Grub really need to reimplement the #HOWMANY option and provide a simple GUI to set it. Still this solution works for me and if you have the same issues it may work for you too.

This entry was posted in Computer, Ubuntu and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *