[Bug 719563] Re: mountall: fatal error: cannot open /dev/mapper/crypthome_unformatted

Thorsten Kohfeldt thorsten.kohfeldt at gmx.de
Wed May 2 18:45:19 UTC 2012


I experience this problem in Oneiric, and I have pinned it down:

The problem vanishes when I make fsck wait for some time before it accesses a device which is given by a logical link to the "real" device node, for example /dev/disk/by-uuid/<something>.
In my specific case the device is encrypted and /etc/fstab lists that same uuid.

Given these circumstances fsck seemingly tries to be clever and somehow tracks all logical links.
On encrypted devices fsck and cryptsetup RACE each other.
When cryptsetup sets up the decrypt device dm-<some integer>, it creates a link /dev/mapper/<some name>_unformatted, which it a little later renames to /dev/mapper/<some name> (seemingly in order to "activate it", which it already WAS when created as the /dev/dm-<some integer> node).
Sometimes fsck even starts before the /dev/mapper/<some name>_unformatted links exists !


THIS IS A TOOL INTERACTION BUG, which can either be fixed in
a) mountall (or udev ?), in case it is responsible for invoking fsck too soon.
or
b) fsck, which should maybe not access the device prematurely and should not be surprised if ANY link to the real device node is renamed
or
c) in cryptsetup (in /lib/cryptsetup/cryptdisks.functions ?), which should not naively rename links to created devices.


This is the WORKAROUND, which I hate, so I really ask for a fix near a), b), c) (see above):
1) cp -a /sbin/fsck /sbin/fsck.util-linux
and
2) replace /sbin/fsck with the following script:

--------------------------------------------- SNIP ------------------
#!/bin/sh

FSCK=$0.util-linux

sleep 1

echo `date` $0: now calling "\"$FSCK $*\"" ...

fsckStatus=0
$FSCK $* || fsckStatus=$?

if [ $fsckStatus -eq 0 ]; then
  statusText="success."
else
  statusText="ERROR $fsckStatus !"
fi

echo `date` $0: status of "\"$FSCK $*\"": $statusText

exit $fsckStatus
--------------------------------------------- SNAP ------------------

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to cryptsetup in Ubuntu.
https://bugs.launchpad.net/bugs/719563

Title:
  mountall: fatal error: cannot open /dev/mapper/crypthome_unformatted

Status in “cryptsetup” package in Ubuntu:
  New
Status in “mountall” package in Ubuntu:
  New

Bug description:
  Binary package hint: mountall

  I have upgraded from Maverick to Natty yesterday, while there are
  still some (apparently irrelevant) packages pending.

  I am using cryptsetup and after entering the passphrase for my crypthome device (where keys for other devices are stored), I am getting a fatal error from mountall (translated from German):
    fsck.ext4: file/dir not found when trying to access /dev/mapper/crypthome_unformatted - Possibly non-existent device?
    mountall: fsck /home [$ID] exited with code 8
    mountall: fatal fsck error: /home

  Then it says that /root is still not mounted, which resides on /home,
  and nothing happens anymore.

  I can fix this using the "M"anual recovery, and doing the following:
  1. mount /home
  2. start every cryptdisk device using cryptdisk_start (necessary for all of them except crypthome)
  3. mount -a
  4. ctrl-d
  --- 
  Architecture: i386
  DistroRelease: Ubuntu 11.04
  NonfreeKernelModules: nvidia
  Package: mountall 2.21
  PackageArchitecture: i386
  ProcEnviron:
   LANGUAGE=de_DE:de:en_US:en_GB:en
   PATH=(custom, user)
   LANG=de_DE.UTF-8
   SHELL=/bin/zsh
  ProcVersionSignature: Ubuntu 2.6.38-3.30-generic 2.6.38-rc4
  Tags: natty
  Uname: Linux 2.6.38-3-generic i686
  UserGroups: adm admin audio cdrom dialout dip floppy fuse libvirtd lpadmin plugdev pulse sambashare sbuild scanner src video

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cryptsetup/+bug/719563/+subscriptions




More information about the foundations-bugs mailing list