VirtualBox

Changeset 68027 in vbox for trunk/src


Ignore:
Timestamp:
Jul 18, 2017 2:21:17 PM (8 years ago)
Author:
vboxsync
Message:

bugref:3809: Linux installer maintenance
Clean up unneeded kernel modules when the vboxdrv service is started.

When a Linux kernel is removed on the host for which VirtualBox driver
modules were installed, the kernel directory and those modules were left
in place. This change adds a check to the vboxdrv service script to look
for such orphaned modules on start-up and remove them along with the
directories.

Location:
trunk/src/VBox/Installer/linux
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/linux/prerm-common.sh

    r62678 r68027  
    3030# error).
    3131
    32 OLDMODULES="vboxdrv vboxnetflt vboxnetadp vboxpci"
    3332
    3433# The below is GNU-specific.  See VBox.sh for the longer Solaris/OS X version.
     
    6867remove_init_script vboxnet >/dev/null 2>&1
    6968rm -f /sbin/vboxconfig
    70 # Remove any generated modules
    71 if [ -z "$VBOX_DONT_REMOVE_OLD_MODULES" ]; then
    72     for i in ${OLDMODULES}; do
    73         # Remove old modules.
    74         rm -f /lib/modules/*/misc/"${i}"*
    75         # This second is no longer used.  Remove the line some time.
    76         rm -f /lib/modules/*/kernel/misc/"${i}"*
    77     done
    78     # Remove leftover module folders.
    79     for i in /lib/modules/*/misc; do
    80         test -d "${i}" && rmdir -p "${i}" 2>/dev/null
    81     done
    82 fi
    8369exit 0
  • trunk/src/VBox/Installer/linux/vboxdrv.sh

    r65403 r68027  
    284284        chown root:vboxusers /dev/vboxusb 2>/dev/null
    285285    fi
     286    # Remove any kernel modules left over from previously installed kernels.
     287    cleanup only_old
    286288    succ_msg "VirtualBox services started"
    287289}
     
    366368cleanup()
    367369{
     370    # If this is set, only remove kernel modules for no longer installed
     371    # kernels.  Note that only generated kernel modules should be placed
     372    # in /lib/modules/*/misc.  Anything that we should not remove automatically
     373    # should go elsewhere.
     374    only_old="${1}"
    368375    for i in /lib/modules/*; do
     376        # Check whether we are only cleaning up for uninstalled kernels.
     377        test -n "${only_old}" && test -e "${i}/kernel/drivers" && continue
    369378        # We could just do "rm -f", but we only want to try deleting folders if
    370379        # we are sure they were ours, i.e. they had our modules in beforehand.
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette