FreeBSD install on xen domu on Linux dom0

I am creating templates to allow users to freshly install various Linux distributions and now am working on this for FreeBSD.

I basically set the required files inside /boot configure /boot/grub.conf, tar.gz it so that it can be extracted to the root of a new domu. Then you choose the distro from the menu.

For FreeBSD I am using the files from: ftp://ftp.freebsd.org/pub/FreeBSD/r...ES/8.2/FreeBSD-8.2-RELEASE-amd64-bootonly.iso

I've set section in grub.conf for FreeBSD to:
Code:
title FreeBSD 8.2 amd64 Fresh Install
root (hd0,0)
kernel /boot/bootloader

Also tried /boot/kernel/kernel
I have seen that the root directive could be a little different from what I have here, but loader won't load at all through pygrub and kernel does not have any ELF notes. Even if I use readelf kernel -n it is empty though the FreeBSD kernel does have the ELF headers. So it seems pygrub won't boot from the FreeBSD kernel since it doesn't have ELF notes.

Anyone have any ideas what I could try to get this too boot for the installer to finish the job?
 
If I'm not mistaken you need to use chainloader.

There are some Grub settings discussed in [thread=5918]this thread[/thread], that may help.
 
Ah, didn't spot that one. No, I don't think grub2 is required. It should work with grub too. But you'll need to load the loader, not the kernel.

Code:
title  FreeBSD 8.2 amd64 Fresh Install
root   (hd0,a)
kernel /boot/loader

If that doesn't work try:
Code:
root (hd0,0)
makeactive
chainloader +1

You may need to adjust the root statement.
 
Thanks. I will try this tonight. I tried something similar, but this I appended makeactive and chainloader +1 as I didn't understand it fully. I will try that just as you wrote and let you know how it works out.
 
pygrub doesn't like root (hd0,a) at all. I can't even get to the menu.

The makeactive one gets me to the menu but doesn't understand that directive.

Code:
title FreeBSD 8.2 amd64 Fresh Install
root (hd0,a)
kernel /boot/loader

Using <class 'grub.GrubConf.GrubConfigFile'> to parse /boot/grub/grub.conf
Traceback (most recent call last):
  File "/usr/bin/pygrub", line 691, in ?
    chosencfg = run_grub(file, entry, fs)
  File "/usr/bin/pygrub", line 545, in run_grub
    g = Grub(file, fs)
  File "/usr/bin/pygrub", line 203, in __init__
    self.read_config(file, fs)
  File "/usr/bin/pygrub", line 407, in read_config
    self.cf.parse(buf)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 303, in parse
    self.add_image(GrubImage(title, img))
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 133, in __init__
    _GrubImage.__init__(self, title, lines)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 84, in __init__
    self.reset(lines)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 102, in reset
    self._parse(lines)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 96, in _parse
    map(self.set_from_line, lines)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 140, in set_from_line
    setattr(self, self.commands[com], arg.strip())
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 105, in set_root
    self._root = GrubDiskPart(val)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 54, in __init__
    (self.disk, self.part) = str.split(",", 2)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 79, in set_part
    self._part = int(val)
ValueError: invalid literal for int(): a
No handlers could be found for logger "xend"
Error: Boot loader didn't return any data!

Code:
title FreeBSD 8.2 amd64 Fresh Install
root (hd0,0)
makeactive
chainloader +1

Using <class 'grub.GrubConf.GrubConfigFile'> to parse /boot/grub/grub.conf
WARNING:root:Unknown image directive makeactive
Traceback (most recent call last):
  File "/usr/bin/pygrub", line 691, in ?
    chosencfg = run_grub(file, entry, fs)
  File "/usr/bin/pygrub", line 568, in run_grub
    grubcfg["kernel"] = img.kernel[1]
TypeError: unsubscriptable object
No handlers could be found for logger "xend"
Error: Boot loader didn't return any data!
 
You need to specify slice in where the partition is. Without that grub won't know where to search correctly. Try this assuming FreeBSD is on the first slice of the disk:

Code:
title FreeBSD 8.2 amd64 Fresh Install
root (hd0,0,a)
kernel /boot/loader
You could read the chapter 'Disk Organization' in the FreeBSD handbook.
 
Did you even try my suggestion? It fixes the error your log lists.
Code:
ValueError: invalid literal for int(): a
That indicates that your root definition is wrong. It wants a number for the slice, not a BSD partition letter. See my previous post for the correct format.
 
sang - I think I may have with the previous troubleshooting. I will try it tonight and let you know. I just wanted to point out the the freebsd kernel from the netboot is not ELF compliant as it does not contain ELF notes. In Linux you can see this with the readelf command. I used readelf on the netbsd xen kernel and it read the notes without a problem.
 
Code:
title FreeBSD 8.2 amd64 Fresh Install
root (hd0,0,a)
kernel /boot/loader

gives me this error:

Code:
Using <class 'grub.GrubConf.GrubConfigFile'> to parse /boot/grub/grub.conf
Traceback (most recent call last):
  File "/usr/bin/pygrub", line 691, in ?
    chosencfg = run_grub(file, entry, fs)
  File "/usr/bin/pygrub", line 545, in run_grub
    g = Grub(file, fs)
  File "/usr/bin/pygrub", line 203, in __init__
    self.read_config(file, fs)
  File "/usr/bin/pygrub", line 407, in read_config
    self.cf.parse(buf)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 303, in parse
    self.add_image(GrubImage(title, img))
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 133, in __init__
    _GrubImage.__init__(self, title, lines)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 84, in __init__
    self.reset(lines)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 102, in reset
    self._parse(lines)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 96, in _parse
    map(self.set_from_line, lines)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 140, in set_from_line
    setattr(self, self.commands[com], arg.strip())
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 105, in set_root
    self._root = GrubDiskPart(val)
  File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 54, in __init__
    (self.disk, self.part) = str.split(",", 2)
ValueError: too many values to unpack
No handlers could be found for logger "xend"
Error: Boot loader didn't return any data!
Usage: xm create <ConfigFile> [options] [vars]

pygrub only wants 2 options it looks like.
 
Code:
File "/usr/lib64/python2.4/site-packages/grub/GrubConf.py", line 54, in __init__
    (self.disk, self.part) = str.split(",", 2)
ValueError: too many values to unpack

This seems to indicate pygrub does not support FreeBSD partitions. It accepts only two values separated by comma, but FreeBSD requires three. This is because BSD uses its own partition system inside slices which other OSs call partitions.

You should ask the pygrub developers about support for FreeBSD. Someone might just need to fix the configuration generator since grub itself supports FreeBSD partitions with the previously mentioned syntax.
 
Back
Top