Create Alpine Linux PV DomU
Obtain a copy of Alpine Linux
To create an Alpine Linux paravirtualized (PV) DomU you will need an Alpine Linux iso.
Download the latest alpine-virtgrsec iso from https://alpinelinux.org/downloads/
In this example we will use /data/ for our download and for our disk images.
Mount the ISO image
Next, mount the iso so we can read the kernel and initramfs:
mount -t iso9660 -o loop /data/alpine-virtgrsec-3.20.3-x86_64.iso /media/cdrom
Now we have the kernel in /media/cdrom/boot/vmlinuz-virtgrsec and initramfs in /media/cdrom/boot/initramfs-virtgrsec.
Alternatively you can use uniso or p7zip to extract the content to a temp area.
Create the disk image
Now we should create an empty file, that will be the hard drive of the DomU (in this example we are using a 3GB disk):
dd if=/dev/zero of=/data/a1.img bs=1M count=3000
Create a DomU config file that boots the ISO image
The next step is to create a basic DomU configuration file, so we can launch the pv guest iso (save it where you like, although the most common place is /etc/xen/).
Contents of /etc/xen/a1.cfg
Install the guest
Now that we have all the necessary files, we can start the DomU to proceed with the install:
xl create -f /etc/xen/a1.cfg -c
Login into the system with user "root" and no password.
We need disable the ext4 64bit feature since pv-grub does not support ext4. Then we proceed with the normal install:
export MKFS_OPTS_BOOT="-O ^64bit"; setup-alpine
After configuring the basic system, you will be asked where would you like to install Alpine, choose xvda and sys.
This will create three partitions on your disk, xvda1 for /boot, xvda2 for swap and xvda3 for /
Available disks are: xvda (3.1 GB ) Which disk(s) would you like to use? (or '?' for help or 'none') [none] xvda The following disk is selected: xvda (3.1 GB ) How would you like to use it? ('sys', 'data' or '?' for help) [?] sys WARNING: The following disk(s) will be erased: xvda (3.1 GB ) WARNING: Erase the above disk(s) and continue? [y/N]: y Initializing partitions on /dev/xvda... Creating file systems... Installing system on /dev/xvda3: Installation is complete. Please reboot. #
Before you reboot, mount the boot partition and create a grub/menu.lst file for pv-grub.
mount /dev/xvda1 /mnt mkdir /mnt/grub
Contents of /mnt/grub/menu.lst
Unmount and power off.
umount /mnt poweroff
Adjust the domU config file to boot from fresh install
In your Dom0, edit your DomU config file to boot with pv-grub.
Contents of /etc/xen/a1.cfg
Remember to unmount the loopback iso image.
umount /media/cdrom
When you next boot, you will be presented with the grub boot menu, and your VM will boot.