Setting up RHEL8 XEN guests from the cloud image

Requriements

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/
wget https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20200113.0.x86_64.qcow2
ln -s CentOS-Stream-GenericCloud-8-20200113.0.x86_64.qcow2 centos.qcow2

Skeleton

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 \
    cloud-config.target \
    NetworkManager \
    kdump \
    ; do
    echo disabling $sv ...
    systemctl disable $sv && echo done || echo FAILED
    echo
done; unset sv

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

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

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

wget https://lab.nethence.com/nunux/5.2.21.domureiser4.modules.tar.gz
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

sync
halt -p

and disable the extra init.

vi centos

#extra = "init=/bin/bash"
extra = "ip=10.3.3.9::10.3.3.1:255.255.255.0:centos:eth0:none"

You’re now good to go for acceptance testing

xl create centos -c

Template

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.

Resources

https://www.centos.org/download/mirrors/

https://wiki.centos.org/action/show/Sources

https://pagure.io/centos-kernel-rpm/blob/c8/f/SOURCES/kernel-x86_64.config

https://pagure.io/centos-kernel-rpm/blob/c8/f/SOURCES

Bug 1663812 - document method to disable motd message https://bugzilla.redhat.com/show_bug.cgi?id=1663812

Is there a way to permanently remove the cockpit.socket message? https://forums.centos.org/viewtopic.php?t=72303

Strange message on ssh login https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org/thread/AQH3F2KY5RUP2RC7EDDXRTMW3AVP2DZJ/

CHAPTER 3. MANAGING KERNEL MODULES https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_monitoring_and_updating_the_kernel/managing-kernel-modules_managing-monitoring-and-updating-the-kernel

anaconda boot options

https://anaconda-installer.readthedocs.io/en/latest/boot-options.html

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/chap-anaconda-boot-options


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun