clean out old kernel versions?

Robert Heller heller at deepsoft.com
Sun Mar 7 19:20:08 UTC 2021


At Sun, 7 Mar 2021 09:42:30 -0800 "Ubuntu user technical support, not for general discussions" <ubuntu-users at lists.ubuntu.com> wrote:

> 
> On Sun,  7 Mar 2021 12:27:33 -0500 (EST)
> Robert Heller <heller at deepsoft.com> wrote:
> 
> > At Sun, 7 Mar 2021 09:07:18 -0800 "Ubuntu user technical support, not
> > for general discussions" <ubuntu-users at lists.ubuntu.com> wrote:
> > 
> > > 
> > > On Sun, 7 Mar 2021 07:11:30 +0000
> > > Colin Law <clanlaw at gmail.com> wrote:
> > >   
> > > > On Sun, 7 Mar 2021, 05:55 Dave Stevens, <geek at uniserve.com> wrote:
> > > >   
> > > > > Linux user-Satellite-A100 4.4.0-21-generic #37-Ubuntu SMP Mon
> > > > > Apr 18 18:34:49 UTC 2016 i686 i686 i686 GNU/Linux
> > > > >
> > > > > cat /etc/issue
> > > > > Linux Mint 18 Sarah \n \l
> > > > >
> > > > > --------------
> > > > >
> > > > >
> > > > > /boot has 440 files in it, almost all of which are old kernel
> > > > > entries. Is there a simple way to get rid of all but the most
> > > > > recent few (2 or 3)?
> > > > >    
> > > > 
> > > > 
> > > > Start with
> > > > sudo apt autoremove
> > > > 
> > > > Though that won't get rid of ones not removed before a mint
> > > > version upgrade.
> > > > 
> > > > Colin  
> > > 
> > > sudo apt autoremove
> > > Reading package lists... Done
> > > Building dependency tree       
> > > Reading state information... Done
> > > 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
> > > user at user-Satellite-A100 /boot $   
> > 
> > OK, then how did you install the kernels?  Did you build them from
> > source? 
> 
> no I use stock mint 18 with mate and every day or two the nag icon show
> up on the bottom panel, I click and something (mintupdate) pops
> up, shows a list of updates and asks if i want them. I say yes, it
> takes a while. I get a reboot warning if it's a kernel then the
> autoremove is suggested. I pretty much always do as it suggests.
> 
> > 
> > It might be that you will just have to use rm (with care!) and then
> > run update-grub to rebuild the grub.cnf file.  For any given kernel
> > x.y.x-nnn-mumble, there will be vmlinuz-x.y.x-nnn-mumble,
> > System.map-x.y.x-nnn-mumble, initrd.img-x.y.x-nnn-mumble, and
> > config-x.y.x-nnn-mumble -- at least for Ubuntu/Mint kernels -- other
> > distros might have other naming conventions.
> > 
> > *IF* you did install them with apt install, you should remove them
> > with apt purge.  Oh, if you managed to remove the generic
> > (unversioned) kernel-image package, that would have also removed the
> > autoremove logic.  You probably should re-install it.
> > 
> > What does 'dpkg-query -l linux-image-generic' display?
> 
> 
> > $ dpkg-query -l linux-image-generic
> Desired=Unknown/Install/Remove/Purge/Hold
> |
> Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
> |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/
> Name                              Version
> Architecture          Description
> +++-=================================-=====================-=====================-========================================================================
> un  linux-image-generic               <none>
> <none>                (no description available)
> user at user-Satellite-A100 /var/log/apt $ 
> 
> like that.

OK, somehow (possibly a Mint installer bug) you lost that package, which 
happens to include the logic to mark old kernels for removal (by autoremove).

Try this:

sudo apt install linux-image-generic

and see if many (most?) of those old kernels get marked for removal, if not 
right off, then after the next kernel update.

> 
> d
> 
> 

-- 
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
heller at deepsoft.com       -- Webhosting Services
                                                      




More information about the ubuntu-users mailing list