I've been using ecryptfs with Ubuntu many a year. Today I found a curious error that I cannot fix.

My home folder is auto-mounted as ecryptfs under Ubuntu whenever I login. I have been using this setup since many years ago. The Ubuntu OS has been upgraded using "do-release-upgrade" and I am currently using 17.04. Here is what I found today, to my surprise.

$ pwd
$ ls -altri | grep -in envars~
45:3806647 -rw-r--r--    1 user1 user1    1346 Aug 16  2010 .bash_envars~
46:3806647 -rw-r--r--    1 user1 user1    1346 Aug 16  2010 .bash_envars~
$ sudo ecryptfs-find .bash_aliases~

As the second command shows, there are two completely identical file entries in my home folder! The third command shows that there is a unique corresponding encrypted file. (Its inode is checked to be equal to 3806647 and the underlying ext4 file system is fine according to "fsck".)

Now, at this point, the system seems perfectly usable.

The problem occurs if I delete the file in question.

$ rm .bash_envars~
$ ls -altri | grep -in envars~
ls: cannot access '.bash_envars~': No such file or directory
2:       ? -?????????   ? ?     ?           ?            ? .bash_envars~

At this point, my home folder has an erroneous entry for a non-existent file.

I tried to "fix" this problem by "rm -f" on the file, or restore the encrypted file (from a hardlinked backup) or the decrypted file (from a backup), but I did not have any luck. Whenever the encrypted file exists, then there are two copies of ".bash_envars~", of which I can delete only one.

Now, a solution may be that I back up all files of my home folder except the problem file, re-start my ecryptfs home folder from scratch, and restore all files to the new home folder. However, as my home folder is pretty big (more than 400 GB by now), and it is cloned in three different machines (all of which show the same above problem), I am a bit reluctant to try this "backup and restore everything except the problem file" approach just yet. If there is a quick solution addressing the problem file, that would be great.

Any help?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.