Virtualbox VM gets aborted if the X dies

Discussions related to using VirtualBox on Linux hosts.
Post Reply
devsk
Posts: 47
Joined: 6. Aug 2008, 22:15

Virtualbox VM gets aborted if the X dies

Post by devsk »

Hi,

First post here.

If X dies unexpectedly, why does the VM die with it? Technically, it can still keep running. This is major loss because it forces fsck/chkdsk on next boot of the guest.

I am using the binary distribution of virtualbox-1.6.2.
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Post by stefan.becker »

Why does word crash, if Windows crash?

Probably because its a windows application?!

You can start Guests with the Hosts using CLI Tools and connect to Guest via RDP/VNC. Then you dont have the Problem.
devsk
Posts: 47
Joined: 6. Aug 2008, 22:15

Post by devsk »

The window which has the VM running in it, will close because X that was serving that window died unexpectedly. The VM inside that window aborts and needs a restart.

The VM itself should not be windows application. only the display of the VM should be. May be they are tied together for a reason, but I don't understand that part.
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

devsk, have a look the Forum Posting Guide for help in framing Qs. Also use postreply to reply to a post and quote to pick up a specific quote to replay against. There's no point in quoting the entire post. It just makes it difficult for others to follow.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
Kitsune
Posts: 11
Joined: 22. Jan 2008, 03:48

Post by Kitsune »

I believe devsk is asking is for the the VirtualBox window in X to not be in the same process as the actual VM thats running, to simply be a front end (kinda like the way stefan mentioned).

I think a better solution to the problem would probably be to have VirtualBox attempt to save the guests' state if it loses its connection to the X server. Assuming the X server doesn't explode too badly, this should be possible.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Well, the problem is is that X is the 'parent' of the VB process. If the 'parent' dies, so does it's 'children', else they become 'zombies'. Just like what Stefan said, the starting process is tied to the X process. You can run VB from a command line by switching to a virtual terminal (TTY) so it runs outside X, then connect to the VM using RDP, VNC or any other remote control software.

For the explanation of 'parents', 'children' and 'zombies', please see:
http://en.wikipedia.org/wiki/Zombie_process
http://en.wikipedia.org/wiki/Parent_process
http://en.wikipedia.org/wiki/Child_process
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
devsk
Posts: 47
Joined: 6. Aug 2008, 22:15

Post by devsk »

Well, the problem is is that X is the 'parent' of the VB process.
you are kidding right? A parent is the process which does 'fork()' to spawn a child process. X doesn't do a spawn of VB processes. Its the shell running under xterm/konsole/g-t that does it. And the rest of the processes are spawned (whether as detached daemons e.g svc process, or as direct children) by that process.

In this case VB processes are more of a client to the X server. And clients can detect server death. VB code can detect that its connection with X has terminated and it needs to save the VM state before dying. There are examples of many processes which exit cleanly after their connection with X abruptly dies. Of course, if the code has hard coded throwing of a dialog saying "saving state", that's going to fall flat as well.

See, I am not that noob.... :P

Starting VM from CLI outside of X and then doing RDP into it, is a good workaround but not the solution.

Another option is that VB can do what vmware-server does. Decouple the console and the VM completely.
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

OK, where stdout is going? Or did you do a
  • nohup VBoxHeadless -s yourVM -p port 1>someRDPlog 2>&1 &
No your stdout is almost certainly connected to a gd served virtual device. You say
  • "VB code can detect that its connection with X has terminated and it needs to save the VM state before dying"
whilst what you should say is that "the VB code could potentially include detection of its stdout/stderr connection type and could establish an exit handler to detect if this device terminates and save the VM state before dying". This an enhancement request, because VB doesn't do that today. Write it up, register it with the Bugtrack system, and file it.

Look, something is pretty wrong with your system if X is crashing. This isn't a sort of high demand request. If you don't want this to crater your VM then run as I suggest above and connect to it with RDP. That way you can still shut it down cleanly through VBoxManage.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
Post Reply