1

Since pty is limited, I want to modify the content of /proc/sys/kernel/pty/max. The original value in max is 4096, and now I want to modify it to 10000.

[root@home pty]# pwd
/proc/sys/kernel/pty
[root@home pty]# ls -lh
total 0
-rw-r--r-- 1 root root 0 Aug 13 11:24 max
-r--r--r-- 1 root root 0 Aug 13 11:24 nr
vim max

I edit the max file directly, using root, but it fails. I use :w! in vim, but then I see the following picture:

then i edit max file directly using root, but failed

so I tried to chmod max first, but that also failed:

[root@home pty]# chmod 666 max 
chmod: changing permissions of `max': Operation not permitted
[root@home pty]# whoami 
root

so, how can I change the content of /proc/sys/kernel/pty/max?

Edit

@jon-lin:

it also failed using the sysctl command:

[root@home kernel]# sysctl -a | less | grep pty
kernel.pty.nr = 2
kernel.pty.max = 4096
[root@home kernel]# sysctl kernel.pty.max=10000
error: "Operation not permitted" setting key "kernel.pty.max"
[root@home kernel]# sysctl -p kernel.pty.max 10000
error: unable to open preload file "kernel.pty.max"
[root@home kernel]# sysctl -p kernel.pty.max = 10000
error: unable to open preload file "kernel.pty.max"

@AlanCurry:

It also failed using echo:

[root@home pty]# cat max
4096
[root@home pty]# echo 10000 > max
bash: echo: write error: Operation not permitted
[root@home pty]# echo 10000 >> max 
bash: echo: write error: Operation not permitted
[root@home pty]# cat max 
4096
6
  • I think you mean /proc/sys/kernel/pty/max (you said /proc/sys/kernel/pts/max in title and body, I've fixed) Aug 13, 2012 at 3:40
  • This should be migrated to unix.SE.
    – bitmask
    Aug 13, 2012 at 3:44
  • @therefromhere i am sure it's /proc/sys/kernel/pty/max, and there is no directory named /proc/sys/kernel/pts on my system. By the way, the system i use is CentOS 5.3, what about yours?
    – hugemeow
    Aug 13, 2012 at 3:45
  • 1
    The not-really-files in /proc and /sys are a bit too fragile for a full-featured editor like vim to handle well. The recommended tools are echo and cat. However... you could just say y when vim asks if you're sure you want to write to it.
    – Alan Curry
    Aug 13, 2012 at 3:53
  • @AlanCurry failed either using echo. replied above:)
    – hugemeow
    Aug 13, 2012 at 4:04

2 Answers 2

4

If you want to change the number of max pseudo terminals you can have, don't edit the proc file. You should make the change to /etc/sysctl.conf and then re-run sysctl -p to change kernel parameters at runtime. Specifically change (or add) the line that has:

kernel.pty.max = <max>

Change <max> to the number you want.

7
  • also failed, i have replied in the post above :)
    – hugemeow
    Aug 13, 2012 at 3:51
  • @hugemeow No, you edit the file /etc/sysctl.conf, and change the line kernel.pty.max to have the value that you want (which appears to be 10000), then save the file. Then run sysctl -p with no other arguments. If you use -p, it tells sysctl to load from a file, and if you give it anything it assumes it's a file. See the sysctl man page
    – Jon Lin
    Aug 13, 2012 at 3:56
  • 1
    @hugemeow If you don't want to edit the file, then use the -w option: sysctl -w kernel.pty.max=10000
    – Jon Lin
    Aug 13, 2012 at 3:58
  • it fails either:( [root@home kernel]# sysctl -w kernel.pty.max=10000 error: "Operation not permitted" setting key "kernel.pty.max"
    – hugemeow
    Aug 13, 2012 at 4:00
  • @hugemeow Not sure what the problem is because it works just fine for me, try editing the conf file and running sysctl -p
    – Jon Lin
    Aug 13, 2012 at 4:07
1

Just experienced the same problem in my environment.

Apparently OpenVZ is controlling these variables on a host level i.e. if you want to change some setting, you'll need to change it on the host machine and as an effect it will be applied to all VMs running on that physical server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .