Announcement

Collapse
No announcement yet.

How to keep a few kernels for back up purposes?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Qqmike
    replied
    Thanks, kubicle. I made that correction in the link and the post above (and in my notes ;-) ).

    Leave a comment:


  • kubicle
    replied
    Originally posted by Qqmike View Post
    sudo apt-get autoclean This will eliminate any old files (Including kernel versions) you may have. Note that if you have many old versions, it will take a while since it has to make sure that removing the kernel version has no issues. You can also do the following:
    I may have misunderstood what you meant, but that's not really a completely accurate description of what autoclean does.
    autoclean is just a "softer" version of 'clean', removing old packages from the download cache, keeping still available packages in cache (while 'clean' removes everything in the cache, including currently available packages)...autoclean does not uninstall anything, nor does it check for any issues.
    Last edited by kubicle; Dec 07, 2020, 12:24 PM.

    Leave a comment:


  • Qqmike
    replied
    I'm gonna post it here, too.

    From various previous discussions of this subject, I copied-saved these notes on manually cleaning old kernels. Sorry, I don't have time to clean it up at the moment, but I think it's in pretty decent shape as is (fwiw, this is what I do -- I simply use Muon as described here):

    Removing old kernels

    Every kernel has four packages (kernel 3.5.0-15 is shown as an example); and these are the files (for old kernels) that you want to remove:

    linux-headers-3.5.0-15 (header files)
    linux-headers-3.5.0-15-generic (additional headers depending on kernel type)
    linux-image-3.5.0-15-generic (kernel image) <-- Important
    linux-image-extra-3.5.0-15-generic (extra image)

    Once you have installed a new kernel and booted into it to see that it's working properly, you can remove all packages related to older kernels - generally around 220 MB for all packages together per kernel. However, you may want to keep the kernel version previous to the newest (that you are using now) so you have a backup option should something go wrong with the current (newest) kernel.

    In Muon (or Synaptic), you can enter in the search box:

    linux-image
    linux-headers
    Or, try this:
    Simply enter the kernel version number; for example, enter
    3.13.0
    and the headers and image files should come up.

    You can now uninstall all packages except those four for the latest kernel (and maybe the four files for the previous kernel, if you want a backup option).

    Un-installing
    Some users here (e.g., vinny and I) recommend you use the "purge" option (in Muon, for example), to remove these files.

    Someone else said:
    > Remove the linux-image-VERSION-generic packages and it will also remove the modules for you.

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    re commands, I have this:

    Remove old kernels -- using apt-get
    Do the following if you wish to remove all older kernel versions that are not in use (except the previous one that you are not using. This is to make sure that if the current kernel version fails in some way, you have a way to go back to a previous state). Do the following:
    Code:
    sudo apt-get autoclean
    (Correction: kubicle): autoclean is just a "softer" version of 'clean', removing old packages from the download cache, keeping still available packages in cache (while 'clean' removes everything in the cache, including currently available packages)...autoclean does not uninstall anything, nor does it check for any issues.)
    You can also do the following:
    Code:
    sudo apt-get clean Which will eliminate everything downloaded and stored in the cache folder of apt. Lastly you have:

    Code:
    sudo apt-get autoremove which would check for any unused packages and remove them if necessary. This is great for those libraries and dependency packages that are no longer needed by any app installed.
    Last edited by Qqmike; Dec 07, 2020, 02:48 PM.

    Leave a comment:


  • Qqmike
    replied
    fhins, you can check another thread on this issue ... Go to my post here, I tell you how I do this (manually), Post #12, fwiw; and you can read other posts about it:
    https://www.kubuntuforums.net/showth...615#post440615

    Leave a comment:


  • jglen490
    replied
    I've used autoremove for a long time. I DO NOT install kernels outside of what is offered in the usual update process. Autoremove leaves the most current kernel, plus the next older kernel. Assuming that the "next older" kernel worked when it was #1, you will always have a drop back point.

    If you are one who experiments with kernels, then autoremove is likely not for you.

    Leave a comment:


  • jlittle
    replied
    Originally posted by fhins View Post
    I guess I didn't clarify well. Let say you have 6 kernels installed over time, and you just want to keep the last 3, but remove the older ones. How do you do that?
    You don't have to run apt autoremove. If you want to keep, say, the last 5 kernels, you can manually remove the 6th oldest. Using muon or synaptic you can easily search for the kernel version number and remove them that way.

    If you do adopt this approach, old, non-kernel stuff could accumulate; probably not a problem and won't be much unless you do a lot of removing packages, but you can do an autoremove dry run to see what it would remove and manually remove it.

    Leave a comment:


  • fhins
    replied
    Thanks for the info.

    Leave a comment:


  • claydoh
    replied
    Running sudo apt autoremove --purge will remove all the old ones, except your current kernel and the last kernel.
    This is a long standing setup in *buntu. There are apt configs and rules that are specifically set up to keep them, which iirc are updated with each new kernel.
    That's how it is supposed to work, at least. Has for me, for many years. Well, four, as it was initially set up previous to 16.04

    I don't see how to set it to three, the configs are all Greek to me atm, and possibly any settings edits may get overridden with each new update.





    Do note that kernels NOT automatically installed by updates, ie things installed manually, such as mainline kernels, or other custom third party builds, are NOT auto-removed.
    Last edited by claydoh; Dec 06, 2020, 06:13 PM.

    Leave a comment:


  • fhins
    replied
    I guess I didn't clarify well. Let say you have 6 kernels installed over time, and you just want to keep the last 3, but remove the older ones. How do you do that?

    Leave a comment:


  • claydoh
    replied
    Autoremove should be keeping your current kernel, and the previous one, uninstalling the rest.
    This has no relation to your grub timeout.
    You usually see them under the 'Advanced' option. if you don't want to change the grub timeout, hit the esc key repeatedly just after the bios splash to get the menu if you don't see it.

    Leave a comment:


  • fhins
    started a topic How to keep a few kernels for back up purposes?

    How to keep a few kernels for back up purposes?

    I just installed Kubuntu 20.04, and no problem there. Over time for you'll be noticing that you have 4 or 5 previously kernels installed if you change the grub timeout from 0 to 3 seconds for example. When you run a "sudo apt auto-remove" in Konsole, you get rid of everything except the newest kernel.

    My question is:
    What do you do if you want to keep the previously installed kernel. For example, you just want to save 1 or 2 previously installed kernels and delete the rest of them?

Users Viewing This Topic

Collapse

There are 0 users viewing this topic.

Working...
X