Building a DomU Using the Debian Installer

Pre-steps

Step 1: Register DomU on netreg.net.cmu.edu using the cl0x user.

Step 2: Update DNS so that the hostname will resolve.

We serve our own DNS based on files in the tinydns-data(8) format. They are available via a git repository in /afs/club/git/service/dns.git.

The DB.club.cc.cmu.edu file is used for records under club.cc.cmu.edu while DB.club.cc.local.cmu.edu is used for records under club.cc.local.cmu.edu.

Add something similar to the following to an appropriate place within the relevant file. Include contact information if the machine is being hosted for an outside group.

# the_machine_name
=XXXXXX.club.cc.cmu.edu:128.237.157.XXX:86400

Our DNS servers pick up the data they serve out of /afs/club/service/dns, which is a clone of the git repository mentioned above. Pull your changes into that clone so that they get served.

Note: several cron jobs need to run before changes go live. Generally if changes are made at least 10 minutes before the hour, the changes will be live a couple minutes after the hour.

Step 3: Find a Dom0 to host the DomU on. http://www.club.cc.cmu.edu/~kbare/list-xen.cgi is helpful.

Obtaining the Debian Installer Files for Xen

For convenience, the /var/local/installers directory on Dom0s can be used as a location to save installers. There may already be a copy of the desired installer available in that directory.

Otherwise, minimal netinstall images for Xen are available from any Debian mirror, typically at /debian/dists/codename/main/installer-arch/version/images/netboot/xen/.
An example: https://cdn-fastly.deb.debian.org/debian/dists/trixie/main/installer-amd64/20250803/images/netboot/xen/.

To download an installer, you can execute a series of commands like the following:

mkdir -p /var/local/installers/trixie-installer-amd64-20250803
https_proxy=http://pkg-proxy.club.cc.cmu.edu:8000/                                                    \
    wget -nd -P /var/local/installers/trixie-installer-amd64-20250803 -r -np -l 1 -R 'index.html*'    \
    https://cdn-fastly.deb.debian.org/debian/dists/trixie/main/installer-amd64/20250803/images/netboot/xen/

Provisioning Storage

We use lvm(8) LVs (logical volumes) to store DomUs' virtual disk partitions.

All DomUs will have a partition for their root filesystem and swap. DomUs that run an AFS client will also have a afscache partition. Specialized service DomUs may have additional partitions, e.g., for a mail queue, additional space for logs, etc.

To create LVs for the root and swap partitions, execute commands similar to the following:

lvcreate -L 10G -n %%HOSTNAME%%-disk dom0.root
lvcreate -L 2G -n %%HOSTNAME%%-swap dom0.root
# For DomUs that will run an AFS client
lvcreate -L 1G -n %%HOSTNAME%%-afscache dom0.root

Unforunately, the Debian Installer can get a little confused when a DomU is provided with its storage as partitions. To keep it from getting confused, create the filesystem or swap area on the LVs before starting the installation. Execute commands similar to the following:

mkfs.ext4 /dev/dom0.root/%%HOSTNAME%%-disk
mkswap /dev/dom0.root/%%HOSTNAME%%-swap
# For DomUs that will run an AFS client
mkfs.ext2 /dev/dom0.root/%%HOSTNAME%%-afscache

Creating the DomU's Xen Configuration

Put the following into a file in /etc/xen with the same name as the DomU's hostname. Replace %%HOSTNAME%%, %%IP_ADDRESS%%, and %%MAC_ADDRESS%% with appropriate values. Add any additional virtual disks to the disk lisk as xvda3, xvda4, etc.

#
#  Kernel + memory size
#
kernel      = '/var/local/installers/trixie-amd64-xen-20250803/vmlinuz'
extra       = 'debian-installer/exit/halt=true --- quiet console=hvc0'
ramdisk     = '/var/local/installers/trixie-amd64-xen-20250803/initrd.gz'

vcpus       = '1'
memory      = '2048'


#
#  Disk device(s).
#
disk        = [
                  '/dev/dom0.root/%%HOSTNAME%%-disk,raw,xvda1,w',
                  '/dev/dom0.root/%%HOSTNAME%%-swap,raw,xvda2,w',
              ]


#
#  Hostname
#
name        = '%%HOSTNAME%%'

#
#  Networking
#
vif         = [ 'ip=%%IP_ADDRESS%%,mac=%%MAC_ADDRESS%%,bridge=xenbr0' ]

#
#  Behaviour
#
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

Running the Debian Installer

Start the DomU running the Debian Installer by running xl create -c /etc/xen/%%HOSTNAME%%.

In many cases, after networking is configured via DHCP, it's desirable to hit escape and configure the network manually, with the correct static IP address, etc.

Enter mirror information manually (this will maximize the hit rate on our proxy server):

  1. Debian archive mirror hostname: cdn-fastly.deb.debian.org
  2. Debian archive mirror directory: /debian/
  3. HTTP proxy information (blank for none): http://pkg-proxy.club.cc.cmu.edu:8000/

After setting the root password, when prompted to create a regular user, hit escape twice to get to the main menu. Select the "Configure the clock" entry.

Use manual partitioning, and assign the partitions to filesystems and mount points appropriately.

At the "Software selection" screen, only select "standard system utilities" in the list.

The installer will complain that installation of the GRUB bootloader failed. To fix this, select the "Execute a shell" entry from the main menu and run:

in-target /bin/sh -c 'http_proxy=http://pkg-proxy.club.cc.cmu.edu:8000/; export http_proxy; apt-get update -y && apt-get install -y grub-xen && update-grub'

Exit from the shell and select the "Continue without boot loader" entry.

Finalizing the Installation

Edit the /etc/xen/%%HOSTNAME%% configuration file so that the DomU boots in PVH mode and loads its kernel and initramfs from its own storage using GRUB.

Change:

kernel      = '/var/local/installers/trixie-amd64-xen-20250803/vmlinuz'
extra       = 'debian-installer/exit/halt=true --- quiet console=hvc0'
ramdisk     = '/var/local/installers/trixie-amd64-xen-20250803/initrd.gz'

To:

type        = 'pvh'
kernel      = '/usr/lib/grub-xen/grub-i386-xen_pvh.bin'

Clubifying the DomU

Boot into the DomU by running xl create -c /etc/xen/%%HOSTNAME%%.

Log in in as root.

Download and install the GPG key used to verify the APT repo for cclub-specific packages.

wget -P /tmp https://www.club.cc.cmu.edu/debian/dists/trixie-cclub/contrib/binary-amd64/cclub-keyring_0.12_all.deb
dpkg -i /tmp/cclub-keyring_0.12_all.deb

Add the APT repo for cclub-specific packages to /etc/apt/sources.list

echo 'deb http://debian.club.cc.cmu.edu/debian/ trixie-cclub contrib' >> /etc/apt/sources.list

Pre-configure the DomU for clubification:

apt-get update
apt-get install cclub-pre-configuration

Install clubification packages.

Always:

apt-get update
apt-get install cclub-base-configuration cclub-xen-pvh-domu-configuration

Then pick one of the two variants below:

Finally, reboot the DomU. There are some network configuration changes that only get applied during boot.

shutdown -r now

To ensure the DomU is started automatically when its Dom0 boots, create a symlink to its configuration in /etc/xen/auto:

ln -t /etc/xen/auto -s ../%%HOSTNAME%%

Historic Information

Keith deleted all of the instructions for old Debian releases. If you want to see them, view revision 130 of this page.

Common Maintenance Tasks/Building Xen Domains (last edited 2025-09-05 04:50:58 by kbare@CLUB.CC.CMU.EDU)