5

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.
6

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. The RemoveIPC option is set to yes by default. That option tells systemd 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:

  1. Create the files with/for a system user -- a user created with the system option (adduser -r or adduser --system)
  2. Edit /etc/systemd/logind.conf, uncomment the line RemoveIPC=yes, change it to RemoveIPC=no, save, and reboot the system

In my case, I went with option #2 because the user was already created.

References:

  • Insanity, why is this the default behaviour? :| – ffledgling May 5 '18 at 21:58
  • @ffledgling - I can't quite figure it out – Sonny May 15 '18 at 14:02

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.