why does Fedora have scriptlets for kernel-core that leave old files in /lib//modules
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    7,401
    Linux (Fedora) Firefox 61.0

    why does Fedora have scriptlets for kernel-core that leave old files in /lib//modules

    I was running

    Code:
    ~ $> sudo /sbin/vboxconfig
    [sudo] password for mos: 
    vboxdrv.sh: Stopping VirtualBox services.
    depmod: WARNING: could not open /lib/modules/4.16.13-300.fc28.x86_64/modules.order: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.16.13-300.fc28.x86_64/modules.builtin: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.16.14-300.fc28.x86_64/modules.order: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.16.14-300.fc28.x86_64/modules.builtin: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.16.15-300.fc28.x86_64/modules.order: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.16.15-300.fc28.x86_64/modules.builtin: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.17.2-200.fc28.x86_64/modules.order: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.17.2-200.fc28.x86_64/modules.builtin: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.17.3-200.fc28.x86_64/modules.order: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.17.3-200.fc28.x86_64/modules.builtin: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.17.4-200.fc28.x86_64/modules.order: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.17.4-200.fc28.x86_64/modules.builtin: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.17.5-200.fc28.x86_64/modules.order: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.17.5-200.fc28.x86_64/modules.builtin: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.17.6-200.fc28.x86_64/modules.order: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.17.6-200.fc28.x86_64/modules.builtin: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.17.7-200.fc28.x86_64/modules.order: No such file or directory
    depmod: WARNING: could not open /lib/modules/4.17.7-200.fc28.x86_64/modules.builtin: No such file or directory
    vboxdrv.sh: Building VirtualBox kernel modules.
    and thought "what are all these warnings", it turns out every kernel I've updated from has left a junk directory in /lib/modules
    I only have these kernels now:
    Code:
    rpm -q kernel
    kernel-4.17.9-200.fc28.x86_64
    kernel-4.17.11-200.fc28.x86_64
    kernel-4.17.12-200.fc28.x86_64
    But my /lib/modules has this massive load of stuff where only the bolded ones are valid kernels
    Code:
    /lib/modules $> ls -ltr /lib/modules
    total 124
    drwxr-xr-x. 3 root root 4096 Feb 12 22:12 4.14.13-300.fc27.x86_64
    drwxr-xr-x. 3 root root 4096 Mar 17 17:44 4.15.4-300.fc27.x86_64
    drwxr-xr-x. 3 root root 4096 Mar 21 17:01 4.15.6-300.fc27.x86_64
    drwxr-xr-x. 3 root root 4096 Mar 24 18:18 4.15.7-300.fc27.x86_64
    drwxr-xr-x. 3 root root 4096 Mar 31 16:53 4.15.9-300.fc27.x86_64
    drwxr-xr-x. 3 root root 4096 Apr  7 00:57 4.15.10-300.fc27.x86_64
    drwxr-xr-x. 3 root root 4096 Apr 14 17:20 4.15.12-301.fc27.x86_64
    drwxr-xr-x. 3 root root 4096 Apr 21 16:49 4.15.13-300.fc27.x86_64
    drwxr-xr-x. 3 root root 4096 Apr 29 18:25 4.15.16-300.fc27.x86_64
    drwxr-xr-x. 3 root root 4096 May  5 16:12 4.15.17-300.fc27.x86_64
    drwxr-xr-x. 3 root root 4096 May 12 15:33 4.16.4-200.fc27.x86_64
    drwxr-xr-x. 3 root root 4096 May 12 19:21 4.16.4-300.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 May 20 15:53 4.16.5-300.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 May 26 16:08 4.16.6-302.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 May 26 16:41 4.16.7-300.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 May 28 17:08 4.16.8-300.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 Jun  9 14:55 4.16.9-300.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 Jun 10 16:00 4.16.11-300.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 Jun 17 15:12 4.16.12-300.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 Aug 11 16:55 4.16.13-300.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 Aug 11 16:55 4.16.14-300.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 Aug 11 16:55 4.16.15-300.fc28.x86_64
    drwxr-xr-x. 7 root root 4096 Aug 11 16:55 4.17.11-200.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 Aug 11 16:55 4.17.2-200.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 Aug 11 16:55 4.17.3-200.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 Aug 11 16:55 4.17.4-200.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 Aug 11 16:55 4.17.5-200.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 Aug 11 16:55 4.17.6-200.fc28.x86_64
    drwxr-xr-x. 3 root root 4096 Aug 11 16:55 4.17.7-200.fc28.x86_64
    drwxr-xr-x. 7 root root 4096 Aug 11 16:55 4.17.9-200.fc28.x86_64
    drwxr-xr-x. 7 root root 4096 Aug 11 16:56 4.17.12-200.fc28.x86_64
    so to look into why this happens I checked "rpm -q --scripts kernel-core"

    Code:
    rpm -q --scripts kernel-core-4.17.12-200.fc28.x86_64
    postinstall scriptlet (using /bin/sh):
    
    if [ `uname -i` == "x86_64" -o `uname -i` == "i386" ] &&
       [ -f /etc/sysconfig/kernel ]; then
      /bin/sed -r -i -e 's/^DEFAULTKERNEL=kernel-smp$/DEFAULTKERNEL=kernel/' /etc/sysconfig/kernel || exit $?
    fi
    preuninstall scriptlet (using /bin/sh):
    /bin/kernel-install remove 4.17.12-200.fc28.x86_64 /lib/modules/4.17.12-200.fc28.x86_64/vmlinuz || exit $?
    posttrans scriptlet (using /bin/sh):
    /bin/kernel-install add 4.17.12-200.fc28.x86_64 /lib/modules/4.17.12-200.fc28.x86_64/vmlinuz || exit $?
    It sure looks to me like this stanza:
    Code:
    preuninstall scriptlet (using /bin/sh):
    /bin/kernel-install remove 4.17.12-200.fc28.x86_64 /lib/modules/4.17.12-200.fc28.x86_64/vmlinuz || exit $?
    should really be:
    Code:
    preuninstall scriptlet (using /bin/sh):
    /bin/kernel-install remove 4.17.12-200.fc28.x86_64 /lib/modules/4.17.12-200.fc28.x86_64 || exit $?

  2. #2
    Join Date
    Jul 2018
    Location
    NSW, Australia
    Posts
    24
    Windows 7 Firefox 61.0

    Re: why does Fedora have scriptlets for kernel-core that leave old files in /lib//mod

    On a test laptop I only get:
    Code:
    $ ls -ltrh /lib/modules
    total 12K
    drwxr-xr-x 6 root root 4.0K Jul 28 11:22 4.17.9-200.fc28.i686
    drwxr-xr-x 6 root root 4.0K Aug  4 15:45 4.17.11-200.fc28.i686
    drwxr-xr-x 6 root root 4.0K Aug 10 04:22 4.17.12-200.fc28.i686
    which corresponds to the 3 kernels I currently have installed, and this machine has been upgraded through many kernel iterations.

    As a test, I did:
    Code:
    $ dnf remove kernel-core-4.17.9-200.fc28.i686
    Dependencies resolved.
    ================================================================================
     Package                   Arch      Version                Repository     Size
    ================================================================================
    Removing:
     kernel-core               i686      4.17.9-200.fc28        @updates       53 M
    Removing dependent packages:
     kernel                    i686      4.17.9-200.fc28        @updates        0
     kernel-modules            i686      4.17.9-200.fc28        @updates       23 M
     kernel-modules-extra      i686      4.17.9-200.fc28        @updates      1.9 M
    
    Transaction Summary
    ================================================================================
    Remove  4 Packages
    
    Freed space: 78 M
    Is this ok [y/N]: y
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                        1/1
      Erasing          : kernel-modules-extra-4.17.9-200.fc28.i686              1/4
      Running scriptlet: kernel-modules-extra-4.17.9-200.fc28.i686              1/4
      Erasing          : kernel-4.17.9-200.fc28.i686                            2/4
      Running scriptlet: kernel-4.17.9-200.fc28.i686                            2/4
      Erasing          : kernel-modules-4.17.9-200.fc28.i686                    3/4
      Running scriptlet: kernel-modules-4.17.9-200.fc28.i686                    3/4
      Running scriptlet: kernel-core-4.17.9-200.fc28.i686                       4/4
      Erasing          : kernel-core-4.17.9-200.fc28.i686                       4/4
      Running scriptlet: kernel-core-4.17.9-200.fc28.i686                       4/4
      Verifying        : kernel-4.17.9-200.fc28.i686                            1/4
      Verifying        : kernel-modules-4.17.9-200.fc28.i686                    2/4
      Verifying        : kernel-core-4.17.9-200.fc28.i686                       3/4
      Verifying        : kernel-modules-extra-4.17.9-200.fc28.i686              4/4
    
    Removed:
      kernel-core.i686 4.17.9-200.fc28    kernel.i686 4.17.9-200.fc28
      kernel-modules.i686 4.17.9-200.fc28 kernel-modules-extra.i686 4.17.9-200.fc28
    
    Complete!
    ...which results in this:
    Code:
    $  ls -ltrh /lib/modules
    total 8.0K
    drwxr-xr-x 6 root root 4.0K Aug  4 15:45 4.17.11-200.fc28.i686
    drwxr-xr-x 6 root root 4.0K Aug 10 04:22 4.17.12-200.fc28.i686
    Last edited by Jim D; 12th August 2018 at 04:16 AM.

  3. #3
    Join Date
    Oct 2011
    Posts
    1,884
    Linux Chrome 67.0.3396.87

    Re: why does Fedora have scriptlets for kernel-core that leave old files in /lib//mod

    They should be removed, unless something else is populating it. At least it does so on older Fedora release. Maybe you have some custom module being built that is keeping the directories from being removed?

  4. #4
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    7,401
    Linux (Fedora) Firefox 61.0

    Re: why does Fedora have scriptlets for kernel-core that leave old files in /lib//mod

    Quote Originally Posted by srakitnican
    They should be removed, unless something else is populating it. At least it does so on older Fedora release. Maybe you have some custom module being built that is keeping the directories from being removed?
    Probably VirtualBox, I have three laptops, the two newer ones with VBox have the bloated /lib/modules issue. The old sony I have doesn't have VirtualBox and it clears off the /lib/modules as expected with each kernel update.

  5. #5
    Join Date
    Feb 2011
    Posts
    193
    Linux Firefox 33.0

    Re: why does Fedora have scriptlets for kernel-core that leave old files in /lib//mod

    When updating the kernel and recompiling the VirtualBox modules, I have noticed that some new vbox modules are symlinks to former ones. You even have chains of symlinks finally reaching the older version. So if you delete obsolete /lib/modules/* you will probably have to install VirtualBox (or recompile the modules) again.

  6. #6
    Join Date
    Oct 2011
    Posts
    1,884
    Linux Chrome 67.0.3396.87

    Re: why does Fedora have scriptlets for kernel-core that leave old files in /lib//mod

    Also, if I remember correctly `kernel-install` script deals only with updating boot loader and /boot files. The script does not deal with removing old modules. These are handled as a list of files by package manager. If you do `rpm -ql kernel-core | grep ^/lib/modules` you can confirm that this is indeed the case.

    And by default package manager does not remove directories owned by the package if there are underlying files that does not belong to package(s) being removed. So there might be a packaging bug in VBox then.

  7. #7
    Join Date
    Dec 2007
    Location
    Albuquerque, New Mexico USA
    Age
    65
    Posts
    161
    Linux (Fedora) Chrome 68.0.3440.106

    Re: why does Fedora have scriptlets for kernel-core that leave old files in /lib//mod

    Same thing happens on my system with VMware Player installed.
    Hope is not a plan

  8. #8
    Join Date
    Sep 2009
    Posts
    2,185
    Linux (Fedora) Firefox 61.0

    Re: why does Fedora have scriptlets for kernel-core that leave old files in /lib//mod

    Take a look in those folders. Each one probably contains a single folder named "misc", and each "misc" folder contains 4 files left over from VirtualBox. I pulled some code from the vbox script that builds the kernel to write a script that cleans them up. However, if you read the documentation for VBoxManager, IIRC, you'll see there is a clean up option. Run that, then run the option to rebuild the kernel module and they should all disappear. It's not the kernel scripts, It's VirtualBox.

    dd_wizard

Similar Threads

  1. [SOLVED]
    Can I remove this non-PAE kernel core? Is PAE-core+modules = PAE?
    By pwalden in forum Installation, Upgrades and Live Media
    Replies: 6
    Last Post: 19th March 2015, 04:17 PM
  2. make kernel modules in core 5
    By Bob Bao in forum Installation, Upgrades and Live Media
    Replies: 8
    Last Post: 6th November 2007, 09:13 PM
  3. Kernel Modules - kmdl files
    By gizmobay in forum Using Fedora
    Replies: 11
    Last Post: 9th October 2007, 01:54 AM
  4. installing old fedora core 5 kernel modules
    By timdahl in forum Using Fedora
    Replies: 4
    Last Post: 7th June 2007, 11:30 PM
  5. Fedora Core 5 - Kernel build files?
    By skudder in forum Using Fedora
    Replies: 15
    Last Post: 27th April 2006, 03:29 AM

Posting Permissions

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