LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 04-29-2011, 06:31 AM   #1
zoran119
Member
 
Registered: Dec 2007
Posts: 217

Rep: Reputation: 18
how do you manage your virtual machines?


hi everyone,

i'm setting up some virtual machines using slackware as the host (what else) and qemu. i'm working with virt-manager and it's less than nice (cannot pick some menu options, there isn't a nice way of disabling the network card, chooses qemu instead of kvm for the machine type....). what else is out there to use? how do you manage your virtual machines?
 
Old 04-29-2011, 08:15 AM   #2
hitest
Guru
 
Registered: Mar 2004
Location: Canada
Distribution: Void, Debian, Slackware, VMs
Posts: 7,342

Rep: Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746
Qemu does a good job with virtual machines. I also like using virtualbox which can be found at slackbuilds.org.

http://slackbuilds.org/repository/13...em/virtualbox/
 
Old 04-29-2011, 08:19 AM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
I use VirtualBox (which is easy to enable or disable stuff in); sorry never tried anything else but VMware so I can't speak to gemu.

Be that as it may, my virtual machines are in a separate partition mounted to /var/lib/virtual (just because that's where I first did it for no particularly good reason). What this does is allow me to do a clean install of Slackware (13.37 is released, eh?) without overwriting the virtual machines -- you just don't format the partition when you're adding to fstab. That's something I'd do no matter what just 'cause backing the blasted things up somewhere is... well, say, difficult when they're 20G to larger and there are three or four of them. Of course a second drive works just fine, too.

Hope this helps some.
 
Old 04-29-2011, 08:54 AM   #4
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,181

Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
Quote:
Originally Posted by zoran119 View Post
hi everyone,

i'm setting up some virtual machines using slackware as the host (what else) and qemu. i'm working with virt-manager and it's less than nice (cannot pick some menu options, there isn't a nice way of disabling the network card, chooses qemu instead of kvm for the machine type....). what else is out there to use? how do you manage your virtual machines?
When I used KVM I used scripts to set it all up.

First I loaded the necessary modules - kvm, kvm-intel, tun and dummy (I attached VIFs to the dummy interface on the host):

Code:
# load kvm kernel modules
echo "Load KVM kernel modules ... "
/usr/bin/sudo /sbin/modprobe kvm
/usr/bin/sudo /sbin/modprobe kvm-intel
/usr/bin/sudo /sbin/modprobe tun
/usr/bin/sudo /sbin/modprobe dummy

# grant kvm group permissions on
# newly-created /dev/kvm and /dev/net
echo "Fix permissions ... "
/usr/bin/sudo /bin/chown root.kvm /dev/kvm
/usr/bin/sudo /bin/chown -R root.kvm /dev/net
/usr/bin/sudo /bin/chmod -R 770 /dev/net
Then I created a bridge and attached the dummy interface to it:
Code:
# create a bridge and bring it up
echo "Create bridge and bring it up ... "
/usr/bin/sudo /sbin/ip addr flush dummy0
/usr/bin/sudo /sbin/ifconfig dummy0 0.0.0.0
/usr/bin/sudo /sbin/brctl addbr br0
/usr/bin/sudo /sbin/brctl stp br0 off
/usr/bin/sudo /sbin/brctl setfd br0 0
/usr/bin/sudo /sbin/brctl sethello br0 1
/usr/bin/sudo /sbin/brctl addif br0 dummy0
/usr/bin/sudo /sbin/ifconfig br0 172.16.1.40

sleep 5s
Then I generated a random MAC address for the guest:
Code:
# generate some random MAC addresses for the guest
echo "Generate random MAC addresses for guests ... "
ranmac0=$(echo -n DE:AD:BE:EF ; for i in `seq 1 2` ; do echo -n `echo ":$RANDOM$RANDOM" | cut -n -c -3` ;done)
After this I created a tap interface for the guest to use and I attached it to the bridge:
Code:
# create a TAP interface and add it to the bridge
echo "Create TAP interface ... "
/usr/bin/sudo /usr/sbin/tunctl -u gerard -g kvm -t tap0
echo "Bring TAP interface up ... "
/usr/bin/sudo /sbin/ip link set tap0 up
sleep 2s
echo "Add TAP interface to bridge ... "
/usr/bin/sudo /usr/sbin/brctl addif br0 tap0
And finally I started the virtual machine with the new tap0 as its VIF:
Code:
# start virtual machine
echo "Starting Virtual Machine ... "
sleep 3s
qemu-system-x86_64 -cpu host -localtime -usb \
	-vga std -daemonize \
	-usbdevice tablet -soundhw all \
	-net nic,macaddr=$ranmac0 \
	-net tap,ifname=tap0,script=no,downscript=no \
	-hda /dev/volgroup/lv_centos \
	-cdrom /mnt/iso/centos5.iso \
	-boot d -m 1280 -vnc :1
None of this is hard to learn and it gives you control over everything. Needless to say I was helped greatly by other users with all of these steps and most of it is taken from their work but the key thing is that I understand it. I would still be using Windows if I found the GUI as flexible and powerful as the shell in Linux/BSD.

Last edited by Gerard Lally; 04-29-2011 at 08:56 AM.
 
Old 04-29-2011, 08:55 AM   #5
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
I use Qemu and to manage them I just set up aliases or scripts so I can just type 'freebsd' etc. in a term. Seems like the simplest way of doing it. Could also just add an item in fluxbox menu to do it too.

You could have aliases that say run qemu with nic support if you wanted I guess.
 
Old 04-29-2011, 09:04 AM   #6
zoran119
Member
 
Registered: Dec 2007
Posts: 217

Original Poster
Rep: Reputation: 18
yeah... scripts/aliases seems so much better than some crappy virsh/virt-manager "solution". thanks for the examples! a bit of doco reading and i'll be ok. the problem i'm having now is that windows 7 doesn't work (without -no-kvm switch). it gives this error on startup:

Code:
kvm: vm entry failed with error 0x80000021

If you're runnning a guest on an Intel machine without
unrestricted mode support, the failure can be most likely
due to the guest entering an invalid state for Intel VT.
For example, the guest maybe running in big real mode
which is not supported on less recent Intel processors.

kvm_run returned -22
anyone got any idea what this might be?
 
Old 04-29-2011, 09:08 AM   #7
manwichmakesameal
Member
 
Registered: Aug 2006
Distribution: Slackware
Posts: 804

Rep: Reputation: 110Reputation: 110
gezley, I'll certainly be using some of your stuff there. Just so I can feel like I'm contributing, here is the script I use to start my VM's:

Code:
#/bin/bash

DISK=opensuse.img
DISKDIR=/home/$USER/qemu-disks

echo -e "Checking for disks..."

# Checking for disk image
if [ -e $DISKDIR/$DISK ] && [ -x /usr/bin/qemu-system-x86_64 ]; then
	echo -e "Found $DISK, initiating VM..." && \
	qemu-system-x86_64 -m 1024 -hda $DISKDIR/$DISK -usb
else
	echo -e "Cannot start VM...."
fi
 
Old 04-29-2011, 10:13 AM   #8
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,181

Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
Quote:
Originally Posted by manwichmakesameal View Post
gezley, I'll certainly be using some of your stuff there. Just so I can feel like I'm contributing, here is the script I use to start my VM's:

Code:
#/bin/bash

DISK=opensuse.img
DISKDIR=/home/$USER/qemu-disks

echo -e "Checking for disks..."

# Checking for disk image
if [ -e $DISKDIR/$DISK ] && [ -x /usr/bin/qemu-system-x86_64 ]; then
	echo -e "Found $DISK, initiating VM..." && \
	qemu-system-x86_64 -m 1024 -hda $DISKDIR/$DISK -usb
else
	echo -e "Cannot start VM...."
fi
Yours is far more elegant manwichmakesameal; I'm learning slowly as I go along!
 
Old 04-29-2011, 10:34 AM   #9
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,105

Rep: Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178
FYI, here I'm happy with virt-manager too
I'm using it on l33t building some additional packages with this sbopkg queue (through my slackbuilds.org fork for current where I updated some stuff, selectable in sbopkg - thanks again, slakmagik)
Code:
ORBit2
GConf
gvfs
libtasn1
libgnome-keyring
gnome-keyring
rarian
tunctl
pycurl
urlgrabber
gtk-vnc
qemu-kvm | BUILD_ARCH=x86_64 KVMGROUP=users
libvirt | VIRTGROUP=users
virtinst
gnome-python
virt-manager
the only additional thing is that you have to create a symlink, to make libvirt able to find the qemu/kvm binary
Code:
ln -s /usr/bin/qemu-system-x86_64 /usr/bin/kvm
I use also lxc with some l33t containers in production, hope to find time to write something about it (I think I'll grab the occasion when I have to setup another node)

all of this is fine with the stock kernels in l33t: if you're using a custom kernel there are some module reccomendations (and in this case you should have a look at the docs).

Last edited by ponce; 04-29-2011 at 12:48 PM.
 
  


Reply



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
Software to manage crontab on multiple machines xxmsaxx Linux - Server 5 11-13-2009 08:39 AM
Connect two virtual linux machines via virtual USB or serial WebBeing Linux - General 4 07-22-2008 07:26 AM
LXer: Create and Manage Virtual Machines Using VirtualBox in Ubuntu LXer Syndicated Linux News 0 01-22-2007 12:54 PM
LXer: Remotely Manage Machines Using VNC LXer Syndicated Linux News 0 11-02-2006 01:33 AM
manage ms machines via linux codenjanod Linux - General 1 10-10-2006 08:01 AM

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

All times are GMT -5. The time now is 09:56 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