View Full Version : HOWTO: QEMU on FreeBSD
vermaden
November 16th, 2008, 22:54
I wrote short qemu howto install/usage on FreeBSD as host os, and in this example with Win2000 as guest os.
changelog:
1. removed useless /etc/qemu-ifup script [it was used in older versions of qemu with tap/bridge interfaces]
2. added info about sound emulation inside qemu OS.
3. removed HACKS_CIRRUS from options [thx to scottro sugestion], reason here: http://forums.bsdnexus.com/viewtopic.php?pid=14036#p14036
4. sometimes OS installation requires unload of kqemu. short: install without kqemu and the use with kqemu
Install qemu with options showed below:
# cd /usr/ports/emulators/qemu && make install clean
Options for qemu:
[X] KQEMU Build with (alpha!) accelerator module
[ ] HACKS_CIRRUS Large display speedup (buggy!)
[ ] RTL8139_TIMER allow use of re(4) nic with FreeBSD guests
[ ] SAMBA samba dependency (for -smb)
[X] SDL SDL/X dependency (graphical output)
[X] CDROM_DMA IDE CDROM DMA
install and configure sudo:
# cd /usr/ports/security/sudo && make install clean
sudo config:
# cat > /usr/local/etc/sudoers << EOF
root ALL=(ALL) ALL
username ALL=(ALL) NOPASSWD: ALL
EOF
username is YOU.
load needed modules:
# sudo kldload aio
# sudo kldload kqemu
create Windows2000 install CD image, use cat or dd:
% cat /dev/acd0 > ~/qemu/win2k.iso
% dd bs=2048 if=/dev/acd0 of=~/qemu/win2k.iso
create qemu image for new OS:
% qemu-img create -f qcow2 ~/qemu/win2000.img 4G
install new os, Windows2000 in our example:
% qemu -boot d -hda ~/qemu/win2000.img -m 128 -cdrom ~/qemu/win2k.iso -win2k-hack -localtime
if You have any problems while installing the OS then unload kqemu module and install again, then after install, load the kqemu module again:
% sudo kldunload kqemu
% qemu -boot d -hda ~/qemu/win2000.img -m 128 -cdrom ~/qemu/win2k.iso -win2k-hack -localtime
% sudo kldload kqemu
typical usage of OS under qemu:
% qemu -hda ~/qemu/win2000.img -m 256 -localtime
typical usage of OS under qemu in snapshot mode [to commit made changes hit left_CTRL+left_ALT+2 and type commit]:
% qemu -hda ~/qemu/win2000.img -m 256 -localtime -snapshot
1. to switch focus between qemu mouse focus and X11 mouse focus use: left_CTRL+left_ALT
2. to ensure that You use kqemu kernel module in user mode hit left_CTRL+left_ALT+2 and type info kqemu, if everything is ok You will see:
kqemu support: enabled for user code
if not You will see:
kqemu support: disabled
if disabled it will work, but terribly slow, You will be running at Pentium 75 speed at host with CPU AthlonXP 1.66GHz.
3. to switch between qemu console and qemu os emualtion use left_CTRL+left_ALT+2 to go to console and left_CTRL+left_ALT+1 to back to emulation.
4. enabling network on emulated os, use DHCP configuration inside emulated os to get automatic IP adress 10.x.x.x
after You quit You os inside emulated os, or by qemu console left_CTRL+left_ALT+2 and type quit use this command to launch again Your emulated OS:
% qemu -hda ~/qemu/win2000.img -m 256 -localtime
How to have sound in qemu OS, You just need to launch qemu the way I listed above, only with -soundhw sb16 or -soundhw es1370 to emulate Sound Blaster 16, or Sound Blaster 128. You can also enable standart annoying BEEP with -soundhw pcspk. You can also enable all three of them like that: -soundhw sb16,es1370,pcspk, or just BEEP + one of them: -soundhw es1370,pcspk, examples
% qemu -hda ~/qemu/win2000.img -m 256 -localtime -soundhw pcspk
% qemu -hda ~/qemu/win2000.img -m 256 -localtime -soundhw es1370,pcspk
% qemu -hda ~/qemu/win2000.img -m 256 -localtime -soundhw es1370,pcspk,sb16
fluxbox add-on:
in ~/.fluxbox/apps:
# qemu
[app] (class=SDL_App)
[Workspace] {2}
[Deco] {BORDER}
[end]
resources:
man qemu-img
man qemu
man aio
man dd
man cat
http://kidsquid.com/cgi-bin/moin.cgi/QuickStartGuide
http://qemu-forum.ipi.fi/qemu-snapshots/
http://qemu-forum.ipi.fi/
http://qemu.org/user-doc.html
http://en.wikipedia.org/wiki/QEMU
The same schema works for Solaris 10 and WindowsXP, You only do not use -win2k-hack.
feel free to point errors, typo and Your hints/suggestions here.
SPlissken
November 20th, 2008, 21:32
Incredible , thanks for this
Here is 2 screenshots
http://splissken.free.fr/Images/Divers/_thumb/2008-11-20-192507_Qemu1.png (http://splissken.free.fr/Images/Divers/2008-11-20-192507_Qemu1.png)
And this one, WinXP Service Pack 3 and video using Flash on french website Allocine (talking about movie)
No problem while watching the video, sound working too
http://splissken.free.fr/Images/Divers/_thumb/2008-11-20-212408_Qemu2.png (http://splissken.free.fr/Images/Divers/2008-11-20-212408_Qemu2.png)
lme@
November 20th, 2008, 22:00
How fast does XP run with kqemu?
SPlissken
November 20th, 2008, 22:11
Well, it s on my laptop with 2 Go of ram
Here is part on dmesg
CPU: Intel(R) Core(TM)2 CPU T7200 @ 2.00GHz (1995.02-MHz 686-class CPU)
Origin = "GenuineIntel" Id = 0x6f6 Stepping = 6
I allow 512 Mo to winXP , you can browse on internet and as i said you can watch flash movie , like those on youtube.
MG
November 23rd, 2008, 23:33
Tip: For Vista you need to steal the bios.bin file from the latest bochs port. Vista requires an ACPI and the qemu bios file does'nt have that, causing a BSOD during startup.
rliegh
November 24th, 2008, 06:28
One comment and one question:
comment: It's probably better, and certainly easier to add yourself to the sudoers file using the visudo command.
question: on several platforms (including freebsd 7.1/amd64) I've compiled qemu from source, including kqemu -only to find that the results of the "info kqemu" command is "support not compiled in". I've had this happen on Linux and OpenBSD (solaris too, I think -but I'm not sure). Most recently I had this happen on FreeBSD 7.1/amd64 (dispite explicitly selectiong the kqemu option).
Has anyone else encountered this and found a way around it?
vermaden
November 24th, 2008, 08:29
I have been using QEMU only on i386 systems so I would not help here.
rliegh
November 24th, 2008, 12:38
I have been using QEMU only on i386 systems so I would not help here.
It seems pretty hit-and-miss; but I just compiled qemu and it seems like this run does support kqemu.
caligula
December 12th, 2008, 02:54
1. to switch focus between qemu mouse focus and X11 mouse focus use: left_CTRL+left_ALT
Hello,
use the qemu options "-usb -usbdevice tablet" and free your mouse by motion.
nox@
January 3rd, 2009, 18:01
...
question: on several platforms (including freebsd 7.1/amd64) I've compiled qemu from source, including kqemu -only to find that the results of the "info kqemu" command is "support not compiled in". I've had this happen on Linux and OpenBSD (solaris too, I think -but I'm not sure). Most recently I had this happen on FreeBSD 7.1/amd64 (dispite explicitly selectiong the kqemu option).
Has anyone else encountered this and found a way around it?
I suspect you are using qemu 0.9.1 (emulators/qemu)? If yes the answer is in the port's pkg-message (can also be read via pkg_info -D qemu\* |less):
...
- also remember that on amd64 you need to run the amd64 (x86_64) system
emulation if you want to use kqemu, i.e. run qemu-system-x86_64 instead of
qemu (the latter only emulates a 32 bit system.) ...
Btw, this has since changed in qemu svn, a snapshot of which is in ports as emulators/qemu-devel.
nox@
January 3rd, 2009, 19:11
...
changelog:
...
3. removed HACKS_CIRRUS from options [thx to scottro sugestion], reason here: http://forums.bsdnexus.com/viewtopic.php?pid=14036#p14036
Actually that patch (HACKS_CIRRUS) no longer applied and has been removed from the qemu ports since.
...
4. sometimes OS installation requires unload of kqemu. short: install without kqemu and the use with kqemu
..or you can do: qemu -no-kqemu ...
...
2. to ensure that You use kqemu kernel module in user mode hit left_CTRL+left_ALT+2 and type info kqemu, if everything is ok You will see:
kqemu support: enabled for user code
If you want kqemu to run (guest) kernel code too do: qemu -kernel-kqemu ... This is (usually) even faster, but works for less guests than userland kqemu, so you may need to experiment.
...
resources:
man qemu-img
man qemu
man aio
man dd
man cat
http://kidsquid.com/cgi-bin/moin.cgi/QuickStartGuide
http://qemu-forum.ipi.fi/qemu-snapshots/
http://qemu-forum.ipi.fi/
http://qemu.org/user-doc.html
http://en.wikipedia.org/wiki/QEMU
Also, there are FreeBSD host notes in the relevant qemu port's pkg-message(s) which can be read by
pkg_info -D qemu\* |less if the port is installed (which also answer FAQs like the kqemu not compiled into the 32 bit qemu 0.9.1 on amd64), and there are the qemu-devel@nongnu.org and freebsd-emulation@FreeBSD.org mailing lists, see
http://lists.gnu.org/mailman/listinfo/qemu-devel and http://lists.freebsd.org/mailman/listinfo/freebsd-emulation respectively. (a nice way to search FreeBSD mailinglists is also http://freebsd.markmail.org/search/.)
And finally, if you want to try svn snapshots: a (hopefully, but currently it seems to be) stable one is usually in ports as emulators/qemu-devel, and once in a while I post experimental port updates for more recent snapshots on the above mailing lists - testers are always welcome...
cloud
January 3rd, 2009, 22:53
A question with Qemu :
I have to log all incoming and outgoing traffic. But in my case, all the traffic use an existing interface, ath0 on my pc, and if I try to sniff, the guest address is nated so I can't know wich packets comes from the guest...
Someone have a solution ?
vermaden
January 4th, 2009, 02:45
@nox
I havent updated it lately
Also, there are FreeBSD host notes in the relevant qemu port's pkg-message(s) which can be read by ...
FreeBSD Handbook does not provide any info about FreeBSD as a host system:
http://freebsd.org/handbook/virtualization-host.html
I have created myself such page ans submited it for inclusion info the FreeBSD's Handbook, but there was lack of interest on the mailing lists for that unfortunelly :/
http://toya.net.pl/~vermaden/FreeBSD-Handbook-Virtualization.htm
nox@
January 4th, 2009, 21:04
A question with Qemu :
I have to log all incoming and outgoing traffic. But in my case, all the traffic use an existing interface, ath0 on my pc, and if I try to sniff, the guest address is nated so I can't know wich packets comes from the guest...
Someone have a solution ?
Well, if you are using slirp (qemu's internal nat) your best bet is probably to simply run tcpdump in the guest and transfer the log out later. Otherwise you could use tuntap instead of slirp and sniff on the tap interface, but since you are using wifi bridging will usually not work so you'd have to nat on the host instead. (using eg pf or ipfw/natd.)
Oh, or maybe you could run qemu as an otherwise idle user and use pf to log packets on sockets belonging to that user...
nox@
January 4th, 2009, 21:20
@nox
I havent updated it lately
Well this was more for the benefit of other readers than to criticise you... :)
...
FreeBSD Handbook does not provide any info about FreeBSD as a host system:
http://freebsd.org/handbook/virtualization-host.html
I have created myself such page ans submited it for inclusion info the FreeBSD's Handbook, but there was lack of interest on the mailing lists for that unfortunelly :/
http://toya.net.pl/~vermaden/FreeBSD-Handbook-Virtualization.htm
Oh, I hadn't seen that before! Actually I had started some docbook myself a while ago that finally ended up in this thread (read the followups too): http://lists.freebsd.org/pipermail/freebsd-doc/2008-December/015224.html
Maybe you can follow up to that...
vermaden
January 4th, 2009, 22:12
Well this was more for the benefit of other readers than to criticise you... :)
I did not took your comment as something bad, imho good you pointed out updates that I havent checked lately.
[QUOTE=nox@;7815]Oh, I hadn't seen that before! Actually I had started some docbook myself a while ago that finally ended up in this thread (read the followups too): http://lists.freebsd.org/pipermail/freebsd-doc/2008-December/015224.html
Maybe you can follow up to that...
Nice work mate, I also havent seen it unfortunelly.
"follow up to that"? You mean include your work in mine part?
nox@
January 4th, 2009, 22:37
...
Nice work mate, I also havent seen it unfortunelly.
"follow up to that"? You mean include your work in mine part?
Follow up to that thread (hmm maybe this is usenet lingo and young ppl don't know it :) - it means post an answer to that thread.)
Anyway, yes you could make a `best-of-both' and post it on there... (preferably as a patch in docbook as I did it so others don't have to convert it.)
ninjaslim
January 8th, 2009, 08:55
Thank you so much for this. I really hope that VirtualBox gets ported though.
Maxamoto
January 13th, 2009, 11:13
Is the assumption that it is impossible to add a USB Western Digital hard drive, either when launching qemu or via console (usb_add) correct? I have a 1TB WD hard drive that I have not been able to add at all. qemu doesn't see it with "info usbhost". I don't have it mounted from within FreeBSD. Here's the output of usbdevs -dv
# usbdevs -dv
Controller /dev/usb0:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x0000), rev 1.00
uhub0
port 1 powered
port 2 powered
Controller /dev/usb1:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x0000), rev 1.00
uhub1
port 1 powered
port 2 powered
Controller /dev/usb2:
addr 1: high speed, self powered, config 1, EHCI root hub(0x0000), Intel(0x0000), rev 1.00
uhub2
port 1 powered
port 2 powered
port 3 addr 2: high speed, power 500 mA, config 1, Zune(0x0710), Microsoft(0x045e), rev 1.00
ugen0
port 4 powered
Controller /dev/usb3:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x0000), rev 1.00
uhub3
port 1 powered
port 2 powered
Controller /dev/usb4:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x0000), rev 1.00
uhub4
port 1 addr 2: low speed, power 100 mA, config 1, Microsoft 5-Button Mouse with IntelliEye(TM)(0x0039), Microsoft(0x045e), rev 3.00
ums0
port 2 powered
Controller /dev/usb5:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x0000), rev 1.00
uhub5
port 1 powered
port 2 powered
Controller /dev/usb6:
addr 1: high speed, self powered, config 1, EHCI root hub(0x0000), Intel(0x0000), rev 1.00
uhub6
port 1 addr 2: high speed, self powered, config 1, My Book(0x1100), Western Digital(0x1058), rev 1.65
umass0
port 2 powered
port 3 powered
port 4 powered
port 5 powered
port 6 addr 3: high speed, power 500 mA, config 1, Laptop Integrated Webcam(0x2640), OmniVision Technologies, Inc. -2640-07.07.20.3(0x05a9), rev 1.00
ugen1
My command to launch the qemu vm is as such:
qemu -boot d -hda winxp.img -m 256 -cdrom -soundhw es1370 -usb -usbdevice tablet -localtime
Modifying this string, or attempting to add the device via qemu's console always ends in "could not add device" error. Thanks in advance for your help :)
adamk
January 13th, 2009, 11:33
If the drive is detected under the FreeBSD host, why not just use "-hdb /dev/da0" (or whatever device the drive shows up as) when starting qemu?
Adam
Maxamoto
January 13th, 2009, 11:48
If the drive is detected under the FreeBSD host, why not just use "-hdb /dev/da0" (or whatever device the drive shows up as) when starting qemu?
Adam
Thanks for the suggestion. I'll give that a shot and see what happens :)
Maxamoto
January 13th, 2009, 12:26
Worked perfectly! Thank you!
da_oli
January 30th, 2009, 11:05
Great HowTo, but how can i get the network working.
On my old qemu installation i had a script that did something like this bevor qemu starts:
sudo ifconfig tap0 create
sudo /sbin/ifconfig tap0 0.0.0.0 promisc up
sudo ifconfig bridge0 create
sudo ifconfig bridge0 addm xl0 up
sudo ifconfig bridge0 addm tap0
So, how is it working in this howto?
greets
Oliver
da_oli
January 30th, 2009, 11:24
Sorry for the double post, but i the solution i'm searching for is for the use of TUN/TAP-Network-Interfaces to get a complete access to the vm
greets
oliver
da_oli
January 30th, 2009, 12:46
Okay and here is the solution :P
I created a startup script for the first vm
#!/bin/sh
sudo ifconfig tap0 create
sudo ifconfig tap0 0.0.0.0 promisc up
sudo ifconfig bridge0 create
sudo ifconfig bridge0 addm em0 up
sudo ifconfig bridge0 addm tap0
sudo qemu -k de -boot c -hda test.img -m 512 -localtime -monitor stdio -usb -usbdevice tablet -net nic -net tap,ifname=tap0,script=no
and one for the second
#!/bin/sh
sudo ifconfig tap1 create
sudo /sbin/ifconfig tap1 0.0.0.0 promisc up
sudo ifconfig bridge0 addm tap1
sudo qemu -k de -boot c -hda test.img -m 512 -localtime -monitor stdio -usb -usbdevice tablet -net nic,macaddr=52:54:00:12:34:57 -net tap,ifname=tap1,script=no
Important in here is the MAC address, a very tricky thing for those who don't like to read manuals like me of course :stud
But okay, all qemu's use the same MAC 52:54:00:12:34:56
That's why its important to change the MAC on the following or all qemu's.
That works fine for me.
And sorry for the triple Post :e
MG
February 8th, 2009, 12:30
Does anyone know how and if it's possible to boot a system installed with qemu using a real physical harddrive?
First I did:
qemu -hda /dev/ad2 -cdrom ~/iso/winxppro.iso -m 512 -boot d
Then I installed windows from within qemu.
But when I try to boot my computer natively from ad2 (secondary master)
it does not recognize the bootsector and stops.
I think qemu does not correctly use the BIOS geometry settings or bootsector location.
Is there any workaround so I can boot the disk both natively and in Qemu?
nox@
February 8th, 2009, 19:27
Does anyone know how and if it's possible to boot a system installed with qemu using a real physical harddrive?
First I did:
qemu -hda /dev/ad2 -cdrom ~/iso/winxppro.iso -m 512 -boot d
Then I installed windows from within qemu.
But when I try to boot my computer natively from ad2 (secondary master)
it does not recognize the bootsector and stops.
I think qemu does not correctly use the BIOS geometry settings or bootsector location.
Is there any workaround so I can boot the disk both natively and in Qemu?
I think the main problem with this is the fact that your guest is Windows - that doesn't usually like hardware being changed under it (and possibly also being moved to a different bios device like when going from the first ide disk in qemu to ad2 on the physical box) - there seem to be ways around the first problem (setting up separate hardware profiles), but I guess the simpler solution would be to keep separate installations, one physical on ad2 and one in an image that you run in qemu and then possibly share a common data partition with.
If you still want to share one install, here are two links I saved that _might_ help at least a little:
http://oopsilon.com/Running-a-Windows-Partition-in-VMware
and
http://www.virtualbox.org/wiki/Migrate_Windows
vermaden
February 8th, 2009, 19:39
Does anyone know how and if it's possible to boot a system installed with qemu using a real physical harddrive?
First I did:
qemu -hda /dev/ad2 -cdrom ~/iso/winxppro.iso -m 512 -boot d
Then I installed windows from within qemu.
But when I try to boot my computer natively from ad2 (secondary master)
it does not recognize the bootsector and stops.
I think qemu does not correctly use the BIOS geometry settings or bootsector location.
Is there any workaround so I can boot the disk both natively and in Qemu?
Maybe try the other way, first isntall Windows natively on desired partition, and then try to use it under QEMU.
fronclynne
February 11th, 2009, 09:17
Does anyone know how and if it's possible to boot a system installed with qemu using a real physical harddrive?
First I did:
qemu -hda /dev/ad2 -cdrom ~/iso/winxppro.iso -m 512 -boot d
Then I installed windows from within qemu.
But when I try to boot my computer natively from ad2 (secondary master)
it does not recognize the bootsector and stops.
I think qemu does not correctly use the BIOS geometry settings or bootsector location.
Is there any workaround so I can boot the disk both natively and in Qemu?
I have thought about trying it, but I haven't a spare drive (nor a place to plug one in), but I'm sure with some liberal applications of -drive (instead of -hda, -cdrom) you could obviate the controller swapping around. Whether this would solve it, I don't know.
Working with fat32 instead of ntfs would make it easier to poke around with in freebsd, but I'm not certain if that would gain you anything, if you lose your soul.
pradtf
March 1st, 2009, 20:02
i'm using fbsd7.0
i just tried for qemu
make install clean
and got
File to patch:
however, doing the same on qemu-devel seems to be working fine.
what are you supposed to do when the File to patch: message comes up?
is the devel version less stable (and therefore less desirable?)
vermaden
March 1st, 2009, 23:42
I havent used QEMU for ages now, I currently use VirtualBox @ OpenSolaris
ArtemD
March 3rd, 2009, 11:16
Discovered Qemu yesterday and wow is it cool! I am specially excited about the VNC server that comes with Qemu. This allows you to run Qemu without X server. This is the command I use to start my Qemu in VNC session which I then tunnel via SSH:
qemu-system-x86_64 -hda ~/qemu/hda.img -boot d -cdrom ~/temp/cd.iso -m 1024 -localtime -vnc :0 -k fi -usb -usbdevice tablet -std-vga&
P.S. I am running FreeBSD 7.1 on AMD64.
vermaden
March 3rd, 2009, 12:46
@ArtemD
Thanks mate, QEMU is generally very nice, but its so slow ...
sossego
March 12th, 2009, 11:39
The AMD solution for networking and such is at daemonforums.
Virtualbox? Nope, not even as a front end to qemu. The current work on VirtualBox for FreeBSD requires:
dev86 patch plus a tar.gz install of dev86, certain flags to be passed to the build process such as <force> and --disable-xpcom,
The make/kmk files to be text edited,
each directory to be built after entering,
and these must be done multiple times.
There are no build instructions for compiling the source.
dev86 needs to be patched so that the build will work on both i386 and amd64 machines.
sossego
March 18th, 2009, 18:39
this is common knowledge but I'd like to add in that one can make a shell script for each instance.
eg #!/bin/sh /usr/local/bin/qemu -m <X> -hda <X.img> -cdrom <X/path> -soundhw <X> -boot c
z662
April 9th, 2009, 06:17
I compiled qemu from ports and made sure that the kqemu accelerator was included as an option to be compiled, however kldload does not recognize kqemu, it is not in /boot/kernel or /boot/modules, and when typing "info kqemu" in the qemu userland it comes back saying that kqemu support had not been compiled. Does anyone know anything about this? Any help would be greatly appreciated. Thanks
sossego
April 10th, 2009, 00:21
Which version of qemu and kqemu? Developer's?
z662
April 10th, 2009, 00:26
I have qemu-0.9.1_10 installed
sossego
April 10th, 2009, 22:02
Do you have the kqemu-kmod installed?
z662
April 11th, 2009, 21:14
No I didn't. I just installed it, so can I just use kldload and it would be loaded automatically, or do I need to reinstall?
sossego
April 12th, 2009, 08:49
You should be able to kldload.echo kqemu_enable=YES >> /etc/rc.conf
z662
April 13th, 2009, 02:38
Ok ill give that a try and post back if I run into any problems. Thanks alot sossego!
graudeejs
April 13th, 2009, 06:54
You should be able to kldload.echo kqemu_enable=YES >> /etc/rc.conf
That is not right
It should be:
echo kqemu_load=YES >> /boot/loader.conf
echo aio_load=YES >> /boot/loader.conf
Because it kernel module. And either should be loaded when booting or when needed with
kldload aio
kldload kqemu
lme@
April 16th, 2009, 14:54
AFAIR aio is no longer needed in recent versions of qemu.
Albertos
June 20th, 2009, 19:19
Now I learned a new stuff. "qemu"
I am new to using freebsd by the way. Every single learnings from me is very important. I did not go to school for this. I just do a self study.
I am running putty/ssh right now and it is good.
Simulation pret (http://simulationpretimmobilier.net)
MG
August 6th, 2009, 14:20
Does anyone know how and if it's possible to boot a system installed with qemu using a real physical harddrive?
First I did:
qemu -hda /dev/ad2 -cdrom ~/iso/winxppro.iso -m 512 -boot d
Then I installed windows from within qemu.
But when I try to boot my computer natively from ad2 (secondary master)
it does not recognize the bootsector and stops.
I think qemu does not correctly use the BIOS geometry settings or bootsector location.
Is there any workaround so I can boot the disk both natively and in Qemu?
I solved this now. Qemu 10.6 seems to do it.
It works for real harddisks, usb-drives, memory disks and image-based md devices.
ad? can be any storage device:
dd if=/dev/zero of=/dev/ad? bs=1m count=1000
fdisk -Iqu /dev/ad?
bsdlabel -wB /dev/ad?s1
newfs -m 0 -o space /dev/ad?s1a
mount /dev/ad?s1a /mnt
cd /usr/src
make installkernel installworld DESTDIR=/mnt
umount /dev/ad?s1a
qemu -hda /dev/ad? -snapshot -m 1024
edit: Now we need a tool that can write Win32 bootcode to a unix device.
When that works it must be easy to boot Qemu with a Windows cdrom an install it to the existing location. Then the system can boot straight into Windows or start FreeBSD where Windows can be started in a virtual machine.
vermaden
August 6th, 2009, 14:42
dd if=/dev/ad? of=/dev/zero bs=1m
Shouldn't this line look like that:
dd if=/dev/zero of=/dev/ad? bs=1m
You are only reading whole disk into /dev/zero, also imho this step is just a waste of time here (zeroing the whole partition/drive).
You can zero only the first sectors to be sure that no junk is there.
MG
August 6th, 2009, 15:21
Shouldn't this line look like that:
dd if=/dev/zero of=/dev/ad? bs=1m
You are only reading whole disk into /dev/zero, also imho this step is just a waste of time here (zeroing the whole partition/drive).
You can zero only the first sectors to be sure that no junk is there.
lol. Not a good backup solution, that zero device.
dd if=/dev/zero of=/dev/ad? bs=1m count=1000
makes 1000 blocks of 1MB
vermaden
August 6th, 2009, 15:26
lol. Not a good backup solution, that zero device.
What backup sollution?
dd if=/dev/zero of=/dev/ad? bs=1m count=1000
makes 1000 blocks of 1MB
Yes ... and?
MG
August 6th, 2009, 15:39
I swapped the if and of, making dd copy /dev/ad? to /dev/zero. Fixed now.
Bernardslave
February 28th, 2011, 18:36
While followed the howto an MP-BIOS bug: 8254 timer not connected to IO-APIC error appeared. Any idea why this error?
sossego
February 28th, 2011, 19:47
What system & OS are you emulating? http://www.google.com/search?q=8254+timer+not+connected+to+IO-APIC&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:unofficial&client=iceweasel-a
The first entry has the solution in the thread. This is for a Linux installation.
Bernardslave
March 1st, 2011, 21:42
Oh thank you for the help, I'm trying to prove Fedora 14 in qemu over a FreeBSD 8.1 emulating by vmware. So I think I should watch bios settings of vmware.
Thanks again!
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.