/usr/sbin/vbox-uninstall-guest-additions-uninstall.sh:没有此文件或目录

/usr/sbin/vbox-uninstall-guest-additions-uninstall.sh:没有此文件或目录

问题

我在用dotless 的 vbguest vagrant 插件保持我的 Virtualbox 客户机添加内容更新。

尝试安装访客添加程序

$ vagrant vbguest --iso VBoxGuestAdditions_5.2.18.iso --do install

给我:

$ vagrant vbguest --iso VBoxGuestAdditions_5.2.18.iso --do install --no-cleanup -f
[helix_dev] GuestAdditions versions on your host (5.2.8) and guest (5.0.16) do not match.
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: mirror.checkdomain.de
* epel: mirror.nl.leaseweb.net
* extras: mirror2.hs-esslingen.de
* updates: ftp.rz.uni-frankfurt.de
755 packages excluded due to repository priority protections
Package kernel-devel-3.10.0-862.11.6.el7.x86_64 already installed and latest version
Package kernel-devel-3.10.0-862.11.6.el7.x86_64 already installed and latest version
Package gcc-4.8.5-28.el7_5.1.x86_64 already installed and latest version
Package binutils-2.27-28.base.el7_5.1.x86_64 already installed and latest version
Package 1:make-3.82-23.el7.x86_64 already installed and latest version
Package 4:perl-5.16.3-292.el7.x86_64 already installed and latest version
Package bzip2-1.0.6-13.el7.x86_64 already installed and latest version
Nothing to do
Copy iso file VBoxGuestAdditions_5.2.18.iso into the box /tmp/VBoxGuestAdditions.iso
Mounting Virtualbox Guest Additions ISO to: /mnt
mount: /dev/loop0 is write-protected, mounting read-only
Forcing installation of Virtualbox Guest Additions 5.2.18 - guest version is 5.0.16
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.18 Guest Additions for Linux........
VirtualBox Guest Additions installer
/usr/sbin/vbox-uninstall-guest-additions: line 9: /opt/VBoxGuestAdditions-5.2.18/uninstall.sh: No such file or directory
Failed to remove existing installation.  Aborting...
An error occurred during installation of VirtualBox Guest Additions 5.2.18. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
Redirecting to /bin/systemctl start vboxadd.service
Failed to start vboxadd.service: Access denied
See system logs and 'systemctl status vboxadd.service' for details.

在虚拟机内安装 VirtualboxAdditions 并手动运行 VBoxLinuxAdditions.run 会导致

$ sudo ./VBoxLinuxAdditions.run install
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.8 Guest Additions for Linux........
VirtualBox Guest Additions installer
/usr/sbin/vbox-uninstall-guest-additions: line 9: /opt/VBoxGuestAdditions-5.2.18/uninstall.sh: No such file or directory
Failed to remove existing installation.  Aborting...

所以我认为它与 dotless 插件没有关系。

当前分析

引用的文件夹 /opt/VBoxGuestAdditions-5.2.18 不存在,我认为这是问题的根源,因此 uninstall.sh 显然也不存在。

看起来安装过程强制要求运行卸载过程,但该过程现已不再存在。

无论我怎么尝试,似乎都无法找回该文件夹(目前)。

我希望你们知道我会做什么。

附加信息:

我在带有 CentOS 7 客户机的 Windows 10 主机上:

cat /etc/*-release
CentOS Linux release 7.5.1804 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.5.1804 (Core)
CentOS Linux release 7.5.1804 (Core)

我的Virtualbox版本是5.2.8,我的Vagrant版本是

$ vagrant version
Installed Version: 2.0.4
Latest Version: 2.1.2

答案1

解决方法: 在我的 Fedora 30 上(作为访客),我在专用文件夹中创建了所需的 uninstall.sh,并向其中添加了可执行标志。文件的内容只是一个回显,之后我能够再次运行向导。

以下是我的 Fedora 30 (Guest) 中的 uninstall.sh 内容

#!/bin/sh
# Auto-generated uninstallation file

PATH=$PATH:/bin:/sbin:/usr/sbin
LOGFILE="/var/log/vboxadd-uninstall.log"

# Read routines.sh
if ! test -r "/opt/VBoxGuestAdditions-6.0.8/routines.sh"; then
    echo 1>&2 "Required file routines.sh not found.  Aborting..."
    return 1
fi
. "/opt/VBoxGuestAdditions-6.0.8/routines.sh"

# We need to be run as root
check_root

create_log "$LOGFILE"

echo 1>&2 "Removing installed version 6.0.8 of VirtualBox Guest Additions..."

NO_CLEANUP=""
if test "$1" = "no_cleanup"; then
    shift
    NO_CLEANUP="no_cleanup"
fi

test -r "/var/lib/VBoxGuestAdditions/filelist" || abort "Required file filelist not found.  Aborting..."

# Stop and clean up all services
if test -r "/opt/VBoxGuestAdditions-6.0.8"/init/vboxadd-service; then
    stop_init_script vboxadd-service 2>> "$LOGFILE"
    delrunlevel vboxadd-service 2>> "$LOGFILE"
    remove_init_script vboxadd-service 2>> "$LOGFILE"
fi
if test -r "/opt/VBoxGuestAdditions-6.0.8"/init/vboxadd; then
    stop_init_script vboxadd 2>> "$LOGFILE"
    test -n "$NO_CLEANUP" || "/opt/VBoxGuestAdditions-6.0.8"/init/vboxadd cleanup 2>> "$LOGFILE"
    delrunlevel vboxadd 2>> "$LOGFILE"
    remove_init_script vboxadd 2>> "$LOGFILE"
fi
finish_init_script_install

# Load all modules
# Important: This needs to be done before loading the configuration
#            value below to not override values which are set to a default
#            value in the modules itself.
for CUR_MODULE in /opt/VBoxGuestAdditions-6.0.8/installer/module-autologon
    do
        . "$CUR_MODULE"
    done

# Load configuration values
test -r "/var/lib/VBoxGuestAdditions/config" && . "/var/lib/VBoxGuestAdditions/config"

# Call uninstallation initialization of all modules
for CUR_MODULE in ""
    do
        if test -z "$CUR_MODULE"; then
            continue
        fi
        mod_${CUR_MODULE}_pre_uninstall
        if [ 0 -ne 0 ]; then
            echo 1>&2 "Module \"$CUR_MODULE\" failed to initialize uninstallation"
            # Continue initialization.
        fi
    done

# Call uninstallation of all modules
for CUR_MODULE in ""
    do
        if test -z "$CUR_MODULE"; then
            continue
        fi
        mod_${CUR_MODULE}_uninstall
        if [ 0 -ne 0 ]; then
            echo 1>&2 "Module \"$CUR_MODULE\" failed to uninstall"
            # Continue uninstallation.
        fi
    done

# And remove all files and empty installation directories
# Remove any non-directory entries
cat "/var/lib/VBoxGuestAdditions/filelist" | xargs rm 2>/dev/null
# Remove any empty (of files) directories in the file list
cat "/var/lib/VBoxGuestAdditions/filelist" |
    while read file; do
        case "$file" in
            */)
            test -d "$file" &&
                find "$file" -depth -type d -exec rmdir '{}' ';' 2>/dev/null
            ;;
        esac
    done

# Remove configuration files
rm "/var/lib/VBoxGuestAdditions/filelist" 2>/dev/null
rm "/var/lib/VBoxGuestAdditions/config" 2>/dev/null
rmdir "/var/lib/VBoxGuestAdditions" 2>/dev/null
exit 0

答案2

我可以通过简单地创建丢失的目录并创建一个空的卸载文件来解决此问题,如下所示:

mkdir /opt/VBoxGuestAdditions-<version>
touch /opt/VBoxGuestAdditions-<version>/uninstall.sh
chmod 777 /opt/VBoxGuestAdditions-<version>/uninstall.sh

然后,重新运行 VBoxGuestAdditions 安装程序。卸载文件似乎不需要执行任何操作;它只需要干净地退出即可。

相关内容