Results 1 to 10 of 10

Thread: How to remove old kernel images which refuse to be removed

  1. #1
    Join Date
    Aug 2013
    Beans
    18

    How to remove old kernel images which refuse to be removed

    OS: Ubuntu 13.04, 64 bit for desktop as downloaded, no modifications/ no PPAs

    I removed (purged) the earlier kernels and after that, again checked for the kernels remaining with the command: dpkg --list | grep linux-image


    yashpal@yashpal-Inspiron-M5010:~$ dpkg --list | grep linux-image

    ii linux-image-3.8.0-29-generic 3.8.0-29.42 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP

    ii linux-image-3.8.0-30-generic 3.8.0-30.44 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP
    rc linux-image-extra-3.8.0-19-generic 3.8.0-19.30 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP

    rc linux-image-extra-3.8.0-21-generic 3.8.0-21.32 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP
    rc linux-image-extra-3.8.0-22-generic 3.8.0-22.33 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP
    rc linux-image-extra-3.8.0-25-generic 3.8.0-25.37 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP
    rc linux-image-extra-3.8.0-26-generic 3.8.0-26.38 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP
    ii linux-image-extra-3.8.0-29-generic 3.8.0-29.42 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP
    ii linux-image-extra-3.8.0-30-generic 3.8.0-30.44 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP
    ii linux-image-generic 3.8.0.30.48 amd64 Generic Linux kernel image
    yashpal@yashpal-Inspiron-M5010:~$

    I tried to remove linux-image-extra-3.8.0-19-generic but it does not remove


    yashpal@yashpal-Inspiron-M5010:~$ sudo apt-get purge linux-image-3.8.0-19-generic

    [sudo] password for yashpal:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Package 'linux-image-3.8.0-19-generic' is not installed, so not removed

    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

    yashpal@yashpal-Inspiron-M5010:~$

    Now, if Package 'linux-image-3.8.0-19-generic' is not installed, why is it being shown in the list and if it is installed, how can it (and other redundant kernels) be removed?
    Could anyone enlighten me please.
    PS:
    I do not have proficiency in command line; I copied and pasted commands after searching on the web; so some complicated command will be well beyond my ability.
    Also, could anyone tell me how to enclose results of command line operations in a window so as to move them up and down and see them in same manner as on the right side of this post (and this page)

  2. #2
    Join Date
    Apr 2011
    Location
    Mystletainn Kick!
    Beans
    6,365
    Distro
    Ubuntu

    Re: How to remove old kernel images which refuse to be removed

    I believe dpkg --list shows what packages are available in the repos.
    Try
    Code:
    ls /boot
    It should show what kernels are installed.
    Code:
    apt-cache policy linux-image* | grep Installed
    show list what kernel images are installed.(or not installed)
    Splat Double Splat Triple Splat
    Earn Your Keep
    Don't mind me, I'm only passing through.
    Once in a blue moon, I'm actually helpful
    .

  3. #3
    Join Date
    Aug 2006
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to remove old kernel images which refuse to be removed

    Note the "rc" and "ii" in the dpkg output.
    rc - package removed, cnfig files remain
    ii - package installed

  4. #4
    Join Date
    Aug 2011
    Location
    52° N 6° E
    Beans
    2,947
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: How to remove old kernel images which refuse to be removed

    Quote Originally Posted by yash_pal2 View Post
    dpkg --list | grep linux-image
    rc linux-image-extra-3.8.0-19-generic 3.8.0-19.30 amd64 Linux kernel image for version 3.8.0 on 64 bit x86 SMP

    (...)

    I tried to remove linux-image-extra-3.8.0-19-generic but it does not remove


    yashpal@yashpal-Inspiron-M5010:~$ sudo apt-get purge linux-image-3.8.0-19-generic

    [sudo] password for yashpal:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Package 'linux-image-3.8.0-19-generic' is not installed, so not removed
    You used the wrong package name. You forgot the "extra" in the name.

    Unless of course you made an error copy-pasting.

  5. #5
    Join Date
    Jul 2005
    Location
    England
    Beans
    Hidden!

    Re: How to remove old kernel images which refuse to be removed

    I use
    Code:
    grep "menuentry " /boot/grub/grub.cfg | cut -c 1-100
    to tell me what kernels I have installed and will be in the grub menu, even if I don't usually see that menu at boot time.

    To remove any unwanted kernels after an update, I always use synaptic, the best package manager available in the Linux world, in my opinion.
    DISTRO: Xubuntu 14.04-64bit --- Code-tags --- Boot-Repair --- Grub2 wiki & Grub2 Basics --- RootSudo

  6. #6
    Join Date
    Jul 2010
    Location
    ozarks, Arkansas, USA
    Beans
    10,744
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: How to remove old kernel images which refuse to be removed

    yash_pal2; Hi !

    In addition to all the other most excellent advise:
    May I suggest that you check that the headers file has also been removed from each kernel:
    Code:
    dpkg --list | grep linux-headers
    In respect to 'rc' .. Removed but Config files remain:
    While there is no built in way to remove all of your configuration information from your removed packages you can remove all configuration data from every removed package with the following command.
    Code:
    dpkg -l | grep '^rc' | awk '{print $2}' | xargs dpkg --purge
    just try'n to help
    THE current(cy) in Documentation:
    https://help.ubuntu.com/community/PopularPages

    Happy ubuntu'n !

  7. #7
    Join Date
    Apr 2011
    Location
    Mystletainn Kick!
    Beans
    6,365
    Distro
    Ubuntu

    Re: How to remove old kernel images which refuse to be removed

    Big +1 to using synaptic package manager.
    It makes things far far far easier when removing stuff like old kernels.
    I also find it harder to misspell something when it is already spelled out correctly.
    I misspell alot.
    Splat Double Splat Triple Splat
    Earn Your Keep
    Don't mind me, I'm only passing through.
    Once in a blue moon, I'm actually helpful
    .

  8. #8
    Join Date
    Jul 2007
    Location
    UK
    Beans
    17,030
    Distro
    Ubuntu Development Release

    Re: How to remove old kernel images which refuse to be removed

    I use this from step 5.

    I usually do the dry run first too.

    http://tuxtweaks.com/2010/10/remove-...h-one-command/

  9. #9
    Join Date
    Aug 2013
    Beans
    18

    Re: How to remove old kernel images which refuse to be removed

    Many thanks:- ' deadflowr', 'mikewhatever', 'Impavidus', 'ajgreeny','Bashing-om', 'philinux'

    It will take me time to work through the suggestions and report back; by the way, there was no error in copy - paste as no site mentioned linux-image-'extra' , they all dealt with 'linux image' and such similar names. However, every aspect would have to be looked into.

  10. #10
    Join Date
    Aug 2013
    Beans
    18

    Re: How to remove old kernel images which refuse to be removed

    Solved
    The suggestion by 'Impavidus' - "You used the wrong package name. You forgot the "extra" in the name"
    did the trick and after removing the unwanted images,
    dpkg --list | grep linux-image shows only
    3.8.0-29-generic, 3.8.0-30-generic and generic 3.8.0.30.48

    I had a lot of problems with Ubuntu 12.04 and no upgrades could be installed; there were messages that boot sector was full. Only recently I realised that all the old kernels had then accumulated. So I wanted to remove the old kernels.
    Many thanks once again ' deadflowr', 'mikewhatever', 'Impavidus', 'ajgreeny','Bashing-om', 'philinux' for the advice, all of which I have noted down & will come handy sooner or later.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •