Setting up RHEL8 XEN guests from the cloud image


RHEL8 does not ship a XEN-capable network installer anymore. This is why it is now best to simply grab the latest cloud image.

cd /root/templates/
ln -s CentOS-Stream-GenericCloud-8-20200113.0.x86_64.qcow2 centos.qcow2


Booting the cloud image

mkdir -p /root/guests/centos/
cd /root/guests/centos/
cp /data/templates/centos.qcow2 ./
vi centos

kernel = "/data/kernels/vmlinuz"
root = "/dev/xvda1 ro console=hvc0 net.ifnames=0 biosdevname=0 mitigations=off"
extra = "init=/bin/bash"

name = "centos"
vcpus = 3
maxvcpus = 8
memory = 7168
disk = ['qcow2:/data/guests/centos8/centos.qcow2,xvda,w']
vif = [ 'bridge=br0, vifname=centos.0' ]
type = "pvh"

We are not trying to enable pvgrub here, as PVH does not support it.

Single-user mode fixup

Get into the extra init

xl create centos -c

export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
mount -t proc none /proc
cat /proc/partitions
mount -o remount,rw /

You should then proceed similarly to the system preparation described here but there’s a few differences. First, there are more services to disable here.

for sv in \
    cloud-config \
    cloud-final \
    cloud-init-local \
    cloud-init \ \
    NetworkManager \
    kdump \
    ; do
    echo disabling $sv ...
    systemctl disable $sv && echo done || echo FAILED
done; unset sv

You would also need to grab the necessary module for TMEM.

dhclient -v eth0
ping -c1
yum update -y
yum install network-scripts wget mlocate -y

systemctl list-unit-files | grep network
systemctl enable network

tar xzf 5.2.21.domureiser4.modules.tar.gz -C /lib/modules/
rm -f 5.2.21.domureiser4.modules.tar.gz
echo tmem > /etc/modules-load.d/tmem.conf

The cloud image also has additional shit to get rid of

rm -f lala/etc/motd.d/cockpit
rm -f lala/etc/issue.d/cockpit.issue
rm -f lala/etc/sysconfig/network-scripts/ifcfg-ens3

When finished, shutdown the guest

halt -p

and disable the extra init.

vi centos

#extra = "init=/bin/bash"
extra = "ip="

You’re now good to go for acceptance testing

xl create centos -c


Eventually make a template out of it

tar cSf /data/templates/centos.qcow2.tar centos.qcow2

Warning: since we don’t mount and edit the QCOW2 disk from the host, we also need to be careful about the SSH host keys. Those should be removed before generating the template.


Bug 1663812 - document method to disable motd message

Is there a way to permanently remove the cockpit.socket message?

Strange message on ssh login


anaconda boot options