Note that $VARS are replaced in the actual grub.cfg with their corresponding values.

I rebooted back into the livecd and have unpacked the initrd image into a temp directory. It looks like the initrd image lacks LVM functionality. For example, if I'm reading /usr/share/initramfs-tools/hooks/lvm2 (installed with lvm2 on the livecd-booted system, not present on the installed one) correctly, an lvm executable should be situated in /sbin; that is not the case.

What's the best way to remedy this situation? I realize that it would be easier to just use the alternate install CD, which apparently supports LVM, but I don't want to wait for it to download and then have to reinstall.

I added /dev in case grub got re-run and wanted to figure out where boot drives were located. I used dpkg in the case that networking is not up or otherwise weird inside the chroot. If networking does work, I recommend "apt-get" over "aptitude" since it does better dep resolution these days.
–
Kees CookFeb 19 '11 at 1:49

Thanks for the tip about apt-get, it's hard to keep track of what's what. Do you have a link to more info on that?
–
intuitedFeb 19 '11 at 13:48

I ended up doing mostly what Kees Cook nicely lays out, with some help from the final section of this walkthrough. However:

I didn't bind-mount /dev. It looks like this caused some error messages later; see below.

I mounted my /var volume on the new root in addition to /boot.

I didn't copy the debs into the /tmp of the new root. Instead, I ran # apt-get install aptitude; aptitude install lvm2 after chrooting.

I did this in order to register these actions in the apt database: for example, aptitude, and perhaps also apt-get, will track which packages were installed explicitly and which were installed automatically as dependencies.

Since I'm actually getting my packages via a local apt proxy (running apt-cacher-ng), I didn't even have to wait for them to download again. I did have to make a file at /etc/apt/apt.conf.d/02proxy containing Acquire::http::Proxy "http://local-apt-proxy-server:3142"; before running apt-get. I had done the same thing before starting to install packages while running off the LiveCD before doing the install.

I got an error message or warning a couple of times, stating

Can not write log, openpty() failed (/dev/pts not mounted?)

This did not prevent the appropriate lines from being added to /var/log/dpkg.log.

I suspect that this issue could have been averted by bind-mounting /dev, but I don't really understand what it means, i.e. I don't know what log it's referring to, or why it would need to access a pty in order to write to a log.

After installing the system to the hard disk, you need to install lvm2 into that system before it can boot. If you installed lvm2 on the livecd, then the packages will still be in /var/cache/apt/archives. Change to that directory, mount the hard disk, and install the packages to the hard disk using dpkg --root=/mnt *.deb. In your case, you need to mount the root fs to /mnt, and also the var fs into /mnt/var.

Also you don't need the separate /boot partition, and a separate /var partition is questionable.

Nice.. that's easier than chroot-ing. I guess this won't register in aptitude's db of packages that were explicitly installed though, so I should probably just install lvm2 and its dependencies this way. Any downsides to using a separate /var? Other than the issue of having to allocate extra 'slack' space? I'd like to be able to snapshot it, so I don't want to mix it in with other large variable files; I'm planning to symlink or bind-mount my home directory to a directory in a separate /data volume that I will create after the system's up & running, to hold music and such.
–
intuitedFeb 17 '11 at 23:33

Also: I'll also need to mount the boot fs at /mnt/boot, no? I gather that lvm2 builds a new initrd on installation.
–
intuitedFeb 17 '11 at 23:37

@intuited no, it will be recorded as manually installed just like always. Yes, you also need /boot mounted if you have a separate one of those. Having a separate /var doesn't help with making snapshots.
–
psusiFeb 18 '11 at 2:00

A separate /var partition won't help with snapshots, no, but it will, for example, help prevent the root fs from filling up unexpectedly. Are you saying that it will introduce problems with taking snapshots? Oh, wait, that's you on the other question comment thread. Nevermind..
–
intuitedFeb 18 '11 at 3:10