Bug 397778 - SMB access causes ecryptfs counter /dev/shm/ecryptfs-$USER-Private to decrement but not increment causing KDE apps to lose access to home directory
Summary: SMB access causes ecryptfs counter /dev/shm/ecryptfs-$USER-Private to decreme...
Status: RESOLVED WORKSFORME
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Neon Linux
: NOR grave
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-23 09:43 UTC by Nick
Modified: 2022-12-30 05:24 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick 2018-08-23 09:43:16 UTC
I've no idea what KDE product or component this goes under or whether the problem is caused by a KDE component, however because the end result of the problem is the ecryptfs directory being umounted causing lots of KDE app write errors I thought it best to report it here.

To reproduce this bug you need Samba installed with the smbd deamon running and you need to have your home directory encrypted using ecryptfs. You also need to create a shared directory, that is publically available ie requires no login.

Example.
You have a Windows 10 system on your network, you access the shared directory and after a while you get write errors from any apps (KDE or otherwise) you are using. This is because the ecryptfs directory has unmounted.

Whether the ecryptfs unmounts is determined by the counter /dev/shm/ecryptfs-$USER-Private. Typically after KDE starting this counter is either 1 or 2 and with each new user login e.g. ALT-F1/F2 etc the counter increments and then decrements when the user logs out. Eventually when everybody logs out, including the KDE desktop user the counter goes to 0 and the ecryptfs un-mounts.

The problem is when an smb access occurs the counter never increments however a few seconds later it always decrements. This causes the counter to reach 0 prematurely and the home directory is unmounted. Problem is your KDE desktop is still running and now KDE and any apps your running at the time can't access the home directory and KDE reports unable to write this config file etc..

So is this an smb issue, an ecryptfs issue or does KDE update the /dev/shm/ecryptfs-$USER-Private counter ? making it a KDE issue.

I know ecryptfs has an auto mount/umount feature which is implemented in my setup e.g. the files /home/$USER/.ecryptfs/auto-mount (zero length file) and /home/$USER/.ecryptfs/auto-mount (zero length file) both exist.

Is it because I'm sharing a folder via smb that doesn't require authentication and that's causing the discrepancy between the increment and decrement of the /dev/shm/ecryptfs-$USER-Private counter ?

I know there are other options for accessing smb shares such as sftp etc but this problem also occurs by simply having a windows system on the same network, on the windows system you don't even need to access the share as I guess windows automatically looks around to see what else is on the network in the background. This causes a linux system to lose access to its encrypted home directory.

This is a long standing issue going back years, 100% reproducible and has been seen on multiple versions of Kubuntu and also on KDE Neon which I'm now running.

Any help appreciated.
Comment 1 Nate Graham 2018-09-04 03:26:29 UTC
Thanks for reporting this. We're currently doing a push for better Samba support and I'd like to see this included. Let me see if I can find some folks who can figure out what's going on here.
Comment 2 Nick 2018-09-04 07:40:45 UTC
That's much appreciated. If you need any additional help or info let me know.

Just to clarify, you don't need a windows systems on your network to produce this bug, The same issue occurs in a all Linux network. Just access your smb share from another KDE desktop using KIO smb:// in dolphin etc and watch your login counter deferment with each access.
Comment 3 Nick 2018-09-04 07:43:43 UTC
Deferment=decrement. Sorry writing this on  my phone! 😊
Comment 4 Justin Zobel 2022-11-30 05:28:32 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 5 Bug Janitor Service 2022-12-15 05:13:38 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Bug Janitor Service 2022-12-30 05:24:17 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!