Ecryptfs - mount: mount(2) failed: No such file or directory

Ecryptfs does not provide a helpful error when it fails to find a passphrase in the user's kernel keyring when mounting an encrypted directory.

The solution is to show an error that says, "Failed to perform eCryptfs mount, stored passphrase not found: [-32]"

The error reported by ecryptfs is the following, in system log:

mount.ecryptfs: Failed to perform eCryptfs mount: [-32]

in console output:

mount: mount(2) failed: No such file or directory
Error mounting eCryptfs: [-1] Operation not permitted

Below is the console output:

eric@skylab:~$ sudo ./mount.sh 
Unable to find a list of options to parse, defaulting to interactive mount
Passphrase: 
Select cipher: 
 1) aes: blocksize = 16; min keysize = 16; max keysize = 32
 2) blowfish: blocksize = 8; min keysize = 16; max keysize = 56
 3) des3_ede: blocksize = 8; min keysize = 24; max keysize = 24
 4) twofish: blocksize = 16; min keysize = 16; max keysize = 32
 5) cast6: blocksize = 16; min keysize = 16; max keysize = 32
 6) cast5: blocksize = 8; min keysize = 5; max keysize = 16
Selection [aes]: 
Select key bytes: 
 1) 16
 2) 32
 3) 24
Selection [16]: 
Enable plaintext passthrough (y/n) [n]: 
Enable filename encryption (y/n) [n]: y
Filename Encryption Key (FNEK) Signature [d395309aaad4de06]: be877764c5918621
Unable to find a list of options to parse, defaulting to interactive mount
Attempting to mount with the following options:
  ecryptfs_unlink_sigs
  ecryptfs_fnek_sig=be877764c5918621
  ecryptfs_key_bytes=16
  ecryptfs_cipher=aes
  ecryptfs_sig=d395309aaad4de06
mount: mount(2) failed: No such file or directory
Error mounting eCryptfs: [-1] Operation not permitted
Check your system logs; visit <http://ecryptfs.org/support.html>

Solution 1:

Run the ecryptfs add passphrase command with the filename encryption key (if you're encrypting the filenames)

ecryptfs-add-passphrase --fnek

Solution 2:

It's a common mistake when you are going to mount the old home directory but actually unsuccessfully mounting your current user's encrypted home (if old and new usernames are the same).

/home/<user>/.Private is a symlink to /home/.ecryptfs/<user>/.Private. On a new system it points to your current home directory, not the old home directory you probably trying to mount.

So be aware to mount .ecryptfs/<user>/.Private, not just <user>/.Private.