I've ported the Windows script posted above to a shell script running under under macOS, effectively Linux. Originally I used the three separate VBoxManage commands as were found in the original script. I found that they could be combined into one command. In fact, if they weren't combined, it started 3 instances of VirtualBox.
I can get the PIWIS VM to start, however the setextradata command used to disable time sync with the host machine doesn't seem to be working. Similarly, the modifyvm option intended to set the PIWIS VM's clock back to a 2019 date also seems to have no effect.
I've run both of those commands separately (commented out in the code for now) and observe no error from VirtualBox.
Is anyone else running on a MacBook? If so, did you run into similar issues? If you did, would you share how you resolved them?
Thx!
Here's the code:
I can get the PIWIS VM to start, however the setextradata command used to disable time sync with the host machine doesn't seem to be working. Similarly, the modifyvm option intended to set the PIWIS VM's clock back to a 2019 date also seems to have no effect.
I've run both of those commands separately (commented out in the code for now) and observe no error from VirtualBox.
Is anyone else running on a MacBook? If so, did you run into similar issues? If you did, would you share how you resolved them?
Thx!
Here's the code:
#! /bin/sh
#set -x
VMname=PIWIS
VMdate=
(date -j -f "%a %d %b %Y %T %Z" "Wed 11 Sep 2019 11:17:49 EST" +"%s")
VBoxPath="/usr/local/bin/VirtualBox"
#VBoxPath="/Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/MacOS/VirtualBoxVM "
echo "\nVMname: $VMname, VMdate: $VMdate, VBoxPath: $VBoxPath\n"
CurrentDateMs=
date +%s
echo "\n CurrentDateMs: $CurrentDateMs\n"
# Date-Difference today to defined date
delta=$((VMdate - CurrentDateMs))
#==================================================================================
# Time-Sync with host disable
#cmd="$VBoxPath VBoxManage setextradata $VMname "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1"
#cmd="/Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/MacOS/VirtualBoxVM --comment Porsche VBoxManage --setextradata $VMname "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1"
#cmd="$VBoxPath --comment Porsche VBoxManage setextradata $VMname "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1"
cmd="$VBoxPath --comment Porsche VBoxManage setextradata $VMname "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1"
echo "\ncmd is: $cmd\n"
#$cmd &
#--------------------------------------------------------------------------------------------
# Set Offset
#cmd="/Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/MacOS/VirtualBoxVM --comment Porsche VBoxManage --modifyvm $VMname --biossystemtimeoffset $delta --no-startvm-errormsgbox"
#cmd="$VBoxPath VBoxManage modifyvm $VMname --biossystemtimeoffset $delta"
cmd="$VBoxPath --comment Porsche VBoxManage modifyvm $VMname biossystemtimeoffset $delta"
echo "\ncmd is: $cmd\n"
#$cmd &
#--------------------------------------------------------------------------------------------
# Start the virtual machine
#cmd="/Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/MacOS/VirtualBoxVM --comment Porsche --startvm PIWIS --no-startvm-errormsgbox"
# This works!
# This invocation starts the VM (within the currently running Oracle VM Manager session - if one is running)
#cmd="$VBoxPath --comment Porsche startvm $VMname no-startvm-errormsgbox"
echo "\ncmd is: $cmd\n"
#$cmd &
#--------------------------------------------------------------------------------------------
# How about a single VBoxManage command?
# This creates a single instance of the Oracle VM Manager, doesn't start the VM - and doesn't seem to disable time sync...
#cmd="$VBoxPath --comment Porsche VBoxManage setextradata $VMname "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" 1 -modifyvm $VMname --biossystemtimeoffset $delta startvm $VMname no-startvm-errormsgbox"
# Let's try the other path
# Starts the VM w/out the Oracle VM Manager - time synce still not disabled...
cmd="/Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/MacOS/VirtualBoxVM --comment Porsche VBoxManage --setextradata $VMname \"VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled\" 1 --modifyvm $VMname --biossystemtimeoffset $delta --startvm $VMname --no-startvm-errormsgbox"
echo "\ncmd is: $cmd\n"
$cmd &
exit