# Citrix Xenserver FreeBSD PV domU



## hedon (Jul 8, 2011)

Hi,

Have you copied your compiled kernel out of the vm (domU) to the XenServer Host Sytsem (dom0) and set the appropriate pv params?

I have just tried to paravirtualize a fresh FreeBSD 8.0 (i386) installation based on the info from Mike Kaganski and Gian Paolo in this thread, which works fine for me. Here is what I have done step-by-step:

* created a new VM via the "other install media" template
* installed FreeBSD from CD (virtual machine runs in HVM/emulated mode)
* compiled a new kernel:


```
root@freebsd-vm# cd /usr/src
root@freebsd-vm# make kernel KERNCONF=XEN
```

* copied the kernel to xenserver:


```
root@freebsd-vm# scp /boot/kernel/kernel <xenserver-ip>:/root
```

* edited /etc/fstab and changed all "ad0" to "xbd0" (which can be done in vi via ":%s/ad0/xbd0/g")
* edited /etc/ttys to include the line:


```
xc0 "/usr/libexec/getty Pc" vt100 on secure
```

On the xenserver I have done:

* renamed the copied kernel:


```
root@xenserver# mkdir /boot/guest/
root@xenserver# mv /root/kernel /boot/guest/freebsd-8.2-xen-kernel
```

* set the bootmode from HVM to paravirtualized:


```
root@xenserver# xe vm-list (note the UUID of the freebsd vm)
root@xenserver# xe vm-param-set uuid=vm-uuid HVM-boot-policy=""
```

* set appropriate parameters:


```
root@xenserver# xe vm-param-set uuid=vm-uuid PV-kernel="/boot/guest/freebsd-8.2-xen-kernel"
root@xenserver# xe vm-param-set uuid=vm-uuid PV-args="boot_vervose=1,vfs.root.mountfrom=ufs:/dev/xbd0s1a,kern.hz=100"
```

And then rebooted the vm which comes up whithout trouble.

This article is from the Citrix forum: http://forums.citrix.com/thread.jspa?threadID=257379&start=15&tstart=0. I added only the path to the kernel.


----------



## gerasim (Jul 28, 2011)

Good day Hedon...

i try to convert to PV freebsd 8.2 amd64 on xenserver... and then whole of compile and transfer option is complete i wasn't able to boot. then i make  xe vm-param-set uuid=(vm-uuid) HVM-boot-policy="BIOS order" - vm will start normaly with new xenhvm kernel, but hard disk still use ad0 scheme but in dmesg it will be xbd0 attached as ad0. network in re0 turned to xn0.. how you boot it?

thanks


----------



## nbari (May 22, 2012)

In my case the mount point is like this:


```
boot_vervose=1,vfs.root.mountfrom=ufs:/dev/xbd0p2,kern.hz=100
```

fstab looks like:

```
# Device	Mountpoint	FStype	Options	Dump	Pass#
/dev/xbd0p2	/		ufs	rw	1	1
/dev/xbd0p3	none		swap	sw	0	0
```


----------



## jbennion (Dec 24, 2012)

*problem with this method.*

I've been trying this and various other techniques I've found in the intarwebs, but can't get the VM to boot in PV on Xenserver 6.1

I get the kernel compiled and installed on the vm, and before I screw with mount points and hvm params, it boots fine. 

But when I copy the vm's new xenhvm kernel to dom0, change the vm-params and mount points,
xenserver complains: "XenguestHelper.Xenctrl_dom_linux_build_failure(2, " elf_xen_note_check: ERROR: Not a Xen-ELF image: No ELF" and won't boot.

I can change the hvm param to bios order and it boots fine (except the mount points are wrong at that point, but ok.) 

What am I missing?

And if anyone HAS pulled this off, why not create a template file or virtual appliance so people can download it.


----------



## akbisw (Jan 13, 2014)

*Re: problem with this method.*



			
				jbennion said:
			
		

> I've been trying this and various other techniques I've found in the intarwebs, but can't get the VM to boot in PV on Xenserver 6.1
> 
> I get the kernel compiled and installed on the vm, and before I screw with mount points and hvm params, it boots fine.
> 
> ...




I have the exact same problem. I changed my root partition from ad0s1a to xbd0s1a. And I am getting the same mount error.


----------



## ondra_knezour (Jan 14, 2014)

I don't have any FreeBSD 8.x running, but for both archaic 9-STABLE and 10-RCx no messing with boot parameters was required.


```
xe vm-param-list uuid=xxx | grep PV-
                     PV-kernel ( RW):
                    PV-ramdisk ( RW):
                       PV-args ( RW):
                PV-legacy-args ( RW):
                 PV-bootloader ( RW):
            PV-bootloader-args ( RW):
            PV-drivers-version (MRO): major: 6; minor: 0; micro: 2; build: 54078
         PV-drivers-up-to-date ( RO): true
```

Just install, for the 9-STABLE version compile custom kernel, XENHVM with ZFS included:

```
cat /usr/src/sys/amd64/conf/XENHVMZFS
include XENHVM
ident XENHVMZFS
makeoptions MODULES_OVERRIDE="zfs opensolaris"
```
and adjust the network configuration to the new device name. 10-RC just works. No fiddling with the /etc/fstab as root on ZFS is used in all cases.

Pool is running on the XenServer 6.2, but I've been using this configuration since XCP 1.1 was released about 3(?) years ago.


----------

