LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-27-2019, 02:21 AM   #1
The_Dark_Passenger
Member
 
Registered: Apr 2018
Distribution: Slackware64 14.2 & -Current
Posts: 93

Rep: Reputation: Disabled
/proc hidepid setting ignored at boot


Hello,

I am trying to set the hidepid value to 2 for /proc at boot. This is how the proc entry appears in my /etc/fstab.
Code:
proc             /proc            proc        defaults,hidepid=2      0   0
However, it is not set at boot, and instead it just uses the default mount options. Remounting /proc with hidepid=2 works. It just won't set at boot. I have also tried setting rw,relatime,hidepid=2 instead of defaults, but that doesn't work either.

Running most up to date Slackware64 -current with 4.19.75 generic kernel.

Any help would be appreciated as to why this isn't occurring at boot.

Thanks!
 
Old 09-27-2019, 02:49 AM   #2
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by The_Dark_Passenger View Post
Any help would be appreciated as to why this isn't occurring at boot.
/proc isn't mounted through the fstab entry, just like /dev/root it is accessed by the kernel much earlier in the boot process. In fact /proc and /sys do not need fstab entries at all as they're auto-mounted anyway. My system doesn't have any entries for either /proc or /sys and still "mount" shows them as mounted, before any of the /etc/fstab entries are shown (like usbfs, which is mounted below /proc):
Quote:
/dev/sda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw,devmode=0666)
An optional fstab entry will - just as for the root fs - only be used when you use a "remount" command, i.e. in rc.local

PS: that the root is shown as /dev/sda1 is because of a remount in the rc.S script
Quote:
# Remount the root filesystem in read-write mode
echo "Remounting root device with read-write enabled."
/sbin/mount -w -v -n -o remount /
because now udev is active, so all devices have been created.

Last edited by ehartman; 09-27-2019 at 02:50 AM.
 
2 members found this post helpful.
Old 09-27-2019, 03:37 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,161

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
I don't use slack these days, but check the initrd for a proc mount.
 
Old 09-28-2019, 01:13 PM   #4
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@The_Dark_Passenger

AFAIK there's no kernel boot parameter to influence the way /proc is mounted and you need to remount it if you want to change the mount options. You could either remount it automatically at boot time with the help of the rc init scripts (/etc/rc.d/rc.local would be more appropriate(clean/non-invasive)) and add your hidepid=2 , or, you can prepare an initrd.img and add your special mount option there, as suggested here:
https://unix.stackexchange.com/quest...tently-at-boot
 
Old 04-02-2020, 05:33 AM   #5
pyllyukko
LQ Newbie
 
Registered: Dec 2007
Location: 🇫🇮
Distribution: Slackware
Posts: 10

Rep: Reputation: 6
In Slackware 14.2 I have the following in /etc/rc.d/rc.S:

Code:
/sbin/mount -v proc /proc -n -t proc -o hidepid=2 2> /dev/null
And it does just that. Users can only see their own processes. All is well!

Now when I try to accomplish the same with Slackware64 current, it just doesn't seem to work no matter what I try
 
Old 04-02-2020, 08:54 AM   #6
mumahendras3
Member
 
Registered: Feb 2018
Location: Indonesia
Distribution: Slackware-current + s6 + s6-rc + s6-linux-init (github.com/mumahendras3/sl6ckware)
Posts: 126

Rep: Reputation: Disabled
Quote:
Originally Posted by pyllyukko View Post
In Slackware 14.2 I have the following in /etc/rc.d/rc.S:

Code:
/sbin/mount -v proc /proc -n -t proc -o hidepid=2 2> /dev/null
And it does just that. Users can only see their own processes. All is well!

Now when I try to accomplish the same with Slackware64 current, it just doesn't seem to work no matter what I try
Do you use initrd? The init script inside initrd mounted the /proc early before switching to the real root. Try modifying that script (check inside your initrd-tree directory, which by default is /boot/initrd-tree).
 
Old 04-03-2020, 04:54 AM   #7
pyllyukko
LQ Newbie
 
Registered: Dec 2007
Location: 🇫🇮
Distribution: Slackware
Posts: 10

Rep: Reputation: 6
Quote:
Originally Posted by mumahendras3 View Post
Do you use initrd? The init script inside initrd mounted the /proc early before switching to the real root. Try modifying that script (check inside your initrd-tree directory, which by default is /boot/initrd-tree).
It happens with and without initrd. I also tried modifying the initrd image and it still didn't work.
 
Old 12-24-2020, 04:06 AM   #8
pyllyukko
LQ Newbie
 
Registered: Dec 2007
Location: 🇫🇮
Distribution: Slackware
Posts: 10

Rep: Reputation: 6
I solved this. So I noticed that when you check mounts there is a double entry for /proc:

Code:
$ mount|grep proc
proc on /proc type proc (rw,relatime,gid=87,hidepid=invisible)
proc on /proc type proc (rw,relatime,gid=87,hidepid=invisible)
I set hidepid in both the initrd image and rc.S and now the processes are hidden. You can see the details in this commit.
 
  


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
/proc and hidepid (hide processes of other users) atelszewski Slackware 4 08-25-2018 08:16 AM
Boot hang after 'proc on /proc type proc (rw)' Hagoromo Slackware 13 10-05-2007 05:03 PM
how to know contents of /proc/ide/hda/smart_values and /proc/ide/hda/smart_threshold Prassanta SUSE / openSUSE 0 02-23-2006 04:21 AM
Correlation between /proc/devices and /proc/modules ColinLadyka Linux - General 1 02-13-2006 05:25 PM
What /proc proc file do I need? GoboFraggle Programming 1 02-04-2003 11:52 PM

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

All times are GMT -5. The time now is 09:35 AM.

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