Create Alpine Linux PV DomU
Obtain a copy of Alpine Linux
To create an Alpine Linux paravirtualized (PV) DomU you'll need an Alpine Linux iso.
Download the latest alpine-virt iso from https://alpinelinux.org/downloads/
In this example we'll use /data/ for the download and disk images.
Mount the ISO image
Next, mount the iso so we can read the kernel and initramfs:
Now we have the kernel in /media/cdrom/boot/vmlinuz-virt and initramfs in /media/cdrom/boot/initramfs-virt.
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):
Alternatively, if a LVM volume group (vg1 say) with free space is available on dom0, create a logical volume for alpine:
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/).
If using LVM, replace /data/a1.img with /dev/vg1/alpine in the disk specification.
Install the guest
Now that we have all the necessary files, we can start the DomU to proceed with the install:
Login into the system with user "root" and no password.
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. #
When you reboot, the pv bootloader, pvgrub, will look to /boot/grub/grub.cfg for its menu, so create that file first.
Mount the boot partition and create a grub/grub.cfg file for pvgrub. (Note that grub.cfg is for pvgrub2 which replaced pvgrub1 and its menu.lst beginning in 2013.)
Install a basic text editor like nano or vim:
If using nano, enter:
Then add the following to create a basic grub2 configuration file:
Finally, Ctrl-S to save, Ctrl-X to exit nano.
Unmount and power off.
Adjust the domU config file to boot from fresh install
In your Dom0, edit your DomU config file to boot with pvgrub.
The name and location of pvgrub in Dom0 is distribution-specific, so you may need to change the "kernel=" line, above.
For example, in Debian 10, it's '/usr/lib/grub-xen/grub-x86_64-xen.bin'
Remember to unmount the loopback iso image.
When you next boot, you will be presented with the grub boot menu, and your VM will boot.