2
~$ locate tp_smapi
/lib/modules/3.0.0-19-generic/updates/dkms/tp_smapi.ko
/lib/modules/3.2.0-26-generic/updates/dkms/tp_smapi.ko
/lib/modules/3.2.0-29-generic/updates/dkms/tp_smapi.ko
/usr/src/tp-smapi-0.41/tp_smapi.c
/var/lib/dkms/tp-smapi/0.41/3.0.0-19-generic/x86_64/module/tp_smapi.ko
/var/lib/dkms/tp-smapi/0.41/3.2.0-26-generic/x86_64/module/tp_smapi.ko
/var/lib/dkms/tp-smapi/0.41/3.2.0-29-generic/x86_64/module/tp_smapi.ko
/var/lib/dkms/tp-smapi/0.41/build/tp_smapi.c'

How to remove the 2 old Linux kernel modules from kernels 3.0.0-19 und 3.2.0-26?

~$ man dkms

"'dkms remove [module/module-version]' removes a module/version combination from a tree.'

What is a "[module/module-version]", please?

Please notice:

I do not want to remove old Linux kernel modules tp_smapi from a tree but I'd like to remove old Linux kernel modules from my Ubuntu 12.04.1 computer.

3
  • Why do you want to remove those modules? Which module-version is in use? You can see it with "modinfo tp_smapi"
    – BuZZ-dEE
    Sep 4, 2012 at 9:04
  • '~$ modinfo tp-smapi filename: /lib/modules/3.2.0-29-generic/updates/dkms/tp_smapi.ko license: GPL version: 0.41 description: ThinkPad SMAPI Support author: Shem Multinymous srcversion: B6841670771B2FF5222BFFD depends: thinkpad_ec vermagic: 3.2.0-29-generic SMP mod_unload modversions parm: debug:Debug level (0=off, 1=on) (int)'
    – user43816
    Sep 4, 2012 at 11:59
  • 1. To get less unwanted responses when I am grepping. -- 2. To save space on my hard disk. -- 3. To tidy up my hard disk.
    – user43816
    Sep 4, 2012 at 12:01

3 Answers 3

7

This has been tried on 10.04, 11.10, and 12.10. However ... I do not guarantee you if it will preserve your modules!

List your kernels with

dpkg --list | grep linux-image

Then just

sudo apt-get purge [image name(s) from the list]*

On older versions of Ubuntu (not 12.04 onwards), you need to say "hi" to GRUB:

sudo update-grub2
2
  • On my 12.04 system, grub was automatically re-run, so no need to do the third step (sudo update-grub2). Sep 29, 2012 at 23:00
  • some more cleanup: dpkg --list | grep linux-headers sudo apt-get purge [packagename from the list]
    – key_
    Feb 19, 2014 at 8:39
5

Actually an easier (for people who favor GUIs over command line) and apparently more thorough (it found and deleted header files "apt-get purge ..." missed) alternative is to just install Ubuntu Tweak.

Go to Janitor/System/Old Kernel, select it, and press "Clean".

1

Maybe you should see this link; it has good instruction except perhaps the grub update.

Or, more safely, open the Ubuntu Software Center then search for Linux Kernel Image. Make sure to show the technical terms (click on "Show Technical Terms" located on the lower left of the screen).

Then update grub with the command:

user#: sudo update-grub

(# - root or administrative privileges)

Cheers! :)

Not the answer you're looking for? Browse other questions tagged or ask your own question.