FAI dying during partition setup

Ryan Steele ryans at aweber.com
Mon Sep 29 23:13:29 CEST 2008


Ryan Steele wrote:
> Ryan Steele wrote:
>> 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.  But then, if I try it again (with the exact same 
>> disk_config), sfdisk and mke2fs drop me to an emergency shell.  I 
>> would guess it's because it's unable to get the kernel to re-read the 
>> partition table without a reboot, but I'm really not sure how FAI can 
>> get around that situation, as there is currently no method for having 
>> FAI "pick up where it left off" right after writing the partition table.
>>
>> Has anybody else encountered this?  It really makes FAI unusable.  
>> Here's the output from FAI when this happens (from fai.log).  
>> /dev/sda2 was my LVM volume:
>>
>> Calling task_install
>> Calling task_partition
>> Partitioning local harddisks
>> setup_harddisks version 0.43fai
>> Probing disks:  /dev/sda
>> Disks found: sda
>>
>> Using config file: /var/lib/fai/config/disk_config/COSTELLO
>> Mapping disk name disk1 to sda
>> Creating partition table: LC_ALL=C sfdisk -q  /dev/sda < 
>> /tmp/fai/partition.sda
>> BLKRRPART: Device or resource busy
>> BLKRRPART: Device or resource busy
>> The command to re-read the partition table failed
>> Reboot your system now, before using mkfs
>> Creating file systems:
>>  mke2fs -q -c -j /dev/sda1
>>  mke2fs -q /dev/sda2
>> /dev/sda2 is apparently in use by the system; will not make a 
>> filesystem here!
>>
>> MKE2FS ERROR:
>>
>> setup_harddisks version 0.43fai
>> Probing disks:  /dev/sda
>> Disks found: sda
>>
>> Using config file: /var/lib/fai/config/disk_config/COSTELLO
>> Mapping disk name disk1 to sda
>> Creating partition table: LC_ALL=C sfdisk -q  /dev/sda < 
>> /tmp/fai/partition.sda
>> Creating file systems:
>>  mke2fs -q -c -j /dev/sda1
>>  mke2fs -q /dev/sda2
>> Save log files via ssh to fai at faimaster:costello/install-20080929_142911
>>
>
> It may be worth noting that, from the emergency shell, 'lsof | grep 
> sda' returns nothing, and swapoff and umount have no effect (because 
> nothing on /dev/sda* is mounted).   I've run partprobe, which hasn't 
> helped, and 'sfdisk -R' and 'sfdisk -R -f' returns "BLKRRPART: Device 
> or resource busy ".  I've also tried adding '--no-reread' to 
> setup_harddisk's sfdisk options to no avail.  I have no idea why it 
> thinks that device is in use.  All that really should have happened 
> with them since boot is their creation by udev.
>
> On a whim, I used dd and /dev/zero to overwrite the partition table so 
> FAI would have something 'fresh' to start with, but I end up with 
> similar results - an emergency shell after mke2fs.  I'm at a bit of a 
> loss as to what's going on here, but this only started after I began 
> installing LVM devices.  For completeness here's what I added to get 
> LVM support:
>
> 1. class SW_RAID.var
> root at faimaster:/srv/fai/config# cat /srv/fai/config/class/SW_RAID.var
> SW_RAID_CONFIG="
> "
>
> LVM_VG_CONFIG="
> sys[]=/dev/sda2
> "
>
> LVM_LV_CONFIG="
> sys/root[-n root ]=1G:/:ext3:
> sys/home[-n home ]=2G:/home:ext3:
> sys/swap[-n swap ]=1G:/swap:swap:
> sys/srv[-n srv ]=1G:/srv:ext3:
> sys/var[-n var ]=1G:/var:ext3:
> sys/varlog[-n varlog]=1G:/var/log:ext3:
> "
>
> 2. Added "dm_mod" to the list of kernelmodules in 20-hwdetect.source
>
> 3. disk_config for the client
> root at faimaster:/srv/fai/config# cat /srv/fai/config/disk_config/COSTELLO
> # <type> <mountpoint> <size in mb> [mount options]     [;extra options]
> disk_config disk1
> primary  /boot         1000        rw,errors=remount-ro ; boot -c -j ext3
> primary  -                 1024-       rw
>
> 4. Last but not least, hooks/mountdisks.SW_RAID and 
> hooks/mountdisks.SW_RAID.source, as described on Peter Gervai's 
> faiwiki page.


So, when paging through the logs during the failed installs, I noticed 
that FAI was doing a 'mke2fs' on /dev/sda2 because /dev/sda2 was 
errantly listed in the disk_config.  But, that clearly won't work, 
because I want that designated for LVM.  This is probably why the mke2fs 
was failing in the manner it was - LVM had already claimed it by the 
time mke2fs got called.  Okay, fine - seems like a simple enough fix to 
remove /dev/sda2 from my disk_config file.  But, alas I end up with:

pvcreate --yes --force /dev/sda2
  Device /dev/sda2 not found (or ignored by filtering).


Still trying to figure out where to go from here.  Should I throw in the 
towel and try to hack the Debian version to work on my Ubuntu boxes?  Or 
is there hope for this method?  I've seen reports of others using this 
method 
(http://www.terryburton.co.uk/blog/2007/08/fully-automatic-installation-of-debian.html, 
for example), but I've had little luck so far.


More information about the linux-fai mailing list