[Yaird-devel] initramfs: cryptsetup-luks on external sdb becoming sda

lkml at think-future.com lkml at think-future.com
Tue Jun 16 11:35:43 UTC 2009


Hey,

maybe I missed a detail while skimming through the yaird docs but I failed to
accomplish the following task using yaird only:

Idea:
pc with internal disk (/dev/sda not using initramfs) and external usb disk 
(/dev/sdb). The change was to enable the pc to use luks partition containers and
swapping the two diskѕ, mounting the internal one into the external usb case and
putting the external one into the pc as new internal one. The system itself is
running already from the internal sda and is only rsynced to the new luks
containers on the external sdb. During the procedure sda becomes sdb and vice 
versa. The preparation is effected using the external usb disk enclosing 
rather than mounting the new disk (for the luks containers) firstly into 
the pc and then booting from a usb device using grml or something and continuing
with the luks container/rsync/initram creation.

Problem:
Now, the thing is, that I can use yaird config directive MAKEDEV "/dev/mapper/root" "/mnt" to tell yaird it ought to handle the luks containers correctly. In
/etc/crypttab /dev/mapper/root is associated to /dev/sdb2 (which will become 
/dev/sda2 !) so yaird will resolve the /dev/mapper/root device to sdB and not 
sdA. Booting this initramfs will fail (neither is future sdB a luks container 
nor is it what I want.. ;). 

Solution:
The solution is (at least how I got it working as intended, maybe using a less
efficient procedure than feasible) to write the initram to a directory using
yaird -f directory initramfs 2.6.30 and hand-crafting ./initramfs/init: replace
every occurence of sdB by sdA. The next step took me some digging in the docs:
file on a previously created initramfs (the one that failed to boot...) tells me
that it's an cpio ascii SRV4 no crc archive, gzip -9 compressed, using stdin/stdout piping. I wanted the new archive to be as close as possible to the way 
the yaird created initramfs was since I ignored what exactly the kernel 
expected and I was eager to avoid swapping the disks on boot failure once more..
Finally, I knew that this "ascii SRV4 no crc archive" is rather not the old 
SRV4 style cpio archive but new new style. So calling cd initramfs; find | 
cpio -o -H newc | gzip -9 > ../initramfs-2.6.30 did the job and booted the 
kernel using the correct device, encryption and everything..

Question:
Back to the question/wishlist item: Did I miss the config directive of yaird or
isn't there yet any chance to tell yaird using a different device to boot of
even if the cryptsetup mapping tells yaird otherwise. After all, it's the user 
knowing best what should happen and giving him the opportunity to tell yaird so
would be preferable. If he's using the directive at all he is supposed to know
what he's doing.. Maybe the directive would have a name such as REALBOOTDEV and 
a sample configuration might be:

### crypttab maps /dev/mapper/root to /dev/sdb2
MAKEDEV "/dev/mapper/root" "/mnt"
### Correcting this via REALBOOTDEV directive
REALBOOTDEV "/dev/sda2" 


Thank you for your work and your answer.

Take care and enjoy,

Nils

-- 
A+
* Nils Radtke                 *      UTM 32       *    icq / lc    *
:x            Think-Future de *  0515651 5394088  * 9336272/92045 :)
   Come uno piglia moglie, entra nel pensatoio. 
   
   



More information about the Yaird-devel mailing list