Bug 799514

Summary: systemd fails to mount encrypted filesystem image
Product: [openSUSE] openSUSE Tumbleweed Reporter: Christian Boltz <suse-beta>
Component: BasesystemAssignee: Frederic Crozat <fcrozat>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P5 - None    
Version: 13.1 Beta 1   
Target Milestone: ---   
Hardware: Other   
OS: openSUSE 12.2   
Whiteboard:
Found By: Beta-Customer Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Christian Boltz 2013-01-20 21:50:50 UTC
systemd fails to mount an encrypted filesystem image - both on boot and later when trying to mount it manually.

(Mounting my encrypted /home partition works without problems.)


First, this is my setup:

# grep testroot /etc/fstab 
/dev/md3             /testroot            ext3       acl,user_xattr        1 2
/dev/mapper/cr_filespace.img /testroot/filespace  ext3       loop,acl,user_xattr,nofail 0 0

# grep testroot /etc/crypttab 
cr_filespace.img /testroot/filespace.img none       none


The relevant part of /var/log/boot.log is:

[  OK  ] Mounted /boot.
[  OK  ] Started File System Check on /dev/md3.
         Mounting /testroot...
[  OK  ] Mounted /testroot.
[DEPEND] Dependency failed for Cryptography Setup for cr_filespace.img.
[DEPEND] Dependency failed for Encrypted Volumes.
[DEPEND] Dependency failed for /testroot/filespace.
         Starting Restart storage after cryptsetup...
[  OK  ] Stopped LSB: Start LVM2.
         Starting LSB: Start LVM2...
boot.lvm[1572]: Waiting for udev to settle...
boot.lvm[1572]: Scanning for LVM volume groups...
boot.lvm[1572]: Reading all physical volumes.  This may take a while...
[  OK  ] Found device /dev/mapper/cr_home.
         Mounting /home...
[  OK  ] Started Cryptography Setup for cr_home.
[  OK  ] Mounted /home.
boot.lvm[1572]: No volume groups found
boot.lvm[1572]: No volume groups found
boot.lvm[1572]: Activating LVM volume groups...
boot.lvm[1572]: No volume groups found
boot.lvm[1572]: ..done
[  OK  ] Started LSB: Start LVM2.
[  OK  ] Started Restart storage after cryptsetup.
[  OK  ] Reached target Local File Systems.


Manually mounting the encrypted image with systemd also fails:

# systemctl start testroot-filespace.mount 
A dependency job for testroot-filespace.mount failed. See 'journalctl -n' for details.
# journalctl -n
Jan 20 22:29:03 geeko.boltz systemd[1]: Starting Cryptography Setup for /testroot/filespace.img.
Jan 20 22:29:03 geeko.boltz systemd[1]: Failed to start Cryptography Setup for /testroot/filespace.img.
Jan 20 22:29:03 geeko.boltz systemd[1]: Dependency failed for Cryptography Setup for cr_filespace.img.
Jan 20 22:29:03 geeko.boltz systemd[1]: Dependency failed for dev-mapper-cr_filespace.img.device.
Jan 20 22:29:03 geeko.boltz systemd[1]: Dependency failed for /testroot/filespace.
Jan 20 22:29:03 geeko.boltz systemd[1]: Job testroot-filespace.mount/start failed with result 'dependency'.
Jan 20 22:29:03 geeko.boltz systemd[1]: Job dev-mapper-cr_filespace.img.device/start failed with result 'dependency'.
Jan 20 22:29:03 geeko.boltz systemd[1]: Job systemd-cryptsetup@cr_filespace.img.service/start failed with result 'dependency'.


However, manually mounting the image works:

# mount /testroot/filespace.img /testroot/filespace
NOTE: mount.crypt does not support utab (systems with no mtab or read-only mtab) yet. This means that you will temporarily need to call umount.crypt(8) rather than umount(8) to get crypto volumes unmounted.
Password: 
# mount |grep filespace
/dev/mapper/_dev_loop1 on /testroot/filespace type ext3 (rw,relatime,data=ordered)


(un)fortunately I don't need /testroot/filespace too often, so I can't tell exactly when this problem was introduced. IIRC it worked on openSUSE 12.2 without problems.
Comment 1 Frederic Crozat 2013-01-22 17:17:28 UTC
ok, found the issue, cryptsetup autogenerated changed names but not in my patch to support crypto loop files.

I've push a fix (and a lot of unrelated fix) in home:fcrozat:branches:Base:System/systemd (should be available in about one hour).

please test (but it works for my testcase ;)
Comment 2 Christian Boltz 2013-01-22 19:46:22 UTC
I just installed the updated packages, followed by

# systemctl daemon-reexec
#Broadcast message from root@geeko.boltz (Tue, 2013-01-22 20:42:24 CET):

Password entry required for 'Please enter passphrase for disk cr_filespace.img on /testroot/filespace!' (PID 24119).
Please enter password with the systemd-tty-ask-password-agent tool!
 
# systemd-tty-ask-password-agent
Please enter passphrase for disk cr_filespace.img on /testroot/filespace! 
# mount |grep filesp
/dev/dm-2 on /testroot/filespace type ext3 (rw,relatime,errors=continue,user_xattr,acl,barrier=1,data=ordered)


-> Looks very good - I didn't even need to reboot :-)  Thanks!
Comment 3 Bernhard Wiedemann 2013-01-23 14:00:22 UTC
This is an autogenerated message for OBS integration:
This bug (799514) was mentioned in
https://build.opensuse.org/request/show/149704 Factory / systemd
Comment 4 Frederic Crozat 2013-01-23 14:18:31 UTC
fixed in Base:System and Factory