It is currently Sat Nov 25, 2017 10:08 am
All times are UTC + 8 hours

[HOWTO] start and stop VM with your NAS.

Just about everything is virtual these days. Topics relating to virutalization go here.

Re: [HOWTO] start and stop VM with your NAS.

Postby sksbir » Mon Apr 10, 2017 3:14 pm

Hi

Code: Select all
VBoxManage list runningvms
gives you the running VMS.
sksbir
 
Posts: 245
Joined: Tue Aug 25, 2015 9:23 pm

Re: [HOWTO] start and stop VM with your NAS.

Postby duffoy » Tue Apr 11, 2017 11:12 pm

Thank you sksbir,

I know this command but what I looking for is a way to control in Logfile etc...to check if a VMs is really shut down gracefully or not.
If you testing the whole installation I think this is a important thing.
The first VM I used is working great, whit the 2 something is weird so have to check this.
Think the script is not used.
Is there a other limitation in /usr/local/etc/init.d/ of the certain levels I can use.
For shutdown I want use K47-K49 and for start the VM's S97-S99.

Best D.
duffoy
 
Posts: 13
Joined: Mon Jan 30, 2017 9:28 pm

Re: [HOWTO] start and stop VM with your NAS.

Postby sksbir » Fri Apr 21, 2017 4:27 am

duffoy wrote:Thank you sksbir,

I know this command but what I looking for is a way to control in Logfile etc...to check if a VMs is really shut down gracefully or not.
If you testing the whole installation I think this is a important thing.
The first VM I used is working great, whit the 2 something is weird so have to check this.
Think the script is not used.
Is there a other limitation in /usr/local/etc/init.d/ of the certain levels I can use.
For shutdown I want use K47-K49 and for start the VM's S97-S99.

Best D.

maybe you are right. I could not determine if NAS shutdown let enough time to VM to shutdown properly. To be sure, I use scheduler from VM OS to shutdown VM gracefully, and after that, use scheduler from NAS to reboot : after reboot, VM is brought up again.
sksbir
 
Posts: 245
Joined: Tue Aug 25, 2015 9:23 pm

Re: [HOWTO] start and stop VM with your NAS.

Postby duffoy » Fri Apr 21, 2017 4:37 pm

sksbirwrote:
maybe you are right. I could not determine if NAS shutdown let enough time to VM to shutdown properly. To be sure, I use scheduler from VM OS to shutdown VM gracefully, and after that, use scheduler from NAS to reboot : after reboot, VM is brought up again.


First thank you sksbir, can you describe where and how you setup this...will be great...

Best D.
duffoy
 
Posts: 13
Joined: Mon Jan 30, 2017 9:28 pm

Re: [HOWTO] start and stop VM with your NAS.

Postby sksbir » Fri Apr 21, 2017 5:10 pm

duffoy wrote:
sksbirwrote:
maybe you are right. I could not determine if NAS shutdown let enough time to VM to shutdown properly. To be sure, I use scheduler from VM OS to shutdown VM gracefully, and after that, use scheduler from NAS to reboot : after reboot, VM is brought up again.


First thank you sksbir, can you describe where and how you setup this...will be great...
Best D.

For example:
- my VM is under linux. I use crontab for schedule a shutdown ( without reboot ) , eg at 2.00 in the morning.
- with crontab from NAS, I schedule a reboot at 2.10

For more security, from NAS, you can schedule a script which will check if VM is really stopped, and reboot NAS only if ok, instead of directly schedule shutdown command.
sksbir
 
Posts: 245
Joined: Tue Aug 25, 2015 9:23 pm

Re: [HOWTO] start and stop VM with your NAS.

Postby duffoy » Sun Apr 23, 2017 12:05 am

@sksbir

I understand, but in my case the crontab is not usable.
I shutdown the VM only when the NAS shutdown in case of a signal from the USV or when the NAS is manualy shutdown.
In all other cases the NAS is running 24/7....

Best D.
duffoy
 
Posts: 13
Joined: Mon Jan 30, 2017 9:28 pm

Re: [HOWTO] start and stop VM with your NAS.

Postby Argamas » Sun May 21, 2017 8:49 am

One suggestion if I may... For VMs that could take a considerable amount of time to stop, it may be preferable to save the VM state instead of initiating a full shutdown.
Code: Select all
VBoxManage controlvm $VM_NAME savestate


As a side effect, the startup may be faster since restoring a state is often quicker than a full boot.

Of course, it all depends on what you have in your VMs and what you're doing but.... that could be worth considering.

As how to determine if the VM was shut down properly... The best way is to check the guest operating system. Windows will log an event ID, linux will often log stuff during reboot, because it will detect some filesystems may not have been unmounted correctly, and it will issue an fsck. As an exemple, an Ubuntu 14.04 VM using EXT4 filesystem would log into /var/log/dmesg a line that would look like this;
Code: Select all
EXT4-fs (dm-0): INFO: recovery required on readonly filesystem


A clean reboot where the filesystem has been unmounted correctly won't have that.

I hope this helps... Good luck.
Argamas
 
Posts: 2
Joined: Sun May 21, 2017 8:24 am

Re: [HOWTO] start and stop VM with your NAS.

Postby docb » Tue Sep 26, 2017 6:37 pm

Hi,
fist of all - thank you for this great script. I get a problem when executing, it shows the error:
Code: Select all
error while loading shared libraries: VBoxDDU.so: cannot open shared object file: No such file or directory

But the name of my VM exits and I changed it in you script. I changed the script to get closer to the error, but I always get the same error.
Here is my testscript:
Code: Select all
#!/bin/sh

PKG_PATH=/usr/local/AppCentral/virtualbox

VM_NAME="UbuntuServer"

source $PKG_PATH/CONTROL/env.sh
. /lib/lsb/init-functions

VBoxManage list runningvms


Do you have a hint for me where to look for the error?
Best regards
doc
docb
 
Posts: 30
Joined: Sat Sep 09, 2017 1:34 am

Re: [HOWTO] start and stop VM with your NAS.

Postby sksbir » Tue Sep 26, 2017 8:52 pm

Hi
Since when did you get this error ? did you recently updated to ADM 3 ? ( maybe some shared libraries no longer exists with ADM3 )
I'm not currently at home and thus cannot test myself.

try to add this line just after the first one:
Code: Select all
set -x

in order to get a more verbose output.

Out of that, vboxmanage command should work directly once connected to your NAS with ssh ( in my memory ) (EDIT: nope, it's wrong) . the environment settings commands which are added in my script are here in order to get the vboxmanage command working under stopping/starting global script.
Last edited by sksbir on Wed Sep 27, 2017 8:25 pm, edited 1 time in total.
sksbir
 
Posts: 245
Joined: Tue Aug 25, 2015 9:23 pm

Re: [HOWTO] start and stop VM with your NAS.

Postby docb » Tue Sep 26, 2017 11:46 pm

Hi,
my AS6302T was deliverd yesterday ;-) So I've got ADM 3.x and the error since I've tried yesterday ;-)
Virtualbox is installed an running perfectly. I tried your advice and added set +x. By the way - the vboxmanage command does not work on the ssh promt. Here is a copy of the promt:

Code: Select all
admin@AS:/volume1/Download/scripts $ ./VM_UbuntuServer_test.sh
+ PKG_PATH=/usr/local/AppCentral/virtualbox
+ VM_NAME=UbuntuServer
+ source /usr/local/AppCentral/virtualbox/CONTROL/env.sh
+ XORG_PATH=/usr/local/AppCentral/xorg
+ [ ! -e /usr/local/AppCentral/xorg/CONTROL/env.sh ]
+ source /usr/local/AppCentral/xorg/CONTROL/env.sh
+ PKG_PATH=/usr/local/AppCentral/xorg
+ export XORG_BIN_PATH=/usr/local/AppCentral/xorg/bin:/usr/local/AppCentral/xorg/usr/bin:/usr/local/AppCentral/xorg/usr/sbin:/usr/local/AppCentral/xorg/sbin:/usr/local/AppCentral/xorg/usr/libexec
+ export XORG_LD_LIBRARY_PATH=/usr/local/AppCentral/xorg/lib:/usr/local/AppCentral/xorg/usr/lib
+ export PATH=/usr/local/AppCentral/xorg/bin:/usr/local/AppCentral/xorg/usr/bin:/usr/local/AppCentral/xorg/usr/sbin:/usr/local/AppCentral/xorg/sbin:/usr/local/AppCentral/xorg/usr/libexec:/bin:/sbin:/usr/bin:/usr/sbin:/usr/builtin/bin:/usr/builtin/sbin:/usr/local/bin:/usr/local/sbin
+ export LD_LIBRARY_PATH=/usr/local/AppCentral/xorg/lib:/usr/local/AppCentral/xorg/usr/lib:/usr/lib64:/usr/lib
+ export PYTHONPATH=:/usr/local/AppCentral/xorg/usr/lib/python2.7/site-packages
+ export DISPLAY=:0
+ export XCURSOR_THEME=whiteglass
+ export XCURSOR_SIZE=48
+ export LD_PRELOAD=/usr/lib/preloadable_libiconv.so
+ export DEFAULT_AVOUTPUT=DP1
+ export EDID_PATH=/sys/class/drm/card0-DP-1/edid
+ DEBUG=flase
+ [ true == flase ]
+ PKG_PATH=/usr/local/AppCentral/virtualbox
+ export VIRTUALBOX_BIN_PATH=/usr/local/AppCentral/virtualbox/bin:/usr/local/AppCentral/xorg/bin:/usr/local/AppCentral/xorg/usr/bin:/usr/local/AppCentral/xorg/usr/sbin:/usr/local/AppCentral/xorg/sbin:/usr/local/AppCentral/xorg/usr/libexec
+ export PATH=/usr/local/AppCentral/virtualbox/bin:/usr/local/AppCentral/xorg/bin:/usr/local/AppCentral/xorg/usr/bin:/usr/local/AppCentral/xorg/usr/sbin:/usr/local/AppCentral/xorg/sbin:/usr/local/AppCentral/xorg/usr/libexec:/bin:/sbin:/usr/bin:/usr/sbin:/usr/builtin/bin:/usr/builtin/sbin:/usr/local/bin:/usr/local/sbin
+ export VIRTUALBOX_LD_LIBRARY_PATH=/usr/local/AppCentral/virtualbox/lib:/usr/local/AppCentral/xorg/lib:/usr/local/AppCentral/xorg/usr/lib
+ export LD_LIBRARY_PATH=/usr/local/AppCentral/virtualbox/lib:/usr/local/AppCentral/xorg/lib:/usr/local/AppCentral/xorg/usr/lib:/usr/lib64:/usr/lib
+ export DISPLAY=:0
+ DEBUG=flase
+ [ true == flase ]
+ . /lib/lsb/init-functions
+ FANCYTTY=
+ [ -e /etc/lsb-base-logging.sh ]
+ true
+ VBoxManage list runningvms
VBoxManage: error while loading shared libraries: VBoxDDU.so: cannot open shared object file: No such file or directory
admin@AS:/volume1/Download/scripts $ ./VBoxManage
-sh: ./VBoxManage: not found
admin@AS:/volume1/Download/scripts $ VBoxManage
-sh: VBoxManage: not found
admin@AS:/volume1/Download/scripts $ vboxmanage
-sh: vboxmanage: not found
admin@AS:/volume1/Download/scripts $


Thanks a lot for helping. This forum seemed to be very slow and unbusy, so I really hesitated to switch from my Sonology where the forums are great. But you really help to improve my opinion ;-)
By the way: I cannot open phpVirtualbox (the Virtualbox App on ADM Desktop). It only opens a tab which closes within miliseconds. The only way to set up Virtualbox is via the HDMI-Portal App. I have a different topic in this forum regarding this error, but just in case that problem could interfere with this here.
docb
 
Posts: 30
Joined: Sat Sep 09, 2017 1:34 am

PreviousNext

Return to Virtualization

  • You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot post attachments in this forum
  • Who is online

    Users browsing this forum: No registered users and 2 guests