VirtualBox

Ignore:
Timestamp:
Jan 28, 2025 12:55:41 PM (4 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167213
Message:

Additions: Linux: rcvboxadd: Do optional checks for vboxsf and vboxvideo when checking status-kernel, bugref:10359.

Those two modules are loaded conditionally.

  • vboxsf -- might be not loaded when VM has not Shared Folder mappings,

check this before verifying module.

  • vboxvideo -- only loaded when VM is using VBoxVGA and VBoxSVGA graphics,

Similar to vboxsf, check this condition first.

File:
1 edited

Legend:

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

    r107923 r107963  
    982982
    983983# A wrapper for check_running_module_version.
    984 # Go through the list of Guest Additions' modules and
    985 # verify if they are loaded and running version matches
    986 # to current installation version. Skip vboxvideo since
    987 # it is not loaded for old guests.
     984# Verify if module is loaded and its version matches
     985# to current Additions installation version.
     986check_running_module()
     987{
     988    mod="$1"
     989
     990    # Check args.
     991    [ -n "$mod" ] || return
     992
     993    # During reload action it may take some time for module
     994    # to be fully loaded, so make a few attempts while checking this.
     995    for attempt in 1 2 3 4 5; do
     996
     997        # Wait before the next attempt.
     998        [ -n "$vbox_add_wait" -a $? -ne 0 ] && sleep 1
     999
     1000        running_module "$mod"
     1001        if [ $? -eq 0 ]; then
     1002            mod_is_running="1"
     1003            check_running_module_version "$mod"
     1004            [ $? -eq 0 ] && break
     1005        else
     1006            mod_is_running=""
     1007            false
     1008        fi
     1009
     1010    done
     1011
     1012    # In case of error, try to print out proper reason of failure.
     1013    if [ $? -ne 0 ]; then
     1014        # Was module loaded?
     1015        if [ -z "$mod_is_running" ]; then
     1016            info "module $mod is not loaded"
     1017        else
     1018            # If module was loaded it means that it has incorrect version.
     1019            info "currently loaded module $mod version ($(running_module_version "$mod")) does not match to VirtualBox Guest Additions installation version ($VBOX_VERSION $VBOX_REVISION)"
     1020        fi
     1021
     1022        # Set "bad" rc.
     1023        false
     1024    fi
     1025}
     1026
     1027# Go through list of Additions modules and check
     1028# if they were properly loaded.
    9881029check_status_kernel()
    9891030{
    990     for mod in vboxguest vboxsf; do
    991 
    992         for attempt in 1 2 3 4 5; do
    993 
    994             # Wait before the next attempt.
    995             [ -n "$vbox_add_wait" -a $? -ne 0 ] && sleep 1
    996 
    997             running_module "$mod"
    998             if [ $? -eq 0 ]; then
    999                 mod_is_running="1"
    1000                 check_running_module_version "$mod"
    1001                 [ $? -eq 0 ] && break
    1002             else
    1003                 mod_is_running=""
    1004                 false
    1005             fi
    1006 
    1007         done
    1008 
    1009         # In case of error, try to print out proper reason of failure.
    1010         if [ $? -ne 0 ]; then
    1011             # Was module loaded?
    1012             if [ -z "$mod_is_running" ]; then
    1013                 info "module $mod is not loaded"
    1014             else
    1015                 # If module was loaded it means that it has incorrect version.
    1016                 info "currently loaded module $mod version ($(running_module_version "$mod")) does not match to VirtualBox Guest Additions installation version ($VBOX_VERSION $VBOX_REVISION)"
    1017             fi
    1018 
    1019             # Set "bad" rc.
    1020             false
    1021         fi
    1022 
    1023     done
     1031    # Module vboxguest should be loaded unconditionally once Guest Additions were installed.
     1032    check_running_module "vboxguest"
     1033
     1034    # Module vboxsf module might not be loaded if VM has no Shared Folder mappings.
     1035    # Check that first and then verify the module.
     1036    if [ $? -eq 0 ]; then
     1037        VBoxControl sharedfolder list >/dev/null 2>&1
     1038        if [ $? -eq 0 ]; then
     1039            check_running_module "vboxsf"
     1040        else
     1041            # Do not spoil $?.
     1042            true
     1043        fi
     1044    fi
     1045
     1046    # Module vboxvideo is optional and expected to be loaded only when VM is
     1047    # running VBoxVGA or VBoxSVGA graphics.
     1048    if [ $? -eq 0 ]; then
     1049        gpu_vendor=$(lspci | grep 'VGA compatible controller' | cut -d ' ' -f 5 2>/dev/null)
     1050        if [ "gpu_vendor" = "InnoTek" ]; then
     1051            check_running_module "vboxvideo"
     1052        else
     1053            # Do not spoil $?.
     1054            true
     1055        fi
     1056    fi
    10241057}
    10251058
     
    12371270    # modules. This operation is asynchronous and requires some time for
    12381271    # modules to be loaded in most of the cases. By setting this variable, we
    1239     # ask check_status_kernel() to wait a bit before making a decision
     1272    # ask check_running_module() to wait a bit before making a decision
    12401273    # whether modules were loaded or not.
    12411274    vbox_add_wait=1
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