VirtualBox

Changeset 97539 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Nov 14, 2022 8:17:06 PM (2 years ago)
Author:
vboxsync
Message:

Additions: Linux: Fix kernel modules rebuild behavior on system shutdown, bugref:10287.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/installer/vboxadd.sh

    r97405 r97539  
    7070QUIET=
    7171test -z "${TARGET_VER}" && TARGET_VER=`uname -r`
     72
    7273# Marker to ignore a particular kernel version which was already installed.
     74#
     75# This is needed in order to prevent modules rebuild on system start and do
     76# that on system shutdown instead. Modern Linux distributions might attempt
     77# to run Additions service in async mode. As a result, on system boot, modules
     78# not-by-us will be loaded while we will try to build our modules. This marker is:
     79#
     80#   created -- in scope of setup_modules() when actual modules are built.
     81#   checked -- in scope of stop() when system goes shutdown and if marker
     82#              for certain kernel version does not exist, modules rebuild
     83#              will be triggered for this kernel version.
     84#   removed -- in scope of cleanup_modules() when modules are removed from
     85#              system for all installed kernels.
    7386SKIPFILE_BASE=/var/lib/VBoxGuestAdditions/skip
     87
    7488export VBOX_KBUILD_TYPE
    7589export USERNAME
     
    498512
    499513    update_initramfs "${KERN_VER}"
     514
     515    # We have just built modules for KERN_VER kernel. Create a marker to indicate
     516    # that modules for this kernel version should not be rebuilt on system shutdown.
     517    touch "$SKIPFILE_BASE"-"$KERN_VER"
     518
    500519    return 0
    501520}
     
    788807{
    789808    begin "Starting."
    790     if test -z "${INSTALL_NO_MODULE_BUILDS}"; then
    791         # We want to build modules for newly installed kernels on shutdown, so
    792         # mark the ones already present.  These will be ignored on shutdown.
    793         rm -f "$SKIPFILE_BASE"-*
    794         for setupi in /lib/modules/*; do
    795             KERN_VER="${setupi##*/}"
    796             # For a full setup, mark kernels we do not want to build.
    797             touch "$SKIPFILE_BASE"-"$KERN_VER"
    798         done
    799     fi
     809
     810    # Check if kernel modules for currently running kernel are ready
     811    # and rebuild them if needed.
    800812    setup
    801813
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