Score:1

/dev/shm is full at 100% use, but has no large files

aw flag

I recently updated to Ubuntu 20.04.3 (kernel 5.11.0-34-generic #36~20.04.1-Ubuntu SMP), so this may be a bug. After a few hours of use the shared memory partition fills up. According to df, partition /dev/shm has 16G of data in it:

Filesystem                 Size  Used Avail Use% Mounted on
...
tmpfs                       16G   16G     0 100% /dev/shm
...

Trying to write a new file to that partition fails:

$ echo "foobar" > /dev/shm/foobar.txt
bash: echo: write error: No space left on device

However, when I look at the files in that partition, the files only use around 170K:

$ du -h /dev/shm/*
0   /dev/shm/foobar.txt
4.0K    /dev/shm/sem.CiscoAcMemoryLock
4.0K    /dev/shm/sem.CiscoAcNamedEventNVM
4.0K    /dev/shm/sem.CiscoAcNamedEventOpenDNS
4.0K    /dev/shm/sem.CiscoAcNamedEventPostureISE
156K    /dev/shm/tmp

I notice this happening because google-chrome dumps core, and I can't restart Chrome until there is space in /dev/shm, and the only I've found to way to get the memory back is reboot.

How can I find out what is using space in /dev/shm?

aw flag
After trial and error, I found this was caused by google-chrome. I'm able to work around it by running Chrome with the "--disable-dev-shm-usage" option. I'm still interested in answers which could have pointed out Chrome as the culprit.
Score:1
cn flag

Files exist on a filesystem as long as they still have a directory entry or are being kept open by a current process. Running du -h /dev/shm/ (adding the * excludes files beginning with .) will only show the former.

You also need to run sudo lsof /dev/shm, which shows the currently open files on that filesystem.

For example:

COMMAND      PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
QtWebEngi 654092 user  DEL    REG   0,31          2610 /dev/shm/.org.chromium.Chromium.eAzBpJ
QtWebEngi 654092 user  DEL    REG   0,31          2613 /dev/shm/.org.chromium.Chromium.eY7oKn
QtWebEngi 654092 user  DEL    REG   0,31          2624 /dev/shm/.org.chromium.Chromium.zuBEOF
QtWebEngi 654092 user   22u   REG   0,31      144 2610 /dev/shm/.org.chromium.Chromium.eAzBpJ (deleted)
QtWebEngi 654092 user   29u   REG   0,31      144 2613 /dev/shm/.org.chromium.Chromium.eY7oKn (deleted)
QtWebEngi 654092 user   46r   REG   0,31  1048576 2624 /dev/shm/.org.chromium.Chromium.zuBEOF (deleted)

Lines that end with (deleted) won't be found by du, but will still take up space as long as any process is holding on to that file.

aw flag
Good suggestion, and I'm sure this will be useful for others, but for me, when I kill all processes that show up with the lsof command, and lsof shows nothing attached to /dev/shm, and the /dev/shm directory is complete empty, df shows that partion at 100% full.
Score:0
in flag

I have same problem with Ubuntu 20.04 LTS (kernel version 5.11.0.34.36, updated with updater to 5.11.0.36.40). After updating kernel to latest version, was problem solved. By post from Marc Gil Sendra, see https://unix.stackexchange.com/questions/654004/ubuntu-20-04-problems-with-chrome-teams-visual-studio-code-maybe-related-wi from 14.7.2021 he solve problem with updating kernel to 5.12.10 version. I use https://linuxhint.com/install-upgrade-linux-kernel-ubuntu-linux-mint/ to upgrade version to 5.14.8-051408-generic and problem seems to be solved.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.