purge-old-kernels deprecated

Jeffrey Walton noloader at gmail.com
Thu Jan 5 18:24:26 UTC 2023


On Thu, Jan 5, 2023 at 1:10 PM Bret Busby <bret at busby.net> wrote:
>
> On 05/01/2023 18:52, Grizzly via ubuntu-users wrote:
> > 05 January 2023  at 8:04, David Fletcher wrote:
> > Re: purge-old-kernels deprecated (at least in part)
> >
> >> On Thu, 2023-01-05 at 01:46 -0500, Jeffrey Walton wrote:
> >>>
> >>> How does one use Apt(8) to remove old kernels with a --keep argument?
> >>
> >> I'm not aware of any keep argument. For a while now I've been using
> >>
> >> sudo apt autoremove
> >>
> >> which I believe automatically keeps two kernels. I also use
> >>
> >> sudo apt autoclean
> >>
> >> which sometimes deletes some redundant files.
> >
> > There is a script (not sure who wrote it)
> >
> > rm-kernels
> >
> > that clears out old kernels giving you the choice remove the ones you want to
> >
> >
> I do not understand why people do not simply, when performing system
> updates/upgrades, apply the sequence repeatedly previously mentioned on
> the mailing list;

Installing a 5.12 kernel on a machine that uses 5.4 by default does
not produce expected results. Additionally, a manual reinstall of a
kernel causes problems. Old kernels are not autocleaned in these
cases. I think it has something to do with apt-mark and manual versus
auto.

> apt update
> apt full upgrade -y
> apt autoremove
> apt autoclean
>
> It is simple an effective, and, it takes care of redundant kernel images
> and associated packages, and other superseded and otherwise redundant
> packages.
>
> I preface the set of four commands, with
> sudo -i
> which acts like the (non-Ubuntu) command
> su -root
> and I follow the four commands with
> exit, so as to avoid inadvertently abusing the superuser mode to
> inadvertently cause system level problems.

Jeff



More information about the ubuntu-users mailing list