LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   /dev/shm (tmpfs) file system stops working (https://www.linuxquestions.org/questions/linux-software-2/dev-shm-tmpfs-file-system-stops-working-4175414543/)

GreyBeard 07-02-2012 08:43 PM

/dev/shm (tmpfs) file system stops working
 
Sometimes /dev/shm just plain stops working. I start getting messages
like "no space left on device" and I can do nothing with it. When I do
a "df" I get something like this:

Filesystem Type Size Used Avail Use% Mounted on
/dev/sda1 ext4 15G 5.6G 8.5G 40% /
/dev/sda2 ext4 209G 183G 16G 93% /home
tmpfs tmpfs 1.6G - - - /dev/shm

Note the dashes in the "tmpfs" line. What exactly do those dashes mean?
I understand that they mean "usage data is unavailable", but why is that
so? I certainly cannot use the file system even tho it appears to be
there; it just "stops working".

I run Slackware 13.37.0. When I do a "uname -a" I get:

Linux atomik 2.6.37.6-smp #1 SMP Sat Apr 9 14:01:14 CDT 2011 \
i686 Intel(R) Atom(TM) CPU D510 @ 1.66GHz GenuineIntel GNU/Linux


I don't know why, when or how it happens. Is it a tmpfs bug, a
Slackware bug, or an indication that my system has been compromised?
(Pardon my paranoia; my machines ARE attacked many times every day.)
I don't place heavy demands on RAM most of the time. This just kinda
happens when it wants to even when everything else seems fine.


The problem goes away if I un-mount and then re-mount /dev/shm, but
until I do that all my processes which depend on /dev/shm are hosed.


TIA

Slackyman 07-03-2012 01:59 AM

Try:
chmod 1777 /dev/shm
and look at who is the owner of /dev/shm with
ls -l /dev
Let's even take a look at your /etc/fstab! It must look like
Code:

tmpfs    /dev/shm    tmpfs    defaults    0    0

GreyBeard 07-06-2012 03:00 AM

"ls -l /dev" yields

drwxrwxrwt 4 root root 140 Jul 3 10:18 shm/

before and after I do the "chmod 1777 /dev/shm". Of course
/dev/shm has not yet failed. I'll try it again whenever it
next decides to fail. I want to emphasize that I have been
using /dev/shm successfully for some time. It's just that
it goes away now and again ....

Slackyman 07-06-2012 08:46 AM

Can you show me the ls -l /dev result when it has the problem?

GreyBeard 08-13-2012 04:28 PM

OK, /dev/shm finally failed again after a month of behaving itself. Here is how the device is behaving now:


# The /dev/shm device is currently in its erroneous
# we-have-no-size-information state:
root@atomik $?=2> df
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda1 ext4 15G 5.9G 8.2G 42% /
/dev/sda2 ext4 209G 187G 11G 95% /home
tmpfs tmpfs 1.6G - - - /dev/shm


# I can see into the device.
root@atomik $?=1> ls -laF /dev/shm/root/nil
total 0
drwxr-xr-x 2 root root 80 Aug 13 16:40 ./
drwx------ 3 root root 60 Aug 4 19:40 ../
-rw-r--r-- 1 root root 0 Aug 13 16:40 x


# I can create an empty file.
root@atomik $?=0> touch /dev/shm/root/nil/y

root@atomik $?=0> ls -laF /dev/shm/root/nil
total 0
drwxr-xr-x 2 root root 100 Aug 13 16:41 ./
drwx------ 3 root root 60 Aug 4 19:40 ../
-rw-r--r-- 1 root root 0 Aug 13 16:40 x
-rw-r--r-- 1 root root 0 Aug 13 16:41 y


# But I cannot create a file with something in it.
# The file shows up but is empty, eg:
root@atomik $?=0> echo hello > /dev/shm/root/nil/z
-su: echo: write error: No space left on device

root@atomik $?=1> ls -laF /dev/shm/root/nil
total 0
drwxr-xr-x 2 root root 120 Aug 13 16:41 ./
drwx------ 3 root root 60 Aug 4 19:40 ../
-rw-r--r-- 1 root root 0 Aug 13 16:40 x
-rw-r--r-- 1 root root 0 Aug 13 16:41 y
-rw-r--r-- 1 root root 0 Aug 13 16:41 z




The answers to questions posted in previous replies to this topic are as follows now that the fault is in effect:

# The fstab entry is correct and always has been.
root@atomik $?=0> fgrep /dev/shm /etc/fstab
tmpfs /dev/shm tmpfs defaults 0 0

# Trying the chmod as requested.
root@atomik $?=0> chmod 1777 /dev/shm

# The protections have changed from up above, ie
# everyone can now write to it ...
root@atomik $?=0> ls -ld /dev/shm
drwxrwxrwt 4 root root 140 Aug 5 17:06 /dev/shm/

# ... except me.
root@atomik $?=0> echo goodbye > /dev/shm/root/nil/z
-su: echo: write error: No space left on device

So there you have it. The device is there but the size are
somehow screwed up so anything which needs to allocate space
cannot do so.

Sorry but I need to remount the device so I can get back to
what I was doing. I'd be happy to take your suggestions about
how to poke at it for the next time this happens, which will
probably be another 1.5 months from now.

Thanks

Slackyman 08-13-2012 04:36 PM

Let's try assigning a size to /dev/shm.
Modify your /etc/fstab addig size to /dev/shm:
Code:

tmpfs      /dev/shm      tmpfs  defaults,size=2g  0  0
(I used 2Gbyte, but you can put any size you want).
And then remount it with sudo mount -o remount /dev/shm

is there enough space on your device?
(let's see it with df -h)


All times are GMT -5. The time now is 03:52 PM.