VirtualBox

Changeset 74964 in vbox for trunk/src/VBox/Additions/linux


Ignore:
Timestamp:
Oct 22, 2018 8:57:20 AM (6 years ago)
Author:
vboxsync
Message:

Additions/linux/installer: try to inhibit reboot while rebuilding initramfs.
bugref:4567: Linux kernel driver maintenance
Since we have started doing initramfs rebuilds again, and in particular since
with the last change they can happen with a delay after a new kernel is
installed, try to inhibit reboots during the rebuild process. Hopefully the
rebuild process is designed so that that is not a problem, but better safe(r)
than sorry. Also try rebuilding kernel modules once a minute to start with,
not once every five minutes, after the new kernel is installed.

File:
1 edited

Legend:

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

    r74891 r74964  
    329329        test -f "/lib/modules/${version}/misc/vboxvideo.ko" &&
    330330        touch "/lib/modules/${version}/initrd/vboxvideo"
     331
     332    # Systems without systemd-inhibit probably don't need their initramfs
     333    # rebuild here anyway.
     334    type systemd-inhibit >/dev/null 2>&1 || return
    331335    if type dracut >/dev/null 2>&1; then
    332         dracut -f --kver "${version}"
     336        systemd-inhibit --why="Installing VirtualBox Guest Additions" \
     337            dracut -f --kver "${version}"
    333338    elif type update-initramfs >/dev/null 2>&1; then
    334         update-initramfs -u -k "${version}"
     339        systemd-inhibit --why="Installing VirtualBox Guest Additions" \
     340            update-initramfs -u -k "${version}"
    335341    fi
    336342}
     
    383389    # installed.  Package managers have been known to trigger module rebuilds
    384390    # before actually installing the headers.
    385     for count in 1 2 3 4 5; do
     391    for delay in 60 60 60 60 60 300 30 300 300; do
    386392        test "x${QUICKSETUP}" = xyes || break
    387393        test -d "/lib/modules/${KERN_VER}/build" && break
    388         printf "Kernel modules not yet installed, waiting five minutes (%s of 5)" "${count}"
    389         sleep 300
     394        printf "Kernel modules not yet installed, waiting %s seconds." "${delay}"
     395        sleep "${delay}"
    390396    done
    391397
     398    # Inhibit shutdown for up to ten minutes if possible.
     399    systemd-inhibit 600 2>/dev/null &
    392400    log "Building the main Guest Additions module."
    393401    if ! myerr=`$BUILDINTMP \
     
    399407        "${INSTALL_DIR}"/other/check_module_dependencies.sh 2>&1 &&
    400408            info "Look at $LOG to find out what went wrong"
    401         update_initramfs "${KERN_VER}"
     409        kill $! 2>/dev/null
    402410        return 0
    403411    fi
     
    409417        module_build_log "$myerr"
    410418        info  "Look at $LOG to find out what went wrong"
    411         update_initramfs "${KERN_VER}"
     419        kill $! 2>/dev/null
    412420        return 0
    413421    fi
     
    426434    update_initramfs "${KERN_VER}"
    427435    depmod
     436    kill $! 2>/dev/null
    428437    return 0
    429438}
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