Technical article 104829

I get "No such device" (ENODEV) when opening /dev/ptmx more than 16 times

OpenServer 5.0.0OpenServer 5.0.2OpenServer 5.0.4OpenServer 5.0.5OpenServer 5.0.6

Written · Last revised

Problem

I am using STREAMS-based pseudo-terminals by opening the ptmx(M) device node. However, when I attempt to open this device for the 17th time, the open(S) routine returns the error code 19 ("No such device", ENODEV).

How do I increase the number of STREAMS-based ptty's beyond the currently configured value of 16?

Solution

You will need to follow the steps below in order to increase the number of STREAMS-based ptty devices.

In the following example, the number of ptty's to be configured will be increased from 16 to 64.

1. Increase the number of master ptty devices by editing the file:

/etc/conf/sdevice.d/ptm
By default, this file contains :
ptm     Y       16      0       0       0       0       0       0       0
Change the 3rd field ("unit") to the number of ptty devices
required.  For example :
ptm     Y       64      0       0       0       0       0       0       0
                ^^

2. Increase the corresponding value for the pseudo-terminal emulation kernel module in the file:

/etc/conf/sdevice.d/ptem
By default, the file contains :
ptem    Y       16      0       0       0       0       0       0       0
Change this to the following:
ptem    Y       64      0       0       0       0       0       0       0
                ^^

3. Increase the corresponding value for the standard terminal line discipline kernel module in the file:

/etc/conf/sdevice.d/ldterm
By default, the file contains:
ldterm  Y       16      0       0       0       0       0       0       0
Change this to the following:
ldterm  Y       64      0       0       0       0       0       0       0
                ^^

4. Create more slave devices by editing the file:

/etc/conf/node.d/pts
By default, this file contains:
pts     pts000  c       0
pts     pts001  c       1
pts     pts002  c       2
pts     pts003  c       3
pts     pts004  c       4
pts     pts005  c       5
pts     pts006  c       6
pts     pts007  c       7
pts     pts008  c       8
pts     pts009  c       9
pts     pts010  c       10
pts     pts011  c       11
pts     pts012  c       12
pts     pts013  c       13
pts     pts014  c       14
pts     pts015  c       15

Add more entries for slave devices to this file, incrementing the numbers as necessary, such as:

pts     pts016  c       16
pts     pts017  c       17
....
....
pts     pts063  c       62
pts     pts064  c       63

5. If the desired number of ptty's will exceed the preconfigured maximum of 32, then you must change the maximum number of units allowed in mdevice(F).

Edit the file:
/etc/conf/cf.d/mdevice

Change the 8th field ("maxu") in the following entries in this file to a number greater than the number of devices required. By default, these entries are:

ptm     -       Scio    ptm     0       42      1       32      -1
...
ldterm  -       Si      ldtr    0       0       1       32      -1
...
ptem    -       Si      ptem    0       0       1       32      -1

Change these entries to the following (assuming a new maximum of 256):

ptm     -       Scio    ptm     0       42      1       256     -1
...
ldterm  -       Si      ldtr    0       0       1       256     -1
...
ptem    -       Si      ptem    0       0       1       256     -1
                                                        ^^^
6. Relink the UNIX kernel:
# cd /etc/conf/cf.d
# ./link_unix -y

7. Reboot the system for these changes to take effect.

NOTE:  If you see the following message when you relink the kernel:
LINE: ptem  Y       64      0       0       0       0       0       0   0
ERROR: Unit, 64, must be within (1, 32)
FATAL ERROR: Errors encountered. Configuration terminated.
idbuild: idconfig had errors.
System build failed.

Then it is likely that one of the above configuration changes was not correctly implemented.

See also

ptmx(M)

From the Xinuos technical article database, record 104829. Reproduced with permission. The original is at www.sco.com/ta/104829, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.