On Thu, Oct 27, 2011 at 10:17:34PM +1100, Brett wrote:
> After creating a virtual.img, I then try: $ qemu-system-x86_64 -m 200
> -monitor stdio -no-fd-bootchk -hda virtual.img -cdrom
> debian-6.0.3-amd64-CD-1.iso -boot d
> 
> The initial boot message and installer menu appears, however when I
> select something (eg install or graphical install) the screen then
> blanks indefintely, and looking at top, qemu-system starts at about 7%
> cpu usage, then climbs to 98% over a few minutes. 

Have you tried with an x86 linux distro and 'qemu' instead of
'qemu-system-x86_64'?

Also try booting linux with vga=normal to make sure the linux kernel doesn't
try to use a framebuffer. Maybe that will help.

> Is there a known working linux distro I could try?

OpenSUSE 11.4 works well for me as an x86 guest on an amd64 OpenBSD host
with qemu-0.15.0p1.
The install CD and the installed system only boot in 'safe' mode
though (in the boot menu, hit F5 and select 'Safe Settings').
This tweaks a huge bunch of kernel parameters. I haven't been
patient enough to figure out which one of them is causing trouble.

Below is the script I use to start the VM from CD.
I use tun networking which allows the VM to behave like any other host
on the local network. It requires a qemu/* anchor in /etc/pf.conf, and also
the line 'Defaults:YOURUSERNAME closefrom_override' in /etc/sudoers.
tun12 might not exist on your system, so create it using /dev/MAKEDEV
or use a different one.
Replace re0 with the network interface of your host.

> Also, launching as a normal user, the highest I can specify -m is 330
> (with a "Failed to allocate memory: Cannot allocate memory" message),
> while using the above command as root, I can set -m to (eg) 2660. Is
> there a sysctl or other setting that will allow a higher memory
> allocation as normal user?

Yes, 'ulimit -d'.
You might also have to tweak datasize-max for your user's login class
in /etc/login.conf.


#!/bin/sh
set -x

iface1=tun12
iface2=re0

sudo ifconfig $iface1 create link0 up
sudo ifconfig bridge3 create
sudo ifconfig bridge3 add $iface1
sudo ifconfig bridge3 add $iface2
sudo ifconfig bridge3 up
printf "pass quick on {$iface1 $iface2} no state\n" | sudo pfctl -a 
qemu/opensuse -f -
ulimit -d 1048576
sudo sh -c "sudo -C 5 -u $USER qemu -name opensuse -m 512 \
        -hda ~/vm/opensuse.img \
        -boot d -cdrom ~/vm/openSUSE-11.4-NET-i586.iso \
        -net nic,macaddr=52:54:00:12:34:64,vlan=1 \
        -net tap,vlan=1,fd=3 \
        3<>/dev/$iface1"
sudo pfctl -a qemu/opensuse -Fa
sudo ifconfig $iface1 destroy
sudo ifconfig bridge3 destroy

Reply via email to