qemu Starting a 2004 FreeBSD in a VM - can't load kernel

cracauer@

Developer
I want to run an old FreeBSD install from 2004 in a VM. I know this isn't a supported release anymore but bear with me :)

The only format I have is a tarfile of the root filesystem. It includes /boot and /kernel. I untarred it over a disk image that boots a modern FreeBSD.

I can't use bhyve because we don't have legacy BIOS for bhyve anymore, so QEMU it is. With a qemu line of `-drive file=root2.raw,format=raw,index=0,media=disk` I arrive at the following boot output.

What does this error indicate? Maybe wrong HD or HD controller type?

Code:
Booting from Hard Disk...
\

Console: internal video/keyboard 
BIOS drive A: is disk0 
BIOS drive C: is disk1 
BIOS 639kB/15232kB available memory 

FreeBSD/i386 bootstrap loader, Revision 0.8 
(root@wavehh.hanse.de, Thu Mar 11 22:18:59 EST 2004) 

Hit [Enter] to boot immediately, or any other key for command prompt. 
Booting [kernel]...                
can't load 'kernel' 
can't load 'kernel.old' 

Type '?' for a list of commands, 'help' for more detailed help. 
ok ls 
bad path '' 
ok

As I said, the filesystem does have /kernel and /boot/
 
Its been a while since I've set up any qemu images but...

I think your image still needs a boot loader...IIRC, root2.raw is expected to be a disk image, not a filesystem image...so it would need to contain a bootloader to point it to /boot and /kernel to locate the components.

OK...I didn't notice that you mentioned extracting to a valid bootable disk...My other thought is that maybe the 2004 image is 32 bit and the newer disk is 64 bit image
 
Its been a while since I've set up any qemu images but...

I think your image still needs a boot loader...IIRC, root2.raw is expected to be a disk image, not a filesystem image...so it would need to contain a bootloader to point it to /boot and /kernel to locate the components.

No, I should have clarified this.

That diskimage has both BIOS and uEFI loading gear. I took a working FreeBSD image, mounted the root partition inside it and untarred the 2004 install in there. I left the bootloaders and the uEFI partition alone.
 
It looks like it can't find /boot/kernel/kernel but I might be missing somethiing. Can you mdconfig -a -t vnode and mount the image?
 
qemu can boot many things , more than bhyve or virtualbox. It's slow. Has lots of parameters as command.

Do you have currently qcow format. Otherwise there are tools to convert to this format.
Sometimes it's fun to make something old again alife.
 
qemu can boot many things , more than bhyve or virtualbox. It's slow. Has lots of parameters as command.
I personally find Qemu 1 of the best OS testing/engineering toolkits ever made. tt works when you don't expect it. It really should have a readable manual. The manpage is too long to quickly return to something.
 
It looks like it can't find /boot/kernel/kernel but I might be missing somethiing. Can you mdconfig -a -t vnode and mount the image?

I think back in that day the kernel actually lived in the root filesystem, "/kernel". /boot has assorted support stuff.

Yes, I did md mount the thing. That is how I populated the filesystem with the old install.

As a test I put a modern /boot/kernel/kernel. That actually loads that kernel. But the userland is just not compatible enough with the new kernel to enter a useful state. So I want to boot the old kernel.
 
I can something stupid,
- Your bootloader have supported "versions".
- It will go into boot0 supported "versions".
- Then boot1 supported "versions".
- Then boot2 supported "versions".

If you have your root filesystem. Then it should be bootable.
Most easy is /etc/fstab.
Before abit more difficult /boot/loader.conf , there are parameters man loader.conf.
Most difficult is before /boot/loader.conf.
I never managed this task. For any questions SirDice or Crivens.
MBR is more easy then UEFI.
Do you have a separate boot partition (or as file) ?
 
I think back in that day the kernel actually lived in the root filesystem, "/kernel". /boot has assorted support stuff.

Yes, I did md mount the thing. That is how I populated the filesystem with the old install.

As a test I put a modern /boot/kernel/kernel. That actually loads that kernel. But the userland is just not compatible enough with the new kernel to enter a useful state. So I want to boot the old kernel.
Rip a kernel from an old ISO? 2004? Must be around the 5.x releases.
 
What is your full qemu command? 2004 would be most likely 32b version, are you using qemu-system-i386?
I see you did ls in the loader, could you try ls / too?
 
What is your full qemu command? 2004 would be most likely 32b version, are you using qemu-system-i386?
I see you did ls in the loader, could you try ls / too?

It is today's QEMU. I don't think I need the 32 bit version, but I will try that. So far I am using:

Code:
qemu-system-x86_64 \
  -cpu host \
  -machine type=pc,accel=kvm \
  -object rng-random,id=rng0,filename=/dev/urandom \
  -device virtio-rng-pci,rng=rng0 \
  -smp 64 \
  -m 16 \
  -nographic \
  -drive file=root2.raw,format=raw,index=0,media=disk \
  -netdev user,id=vmnic,ipv6=off,hostfwd=tcp::3237-:22 \
  -device virtio-net,netdev=vmnic \
  -device usb-ehci

Code:
ok ls / 
bad path '/' 
ok
 
Hmm, don't know if this is relevant because I don't know what was the boot process in 2004 FreeBSD, but shouldn't you also need to write the boot sector of the boot drive with the actual boot loader code for it to start?
 
It's hard to troubleshoot without actual disk.
I'd start with the bare minimum first: qemu-system-i386 -hda root2.raw and go from there (ignoring warning about "guessing raw").

Passing -cpu host to old FreeBSD could mess things up too (but here I'm just guessing).
 
I think the problem is that the bootloader I have in the MBR is too new.

I have downloaded FreeBSD-5.1 ISOs to properly install from there first.

Using i386 QEMU didn't make a difference.
 
I took a working FreeBSD image, mounted the root partition inside it and untarred the 2004 install in there. I left the bootloaders and the uEFI partition alone.
Oh, I missed this one when I was replying to your question. I thought you have actual working disk from the past.

So legacy boot is from up-to-date version of FreeBSD ? That could mess things up.
 
Back
Top