Grub Entries cleanup and maintenance



  • As I continue to try and learn more, how critical is it to cleanup existing grub entries on any given linux system.

    As I understand it grubby should keep some historical records if issues are encountered. But how many records are to many, and do you clean them up manually?

    If so how do you cleanup grub, and why isn't this a relatively automatic feature or setting?



  • @DustinB3403 You never touch grub yourself. You let the system take care of it for you when it adds or removes kernels.

    As to removing old kernels, it depends on the distribution you use. A good distro just takes care of this for you. The annoying ones make you do it manually.

    RedHat/CentOS/Fedora = automatically cleans up older kernels. You don't do anything and it will keep a sane number by default. I think it's 4 and a recovery option.

    Debian/Ubuntu = keeps all kernels till you manually remove them. I forget offhand what the command is besides it's an option for apt.

    This is one reason I'm happily moving things from the old rental box to my new server for my home lab. The old rental box has Ubuntu with a tiny little 256MB /boot partition. It can keep ~3 kernels, and that's it, ugh!



  • @travisdh1 said in Grub Entries cleanup and maintenance:

    @DustinB3403 You never touch grub yourself. You let the system take care of it for you when it adds or removes kernels.

    As to removing old kernels, it depends on the distribution you use. A good distro just takes care of this for you. The annoying ones make you do it manually.

    RedHat/CentOS/Fedora = automatically cleans up older kernels. You don't do anything and it will keep a sane number by default. I think it's 4 and a recovery option.

    Debian/Ubuntu = keeps all kernels till you manually remove them. I forget offhand what the command is besides it's an option for apt.

    This is one reason I'm happily moving things from the old rental box to my new server for my home lab. The old rental box has Ubuntu with a tiny little 256MB /boot partition. It can keep ~3 kernels, and that's it, ugh!

    How many entries are you seeing? Like @travisdh1 said, it's not something that you should be messing with by hand. You do want to keep an eye on usage of the partition where your /boot resides. If it gets too full you're in for some fun trying to clear kernels by hand, hoping that everything still works afterwards



  • @notverypunny not many 2 and a recovery.

    But I have seen many more on past systems so I wanted to take a look into it. To see if this is/was something most people are managing manually.



  • @DustinB3403 said in Grub Entries cleanup and maintenance:

    @notverypunny not many 2 and a recovery.

    But I have seen many more on past systems so I wanted to take a look into it. To see if this is/was something most people are managing manually.

    Do you have an Ubuntu system that has been around a while? Look at one of those and you'll see one reason why me and @JaredBusch actively hate Ubuntu.



  • @travisdh1 said in Grub Entries cleanup and maintenance:

    @DustinB3403 said in Grub Entries cleanup and maintenance:

    @notverypunny not many 2 and a recovery.

    But I have seen many more on past systems so I wanted to take a look into it. To see if this is/was something most people are managing manually.

    Do you have an Ubuntu system that has been around a while? Look at one of those and you'll see one reason why me and @JaredBusch actively hate Ubuntu.

    No I don't have any remaining systems of importance that I've seen this on. Just from recollection did this come to mind.



  • @DustinB3403 said in Grub Entries cleanup and maintenance:

    @travisdh1 said in Grub Entries cleanup and maintenance:

    @DustinB3403 said in Grub Entries cleanup and maintenance:

    @notverypunny not many 2 and a recovery.

    But I have seen many more on past systems so I wanted to take a look into it. To see if this is/was something most people are managing manually.

    Do you have an Ubuntu system that has been around a while? Look at one of those and you'll see one reason why me and @JaredBusch actively hate Ubuntu.

    No I don't have any remaining systems of importance that I've seen this on. Just from recollection did this come to mind.

    Lucky



  • @travisdh1 said in Grub Entries cleanup and maintenance:

    @DustinB3403 said in Grub Entries cleanup and maintenance:

    @travisdh1 said in Grub Entries cleanup and maintenance:

    @DustinB3403 said in Grub Entries cleanup and maintenance:

    @notverypunny not many 2 and a recovery.

    But I have seen many more on past systems so I wanted to take a look into it. To see if this is/was something most people are managing manually.

    Do you have an Ubuntu system that has been around a while? Look at one of those and you'll see one reason why me and @JaredBusch actively hate Ubuntu.

    No I don't have any remaining systems of importance that I've seen this on. Just from recollection did this come to mind.

    Lucky

    I've got XOCE in my lab, but that's not critical to my day to day.



  • @travisdh1 said in Grub Entries cleanup and maintenance:

    @DustinB3403 You never touch grub yourself. You let the system take care of it for you when it adds or removes kernels.

    As to removing old kernels, it depends on the distribution you use. A good distro just takes care of this for you. The annoying ones make you do it manually.

    RedHat/CentOS/Fedora = automatically cleans up older kernels. You don't do anything and it will keep a sane number by default. I think it's 4 and a recovery option.

    Debian/Ubuntu = keeps all kernels till you manually remove them. I forget offhand what the command is besides it's an option for apt.

    This is one reason I'm happily moving things from the old rental box to my new server for my home lab. The old rental box has Ubuntu with a tiny little 256MB /boot partition. It can keep ~3 kernels, and that's it, ugh!

    For Debian/Ubuntu it is

    sudo apt-get autoremove --purge
    

    But that should happen when you do update as you don't want an old lingering kernel to cause trouble...



  • @dbeato said in Grub Entries cleanup and maintenance:

    @travisdh1 said in Grub Entries cleanup and maintenance:

    @DustinB3403 You never touch grub yourself. You let the system take care of it for you when it adds or removes kernels.

    As to removing old kernels, it depends on the distribution you use. A good distro just takes care of this for you. The annoying ones make you do it manually.

    RedHat/CentOS/Fedora = automatically cleans up older kernels. You don't do anything and it will keep a sane number by default. I think it's 4 and a recovery option.

    Debian/Ubuntu = keeps all kernels till you manually remove them. I forget offhand what the command is besides it's an option for apt.

    This is one reason I'm happily moving things from the old rental box to my new server for my home lab. The old rental box has Ubuntu with a tiny little 256MB /boot partition. It can keep ~3 kernels, and that's it, ugh!

    For Debian/Ubuntu it is

    sudo apt-get autoremove --purge
    

    But that should happen when you do update as you don't want an old lingering kernel to cause trouble...

    More here
    https://help.ubuntu.com/community/RemoveOldKernels



  • @dbeato said in Grub Entries cleanup and maintenance:

    @travisdh1 said in Grub Entries cleanup and maintenance:

    @DustinB3403 You never touch grub yourself. You let the system take care of it for you when it adds or removes kernels.

    As to removing old kernels, it depends on the distribution you use. A good distro just takes care of this for you. The annoying ones make you do it manually.

    RedHat/CentOS/Fedora = automatically cleans up older kernels. You don't do anything and it will keep a sane number by default. I think it's 4 and a recovery option.

    Debian/Ubuntu = keeps all kernels till you manually remove them. I forget offhand what the command is besides it's an option for apt.

    This is one reason I'm happily moving things from the old rental box to my new server for my home lab. The old rental box has Ubuntu with a tiny little 256MB /boot partition. It can keep ~3 kernels, and that's it, ugh!

    For Debian/Ubuntu it is

    sudo apt-get autoremove --purge
    

    But that should happen when you do update as you don't want an old lingering kernel to cause trouble...

    Should happen, and does happen, are two different things in Ubuntu.



  • @dbeato said in Grub Entries cleanup and maintenance:

    @dbeato said in Grub Entries cleanup and maintenance:

    @travisdh1 said in Grub Entries cleanup and maintenance:

    @DustinB3403 You never touch grub yourself. You let the system take care of it for you when it adds or removes kernels.

    As to removing old kernels, it depends on the distribution you use. A good distro just takes care of this for you. The annoying ones make you do it manually.

    RedHat/CentOS/Fedora = automatically cleans up older kernels. You don't do anything and it will keep a sane number by default. I think it's 4 and a recovery option.

    Debian/Ubuntu = keeps all kernels till you manually remove them. I forget offhand what the command is besides it's an option for apt.

    This is one reason I'm happily moving things from the old rental box to my new server for my home lab. The old rental box has Ubuntu with a tiny little 256MB /boot partition. It can keep ~3 kernels, and that's it, ugh!

    For Debian/Ubuntu it is

    sudo apt-get autoremove --purge
    

    But that should happen when you do update as you don't want an old lingering kernel to cause trouble...

    More here
    https://help.ubuntu.com/community/RemoveOldKernels

    It only works if we set up unattended upgrade to remove old kernels.



  • @black3dynamite said in Grub Entries cleanup and maintenance:

    @dbeato said in Grub Entries cleanup and maintenance:

    @dbeato said in Grub Entries cleanup and maintenance:

    @travisdh1 said in Grub Entries cleanup and maintenance:

    @DustinB3403 You never touch grub yourself. You let the system take care of it for you when it adds or removes kernels.

    As to removing old kernels, it depends on the distribution you use. A good distro just takes care of this for you. The annoying ones make you do it manually.

    RedHat/CentOS/Fedora = automatically cleans up older kernels. You don't do anything and it will keep a sane number by default. I think it's 4 and a recovery option.

    Debian/Ubuntu = keeps all kernels till you manually remove them. I forget offhand what the command is besides it's an option for apt.

    This is one reason I'm happily moving things from the old rental box to my new server for my home lab. The old rental box has Ubuntu with a tiny little 256MB /boot partition. It can keep ~3 kernels, and that's it, ugh!

    For Debian/Ubuntu it is

    sudo apt-get autoremove --purge
    

    But that should happen when you do update as you don't want an old lingering kernel to cause trouble...

    More here
    https://help.ubuntu.com/community/RemoveOldKernels

    It only works if we set up unattended upgrade to remove old kernels.

    Correct



  • OMG, so this.. If using unattended upgrades, make sure autoremove is configured properly.
    I had a box take a dump because it ran out of space in /boot with a ridiculous number of old kernels installed.
    Trying to run autoremove failed because it requires some space to do its work.

    Had to manually remove a bunch of files before autoremove could run...



  • @travisdh1 said in Grub Entries cleanup and maintenance:

    @DustinB3403 You never touch grub yourself. You let the system take care of it for you when it adds or removes kernels.

    As to removing old kernels, it depends on the distribution you use. A good distro just takes care of this for you. The annoying ones make you do it manually.

    RedHat/CentOS/Fedora = automatically cleans up older kernels. You don't do anything and it will keep a sane number by default. I think it's 4 and a recovery option.

    Debian/Ubuntu = keeps all kernels till you manually remove them. I forget offhand what the command is besides it's an option for apt.

    This is one reason I'm happily moving things from the old rental box to my new server for my home lab. The old rental box has Ubuntu with a tiny little 256MB /boot partition. It can keep ~3 kernels, and that's it, ugh!

    You can install without /boot. IIRC there is a other config change with unattended-upgrades to auto remove kernels.



  • @stacksofplates said in Grub Entries cleanup and maintenance:

    @travisdh1 said in Grub Entries cleanup and maintenance:

    @DustinB3403 You never touch grub yourself. You let the system take care of it for you when it adds or removes kernels.

    As to removing old kernels, it depends on the distribution you use. A good distro just takes care of this for you. The annoying ones make you do it manually.

    RedHat/CentOS/Fedora = automatically cleans up older kernels. You don't do anything and it will keep a sane number by default. I think it's 4 and a recovery option.

    Debian/Ubuntu = keeps all kernels till you manually remove them. I forget offhand what the command is besides it's an option for apt.

    This is one reason I'm happily moving things from the old rental box to my new server for my home lab. The old rental box has Ubuntu with a tiny little 256MB /boot partition. It can keep ~3 kernels, and that's it, ugh!

    You can install without /boot. IIRC there is a other config change with unattended-upgrades to auto remove kernels.

    You normally can, yes. Since my current home lab box is a rental, I could only choose from the options they gave me at the time. Today, they'd let you use your own iso, but still wouldn't recommend them for anything other than a test lab.