LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-17-2018, 11:07 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 1,442

Rep: Reputation: 121Reputation: 121
The virtual machine has terminated unexpectedly during startup because of signal 6


I am attempting to shutdown, backup and restart a VirtualBox virtual machine. The restart command is the usual:
Code:
$ VBoxManage startvm vname
When I run this from a cron job the start fails with the message:
Code:
VBoxManage: error: The virtual machine 'WIN7VM' has terminated unexpectedly during startup because of signal 6
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine
When the cron job runs, the user is currently logged onto KDE (i.e. a GUI exists for this user). If the user open a Konsole and runs the same command, it works, but doesn't work in that user's crontab.

I've posted this on the virtualbox.org forum and they are suggesting I post this here as they feel this is more Linux related than VirtualBox related.

Any idea why I can run this from KDE/Konsole/command line, but not from cron?

Last edited by mfoley; 05-17-2018 at 11:09 PM.
 
Old 05-17-2018, 11:43 PM   #2
upnort
Member
 
Registered: Oct 2014
Distribution: Slackware, Proxmox, Debian, CentOS, Ubuntu MATE
Posts: 703

Rep: Reputation: Disabled
Quote:
Any idea why I can run this from KDE/Konsole/command line, but not from cron?
Environment variables?

DISPLAY
VBOX_USER_HOME

Possibly:
VBOX_PROGRAM_PATH

Try prefixing the cron job with DISPLAY=0:.0 VBOX_USER_HOME=${Default Machine Folder}? Default Machine Folder is defined in the VirtualBox GUI Preferences.
 
1 members found this post helpful.
Old 05-18-2018, 03:23 AM   #3
55020
Senior Member
 
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 1,279
Blog Entries: 4

Rep: Reputation: Disabled
cron jobs don't have any associated display, so you need to start the VM with
Code:
VBoxManage startvm name --type=headless
 
1 members found this post helpful.
Old 05-19-2018, 01:54 PM   #4
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 1,442

Original Poster
Rep: Reputation: 121Reputation: 121
upnort: I'll try the suggested environment variables. None of the VBOX_ variable seen to exist. DISPLAY, yes. I've already tried setting the cron path to be the same as the login path.

55020: But if I start headless, the logged in user cannot see the VM, right? Perhaps upnort's suggested DISPLAY=0:.0 will work ...

Last edited by mfoley; 05-19-2018 at 01:56 PM.
 
Old 05-19-2018, 02:16 PM   #5
upnort
Member
 
Registered: Oct 2014
Distribution: Slackware, Proxmox, Debian, CentOS, Ubuntu MATE
Posts: 703

Rep: Reputation: Disabled
Quote:
But if I start headless, the logged in user cannot see the VM, right? Perhaps upnort's suggested DISPLAY=0:.0 will work ...
True, but there are ways to access a headless system. One way is configure the system with SSH. Or, if the VM does not run X, use something like TigerVNC. Similar to TigerVNC, another way is use the VirtualBox built-in Remote Display support (VirtualBox GUI->Display->Remote Display). After enabling, use the rdesktop command (part of the stock Slackware) to view the VM console. For example, rdesktop -N ${hostname|ip address}:3389.

For VMs I trust I tend to use Bridge mode and configure the VM as part of the LAN. SSH works great with that. I have another system that I used to run headless and I used the rdesktop trick to access the VM console. The VirtualBox Remote Display support works with normal VMs too and not just headless.

With respect to the original post, I suspect mising environment variables. When I have seen that in the past, from a terminal window running in X I dump `env | sort` to a text file. Then in the cron job I configure something to dump the same results. Then compare to find the missing variables. I am sure the missing DISPLAY is part of the problem and the missing VBOX variables could be too. Usually the VBOX variables don't matter if using the standard VirtualBox install directories. Another possible missing variable with the cron job might be $HOME.
 
Old 05-20-2018, 11:45 AM   #6
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 1,442

Original Poster
Rep: Reputation: 121Reputation: 121
I got it!! If I specify the crontab as:
Code:
49 12 * * * /bin/bash -c "DISPLAY=:0 $HOME/backupVM >> $HOME/backupVM.log 2>&1"
It works. Putting "DISPLAY=:0" in the actual backupVM script does not work.

Yes, I do use bridge mode and the VMs are part of the LAN. To log into the VM from a remote Windows workstation, I just use Remote Desktop Connection. I've not had the need to connect to the VM from Linux so I haven't used rdesktop. As far as the user on the Linux workstation running rdesktop, that is still an additional step versus the VM just being there when she gets into the office.

Last edited by mfoley; 05-20-2018 at 11:52 AM.
 
1 members found this post helpful.
  


Reply

Tags
cron, kde, signal, virtual box


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi-thread terminated unexpectedly with POSIX threads Ericxx Programming 10 07-08-2013 12:41 AM
[SOLVED] Terminated by signal 13 bellsal Linux - Newbie 6 01-06-2011 10:19 PM
kdm[****]: X server for display :0 terminated unexpectedly http:// Linux - Newbie 2 07-14-2008 01:20 PM
:0 Display in loop then terminated unexpectedly PB0711 SUSE / openSUSE 1 01-18-2008 08:09 PM
Azureus TERMINATED. unexpectedly. J_7D5 Linux - Software 3 11-11-2005 06:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration