Holger Parplies wrote:
Hi,

Ryan Steele wrote on 2008-09-29 17:13:29 -0400 [Re: FAI dying during partition 
setup]:
Recently, I've been trying to set up LVM clients with FAI 3.2.4 for Ubuntu, using Peter Gervai's well-placed LVM hooks. However, I keep hitting the situation where sfdisk cannot read the partition table, and mke2fs cannot create a filesystem, because it thinks the device is in use. It's reproducible every time if I FAI-install the client more than once. E.g., the first time I FAI-install the LVM-enabled host, it works. [...]

while I have no experience with FAI > 3.1.8 or the LVM hooks, I would guess
that, for some reason, the volume group is activated (do you have anything in
/dev/mapper?).

I'll have to check. I know that vgdisplay --verbose --partial had /dev/sda2 in it, but I couldn't vgremove it (again, got the BLKRRPART error).

You could see if 'vgchange -an' changes anything about the
BLKRRPART (that's one of the things I like about FAI - you can debug your
scripts in the exact context they are run).

I'll give that a shot as well. And yeah, I like being able to drop to the emergency shell and run things right there - it's very helpful.

I use FAI 3.1.8 with my own partition-hook for managing my own LVM requirements
(like sometimes keeping some of the LVs ...).

Completely home-brewed, or adapted from Peter Gervai/Michael Svamberg?

What works for me without any
problems (including repeated installation with identical disk layout) is
basically

- sfdisk
- modprobe dm_mod
- pvcreate -y -ff [and I didn't mention -ff ;-]

Yeah, I changed Peter's script from --force to -ff due to some error messages.

- vgscan

and so on (including mke2fssing my root partition, which isn't on LVM). Of
course I don't pvcreate in the cases I want to keep LVs :).

I realize FAI 3.2.4 is a totally different context (kernel version, etc.), but
maybe it helps just the same.

Maybe, but before I start reinventing the wheel and writing my own LVM hooks, it might be worth my while to adapt 3.2.10 for Ubuntu.

2. Added "dm_mod" to the list of kernelmodules in 20-hwdetect.source

So I guess my suggestion is, basically, to modprobe dm_mod later, specifically
after the sfdisk has been done.

Yeah, that might be worthwhile, because experience has taught me that if dm_mod is running via the initramfs, sfdisk -R always fails to have the kernel re-read the partition tables.

Regards,
Holger

I appreciate the insight and advice. I'll let you know if any of it works for me.

Antwort per Email an