Comment 1 for bug 475936

Revision history for this message
all-by-my-self (all-by-my-self) wrote : Re: /dev/mapper/tmp encrypted with /dev/urandom not mounted on bootup

Hi out there!

I had the same problem. On jaunty no problems but on karmic (complete updated on 4th Dec).

The new canonical-special init-system isn't perfect.

This routes to the unmountable (non-luks-) cryptsetup-devices:

The new init-system don't use the old /etc/inittab. That file is replaced by the *.conf-files in /etc/init/.

The *.conf-files uses a syntax for starting themselfs by events (see man startup, starting, started, stopping and stopped).

A normal init starts at /etc/init/mountall.conf (and maybe some others). If started the script starts /etc/init/udev.conf. These scripts start other scripts. And so on.

The cryptsetup-devices are starting after mountall.conf and udev.conf from /etc/init/cryptdisks-enable.conf (including /lib/cryptsetup/cryptdisks.functions). This script read the /etc/crypttab and /etc/default/cryptdisks to create or open the crypted devices.

The mountall.conf runs the new command "mountall" (binary!) that reads the /etc/fstab and tries to mount all devices described therein (exclude the ones with "noauto" option).

Mounting a closed or not created crypt-device like /dev/mapper/crypttmp isn't possible! This is the jumping point! It is necessary to open or create the crypt-devices BEFORE mounting them.

root-Luks-cryptsetup-devices with passphrase-input over keyboard seems to open automatically before running the *.conf-files.

This is my workaround:

--------

1) Basics (with and without an external key-file)

 - log in as root (on console with "sudo -s")
 - open /etc/init/cryptdisks-enable.conf in an editor
 - replace "start on stopped udevtrigger" with "start on startup"
 - save the script
 - open /etc/init/mountall.conf
 - replace "start on startup" with "start on stopping cryptdisks-enable"
 - save the script

--------

2) Additionals (just for using a key-file on an external device)

 - determine the external device (USB-stick) (e.g. /dev/sdb1)
 - for rookies only: replace sdXY in the following codes with the determined indication of your external device
 - open (still as root) /etc/fstab
 - add "/dev/sdXY /mnt ext2 noauto,ro,dev,nouser,async 0 0"
 - for rookies only: instead of /mnt you MUST choose the same directory you use for the key-file-path in /etc/crypttab
 - for rookies only: instead of ext2 you MUST choose the filesystem of your external device /dev/sdXY
 - for all: you can use other options, but MUST use "noauto", because mountall.conf will try to mount it if that option isn't set
 - save fstab
 - open /etc/default/cryptdisks in an editor
 - replace 'CRYPTDISKS_MOUNT=""' with 'CRYPTDISKS_MOUNT="/dev/sdXY"'
 - save the script

so far so good? It works, but...

... there is still a little problem left!

/etc/init/cryptdisks-enable.conf mounts /dev/sdXY but couldn't close it after using. I think, because udevd isn't running at the point of mounting /dev/sdXY. The script udev.conf is started after the cryptdisks-enable.conf stopped. So the mount isn't written in /etc/mtab or given to /proc/mounts.

fact: after booting the system, /dev/sdXY is still mounted on /mnt - but you cannot get any system-output for this! Nor "df" nor "cat /etc/mtab" nor "cat /proc/mounts" tells you something about it!

solution: you can use "umount /mnt" to unmount it! "umount /dev/sdXY" don't work maybe because umount substitute /mnt for /dev/sdXY by looking at mtab or /proc/mounts before unmounting it? I think so.

I wrote a little runlevel-script "S05cryptUmount" with that commandline and placed it in /etc/init.d and linked it from /etc/rc2.d/.

--------

On my old Athlon 2200+ system it works real fine! (until now - knock on wood - knock, knock - I'll see what happen if I install additional software...)

Please post here, if your karmic-system doesn't boot up with this solution!

I hope, this helps many people and the canonical-team to solve the init-problem(s).

Nice to meet you - C U soon...

Greetings from germany to the linux-community all over the world,

all-by-my-self