Marc Allard
Explorer
- Joined
- Mar 16, 2014
- Messages
- 56
Hello,
I have installed a jail with virtual box.
After that I have installed a virtual machine (Nanoboot) and I have seen that when the virtual machine is running, when I shut down the host, the host will not shutdown but restart.
If I shut down the virtual machine before I click on the shutdown button all is fine.
I have tried with the method /etc/rc.conf
listed here http://wiki.sysconfig.org.uk/display/howto/VirtualBox On FreeBSD
and it doesn't work too.
The virtual machine crashes when I shut down the host.
So I guess something doesn't happen when I shutdown the host (the jail isn't aware or something like that.
I have also made a shell script in the jail (mnt/VHD/shutdown.sh) with a chmod 777 (simpler for debug)
and the script has the following lines
#!bin/sh
su vbox -c "VBoxManage controlvm NanobootXPEnology savestate"
When I execure it in a shell session (as root) there is no problem. (the machine stops normally)
When I execute it in a script (shutdown script) with the following command
jexec 1 /mnt/VHD/shutdown.sh
It doesn't work too.
Can you please tell me how I can let the host sleep when I want it down (or better)
Can you please tell me if there is a way to shut down the virtual machine automatically when I shut down the host so the host stays down and the machine closes normally?
Thank you
Marc
EDIT : Found a workaround
After some investigation
I have seen a workaround (not very good)
The problems seems to be because when there is a shutdown, the jails want to unmount the filesystem (I have seen a message telling impossible to unmount VHD as it is in use) before stopping the virtual machine.When it happens, the host crashes.
I have created a script on the jail that closes the running machine (you must not use the command directly
I do a
mount -uw / (to be able to change the /conf...
In the /conf/base/etc/rc.shutdown (and also /etc/rc.shutdown)
I add the following in the beginning of the file
/usr/sbin/jexec 1 /mnt/VHD/shutdown.sh
sleep 10
I am not sure if the sleep 10 is important but I prefer to be safe than sorry.
And my shutdown script in the jail must be
#!bin/sh
su vbox -c "/usr/local/bin/VBoxManage controlvm NanobootXPEnology savestate"
Without the /usr/local/bin/ the script works perfectly but not when I shutdown the jail)
I have to see a way to use the script without hardcoding the number 1 in jexec
Marc
I have installed a jail with virtual box.
After that I have installed a virtual machine (Nanoboot) and I have seen that when the virtual machine is running, when I shut down the host, the host will not shutdown but restart.
If I shut down the virtual machine before I click on the shutdown button all is fine.
I have tried with the method /etc/rc.conf
listed here http://wiki.sysconfig.org.uk/display/howto/VirtualBox On FreeBSD
and it doesn't work too.
The virtual machine crashes when I shut down the host.
So I guess something doesn't happen when I shutdown the host (the jail isn't aware or something like that.
I have also made a shell script in the jail (mnt/VHD/shutdown.sh) with a chmod 777 (simpler for debug)
and the script has the following lines
#!bin/sh
su vbox -c "VBoxManage controlvm NanobootXPEnology savestate"
When I execure it in a shell session (as root) there is no problem. (the machine stops normally)
When I execute it in a script (shutdown script) with the following command
jexec 1 /mnt/VHD/shutdown.sh
It doesn't work too.
Can you please tell me how I can let the host sleep when I want it down (or better)
Can you please tell me if there is a way to shut down the virtual machine automatically when I shut down the host so the host stays down and the machine closes normally?
Thank you
Marc
EDIT : Found a workaround
After some investigation
I have seen a workaround (not very good)
The problems seems to be because when there is a shutdown, the jails want to unmount the filesystem (I have seen a message telling impossible to unmount VHD as it is in use) before stopping the virtual machine.When it happens, the host crashes.
I have created a script on the jail that closes the running machine (you must not use the command directly
I do a
mount -uw / (to be able to change the /conf...
In the /conf/base/etc/rc.shutdown (and also /etc/rc.shutdown)
I add the following in the beginning of the file
/usr/sbin/jexec 1 /mnt/VHD/shutdown.sh
sleep 10
I am not sure if the sleep 10 is important but I prefer to be safe than sorry.
And my shutdown script in the jail must be
#!bin/sh
su vbox -c "/usr/local/bin/VBoxManage controlvm NanobootXPEnology savestate"
Without the /usr/local/bin/ the script works perfectly but not when I shutdown the jail)
I have to see a way to use the script without hardcoding the number 1 in jexec
Marc