I am migrating a web application that was previously running on Ubuntu 12.04 LTS. It makes extensive use of /dev/shm/
. I'm finding that the application data is disappearing from /dev/shm/
on the Ubuntu 16.04 LTS server.
Is there some sort of garbage collection that's deleting the files and directories from there? I see that 12.04 is configured with this symbolic link: /dev/shm -> /run/shm
, whereas 16.04 has exactly the opposite: /run/shm -> /dev/shm
. I don't see how that would make any difference, though.
UPDATES
- I suspected AppArmor, but removing it did not change the behavior
- The removal of the directory structures seems to happen every five minutes
- Directories with files in them eventually get deleted, but not as quickly
- I'm suspecting the age of the files/directories affects deletion
- It looks like this guy is experiencing the same issue.
After hours of searching and reading, I found the culprit. It's a setting for
systemd
. The/etc/systemd/logind.conf
contains default configuration options, with each of them commented out. TheRemoveIPC
option is set toyes
by default. That option tellssystemd
to clean up interprocess communication (IPC) for "user accounts" who aren't logged in. This does not affect "system accounts"In my case, the files and directories were being created for a user account, not a system account.
There are two possible solutions:
adduser -r
oradduser --system
)/etc/systemd/logind.conf
, uncomment the lineRemoveIPC=yes
, change it toRemoveIPC=no
, save, and reboot the systemIn my case, I went with option #2 because the user was already created.
References: