Auto start scrip stopped working

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Jonners59
Posts: 45
Joined: 21. Jan 2011, 20:09
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows 7 32-bit Home Prem

Auto start scrip stopped working

Post by Jonners59 »

I have a script someone shared with me about 5 or so years ago to start up my VM when the machine is powered up. For some reason it has stopped working properly and does not start the image/guest OS.

The error I get is:

Code: Select all

--startvm is an option for the VirtualBox VM runner (VirtualBoxVM) application, not the VirtualBox Manager.
I do not know why this is, it worked fine for years.

The code/script is:

Code: Select all

/usr/bin/VirtualBox --startvm "Debian|80635bcd-57cd-4a6d-bba8-f46e63928cff" & VirtualBox --startvm "Debian" &
and the /usr/bin/VirtualBox is a shortcut/link to a script that has the following code:

Code: Select all

#!/bin/sh
## @file
# Oracle VM VirtualBox startup script, Linux hosts.
#

# written by Patrick Winnertz <patrick.winnertz@skolelinux.org> and
# Michael Meskes <meskes@debian.org>
# and placed under GPLv2
#
# this is based on a script by
# Oracle VirtualBox
#
# Copyright (C) 2006-2015 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#

PATH="/usr/bin:/bin:/usr/sbin:/sbin"

# VirtualBox installation directory
INSTALL_DIR="/usr/lib/virtualbox"

# Note: This script must not fail if the module was not successfully installed
#       because the user might not want to run a VM but only change VM params!

if [ ! -c /dev/vboxdrv ]; then
    cat << EOF
WARNING: The character device /dev/vboxdrv does not exist.
	 Please install the virtualbox-dkms package and the appropriate
	 headers, most likely linux-headers-$(uname -r | cut -d- -f3).

	 You will not be able to start VMs until this problem is fixed.
EOF
fi

SERVER_PID=`ps -U \`whoami\` | grep VBoxSVC | awk '{ print $1 }'`
if [ -z "$SERVER_PID" ]; then
    # Server not running yet/anymore, cleanup socket path.
    # See IPC_GetDefaultSocketPath()!
    if [ -n "$LOGNAME" ]; then
        rm -rf /tmp/.vbox-$LOGNAME-ipc > /dev/null 2>&1
    else
        rm -rf /tmp/.vbox-$USER-ipc > /dev/null 2>&1
    fi
fi

APP=`basename $0`
case "$APP" in
    VirtualBox|virtualbox)
        exec "$INSTALL_DIR/VirtualBox" "$@"
        ;;
    VBoxManage|vboxmanage)
        exec "$INSTALL_DIR/VBoxManage" "$@"
        ;;
    VBoxSDL|vboxsdl)
        exec "$INSTALL_DIR/VBoxSDL" "$@"
        ;;
    VBoxVRDP|VBoxHeadless|vboxheadless)
        exec "$INSTALL_DIR/VBoxHeadless" "$@"
        ;;
    VBoxAutostart|vboxautostart)
        exec "$INSTALL_DIR/VBoxAutostart" "$@"
        ;;
    VBoxBalloonCtrl|vboxballoonctrl)
        exec "$INSTALL_DIR/VBoxBalloonCtrl" "$@"
        ;;
    VBoxBugReport|vboxbugreport)
        exec "$INSTALL_DIR/VBoxBugReport" "$@"
        ;;
    VBoxDTrace|vboxdtrace)
        exec "$INSTALL_DIR/VBoxDTrace" "$@"
        ;;
    vboxwebsrv)
        exec "$INSTALL_DIR/vboxwebsrv" "$@"
        ;;
    *)
        echo "Unknown application - $APP"
        exit 1
        ;;
esac
exit 0
Any help please?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Auto start scrip stopped working

Post by scottgus1 »

The VM-running exe is now called VirtualboxVM.exe, not the old Virtualbox.exe. The 'runner' was separated from the main Virtualbox window's exe.

Try opening the main Virtualbox window, right-click a guest, and choose 'Create shortcut'. That shortcut's command line is the new 'runner'.
Jonners59
Posts: 45
Joined: 21. Jan 2011, 20:09
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows 7 32-bit Home Prem

Re: Auto start scrip stopped working

Post by Jonners59 »

THANK YOU!!!!

So basically the first script has changed to:

Code: Select all

/usr/lib/virtualbox/VirtualBoxVM --comment "Debian" --startvm "{4035005f-8e3c-4b11-9b2c-6b5f840bbc84}"
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Auto start scrip stopped working

Post by scottgus1 »

Great! Glad you're up and running.
Post Reply