LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 09-07-2011, 04:01 AM   #1
dman777
Member
 
Registered: Dec 2010
Distribution: Gentoo
Posts: 232

Rep: Reputation: 8
Starting a KVM guest on boot up


Code:
[one@host179 ~]$ cat kvm_startup.sh 
#!/bin/bash

sleep 5

/usr/libexec/qemu-kvm -net nic -net user -m 900 /mnt/guests/guest1.img& 

sleep 4

/usr/bin/xterm -e /usr/bin/vncviewer 127.0.0.1:5900 
[one@host179 ~]

I want to start a kvm guest on boot up. I'm using gnome desktop in which I wrote the above script and have gnome start it when the user logs in.

Is this the best way or is there a better/more efficient way?
 
Old 09-07-2011, 04:25 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
starting on boot is *NOT* starting when a user logs in, they are TOTALLY different things. A user will often never log in to a server after it's booted.
 
Old 09-07-2011, 03:36 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,921

Rep: Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618
Looks pretty basic to me. As above you have to choose why and how you need to use it but the script seems like it should work. Might ask that in coding section, they do this all the time and it might be a better place for your question.

An error detection may help.
 
Old 09-13-2011, 08:02 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,599
Blog Entries: 4

Rep: Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905
Every operating-system has the ability to start "services" (a.k.a. "daemons") at boot-time, and you can define your VM as a "service."

Conceptually, you should define a new user-id and group on your Linux box which is "what the VM service-processes run in," and you set up the service definition (in whatever way is appropriate for your particular distro) so that the KVM process is launched under that user-id automagically at startup. You'll need to arrange for logging messages to be recorded (and probably to be handled by "logrotate"), just as with any other service.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] CentOS 5.6 KVM Guest - Boot Failed: Not a bootable disk interpos Linux - Virtualization and Cloud 7 07-13-2011 06:01 AM
LXer: Set up Spicevmc Channel on Ubuntu 11.04 as KVM Server and spice-vdagent as a KVM guest LXer Syndicated Linux News 0 06-15-2011 07:10 PM
[SOLVED] Slackware64 13.37 KVM GUEST Xorg segfaults when starting KDE (workaround) rtguille Slackware 2 05-15-2011 05:13 PM
Slackware64 -current kvm guest boot issue rpedrica Slackware 10 03-31-2011 10:15 AM
[SOLVED] migrating from vmware to kvm, lvm partitioned guest failed to boot chakoshi Linux - Virtualization and Cloud 3 03-20-2011 04:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 10:15 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
Open Source Consulting | Domain Registration