LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-08-2016, 04:31 PM   #1
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Rep: Reputation: Disabled
/dev/shm mounted twice on -current


Hi,

Code:
$ cat /proc/mounts 
proc /proc proc rw,relatime,gid=2001,hidepid=2 0 0
sysfs /sys sysfs rw,relatime 0 0
tmpfs /run tmpfs rw,relatime,mode=755 0 0
devtmpfs /dev devtmpfs rw,relatime,size=4037652k,nr_inodes=1009413,mode=755 0 0
/dev/sda2 / ext4 rw,relatime,data=ordered 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,relatime 0 0
devpts /dev/pts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /dev/shm tmpfs rw,relatime 0 0
cgroup_root /sys/fs/cgroup tmpfs rw,relatime,mode=755 0 0
cpuset /sys/fs/cgroup/cpuset cgroup rw,relatime,cpuset 0 0
cpu /sys/fs/cgroup/cpu cgroup rw,relatime,cpu 0 0
cpuacct /sys/fs/cgroup/cpuacct cgroup rw,relatime,cpuacct 0 0
blkio /sys/fs/cgroup/blkio cgroup rw,relatime,blkio 0 0
memory /sys/fs/cgroup/memory cgroup rw,relatime,memory 0 0
devices /sys/fs/cgroup/devices cgroup rw,relatime,devices 0 0
freezer /sys/fs/cgroup/freezer cgroup rw,relatime,freezer 0 0
net_cls /sys/fs/cgroup/net_cls cgroup rw,relatime,net_cls 0 0
perf_event /sys/fs/cgroup/perf_event cgroup rw,relatime,perf_event 0 0
net_prio /sys/fs/cgroup/net_prio cgroup rw,relatime,net_prio 0 0
pids /sys/fs/cgroup/pids cgroup rw,relatime,pids 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
/dev/sda3 /home ext4 rw,relatime,data=ordered 0 0
tmpfs /dev/shm tmpfs rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
gvfsd-fuse /home/antezu/.gvfs fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1001,group_id=100 0 0
/dev/shm is mounted twice. Is that correct?

--
Best regards,
Andrzej Telszewski
 
Old 02-08-2016, 05:49 PM   #2
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
Well spotted. Looks like rc.udev mounts it before /etc/mtab gets cleared out, and then it gets mounted again by 'mount -a' later on.

This should fix it:
Code:
--- rc.S.orig   2016-02-08 23:15:45.715960963 +0000
+++ rc.S        2016-02-08 23:42:01.282616442 +0000
@@ -273,12 +273,15 @@
 # Add entry for / to /etc/mtab:
 /sbin/mount -f -w /
 
-# Add /proc and /sys mounts to /etc/mtab:
+# Add /proc, /sys and /dev/shm mounts to /etc/mtab:
 if [ -d /proc/sys ]; then
-  /sbin/mount -f proc /proc -t proc
+  /sbin/mount -f -t proc proc /proc
 fi
 if [ -d /sys/bus ]; then
-  /sbin/mount -f sysfs /sys -t sysfs
+  /sbin/mount -f -t sysfs sysfs /sys
+fi
+if grep -q '^[^ ]\+ /dev/shm ' /proc/mounts 2>/dev/null; then
+  /sbin/mount -f -t tmpfs tmpfs /dev/shm
 fi
 
 # Configure ISA Plug-and-Play devices:
I also took the liberty of fixing the mount commands: options should always come before args.
 
4 members found this post helpful.
Old 02-15-2016, 02:16 PM   #3
Andersen
Member
 
Registered: Dec 2008
Distribution: Slackware
Posts: 177

Rep: Reputation: 72
Quote:
Current (pre-release) ChangeLog for x86_64

Thu Feb 11 21:56:21 UTC 2016
a/sysvinit-scripts-2.0-noarch-29.txz: Rebuilt.
rc.S: Avoid mounting /dev/shm twice.
Thanks to Andrzej Telszewski and GazL.
rc.6, rc.K: Match 'type nfs ' rather than 'type nfs' to avoid false hits
(and error messages) from matching nfsd pseudo-filesystems.
Thanks to Jonathan Woithe.
This solution found its way to -current changelog, but after latest upgrade I have problems with chromium and vlc:

Code:
ERROR:shared_memory_posix.cc(302)] Creating shared memory in /dev/shm/.org.chromium.Chromium.WkqRcM failed: Permission denied
[2217:2217:0215/210852:ERROR:shared_memory_posix.cc(305)] Unable to access(W_OK|X_OK) /dev/shm: Permission denied
[2217:2217:0215/210852:FATAL:shared_memory_posix.cc(307)] This is frequently caused by incorrect permissions on /dev/shm.  Try 'sudo chmod 1777 /dev/shm' to fix.
Code:
VLC media player 2.2.2 Weatherwax (revision 2.2.2-0-g6259d80)
shm_open() failed: Permission denied
Is it safe to try proposed fix chmod 1777 /dev/shm ?
 
Old 02-15-2016, 02:21 PM   #4
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Original Poster
Rep: Reputation: Disabled
Hi,

/dev/shm should be drwxrwxrwt, which is the case on my system.
Is your different?

--
Best regards,
Andrzej Telszewski
 
1 members found this post helpful.
Old 02-15-2016, 02:23 PM   #5
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,096

Rep: Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173
Quote:
Originally Posted by atelszewski View Post
/dev/shm should be drwxrwxrwt, which is the case on my system.
I can confirm this: after installing latest updates, with the new rc.* scripts in place and rebooting
Code:
$ ls -la /dev/ | grep shm
drwxrwxrwt   2 root   root         100 feb 15 21:21 shm
 
1 members found this post helpful.
Old 02-15-2016, 02:38 PM   #6
Andersen
Member
 
Registered: Dec 2008
Distribution: Slackware
Posts: 177

Rep: Reputation: 72
Upgraded, chose to overwrite with new config files, and rebooted, but..

Code:
bash-4.3$ ls -la /dev/ | grep shm
drwxr-xr-t   2 root   root          40 Sep 23  2008 shm
Then, just in case I missed O option last time, I did another check:

Quote:
bash-4.3# slackpkg new-config
Searching for NEW configuration files
No .new files found.
edit:

Only now I see Sep 23 2008 shm What the.. :/

Last edited by Andersen; 02-15-2016 at 02:50 PM.
 
Old 02-15-2016, 04:11 PM   #7
yars
Member
 
Registered: Apr 2012
Location: Russia
Distribution: Slackware64-current
Posts: 249

Rep: Reputation: 24
Quote:
Is it safe to try proposed fix chmod 1777 /dev/shm ?
Yes.
EDIT: Have you a entry for /dev/shm in fstab?

Last edited by yars; 02-15-2016 at 04:18 PM.
 
1 members found this post helpful.
Old 02-15-2016, 05:50 PM   #8
Andersen
Member
 
Registered: Dec 2008
Distribution: Slackware
Posts: 177

Rep: Reputation: 72
Thanks. Yes I do..

Code:
tmpfs            /dev/shm         tmpfs       defaults         0   0
I don't know what caused the problem, but before the latest upgrade everything worked well..
 
Old 02-15-2016, 06:29 PM   #9
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
Have you checked whether the /dev/shm mount is actually being done? (grep 'shm' /proc/mounts).

If it's not, then it's possible that the second unintended mount was masking a failure of the first, though why it might be failing I couldn't say.
 
2 members found this post helpful.
Old 02-15-2016, 06:46 PM   #10
Andersen
Member
 
Registered: Dec 2008
Distribution: Slackware
Posts: 177

Rep: Reputation: 72
Code:
bash-4.3$ grep 'shm' /proc/mounts
tmpfs /dev/shm tmpfs rw,relatime 0 0
I tried chmod 1777 /dev/shm. It worked, but just until reboot.
Now it's back with drwxr-xr-t 2 root root 40 Sep 23 2008 shm
 
Old 02-15-2016, 08:06 PM   #11
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
initrd, perhaps?
 
1 members found this post helpful.
Old 02-16-2016, 04:47 AM   #12
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
Just an observation regarding rc.udev:

One thing I noticed is that the mount for /dev/shm in rc.udev doesn't include a '-n' but the rootfs will be 'ro' at this point.

On modern kernels devtmpfs will be pre-mounted before rc.S or even the initrd get involved (CONFIG_DEVTMPFS_MOUNT=y). The unmounting of pts and shm in order to mount devtmpfs and the later remounting of shm and pts in rc.udev seems not at-all 'KISS', especially given that the rootfs will be 'ro' at this point: introducing other obstacles to be worked around. So, I'm wondering whether it might not be better all round to leave /dev/shm and /dev/pts for 'mount -a' to do (once rootfs has gone 'rw') and maybe even strip out all this dancing around with devtmpfs and related mounts from rc.udev completely.

Even if shm and pts are required this early in boot (are they?) and can't be left for 'mount -a', then I suggest it's better to promote their mounting into rc.S where all the other mounting activity resides. IMO it would be cleaner for rc.udev to just concern itself with udevd and not devtmpfs, /dev/shm or /dev/pts.

Last edited by GazL; 02-16-2016 at 04:55 AM.
 
Old 02-16-2016, 05:27 AM   #13
Andersen
Member
 
Registered: Dec 2008
Distribution: Slackware
Posts: 177

Rep: Reputation: 72
Quote:
Originally Posted by Richard Cranium View Post
initrd, perhaps?
I'm using huge.s kernel, no initrd. Actually, that's why this is even more puzzling to me, I didn't make any changes from default configuration.
 
Old 02-16-2016, 07:35 AM   #14
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
Clearly something is not quite right with your system. /proc/mounts shows that /dev/shm is mounted, yet your ls -l shows a date of 2008 and non-default permissions, which doesn't make sense for a tmpfs created at boot time.

A few other things to check:
That devtmpfs is mounted on /dev
/etc/rc.d/rc.udev is 755, and has a md5sum of efc795ae7830f3ad598b6db170569e28
/lib/udev/devices/shm doesn't exist (in fact on my box the directory is empty).
That you haven't got anything funky in your rc.local.
 
1 members found this post helpful.
Old 02-16-2016, 07:58 AM   #15
Andersen
Member
 
Registered: Dec 2008
Distribution: Slackware
Posts: 177

Rep: Reputation: 72
Quote:
Originally Posted by GazL View Post
Clearly something is not quite right with your system. /proc/mounts shows that /dev/shm is mounted, yet your ls -l shows a date of 2008 and non-default permissions, which doesn't make sense for a tmpfs created at boot time.

A few other things to check:
That devtmpfs is mounted on /dev
/etc/rc.d/rc.udev is 755, and has a md5sum of efc795ae7830f3ad598b6db170569e28
/lib/udev/devices/shm doesn't exist (in fact on my box the directory is empty).
That you haven't got anything funky in your rc.local.
Thanks GazL. Everything looks ok from here:

Code:
bash-4.3$ grep 'devtmpfs' /proc/mounts
devtmpfs /dev devtmpfs rw,relatime,size=1947532k,nr_inodes=486883,mode=755 0 0
Code:
bash-4.3$ ls -l /etc/rc.d/rc.udev
-rwxr-xr-x 1 root root 7042 Feb  6 11:04 /etc/rc.d/rc.udev

Code:
bash-4.3$ md5sum /etc/rc.d/rc.udev
efc795ae7830f3ad598b6db170569e28  /etc/rc.d/rc.udev
rc.local is clear.

Code:
bash-4.3$ cat /etc/rc.d/rc.local
#!/bin/sh
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
Quote:
/lib/udev/devices/shm doesn't exist (in fact on my box the directory is empty).
Same thing here.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Terminal Emulation & /dev/pts and /dev/shm Issues on Kernel 3.4.3 unassailable Gentoo 8 10-27-2012 11:03 PM
differences betwne /dev/shm and kernel.shm hallask Linux - Server 2 09-23-2011 06:26 AM
tmps mounted on /dev/shm--- PLS HELP!! maemi3916 Linux - Newbie 3 08-24-2011 02:04 AM
[SOLVED] Issues with /dev/pts & /dev/shm, when LFS boots zer0signal Linux From Scratch 2 12-21-2010 07:14 AM
/dev/shm not mounted /dev busy compgenius999 Linux - Newbie 1 03-03-2010 11:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration