LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-21-2014, 06:47 AM   #1
jokar.mohsen
Member
 
Registered: Jul 2008
Location: Tehran
Posts: 441

Rep: Reputation: 22
Unhappy Run VirtualBox at Startup


Hello Dears.
I want to Run my VMs on VirtualBox when system is started. I use Fedora and edit "/home/hamshary/.bash_profile" and add two lines to it :

VBoxManage startvm 1
VBoxManage startvm 2

but it started when I login to system, I want it is started without Login to system.
How can I do it?

Cheers.
 
Old 10-21-2014, 09:55 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,926

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by jokar.mohsen View Post
Hello Dears.
I want to Run my VMs on VirtualBox when system is started. I use Fedora and edit "/home/hamshary/.bash_profile" and add two lines to it :

VBoxManage startvm 1
VBoxManage startvm 2

but it started when I login to system, I want it is started without Login to system. How can I do it?
Again, as with pretty much ALL of your other threads, you provide few useful details. As you've been asked MANY times before, what VERSION of Fedora??? And the VERY FIRST HIT in Google for "how to run a program at system startup on fedora" is:
http://docs.fedoraproject.org/en-US/...-run-boot.html

...amazingly, from the Fedora site, with instructions. Is there some reason you can't perform such basic research after so many times getting ASKED to?
 
Old 10-21-2014, 11:06 AM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Put it in your cron, eg:
Code:
@reboot /usr/bin/nohup /usr/bin/vboxheadless -e "TCP/Ports"=3389 -s "VM Name" &> $HOME/logs/vmname.log &
vboxheadless is a MUCH better way to start up VMs autonomously on boot than trying to launch an interactive GUI VM manager, especially since you want it to start up on boot BEFORE you log in, which means there is no X server for it to open on.

When you open it on vboxheadless, you can connect to the GUI with rdesktop using the port specified by "TCP/Ports" and manage it like you would normally.

Last edited by suicidaleggroll; 10-21-2014 at 11:15 AM.
 
Old 10-22-2014, 05:43 AM   #4
jokar.mohsen
Member
 
Registered: Jul 2008
Location: Tehran
Posts: 441

Original Poster
Rep: Reputation: 22
Post

Quote:
Originally Posted by suicidaleggroll View Post
Put it in your cron, eg:
Code:
@reboot /usr/bin/nohup /usr/bin/vboxheadless -e "TCP/Ports"=3389 -s "VM Name" &> $HOME/logs/vmname.log &
vboxheadless is a MUCH better way to start up VMs autonomously on boot than trying to launch an interactive GUI VM manager, especially since you want it to start up on boot BEFORE you log in, which means there is no X server for it to open on.

When you open it on vboxheadless, you can connect to the GUI with rdesktop using the port specified by "TCP/Ports" and manage it like you would normally.
Hello.
Thank you for reply but can you tell me that why I must use a TCP/Port? My VMs use Bridge NIC and I guess that I don't need this port!!!!! In your opinion with out this TCP option can I connect to guests?

Thanks.
 
Old 10-22-2014, 07:19 AM   #5
jokar.mohsen
Member
 
Registered: Jul 2008
Location: Tehran
Posts: 441

Original Poster
Rep: Reputation: 22
If I create an SH file in /etc/init.d/ and write below line :

VBoxHeadless --startvm "testvm" &

and then use "chmod +x" , can it start when system is booted? Can my VM run automatically?


Thanks.
 
Old 10-22-2014, 10:02 AM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by jokar.mohsen View Post
Hello.
Thank you for reply but can you tell me that why I must use a TCP/Port? My VMs use Bridge NIC and I guess that I don't need this port!!!!! In your opinion with out this TCP option can I connect to guests?

Thanks.
Bridge vs NAT makes absolutely no difference. You're not connecting to the client on that port, you're connecting to the host. It lets you see and control the VM through the entire boot process, not just when it's in the OS (ever used IPMI? It's like that).

For example, say you're ssh'd into your guest, and you make some change that shuts down the NIC. Maybe you accidentally ran an ifdown, forgetting that once it's down you won't be able to run ifup again, or maybe you made a typo in sshd.config and the ssh server won't come back up. You can connect to that RDP port and manage the system regardless of the guest's network connection status, you only need to be able to access the host.

The RDP server runs automatically with vboxheadless, the "TCP/Port" argument just lets you control the listening port. 3389 is the default, but I just provided it in my post so you could change it. Every VM you run headlessly will need its own unique port on the host. You'll also need to install the VBox extensions for it to work properly.

Last edited by suicidaleggroll; 10-22-2014 at 10:13 AM.
 
Old 10-22-2014, 10:05 AM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by jokar.mohsen View Post
If I create an SH file in /etc/init.d/ and write below line :

VBoxHeadless --startvm "testvm" &

and then use "chmod +x" , can it start when system is booted? Can my VM run automatically?


Thanks.
Unless you want vbox to run as root, don't put it in init.d. Put it in your user's crontab using the "@reboot" directive.
The command I gave you is an exact cut and paste from the crontab of one of my systems (except I changed the VM name and log file location). That user on my system starts up four VMs on boot that way, and the four lines in crontab look exactly like the one I posted, other than the port and name.

Last edited by suicidaleggroll; 10-22-2014 at 10:08 AM.
 
Old 10-25-2014, 05:59 AM   #8
jokar.mohsen
Member
 
Registered: Jul 2008
Location: Tehran
Posts: 441

Original Poster
Rep: Reputation: 22
Thank you so much for your info.
Can I use your command to run two VMs? I mean is below command :

@reboot /usr/bin/nohup /usr/bin/vboxheadless -e "TCP/Ports"=3389 -s "VM Name" &> $HOME/logs/vmname.log &

Cheers.
 
Old 10-25-2014, 06:52 AM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,926

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by jokar.mohsen View Post
Thank you so much for your info.
Can I use your command to run two VMs? I mean is below command :

@reboot /usr/bin/nohup /usr/bin/vboxheadless -e "TCP/Ports"=3389 -s "VM Name" &> $HOME/logs/vmname.log &

Cheers.
Is there a reason you don't just TRY IT? You've been given answers/help, but you actually have to DO something to get results.
 
  


Reply


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
[SOLVED] Installing VirtualBox*.run * Oracle*.run on Slackware 14 - Help/Information lkraemer Slackware 3 10-09-2012 10:08 AM
VirtualBox Issue - /etc/init.d/vboxdrv setup - startup HeyDev Linux - Newbie 9 10-05-2011 07:57 AM
VirtualBox Issue - /etc/init.d/vboxdrv setup - startup HeyDev Linux - Software 2 08-12-2011 08:50 PM
[SOLVED] VirtualBox: how to start and shutdown guests VMs on startup matiasar Linux - Software 3 06-23-2010 10:01 AM
I run Fedora 9 and I boot from USB, how I run at startup Firewall and antivirus? gginis Linux - Software 3 06-08-2008 04:19 AM


All times are GMT -5. The time now is 04:28 PM.

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