Intro¶
This is a HOWTO on how to install Fedora 23 Server as a Xen PV domU under a Debian Jessie dom0, using pv-grub for booting the guest. Using pv-grub makes it possible to easily avoid HVM domains and use storage domains, since that's not possible for pygrub.
Download installer image¶
We're using the pxeboot images from Fedora 23. Download the kernel and initramfs:
dom0$ cd /mnt/isos/Linux/Fedora/23/
dom0$ wget https://dl.fedoraproject.org/pub/fedora/linux/releases/23/Server/x86_64/os/images/pxeboot/initrd.img
dom0$ wget https://dl.fedoraproject.org/pub/fedora/linux/releases/23/Server/x86_64/os/images/pxeboot/vmlinuz
Configure Xen domU for installation¶
Create a basic domU configuration file for the domain. This is my
/etc/xen/fed23lab
:
kernel = '/mnt/isos/Linux/Fedora/23/vmlinuz' ramdisk = '/mnt/isos/Linux/Fedora/23/initrd.img' extra = 'inst.stage2=http://download.fedoraproject.org/pub/fedora/linux/releases/23/Server/x86_64/os/ ip=dhcp' name = "fed23lab" memory = 1024 vcpus = 1 vif = ['mac=00:16:3E:xx:xx:xx, bridge=xenbrX'] disk = ['/dev/zvol/storage/it/vms/fed23lab/disk0,raw,xvda,rw,backend=nas01']
Note that I needed more than 512 MB RAM for the installer to boot up properly.
The extra
field contains information for the installer on where to download
the packages from, what networking settings and so on. An example that uses
static IPv4 address instead of DHCP:
extra = 'inst.stage2=http://download.fedoraproject.org/pub/fedora/linux/releases/23/Server/x86_64/os/ ip=10.3.3.5::10.3.3.1:255.255.255.0:fed23lab:eth0:off nameserver=10.3.3.1'
The off
value in the last fields means that the DHCP client should be
disabled.
More information about IP settings can be found in the dracut.cmdline(7)
man
page, and about
the installer fields in section 10.4 in Fedora Installation
Guide.
Install Fedora 23¶
Create the domain and let the installer download some components. You will then be presented with an text based installer in a tmux session.
$ xl create -c /etc/xen/fed23lab ... X was unable to start on your machine. Would you like to start VNC to connect t o this computer from another computer and perform a graphical installation or co ntinue with a text mode installation? 1) Start VNC 2) Use text mode
Using text mode is fine, but advanced partitioning is only available in the graphical installer. However, using the installer through VNC works very well.
Finish the installation but avoid letting the domain reboot. I chose the
minimal installation to avoid a lot of, in my opinion, unnecessary packages.
The next sections of this guide also assumes that you have a separate partition
for /boot
as is default by the installer.
Preparing for pv-grub¶
The same guide can be followed as in the pvgrub workaround for separate /boot article, before booting the guest up the first time with pv-grub.
The required symbolic link to grub.cfg
can be created before rebooting the
guest after installation, e.g. to avoid bringing in the disk from your storage
domain to dom0. Instead of pressing the Reboot button, switch to the shell tmux
pane (number two) and create the link:
[anaconda root@fed23lab ~]# cd /mnt/sysimage/boot/ [anaconda root@fed23lab boot]# mkdir grub [anaconda root@fed23lab boot]# cd grub [anaconda root@fed23lab grub]# ln -s /grub2/grub.cfg grub.cfg
The pv-grub on Debian Jessie is not aware of the linux16
and initrd16
commands that Fedora uses, so make sure you temporarily replace that in the
config before rebooting:
[anaconda root@fed23lab boot]# sed -i -e "s/linux16/linux/" -e "s/initrd16/initrd/" /mnt/sysimage/boot/grub2/grub.cfg
Now, reboot the domU and destroy it if it starts up on the installer again.
Booting the domU with pv-grub¶
Make the following changes to the domU configuration:
--- a/xen/fed23lab +++ b/xen/fed23lab @@ -1,6 +1,4 @@ -kernel = '/mnt/isos/Linux/Fedora/23/vmlinuz' -ramdisk = '/mnt/isos/Linux/Fedora/23/initrd.img' -extra = 'inst.stage2=http://download.fedoraproject.org/pub/fedora/linux/releases/23/Server/x86_64/os/ ip=dhcp' +kernel = '/usr/lib/grub-xen/grub-x86_64-xen.bin' name = "fed23lab"
Make the pv-grub modifications permanent¶
To make sure that linux16
and initrd16
commands are never used in the grub
configuration file, following adjustments should be made to
/etc/grub.d/10_linux
in the domU:
--- a/grub.d/10_linux 2015-12-02 20:55:30.225073995 +0100 +++ b/grub.d/10_linux 2015-12-02 20:55:37.308073995 +0100 @@ -89,7 +89,7 @@ linux_entry () initrdefi="initrd" case "$machine" in i?86|x86_64) - sixteenbit="16" + sixteenbit="" linuxefi="linuxefi" initrdefi="initrdefi" ;;
A fresh configuration can then be generated with:
[root@fed23lab grub.d]# grub2-mkconfig -o /boot/grub2/grub.cfg
Note that upgrades to the grub package might undo these changes!