Grub cleaner

Forum tags: 

Hi to everybody! :)

I started tu use Bleachbit on my Debian Wheezy, after it I updated system to Jessie and now I'm on stretch.

I used always grub boot manager but I have in grub.cfg all my past kernel menu' entry like what you can read below:

menuentry 'Debian GNU/Linux, con Linux 3.16.0-4-686-pae'$
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio;$
insmod part_msdos
insmod ext2

I didn't find a cleaner about grub and its old kernel versions, it could be a good idea to clean it and also to clean old kernel images like you can see below:

root@server01:/lib/modules# ls
3.16.0-4-686-pae 3.2.0-4-686-pae 4.8.0-1-686-pae

When I'm sure last kernel is ok I can remove all old images.


I am not familiar with Debian itself, but on Ubuntu doesn't sudo apt autoremove remove these? BleachBit has an apt clean.

Andrew, lead developer

Thanks for your reply, usually I did "aptitude autoclean" and it works after packet updates but in grub.cfg I have, like what I wrote above, text lines of old kernels.

Old kernel lines start with "} menuentry 'Debian GNU/Linux, with Linux 3.16.0-4-686 and it start..." and end with "initrd /initrd.img-3.16.0-4-686-pae }"

Ok this file is not heavy about dimension but it could be nice to have a grub.cfg without old kernel lines, how could I make a own bleachbit cleaner?

Maybe it could be also a grub utility to clean it... I don't know...


The simpler BleachBit cleaners are written in CleanerML, while more sophisticated cleaners require Python coding (example for journald).

Andrew, lead developer

I found a solution about how to clean grub and old kernels:

Maybe I could make a script for Bleachbit from the page above.