improve ecryptfs-mount-private output at error

Bug #1297044 reported by Karl-Philipp Richter
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
eCryptfs
Confirmed
Undecided
Unassigned

Bug Description

When ecryptfs-mount-private fails due to a missing file or diretory it should catch the exception/anticipate this state and provide useful error messages. It does not in the following example:
Steps to reproduce:
<code>
# Open system recovery and open root console
remount -o remount,rw /
init 3
su <user>
ecryptfs-mount-private
# enter login password
</code>
This will print
<output>
inserted auth tok with sig [...] into the user session keyring
open: No such file or directory
Error locking counter
</output>
user doesn't have any idea what went wrong, but output could be helpful, e.g. tell WHICH file or directory is missing.

version information depend on:
https://bugs.launchpad.net/ecryptfs/+bug/1297042

aporter (aporter)
Changed in ecryptfs:
status: New → Confirmed
Revision history for this message
Sam Pointer (sam.pointer) wrote :

Should anybody trying to be mount an encrypted volume in 2017 from a recovery root prompt, the following steps work on Ubuntu 14.

The primary missing file is the symlink of `/dev/shm` to `/run/shm` and the permissions on the target when booted in this state.

export user="me"
chgrp ${user} /run/shm
chmod g+w /run/shm
cd /dev
ln -s /run/shm/ shm
mount -o remount,rw $(mount | grep "on / type" | awk '{print $1}') /
su - ${user}
/usr/bin/ecryptfs-mount-private

Revision history for this message
Sam Pointer (sam.pointer) wrote :

This specific problem seems to have been introduced in Ubuntu in 2011 with the move to the /run filesystem.[1] Unless /etc/init/mounted-dev.conf is run the symlink of /dev/shm, created in that script, will not be created.

The reason /dev/shm is expected is because `ecryptfs-mount-private` executes mount.ecryptfs_private, which is built to expect /dev/shm to exist.[2]

[1]: http://metadata.ftp-master.debian.org/changelogs/main/m/mountall/oldstable_changelog
[2]: http://bazaar.launchpad.net/~ecryptfs/ecryptfs/trunk/view/head:/src/utils/mount.ecryptfs_private.c#L55

Revision history for this message
Sam Pointer (sam.pointer) wrote :

The underlying reason for this error is rooted in the move to the /run filesystem in 2011. Unless /etc/init/mounted-dev.conf is run a symlink from /dev/shm to /run/shm is not created.[1]

/usr/bin/ecryptfs-mount-private itself executes /sbin/mount.ecryptfs_private, which in turn is built to exepect /dev/shm to exist.[2]

[1]: http://metadata.ftp-master.debian.org/changelogs/main/m/mountall/oldstable_changelog
[2]: http://bazaar.launchpad.net/~ecryptfs/ecryptfs/trunk/view/head:/src/utils/mount.ecryptfs_private.c#L55

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.