Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: why does purge-kernels leave the associated /lib/modules/<kernel-ver> behind?

  1. #1
    Join Date
    Apr 2014
    Location
    "Great North Wet"
    Posts
    138

    Default why does purge-kernels leave the associated /lib/modules/<kernel-ver> behind?

    I've noticed for a very long time over several openSuse versions that whenever purge-kernels runs it never removes the /lib/modules/<kernel-ver> of the removed kernel.
    I typically find several old /lib/modules/<kernel-ver> directories after a few kernel updates.
    Since these modules are no longer useful, why aren't they deleted along with the kernel?
    Can (or how to) purge-kernels be modified to include the associated modules when removing a kernel?
    Turkey Creek Jack Johnson: Nobody move!
    Doc Holliday: Nonsense. By all means, move.

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,755
    Blog Entries
    3

    Default Re: why does purge-kernels leave the associated /lib/modules/<kernel-ver> behind?

    With Leap 15.1, I am seeing:
    Code:
    % ls /lib/modules
    4.12.14-lp151.28.10-default  4.12.14-lp151.28.13-default
    No old directories there.

    However: I did see this on a previous system with nVidia graphics. The old directory was left there because it was not empty (it contain the nvidia module). And I remember it with an even older computer where I was using a WiFi driver that did not come with the kernel.

    You probably get that whenever you install something that adds modules are do not come as part of the kernel.

    When the old kernel is removed, all files that came with that kernel are removed. But a directory is not removed unless it is empty.

    At least, that's how I understand it.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  3. #3
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,755
    Blog Entries
    3

    Default Re: why does purge-kernels leave the associated /lib/modules/<kernel-ver> behind?

    Quote Originally Posted by erbenton View Post
    Since these modules are no longer useful, why aren't they deleted along with the kernel
    I'm not sure, but I think sometimes a newer kernel uses symlinks to the added modules in an older kernel. So you don't really know for sure that they are not in use.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  4. #4
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,760

    Default Re: why does purge-kernels leave the associated /lib/modules/<kernel-ver> behind?

    15.1 recent new install
    Have NVIDIA have had 2 kernel updates have 3 directories the oldest (4.12.14-lp151.27-default) is empty but for an empty directory called updates. This appears where the NVIDIA stuff resides. All other files and directories have been cleared. So the cleanup routine seems to be missing this directory and thus leaves the parent.

    Suppose there should be a bug report filed

  5. #5
    Join Date
    Oct 2014
    Location
    Italy
    Posts
    1,674

    Default Re: why does purge-kernels leave the associated /lib/modules/<kernel-ver> behind?

    Quote Originally Posted by nrickert View Post
    With Leap 15.1, I am seeing:
    Code:
    % ls /lib/modules
    4.12.14-lp151.28.10-default  4.12.14-lp151.28.13-default
    No old directories there.

    However: I did see this on a previous system with nVidia graphics...
    +1
    That's also my experience and my understanding.
    Main: Leap 15 Gnome on i7 4720HQ + Geforce GTX960M
    Test: Leap 42.3 (& others) on Core2Duo + GM965

  6. #6
    Join Date
    Apr 2014
    Location
    "Great North Wet"
    Posts
    138

    Default Re: why does purge-kernels leave the associated /lib/modules/<kernel-ver> behind?

    I am using NVidia driver so maybe thats why, But even then the driver has to be rebuilt for each kernel or it wont load so why its kept around is beyond me.

    nrickert:
    I've never seen a kernel sym linked to another kernel's modules and if was i doubt the system would boot
    Turkey Creek Jack Johnson: Nobody move!
    Doc Holliday: Nonsense. By all means, move.

  7. #7
    Join Date
    Jun 2008
    Location
    Yorkshire
    Posts
    341

    Default Re: why does purge-kernels leave the associated /lib/modules/<kernel-ver> behind?

    Quote Originally Posted by erbenton View Post
    I am using NVidia driver so maybe thats why, But even then the driver has to be rebuilt for each kernel or it wont load so why its kept around is beyond me.
    Presumably because the kernel update process can't deal with modules that aren't an integrated part of the kernel. I just remove old unneeded folders periodically.
    Pete

  8. #8
    Join Date
    Apr 2014
    Location
    "Great North Wet"
    Posts
    138

    Default Re: why does purge-kernels leave the associated /lib/modules/<kernel-ver> behind?

    Pete, shouldn't that be the job of purge-kernels? The modules directory of a deleted kernel is useless, it cant be used for anything
    Turkey Creek Jack Johnson: Nobody move!
    Doc Holliday: Nonsense. By all means, move.

  9. #9
    Join Date
    Apr 2016
    Location
    North America
    Posts
    537

    Default Re: why does purge-kernels leave the associated /lib/modules/<kernel-ver> behind?


  10. #10
    Join Date
    Apr 2016
    Location
    North America
    Posts
    537

    Default Re: why does purge-kernels leave the associated /lib/modules/<kernel-ver> behind?

    Actually, it looks like the version installed in tumbleweed is different. I'm noticing comments that don't exist in that other version.

    Code:
    less /sbin/purge-kernels
    zypper tells me it's provided by dracut, but I can't find it in that repository.

Page 1 of 2 12 LastLast

Posting Permissions

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