Tips

Some tips for working on the installer.

Making changes before the casper-bottom scripts are processed

Unfortunately, aside from cat and redirection, your only editor in the initramfs is busybox sed (less featureful than the copy of sed present on your system).

Test changes to files in scripts/casper-bottom using sed s-commands (s/string/replacement/g), then apply them with sed -i.

Making changes just before the filesystem is mounted

Add break=bottom to the kernel command line. Once at the (initramfs) prompt, type the following:

chroot /root bash
mount -t proc proc /proc
mount -t devpts devpts /dev/pts
screen
dhclient eth0

Using screen allows you to use scp and ssh interactively. Remember, 10.0.2.2 is the host in KVM.

Fixing your keymap after running ubiquity

Ubiquity applies the selected keymap immediately. If you've selected a keymap not applicable to your keyboard and have already exited ubiquity, type the following to reset your keymap (where 'us' is your layout):

setxkbmap us

Copying debconf template changes to the live environment

sudo apt-get -y install po-debconf debconf-utils
mkdir po
po2debconf ubiquity.templates > ubiquity.templates-stripped
sudo debconf-loadtemplate ubiquity ubiquity.templates-stripped

Pretending you're on an Intel Mac

The partitioner changes behaviour on Intel Macs to accommodate Apple's deviation from the GPT specification. It's sometimes useful to simulate this. Run these commands as root.

(echo '#! /bin/sh'; echo 'i386/mac') >/bin/archdetect
# In d-i, run through installer until after "Loading additional components".
# In ubiquity, you can proceed immediately.
sed -i 's/^\([[:space:]]*\)\(parted_server\)/\1PARTED_GPT_APPLE=1 \2/' /lib/partman/init.d/30parted

Appending to your block of changes in the changelog

dch has the rather odd default of creating a new block for your entries if someone has added an entry since your last change. To disable this, add the following to your ~/.devscripts file:

DEBCHANGE_MULTIMAINT_MERGE=yes

Working with packages that don't exist outside of Ubuntu

When using dch to modify the changelog, use the -U option rather than -i or -a as it will intelligently increment the minor number.

Editing KVM disk images

Pressing Shift to get at the GRUB menu doesn't work inside KVM for some reason. This makes some installer development work tricky, especially working on oem-config. To edit a KVM disk image without having to boot it, install the nbd-client package if you don't have it already, and run this in one window:

kvm-nbd foo.img

... and this in another:

sudo nbd-client localhost 1024 /dev/nbd0
sudo mount /dev/nbd0p1 /mnt
# hack on /mnt
sudo umount /mnt
sudo nbd-client -d /dev/nbd0

Working on oem-config in reasonable time using KVM snapshots

Working on oem-config takes a while, because you need to do an OEM-mode installation, reboot, run oem-config-prepare, reboot again, and then you get to run oem-config. If you make a mistake, you have to go back to the start, and this sucks, so don't do it. Instead, you can use KVM snapshots. Any time you want to save your state, run:

kvm-img snapshot -c NAME-OF-SNAPSHOT foo.img

And to go back to a previous snapshot:

kvm-img snapshot -a NAME-OF-SNAPSHOT foo.img

I've only ever tried doing this when the VM isn't running, since as far as I know it's snapshotting the disk rather than the full machine state.

Using locally-built udebs in debian-installer

Switch to VT2 and edit /var/lib/dpkg/info/load-cdrom.postinst. Add lines to wget your udeb and udpkg -i it. Switch back to VT1 and continue the install. It may fail at the "loading additional components" phase. Go into the menu and configure the network, then go back into "load additional components from the CD" step.

Updating gfxboot-theme-ubuntu

Installer/UpdateGfxbootThemeUbuntu

Modifying the contents of /media/cdrom with read-only media

This helps when debugging problems with apt-cdrom, among other things:

sudo unlink /media/cdrom
sudo mkdir /media/cdrom
sudo mount -t overlayfs -o lowerdir=/cdrom,upperdir=$(mktemp -d) overlayfs /media/cdrom

Installer/Development/Tips (last edited 2012-03-19 21:20:22 by ev)