Mailing List Archive

How to create a PVH guest on a Debian host?
Hello. I just joined the list and there isn't much information on the
web page, so I can only hope this is the right place to seek technical
assistance.

I've set Xen up on a Debian Bullseye host according to the following
tutorial: https://wiki.xenproject.org/wiki/Xen_Project_Beginners_Guide

Now I'm ready to create a guest, and I haven't found much information on
how to make a PVH guest. The best thing I've found is this brief
description of editing some config files:
https://pub.nethence.com/xen/pvh

Honestly I'm not even sure PVH is what I want; I just want something
that's going to be light on RAM and not slow (I'll be running from
USB), but I haven't found many comparisons of PV, PVHVM, etc. that are
understandable. But PVH has been described as the most efficient.
AW: How to create a PVH guest on a Debian host? [ In reply to ]
Hi!

PVs have a bad reputation as PVH should be much faster. I could not detect any performance gain by changing from PV to PVH. Anyway, I still prefer building domUs with "xen-create-image", eg:
xen-create-image --hostname=testserver.example.com --vcpus=4 --memory=8G --maxmem=8G --size=20G --fs=ext4 --swap=2G --ip=1.2.3.4 -netmask=255.255.255.0 --gateway=1.2.3.1 --password=ohmygod --dist=bionic --genpass=0 --pygrub --install-method=debootstrap --boot --lvm=vg0

see "man xen-create-image".

I recently created a PVH domU using the Ubuntu cloud image. See my steps below.

regards
Klaus

# Ubuntu Cloud Image: es gibt .img und img-kvm.
# - Das KVM image hat anscheinend keine Treiber f?r realtek/intel/PV sondern nur f?r kvm/virtio.
# - Das normale Cloud Image erkennt Xen und blendet dann die emulierte NIC aus und verwendet 'vif'.

# Xen Config Options sind nur in der Manpage gut dokumentiert:
# https://xenbits.xen.org/docs/4.11-testing/man/xl.cfg.5.html

# Download and extend qcow2 image
cd /mnt
wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
qemu-img resize jammy-server-cloudimg-amd64.img 100G
qemu-img info jammy-server-cloudimg-amd64.img

# mount image and extend / partition and file system
modprobe nbd max_part=8
qemu-nbd -c /dev/nbd0 jammy-server-cloudimg-amd64.img
growpart /dev/nbd0 1
e2fsck -f /dev/nbd0p1
resize2fs /dev/nbd0p1

# mount and configure VM
NAME=testserver
export ROOTPW=crazyrootpassword
ROOT=a
mkdir $ROOT && mount /dev/nbd0p1 $ROOT

echo "network:
version: 2
renderer: networkd
ethernets:
eth0:
accept-ra: no
addresses:
- 1.2.3.4/24
gateway4: 1.2.3.1" > $ROOT/etc/netplan/10-eth0.yaml

echo $NAME > $ROOT/etc/hostname
echo "
83.136.34.101 $NAME.example.com $NAME" >> $ROOT/etc/hosts

rm $ROOT/etc/resolv.conf
echo "nameserver 8.8.8.8
search example.com" > $ROOT/etc/resolv.conf

# Chroot to set Root PW
chroot a /bin/bash
echo "root:$ROOTPW" | chpasswd

# Purge and reinstall ssh so that ssh host keys are generated
apt purge openssh-server
apt install openssh-server
# if you need SSH login enable next line
#sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

exit
umount ./a && rmdir a && qemu-nbd -d /dev/nbd0

# Xen Config File erstellen
echo "name = '$NAME'
# Der letzte Schrei: PVs mit ein bissl HVM
type = 'pvh'
kernel = '/usr/lib/grub-xen/grub-i386-xen_pvh.bin'
serial = 'pty'
vcpus = '54'
memory = '49152'
disk = [ 'tap:qcow2:/mnt/jammy-server-cloudimg-amd64.img,xvda,w' ]
# MAC soll mit 00:16:3E beginnen
vif = [ 'ip=10.250.0.189,mac=00:16:3E:`openssl rand -hex 1`:`openssl rand -hex 1`:`openssl rand -hex 1`,bridge=br0,model=e1000' ]
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'restart'
" > /etc/xen/$NAME.cfg

xen create -c /etc/xen/$NAME.cfg

# Login to VM
systemctl stop systemd-resolved
systemctl disable systemd-resolved




> -----Urspr?ngliche Nachricht-----
> Von: Xen-users <xen-users-bounces@lists.xenproject.org> Im Auftrag von
> Name Here
> Gesendet: Montag, 31. Oktober 2022 19:47
> An: xen-users@lists.xenproject.org
> Betreff: How to create a PVH guest on a Debian host?
>
> Hello. I just joined the list and there isn't much information on the
> web page, so I can only hope this is the right place to seek technical
> assistance.
>
> I've set Xen up on a Debian Bullseye host according to the following
> tutorial: https://wiki.xenproject.org/wiki/Xen_Project_Beginners_Guide
>
> Now I'm ready to create a guest, and I haven't found much information on
> how to make a PVH guest. The best thing I've found is this brief
> description of editing some config files:
> https://pub.nethence.com/xen/pvh
>
> Honestly I'm not even sure PVH is what I want; I just want something
> that's going to be light on RAM and not slow (I'll be running from
> USB), but I haven't found many comparisons of PV, PVHVM, etc. that are
> understandable. But PVH has been described as the most efficient.
>