How to shut down Ubuntu 11.10 host from within a Windows 7 VirtualBox guest?
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
1
down vote
favorite
I have installed virtual box 4.2 on a Ubuntu 11.10 host.
I have Windows 7 as the only guest OS.
I'm able to auto start Windows 7 virtual when Ubuntu boots by adding it in start application with the command "VBoxMange startvm Win7" in the command option.
Now when I shutdown Windows 7 , the virtualbox program is getting closed, but I go back to Ubuntu, when I want to have Ubuntu shut down as well when I click Shutdown in Windows 7 in Virtualbox.
This is an assignment for me. Can anybody please help me on this?
Also, when virtual box starts up automatically, Ubuntu's desktop should not be visible.
virtualbox shutdown
add a comment |Â
up vote
1
down vote
favorite
I have installed virtual box 4.2 on a Ubuntu 11.10 host.
I have Windows 7 as the only guest OS.
I'm able to auto start Windows 7 virtual when Ubuntu boots by adding it in start application with the command "VBoxMange startvm Win7" in the command option.
Now when I shutdown Windows 7 , the virtualbox program is getting closed, but I go back to Ubuntu, when I want to have Ubuntu shut down as well when I click Shutdown in Windows 7 in Virtualbox.
This is an assignment for me. Can anybody please help me on this?
Also, when virtual box starts up automatically, Ubuntu's desktop should not be visible.
virtualbox shutdown
1
It would have been a major design flaw indeeed, if guests could issue a shutdown command for for their hosts. I hope the designers of VirtualBox were smart enough to not allow something like that.
â mikewhatever
Jan 27 '13 at 13:34
2
This is such a curious request. Why don't you just install Windows 7 on your machine rather than running it within a VM?
â Paddy Landau
Jan 27 '13 at 13:52
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have installed virtual box 4.2 on a Ubuntu 11.10 host.
I have Windows 7 as the only guest OS.
I'm able to auto start Windows 7 virtual when Ubuntu boots by adding it in start application with the command "VBoxMange startvm Win7" in the command option.
Now when I shutdown Windows 7 , the virtualbox program is getting closed, but I go back to Ubuntu, when I want to have Ubuntu shut down as well when I click Shutdown in Windows 7 in Virtualbox.
This is an assignment for me. Can anybody please help me on this?
Also, when virtual box starts up automatically, Ubuntu's desktop should not be visible.
virtualbox shutdown
I have installed virtual box 4.2 on a Ubuntu 11.10 host.
I have Windows 7 as the only guest OS.
I'm able to auto start Windows 7 virtual when Ubuntu boots by adding it in start application with the command "VBoxMange startvm Win7" in the command option.
Now when I shutdown Windows 7 , the virtualbox program is getting closed, but I go back to Ubuntu, when I want to have Ubuntu shut down as well when I click Shutdown in Windows 7 in Virtualbox.
This is an assignment for me. Can anybody please help me on this?
Also, when virtual box starts up automatically, Ubuntu's desktop should not be visible.
virtualbox shutdown
edited Jan 27 '13 at 12:18
Eliah Kagan
79.2k20218359
79.2k20218359
asked Jan 27 '13 at 11:45
Bharath VRP
62
62
1
It would have been a major design flaw indeeed, if guests could issue a shutdown command for for their hosts. I hope the designers of VirtualBox were smart enough to not allow something like that.
â mikewhatever
Jan 27 '13 at 13:34
2
This is such a curious request. Why don't you just install Windows 7 on your machine rather than running it within a VM?
â Paddy Landau
Jan 27 '13 at 13:52
add a comment |Â
1
It would have been a major design flaw indeeed, if guests could issue a shutdown command for for their hosts. I hope the designers of VirtualBox were smart enough to not allow something like that.
â mikewhatever
Jan 27 '13 at 13:34
2
This is such a curious request. Why don't you just install Windows 7 on your machine rather than running it within a VM?
â Paddy Landau
Jan 27 '13 at 13:52
1
1
It would have been a major design flaw indeeed, if guests could issue a shutdown command for for their hosts. I hope the designers of VirtualBox were smart enough to not allow something like that.
â mikewhatever
Jan 27 '13 at 13:34
It would have been a major design flaw indeeed, if guests could issue a shutdown command for for their hosts. I hope the designers of VirtualBox were smart enough to not allow something like that.
â mikewhatever
Jan 27 '13 at 13:34
2
2
This is such a curious request. Why don't you just install Windows 7 on your machine rather than running it within a VM?
â Paddy Landau
Jan 27 '13 at 13:52
This is such a curious request. Why don't you just install Windows 7 on your machine rather than running it within a VM?
â Paddy Landau
Jan 27 '13 at 13:52
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
The way to do this is to write a script to start your VM, wait until it terminates, and then issue the shut-down command.
Create a folder bin
in your home folder (if it does not exist already).
Now create a file with the following contents. Let's call it win7vmshutdown
, and save it in your bin
folder.
#!/bin/bash
VBoxManage startvm 'Win7' # Start the VM.
sleep 10s # Give it time to start up.
while pgrep VirtualBox >/dev/null # As long as the VM is running...
do
sleep 5s # Wait a bit before trying again.
done
gnome-session-quit --power-off # Issue the command to shut down.
Make the script executable; enter the following in a Terminal.
chmod +x ~/bin/win7vmshutdown
In your Startup Applications, remove the VBoxManage ...
command and replace it with win7vmshutdown
.
The shutdown command will prompt you for shutdown; if you don't answer, it will shut down in 60 seconds. This gives you time to interrupt the shutdown in case of unexpected problems.
Reboot your computer to test.
You said:
Also, when virtual box starts up automatically, Ubuntu's desktop should not be visible.
To do that, you want to run your VM in full-screen. Install the Guest Additions in your VM, reboot it, and run it full-screen.
add a comment |Â
up vote
1
down vote
You need to create a script that runs on your Windows box that performs a coordinated shutdown of your systems.
From what I read, you want to trigger this from inside your Windows 7 VM.
For a scriptable shutdown of Windows 7, use the psshutdown
utility from SysInternals.
You will also need to signal your host to shut down. The best way to do this is to remotely trigger it using secure shell.
On the Ubuntu machine :
You should create a user specifically for this task, and an SSH key specifically for this user. This user will be running a script with elevated privileges and access to it should be at a minimum.
On the Windows machine :
You will need a means to run the script on the host machine via SSH. The Cygwin version of OpenSSH is probably the best option.
So your Windows script should
- Use SSH to start the script on the host
- Run
psshutdown -t 0 -k
The Ubuntu script should
- Be owned by root
- Have the setuid attribute on so that it will run with root privileges
sleep
for a period of time greater than the Windows machine shutdown- Execute
/sbin/poweroff
As for the other matter - if you don't want to see the Ubuntu desktop at any time, you can just not load it. Add a user X session that only starts the VirtualBox instance in full screen mode.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
The way to do this is to write a script to start your VM, wait until it terminates, and then issue the shut-down command.
Create a folder bin
in your home folder (if it does not exist already).
Now create a file with the following contents. Let's call it win7vmshutdown
, and save it in your bin
folder.
#!/bin/bash
VBoxManage startvm 'Win7' # Start the VM.
sleep 10s # Give it time to start up.
while pgrep VirtualBox >/dev/null # As long as the VM is running...
do
sleep 5s # Wait a bit before trying again.
done
gnome-session-quit --power-off # Issue the command to shut down.
Make the script executable; enter the following in a Terminal.
chmod +x ~/bin/win7vmshutdown
In your Startup Applications, remove the VBoxManage ...
command and replace it with win7vmshutdown
.
The shutdown command will prompt you for shutdown; if you don't answer, it will shut down in 60 seconds. This gives you time to interrupt the shutdown in case of unexpected problems.
Reboot your computer to test.
You said:
Also, when virtual box starts up automatically, Ubuntu's desktop should not be visible.
To do that, you want to run your VM in full-screen. Install the Guest Additions in your VM, reboot it, and run it full-screen.
add a comment |Â
up vote
3
down vote
The way to do this is to write a script to start your VM, wait until it terminates, and then issue the shut-down command.
Create a folder bin
in your home folder (if it does not exist already).
Now create a file with the following contents. Let's call it win7vmshutdown
, and save it in your bin
folder.
#!/bin/bash
VBoxManage startvm 'Win7' # Start the VM.
sleep 10s # Give it time to start up.
while pgrep VirtualBox >/dev/null # As long as the VM is running...
do
sleep 5s # Wait a bit before trying again.
done
gnome-session-quit --power-off # Issue the command to shut down.
Make the script executable; enter the following in a Terminal.
chmod +x ~/bin/win7vmshutdown
In your Startup Applications, remove the VBoxManage ...
command and replace it with win7vmshutdown
.
The shutdown command will prompt you for shutdown; if you don't answer, it will shut down in 60 seconds. This gives you time to interrupt the shutdown in case of unexpected problems.
Reboot your computer to test.
You said:
Also, when virtual box starts up automatically, Ubuntu's desktop should not be visible.
To do that, you want to run your VM in full-screen. Install the Guest Additions in your VM, reboot it, and run it full-screen.
add a comment |Â
up vote
3
down vote
up vote
3
down vote
The way to do this is to write a script to start your VM, wait until it terminates, and then issue the shut-down command.
Create a folder bin
in your home folder (if it does not exist already).
Now create a file with the following contents. Let's call it win7vmshutdown
, and save it in your bin
folder.
#!/bin/bash
VBoxManage startvm 'Win7' # Start the VM.
sleep 10s # Give it time to start up.
while pgrep VirtualBox >/dev/null # As long as the VM is running...
do
sleep 5s # Wait a bit before trying again.
done
gnome-session-quit --power-off # Issue the command to shut down.
Make the script executable; enter the following in a Terminal.
chmod +x ~/bin/win7vmshutdown
In your Startup Applications, remove the VBoxManage ...
command and replace it with win7vmshutdown
.
The shutdown command will prompt you for shutdown; if you don't answer, it will shut down in 60 seconds. This gives you time to interrupt the shutdown in case of unexpected problems.
Reboot your computer to test.
You said:
Also, when virtual box starts up automatically, Ubuntu's desktop should not be visible.
To do that, you want to run your VM in full-screen. Install the Guest Additions in your VM, reboot it, and run it full-screen.
The way to do this is to write a script to start your VM, wait until it terminates, and then issue the shut-down command.
Create a folder bin
in your home folder (if it does not exist already).
Now create a file with the following contents. Let's call it win7vmshutdown
, and save it in your bin
folder.
#!/bin/bash
VBoxManage startvm 'Win7' # Start the VM.
sleep 10s # Give it time to start up.
while pgrep VirtualBox >/dev/null # As long as the VM is running...
do
sleep 5s # Wait a bit before trying again.
done
gnome-session-quit --power-off # Issue the command to shut down.
Make the script executable; enter the following in a Terminal.
chmod +x ~/bin/win7vmshutdown
In your Startup Applications, remove the VBoxManage ...
command and replace it with win7vmshutdown
.
The shutdown command will prompt you for shutdown; if you don't answer, it will shut down in 60 seconds. This gives you time to interrupt the shutdown in case of unexpected problems.
Reboot your computer to test.
You said:
Also, when virtual box starts up automatically, Ubuntu's desktop should not be visible.
To do that, you want to run your VM in full-screen. Install the Guest Additions in your VM, reboot it, and run it full-screen.
edited Jan 27 '13 at 14:31
answered Jan 27 '13 at 13:52
Paddy Landau
3,07722243
3,07722243
add a comment |Â
add a comment |Â
up vote
1
down vote
You need to create a script that runs on your Windows box that performs a coordinated shutdown of your systems.
From what I read, you want to trigger this from inside your Windows 7 VM.
For a scriptable shutdown of Windows 7, use the psshutdown
utility from SysInternals.
You will also need to signal your host to shut down. The best way to do this is to remotely trigger it using secure shell.
On the Ubuntu machine :
You should create a user specifically for this task, and an SSH key specifically for this user. This user will be running a script with elevated privileges and access to it should be at a minimum.
On the Windows machine :
You will need a means to run the script on the host machine via SSH. The Cygwin version of OpenSSH is probably the best option.
So your Windows script should
- Use SSH to start the script on the host
- Run
psshutdown -t 0 -k
The Ubuntu script should
- Be owned by root
- Have the setuid attribute on so that it will run with root privileges
sleep
for a period of time greater than the Windows machine shutdown- Execute
/sbin/poweroff
As for the other matter - if you don't want to see the Ubuntu desktop at any time, you can just not load it. Add a user X session that only starts the VirtualBox instance in full screen mode.
add a comment |Â
up vote
1
down vote
You need to create a script that runs on your Windows box that performs a coordinated shutdown of your systems.
From what I read, you want to trigger this from inside your Windows 7 VM.
For a scriptable shutdown of Windows 7, use the psshutdown
utility from SysInternals.
You will also need to signal your host to shut down. The best way to do this is to remotely trigger it using secure shell.
On the Ubuntu machine :
You should create a user specifically for this task, and an SSH key specifically for this user. This user will be running a script with elevated privileges and access to it should be at a minimum.
On the Windows machine :
You will need a means to run the script on the host machine via SSH. The Cygwin version of OpenSSH is probably the best option.
So your Windows script should
- Use SSH to start the script on the host
- Run
psshutdown -t 0 -k
The Ubuntu script should
- Be owned by root
- Have the setuid attribute on so that it will run with root privileges
sleep
for a period of time greater than the Windows machine shutdown- Execute
/sbin/poweroff
As for the other matter - if you don't want to see the Ubuntu desktop at any time, you can just not load it. Add a user X session that only starts the VirtualBox instance in full screen mode.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
You need to create a script that runs on your Windows box that performs a coordinated shutdown of your systems.
From what I read, you want to trigger this from inside your Windows 7 VM.
For a scriptable shutdown of Windows 7, use the psshutdown
utility from SysInternals.
You will also need to signal your host to shut down. The best way to do this is to remotely trigger it using secure shell.
On the Ubuntu machine :
You should create a user specifically for this task, and an SSH key specifically for this user. This user will be running a script with elevated privileges and access to it should be at a minimum.
On the Windows machine :
You will need a means to run the script on the host machine via SSH. The Cygwin version of OpenSSH is probably the best option.
So your Windows script should
- Use SSH to start the script on the host
- Run
psshutdown -t 0 -k
The Ubuntu script should
- Be owned by root
- Have the setuid attribute on so that it will run with root privileges
sleep
for a period of time greater than the Windows machine shutdown- Execute
/sbin/poweroff
As for the other matter - if you don't want to see the Ubuntu desktop at any time, you can just not load it. Add a user X session that only starts the VirtualBox instance in full screen mode.
You need to create a script that runs on your Windows box that performs a coordinated shutdown of your systems.
From what I read, you want to trigger this from inside your Windows 7 VM.
For a scriptable shutdown of Windows 7, use the psshutdown
utility from SysInternals.
You will also need to signal your host to shut down. The best way to do this is to remotely trigger it using secure shell.
On the Ubuntu machine :
You should create a user specifically for this task, and an SSH key specifically for this user. This user will be running a script with elevated privileges and access to it should be at a minimum.
On the Windows machine :
You will need a means to run the script on the host machine via SSH. The Cygwin version of OpenSSH is probably the best option.
So your Windows script should
- Use SSH to start the script on the host
- Run
psshutdown -t 0 -k
The Ubuntu script should
- Be owned by root
- Have the setuid attribute on so that it will run with root privileges
sleep
for a period of time greater than the Windows machine shutdown- Execute
/sbin/poweroff
As for the other matter - if you don't want to see the Ubuntu desktop at any time, you can just not load it. Add a user X session that only starts the VirtualBox instance in full screen mode.
answered Jan 27 '13 at 13:58
Adrian
4,8261026
4,8261026
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f248211%2fhow-to-shut-down-ubuntu-11-10-host-from-within-a-windows-7-virtualbox-guest%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
It would have been a major design flaw indeeed, if guests could issue a shutdown command for for their hosts. I hope the designers of VirtualBox were smart enough to not allow something like that.
â mikewhatever
Jan 27 '13 at 13:34
2
This is such a curious request. Why don't you just install Windows 7 on your machine rather than running it within a VM?
â Paddy Landau
Jan 27 '13 at 13:52