Bug 669700 - Size parameter for tmpfs in fstab is not applied during reboot.
Summary: Size parameter for tmpfs in fstab is not applied during reboot.
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: initscripts   
(Show other bugs)
Version: 6.0
Hardware: Unspecified
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Lukáš Nykrýn
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Keywords: Reopened
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-14 13:44 UTC by Petr Ruzicka
Modified: 2018-12-01 17:49 UTC (History)
16 users (show)

Fixed In Version: initscripts-9.03.32-1.el6
Doc Type: Bug Fix
Doc Text:
Cause: /dev/shm is mounted in dracut without attributes from fstab. Consequence: /dev/shm does not have attributes from fstab. Fix: Remount /dev/shm in rc.sysinit. Result: /dev/shm has attributes from fstab.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-21 10:25:13 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0518 normal SHIPPED_LIVE initscripts bug fix and enhancement update 2013-02-20 21:29:01 UTC
Red Hat Knowledge Base (Legacy) 46482 None None None Never

Description Petr Ruzicka 2011-01-14 13:44:05 UTC
*** Description of problem:

I put this line into fstab:
tmpfs                   /dev/shm                tmpfs   defaults,size=10m        0 0

I expect tmpfs will have 10 Megs, but after reboot it's still 50% of memory.

This is working correctly under RHEL 5.5 and 4.8.

*** Version-Release number of selected component (if applicable):

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.0 (Santiago)

*** How reproducible:

echo "tmpfs                   /dev/shm                tmpfs   defaults,size=10m        0 0" >> /etc/fstab
reboot
df -h /dev/shm

*** Steps to Reproduce:
1. echo "tmpfs   
                /dev/shm                tmpfs   defaults,size=10m        0 0" >> /etc/fstab

2. reboot

3. df -h /dev/shm
  
*** Actual results:

# df -h /dev/shm
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                 7.8G     0  7.8G   0% /dev/shm

*** Expected results:

# df -h /dev/shm
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                 7.8G     0  10M   0% /dev/shm

*** Additional info:

This is working correctly under RHEL 5.5 and 4.8.

Comment 2 RHEL Product and Program Management 2011-01-14 14:10:14 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 3 Ondrej Vasik 2011-01-14 14:27:16 UTC
Filesystem is just basic package with system directory layout. Let's try kernel for this one bugzilla.

Comment 4 Petr Ruzicka 2011-01-14 14:52:15 UTC
I tried the following entries in fstab, but no luck:

none                    /dev/shm                tmpfs   defaults,size=5G        0 0
tmpfs                   /dev/shm                tmpfs   defaults,size=5g        0 0
tmpfs                   /dev/shm                tmpfs   defaults,size=500m        0 0
tmpfs                   /dev/shm                tmpfs   defaults,size=500M        0 0

Regards PetrR

Comment 5 Petr Ruzicka 2011-01-17 10:38:54 UTC
Hello.

I also tried size=10% parameter, which is also not working.

See you

PetrR

Comment 6 Petr Ruzicka 2011-01-26 10:16:53 UTC
Hello.

I can confirm this bug is also appearing in the latest RHEL6.1 version (installed today from developer's repo).

I tried in /etc/fstab:

none                    /dev/shm                tmpfs   defaults,size=10m       
0 0
none                    /dev/shm                tmpfs   defaults,size=10M       
0 0
none                    /dev/shm                tmpfs   defaults,size=10%       
0 0

-> but after reboot - nothing changed.

Regards.

PetrR

Comment 7 RHEL Product and Program Management 2011-02-01 05:50:25 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 8 Jeff Moyer 2011-02-01 15:17:55 UTC
If you try to do the mount from the command line, I think you'll find it works:

# mount -t tmpfs none /mnt/xx -o size=10M
# mount | grep tmpfs
none on /mnt/xx type tmpfs (rw,size=10M,rootcontext="unconfined_u:object_r:mnt_t:s0")
# df -h /mnt/xx
Filesystem            Size  Used Avail Use% Mounted on
none                   10M     0   10M   0% /mnt/xx

I can also resize this on the fly:
# mount -t tmpfs none /mnt/xx -o remount,size=100M
# df -h /mnt/xx
Filesystem            Size  Used Avail Use% Mounted on
none                  100M     0  100M   0% /mnt/xx

So, this may be a dracut or /sbin/init issue, but certainly not a kernel one.

Comment 9 Petr Ruzicka 2011-02-01 16:31:25 UTC
Mounting from command line is forking fine.

But this should be also working from /etc/fstab during the boot...

I'm not sure where should I put this ticket (sorry)... I just want to report the bug...

Comment 10 Eric Sandeen 2011-02-01 18:21:12 UTC
A test with a size specified in /etc/fstab:


tmpfs     /tmp/tmpfs        tmpfs   defaults,size=10m      0 0


and then 

# mkdir /tmp/tmpfs
# mount /tmp/tmpfs

might tell us if it's an fstab parsing problem, maybe related to util-linux?  If it works, then it is likely an initramfs sort of thing

Comment 11 RHEL Product and Program Management 2011-02-01 19:06:35 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 12 Petr Ruzicka 2011-02-02 08:54:09 UTC
I tried it as you mentioned above:

# grep ^tmpfs /etc/fstab 
tmpfs                   /tmp/tmpfs                   tmpfs,size=10m   defaults        0 0

# mount /tmp/tmpfs

# df -h /tmp/tmpfs
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                 246M     0  246M   0% /tmp/tmpfs

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.0 (Santiago)

Regards 

PetrR

Comment 14 Karel Zak 2011-02-02 17:07:22 UTC
I'm not able to reproduce the bug on RHEL6.1 stable (QA) system

# echo "tmpfs   /mnt/tmpfs    tmpfs   defaults,size=10m   0 0" >> /etc/fstab

# mkdir -p /mnt/tmpfs

# mount /mnt/tnmpfs

# df -h | grep /mnt/tmpfs
tmpfs                  10M     0   10M   0% /mnt/tmpfs

# uname -a
Linux auto-x86-64-001.ss.eng.bos.redhat.com 2.6.32-94.el6.x86_64 #1 SMP Tue Dec
28 21:55:53 EST 2010 x86_64 x86_64 x86_64 GNU/Linux

# rpm -qf /bin/mount
util-linux-ng-2.17.2-9.el6.x86_64


Please, use strace to check if mount(8) works as expected:

# strace -f -e mount mount /mnt/tmpfs
[...]
[pid 10914] mount("tmpfs", "/mnt/tmpfs", "tmpfs", MS_MGC_VAL, "size=10m,rootcontext=\"unconfined_u:object_r:mnt_t:s0\"") = 0

^^^ this is syscall, size=10m is there.

Comment 15 Karel Zak 2011-02-02 17:10:53 UTC
(In reply to comment #12)
> I tried it as you mentioned above:
> 
> # grep ^tmpfs /etc/fstab 
> tmpfs                   /tmp/tmpfs                   tmpfs,size=10m   defaults 
>       0 0

This is not valid fstab entry of course, must be

    tmpfs   /tmp/tmpfs  tmpfs   size=10m,defaults

in your example is size=10m interpreted as second possible filesystem name (see -t  in mount(8)) rather than mount option....

Comment 16 Petr Ruzicka 2011-02-03 09:33:05 UTC
Hello.

The "original bug description" was about the following lines in fstab (please see the "/dev/shm"):

tmpfs   /dev/shm  tmpfs   defaults,size=10m 0 0

I also tried the line mentioned above (just changed the /tmp/tmpfs -> /dev/shm):

tmpfs   /dev/shm  tmpfs   size=10m,defaults 0 0

=> But after reboot the size was not applied. 
The tests with manual "mount" are always working fine - but during reboot it's not under RHEL6.x.


This line in /etc/fstab "is working" fine in RHEL 5.6, but not in RHEL6.x:
 
tmpfs   /dev/shm  tmpfs   defaults,size=10m 0 0


This line in /etc/fstab "is working" fine in RHEL 5.6, but not in RHEL6.x:

tmpfs   /dev/shm  tmpfs   size=10m,defaults 0 0

Please let me know...

PetrR

Comment 17 Harald Hoyer 2011-02-03 09:47:06 UTC
dracut mounts /dev/shm and it is never remounted. So any /etc/fstab entry is not honored.

Can you remount /dev/shm with -o remount,size=10m in a shell?

Comment 18 Petr Ruzicka 2011-02-03 09:57:17 UTC
I can remount /dev/shm in shell (with the correct size):

# df -h /dev/shm
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                 246M     0  246M   0% /dev/shm

# grep shm /etc/fstab
tmpfs                   /dev/shm                tmpfs   size=10m,defaults        0 0

# mount /dev/shm

# df -h /dev/shm
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                  10M     0   10M   0% /dev/shm

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.0 (Santiago)


=> So if I understand it well. It's not possible to set size parameter for /dev/shm during boot in /etc/fstab, because it's used by dracult. 
=> Even this works in previous RHELs (4.x, 5.x) this will not work under RHEL6.x and later.
=>> Am I right?

PetrR

Comment 19 Harald Hoyer 2011-02-03 10:13:09 UTC
err.. you did not remount... you just double mounted /dev/shm.

check with 
# grep shm /proc/mounts

And yes, in the current state, you could not control the following mount points with /etc/fstab:

/proc
/sys
/dev
/dev/pts
/dev/shm
/

dracut upstream has support for /etc/fstab.sys and mount flags of / are honored.

If /dev/shm is critical, then you would have to request a remount in dracut, after /etc/fstab is accessible and call this a bug.

What about an entry in rc.local:

mount -o remount,size=10M /dev/shm

Comment 20 Petr Ruzicka 2011-02-03 10:44:50 UTC
Hello.

Thanks for the explanation. I can always to "workaround" in init scripts, but it's not "common".

Dracult is the way forward and even if it brings little "incompatibility" with previous RHEL versions like in this example, it's a good thing.

==>> The final solution is using the init scripts to remount /dev/shm, because dracult ignores the mounts /dev/shm and it's not remounted after. Therefore /etc/fstab settings for /dev/shm are ignored.

=> I think you can close the ticket now, because I got the answer - It's just behave different than in RHEL5.x or 4.x.


Some results from test I did:

# grep shm /proc/mounts 
tmpfs /dev/shm tmpfs rw,seclabel,relatime 0 0

# grep shm /etc/fstab
tmpfs                   /dev/shm                tmpfs   size=10m,defaults        0 0

# mount -o remount,size=10m /dev/shm
# df -h /dev/shm
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                  10M     0   10M   0% /dev/shm

*********

# umount /dev/shm
# grep shm /proc/mounts 
# grep shm /etc/fstab
tmpfs                   /dev/shm                tmpfs   size=10m,defaults        0 0

# mount /dev/shm
# df -h /dev/shm
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                  10M     0   10M   0% /dev/shm


Thanks 

PetrR

Comment 22 Javier Ramirez 2012-09-28 12:39:22 UTC
Hi,

The customer where I'm working right now has found another workaround:

diff /etc/rc.d/rc.sysinit.org /etc/rc.d/rc.sysinit
504c504
< mount -f /dev/shm >/dev/null 2>&1
---
> mount /dev/shm >/dev/null 2>&1 

What do you think about it?

Cheers.

Comment 23 Harald Hoyer 2012-09-28 14:53:40 UTC
(In reply to comment #22)
> Hi,
> 
> The customer where I'm working right now has found another workaround:
> 
> diff /etc/rc.d/rc.sysinit.org /etc/rc.d/rc.sysinit
> 504c504
> < mount -f /dev/shm >/dev/null 2>&1
> ---
> > mount /dev/shm >/dev/null 2>&1 
> 
> What do you think about it?
> 
> Cheers.

That would of course be the preferred fix. Reassigning to initscripts for comments.

Comment 24 Lukáš Nykrýn 2012-10-01 14:17:16 UTC
If I am not mistaken difference between 5 and 6 is that in rhel5 we don't mount /dev/shm in dracut.

But remount it in initscripts should be fine.

Comment 29 errata-xmlrpc 2013-02-21 10:25:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0518.html


Note You need to log in before you can comment on or make changes to this bug.