VirtualBox

Ignore:
Timestamp:
Apr 21, 2023 3:47:20 PM (21 months ago)
Author:
vboxsync
Message:

Additions: Linux: rcvboxadd: Do not use systemctl when reloading VBoxService, bugref:10359.

Reload action is triggered by default when systemd starts vboxadd.service. Some distributions
do not like when "nested" systemctl is called in this context, resulting in a deadlock on service
start. Instead of using systemctl, try to run underlying script directly.

File:
1 edited

Legend:

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

    r99505 r99508  
    149149BUILDINTMP="$MODULE_SRC/build_in_tmp"
    150150
     151# Path to VBoxService control script.
     152VBOX_SERVICE_SCRIPT="/usr/sbin/rcvboxadd-service"
     153
    151154# Attempt to detect VirtualBox Guest Additions version and revision information.
    152155VBOXCONTROL="${INSTALL_DIR}/bin/VBoxControl"
     
    230233
    231234    [ "$expected" = "$(running_module_version "$mod")" ] || return
    232 }
    233 
    234 
    235 # Checks if systemctl is present and functional (i.e., systemd is the init process).
    236 use_systemd()
    237 {
    238     systemctl status >/dev/null 2>&1
    239 }
    240 
    241 # Returns if we did install a service as a systemd service.
    242 #
    243 # Input $1: Service name to check.
    244 #
    245 # Returns true if the service is installed as a systemd service, false if not.
    246 systemd_service_installed()
    247 {
    248     ## Name of service to test.
    249     name="${1}"
    250 
    251     test -f /lib/systemd/system/"${name}".service ||
    252         test -f /usr/lib/systemd/system/"${name}".service
    253 }
    254 
    255 ## Performs an action on a service
    256 do_sysvinit_action()
    257 {
    258     ## Name of service to start.
    259     name="${1}"
    260     ## The action to perform, normally "start", "stop" or "status".
    261     action="${2}"
    262 
    263     if use_systemd -a systemd_service_installed "${name}"; then
    264         systemctl -q ${action} "${name}"
    265     elif test -x "/etc/rc.d/init.d/${name}"; then
    266         "/etc/rc.d/init.d/${name}" "${action}" quiet
    267     elif test -x "/etc/init.d/${name}"; then
    268         "/etc/init.d/${name}" "${action}" quiet
    269     fi
    270235}
    271236
     
    10881053
    10891054    # Stop VBoxService if running.
    1090     do_sysvinit_action vboxadd-service status >/dev/null 2>&1
     1055    $VBOX_SERVICE_SCRIPT status >/dev/null 2>&1
    10911056    if [ $? -eq 0 ]; then
    1092         do_sysvinit_action vboxadd-service stop >/dev/null 2>&1 || fail "unable to stop VBoxService"
     1057        $VBOX_SERVICE_SCRIPT stop >/dev/null 2>&1 || fail "unable to stop VBoxService"
    10931058    fi
    10941059
     
    11411106
    11421107        # Start VBoxService and VBoxDRMClient (systemctl start vboxadd-service.service).
    1143         [ $? -eq 0 ] && do_sysvinit_action vboxadd-service start >/dev/null 2>&1
     1108        [ $? -eq 0 ] && $VBOX_SERVICE_SCRIPT start >/dev/null 2>&1
    11441109
    11451110        # Reload VBoxClient processes.
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