Unix Technical Forum

/dev/pts and CONFIG_UNIX98_PTY etc

This is a discussion on /dev/pts and CONFIG_UNIX98_PTY etc within the Linux Operating System forums, part of the Unix Operating Systems category; --> I am having some problems running gnome terminal in an FC6 Xen guest. I get this error Quote: There ...


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-19-2008, 06:58 AM
voipfc
 
Posts: n/a
Default /dev/pts and CONFIG_UNIX98_PTY etc

I am having some problems running gnome terminal in an FC6 Xen guest.
I get this error
Quote:
There was an error creating the child process for this terminal

and it appears that some /dev related devices are not created
properly. /dev/pts is definitely not created.

I had to chmod o+rw /dev/null, /dev/random and /dev/urandom in
rc.local to get some things to work properly.

Googling indicates that some entries relating to CONFIG_UNIX98_XXX
values related to the kernel have to be adapted to get things to work
properly. Where can I do this?

Are there some MAKEDEV related entries that I have to edit as well?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-19-2008, 06:58 AM
elsiddik
 
Posts: n/a
Default Re: /dev/pts and CONFIG_UNIX98_PTY etc

On Apr 24, 6:40 am, voipfc <voi...@googlemail.com> wrote:
> I am having some problems running gnome terminal in an FC6 Xen guest.
> I get this error
> Quote:
> There was an error creating the child process for this terminal
>
> and it appears that some /dev related devices are not created
> properly. /dev/pts is definitely not created.
>
> I had to chmod o+rw /dev/null, /dev/random and /dev/urandom in
> rc.local to get some things to work properly.
>
> Googling indicates that some entries relating to CONFIG_UNIX98_XXX
> values related to the kernel have to be adapted to get things to work
> properly. Where can I do this?
>
> Are there some MAKEDEV related entries that I have to edit as well?



create /dev/pts first - if it doesnt exsist do mkdir /dev/pts
now check if /dev/tts and /dev/tty if theres something in there ,
if not try to creat them also with /sbin/makedev .

http://www.linux.com/howtos/Serial-H...1.shtml#ss11.9

zaher el siddik
http;//elsiddik.blogspot.com/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-19-2008, 06:59 AM
voipfc
 
Posts: n/a
Default Re: /dev/pts and CONFIG_UNIX98_PTY etc

On Apr 25, 12:11 pm, elsiddik <elsid...@gmail.com> wrote:
> On Apr 24, 6:40 am, voipfc <voi...@googlemail.com> wrote:
>
>
>
> > I am having some problems running gnome terminal in an FC6 Xen guest.
> > I get this error
> > Quote:
> > There was an error creating the child process for this terminal

>
> > and it appears that some /dev related devices are not created
> > properly. /dev/pts is definitely not created.

>
> > I had to chmod o+rw /dev/null, /dev/random and /dev/urandom in
> > rc.local to get some things to work properly.

>
> > Googling indicates that some entries relating to CONFIG_UNIX98_XXX
> > values related to the kernel have to be adapted to get things to work
> > properly. Where can I do this?

>
> > Are there some MAKEDEV related entries that I have to edit as well?

>
> create /dev/pts first - if it doesnt exsist do mkdir /dev/pts
> now check if /dev/tts and /dev/tty if theres something in there ,
> if not try to creat them also with /sbin/makedev .
>
> http://www.linux.com/howtos/Serial-H...1.shtml#ss11.9
>
> zaher el siddik
> http;//elsiddik.blogspot.com/


This is the part where I have to be careful. Do you know of the lines
in MAKEDEV which are responsible for /dev/pts creation?
I'd rather go for the right MAKEDEV file than run the commands
manually. The complaints about /dev/pts start during the boot process
and I'd to have it setup before all the other process that depend on
it start.

Is there a way of finding out where CONFIG_UNIX98_XXX are configured -
if it is supposed to be compiled into the kernel?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-19-2008, 07:01 AM
jayjwa@hotmail.com
 
Posts: n/a
Default Re: /dev/pts and CONFIG_UNIX98_PTY etc

voipfc wrote:
> On Apr 25, 12:11 pm, elsiddik <elsid...@gmail.com> wrote:
>> On Apr 24, 6:40 am, voipfc <voi...@googlemail.com> wrote:
>>
>>
>>
>> > I am having some problems running gnome terminal in an FC6 Xen guest.
>> > I get this error
>> > Quote:
>> > There was an error creating the child process for this terminal

>>
>> > and it appears that some /dev related devices are not created
>> > properly. /dev/pts is definitely not created.

>>
>> > I had to chmod o+rw /dev/null, /dev/random and /dev/urandom in
>> > rc.local to get some things to work properly.

>>
>> > Googling indicates that some entries relating to CONFIG_UNIX98_XXX
>> > values related to the kernel have to be adapted to get things to work
>> > properly. Where can I do this?

>>
>> > Are there some MAKEDEV related entries that I have to edit as well?

>>
>> create /dev/pts first - if it doesnt exsist do mkdir /dev/pts
>> now check if /dev/tts and /dev/tty if theres something in there ,
>> if not try to creat them also with /sbin/makedev .
>>
>> http://www.linux.com/howtos/Serial-H...1.shtml#ss11.9
>>
>> zaher el siddik
>> http;//elsiddik.blogspot.com/

>
> This is the part where I have to be careful. Do you know of the lines
> in MAKEDEV which are responsible for /dev/pts creation?



Look in /usr/src/linux/Documentation/devices.txt when you need to make
devices. I'm assuming you have plain old hand-made files in dev and
are not using udev or something similar that is supposed to keep track
of what's in /dev. "mknod" is the program to use to make /dev/
entries. "MAKEDEV" is usually a script-wrapper for mknod, and may (or
may not!) be up-to-date (eg, know about UNIX98 terminals) or do what
you think|hope it will. The manpage I have for MAKEDEV refers to the
"current" kernel as being 1.2!


/usr/src/linux/Documentation/devices.txt (around line 2600+ on a 2.6.20.7):

136-143 char Unix98 PTY slaves
0 = /dev/pts/0 First Unix98 pseudo-TTY
1 = /dev/pts/1 Second Unix98 pesudo-TTY
...

These device nodes are automatically generated with
the proper permissions and modes by mounting the
devpts filesystem onto /dev/pts with the appropriate
mount options (distribution dependent, however, on
*most* distributions the appropriate options are
"mode=0620,gid=<gid of the "tty" group>".)




> I'd rather go for the right MAKEDEV file than run the commands
> manually. The complaints about /dev/pts start during the boot process
> and I'd to have it setup before all the other process that depend on
> it start.


You can set it up now. See 'man 4 ptmx'. After you have it working,
stick the commands to set it up in your boot scripts. Once you have an
entry in fstab for it, it should mount with a 'mount -a' option with
the rest of the filesystems.


1. Make the /dev/pts directory.

mkdir -m 755 /dev/pts
chown root.root /dev/pts

2. Make the pty multiplexer: crw-rw-rw- 1 root tty 5, 2 2007-05-05 09:37 /dev/ptmx

That's char major 5, minor 2.

5 char Alternate TTY devices
0 = /dev/tty Current TTY device
1 = /dev/console System console
2 = /dev/ptmx PTY master multiplex


Check in /proc/devices:

Character devices:
1 mem
2 pty
3 ttyp
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx

The char. major number should really go by what your kernel assigned
it, athough I can't imagine a situation where it wouldn't be the
traditional 5, as above.


mknod /dev/ptmx c 5 2
chmod 666 /dev/ptmx
chown root.tty /dev/ptmx

You might want to look thru devices.txt and make sure you have any
other device files you might need. Some special hardware will
sometimes need you to make a /dev/ entry for it. I have a modem like
this.


3. (Re)compile the kernel to include CONFIG_UNIX98_PTYS (and anything that it depends on)

config UNIX98_PTYS
bool "Unix98 PTY support" if EMBEDDED
default y
---help---
A pseudo terminal (PTY) is a software device consisting of two
halves: a master and a slave. The slave device behaves identical to
a physical terminal; the master device is used by a process to
read data from and write data to the slave, thereby emulating a
terminal. Typical programs for the master side are telnet servers
and xterms.

Linux has traditionally used the BSD-like names /dev/ptyxx for
masters and /dev/ttyxx for slaves of pseudo terminals. This scheme
has a number of problems. The GNU C library glibc 2.1 and later,
however, supports the Unix98 naming standard: in order to acquire a
pseudo terminal, a process opens /dev/ptmx; the number of the pseudo
terminal is then made available to the process and the pseudo
terminal slave can be accessed as /dev/pts/<number>. What was
traditionally /dev/ttyp2 will then be /dev/pts/2, for example.

All modern Linux systems use the Unix98 ptys. Say Y unless
you're on an embedded system and want to conserve memory.

4. Mount the pseudo-filesystem on /dev/pts:


mount -t devpts -o uid=0,gid=5,mode=620 devpts /dev/pts

(I'm giving this command from memory from about 2 years ago, so
hopefully it's correct. If not, try moving the options around, it
should be very similar. Once you have the /etc/fstab entry, the system
startup scritps will mount it automatically when mount -a is called.)

5. I think that's all.../dev/pts should now fill 'by itself' with entires when needed.

/dev/pts:

drwxr-xr-x 2 root root 0 2007-04-30 02:09 ./
drwxr-xr-x 17 root root 40K 2007-05-05 05:00 ../
crw--w---- 1 root tty 136, 3 2007-04-30 18:19 3









> Is there a way of finding out where CONFIG_UNIX98_XXX are configured -
> if it is supposed to be compiled into the kernel?



Yes, I put this in the kernel.

CONFIG_UNIX98_PTYS=y


When you 'make menuconfig' or 'make gconfig' or whatever you use to
configure your kernel, you set this.


You also need devpts support. This is the filesystem that mounts on
top of the /dev/pts. Its /etc/fstab entry:

# file system mount point vsftype options dump fsck-order
/dev/hda1 / ext2 defaults 1 1
/dev/hda2 swap swap defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
securityfs /sys/kernel/security securityfs defaults 0 0
configfs /config configfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
shm /dev/shm tmpfs defaults 0 0
usbfs /proc/bus/usb usbfs defaults 0 0




Running mount will show something like:

/dev/hda1 on / type ext2 (rw)
proc on /proc type proc (rw)
configfs on /config type configfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
shm on /dev/shm type tmpfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
sysfs on /sys type sysfs (rw)
securityfs on /sys/kernel/security type securityfs (rw)


The line is here:

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

note gid=5, is that of my "tty" user group.

# getent group | grep tty
tty:x:5:


From the mount manpage,

Mount options for devpts
The devpts file system is a pseudo file system, traditionally mounted on /dev/pts. In order to acquire a
pseudo terminal, a process opens /dev/ptmx; the number of the pseudo terminal is then made available to the
process and the pseudo terminal slave can be accessed as /dev/pts/<number>.

uid=value and gid=value
This sets the owner or the group of newly created PTYs to the specified values. When nothing is spec-
ified, they will be set to the UID and GID of the creating process. For example, if there is a tty
group with GID 5, then gid=5 will cause newly created PTYs to belong to the tty group.

mode=value
Set the mode of newly created PTYs to the specified value. The default is 0600. A value of mode=620
and gid=5 makes "mesg y" the default on newly created PTYs.



The file system type is 'devpts', but for some reason I can't remember
the kernel option to enable this...(might be bundled in with CONFIG_UNIX98*,
or on by default.)



If you see 'devpts' in /proc/filesystems, you should be OK.

/proc/filesystems

nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev securityfs
nodev sockfs
nodev usbfs
nodev pipefs
nodev futexfs
nodev tmpfs
nodev eventpollfs
nodev devpts
ext2
nodev ramfs
msdos
vfat
iso9660
nodev mqueue
nodev configfs





Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-19-2008, 07:03 AM
voipfc
 
Posts: n/a
Default Re: /dev/pts and CONFIG_UNIX98_PTY etc

On 6 May, 09:54, jay...@hotmail.com wrote:
> voipfcwrote:
> > On Apr 25, 12:11 pm, elsiddik <elsid...@gmail.com> wrote:
> >> On Apr 24, 6:40 am,voipfc<voi...@googlemail.com> wrote:

>
> >> > I am having some problems running gnome terminal in an FC6 Xen guest.
> >> > I get this error
> >> > Quote:
> >> > There was an error creating the child process for this terminal

>
> >> > and it appears that some /dev related devices are not created
> >> > properly. /dev/pts is definitely not created.

>
> >> > I had to chmod o+rw /dev/null, /dev/random and /dev/urandom in
> >> > rc.local to get some things to work properly.

>
> >> > Googling indicates that some entries relating to CONFIG_UNIX98_XXX
> >> > values related to the kernel have to be adapted to get things to work
> >> > properly. Where can I do this?

>
> >> > Are there some MAKEDEV related entries that I have to edit as well?

>
> >> create /dev/pts first - if it doesnt exsist do mkdir /dev/pts
> >> now check if /dev/tts and /dev/tty if theres something in there ,
> >> if not try to creat them also with /sbin/makedev .

>
> >>http://www.linux.com/howtos/Serial-H...1.shtml#ss11.9

>
> >> zaher el siddik
> >> http;//elsiddik.blogspot.com/

>
> > This is the part where I have to be careful. Do you know of the lines
> > in MAKEDEV which are responsible for /dev/pts creation?

>
> Look in /usr/src/linux/Documentation/devices.txt when you need to make
> devices. I'm assuming you have plain old hand-made files in dev and
> are not using udev or something similar that is supposed to keep track
> of what's in /dev. "mknod" is the program to use to make /dev/
> entries. "MAKEDEV" is usually a script-wrapper for mknod, and may (or
> may not!) be up-to-date (eg, know about UNIX98 terminals) or do what
> you think|hope it will. The manpage I have for MAKEDEV refers to the
> "current" kernel as being 1.2!
>
> /usr/src/linux/Documentation/devices.txt (around line 2600+ on a 2.6.20.7):
>
> 136-143 char Unix98 PTY slaves
> 0 = /dev/pts/0 First Unix98 pseudo-TTY
> 1 = /dev/pts/1 Second Unix98 pesudo-TTY
> ...
>
> These device nodes are automatically generated with
> the proper permissions and modes by mounting the
> devpts filesystem onto /dev/pts with the appropriate
> mount options (distribution dependent, however, on
> *most* distributions the appropriate options are
> "mode=0620,gid=<gid of the "tty" group>".)
>
> > I'd rather go for the right MAKEDEV file than run the commands
> > manually. The complaints about /dev/pts start during the boot process
> > and I'd to have it setup before all the other process that depend on
> > it start.

>
> You can set it up now. See 'man 4 ptmx'. After you have it working,
> stick the commands to set it up in your boot scripts. Once you have an
> entry in fstab for it, it should mount with a 'mount -a' option with
> the rest of the filesystems.
>
> 1. Make the /dev/pts directory.
>
> mkdir -m 755 /dev/pts
> chown root.root /dev/pts
>
> 2. Make the pty multiplexer: crw-rw-rw- 1 root tty 5, 2 2007-05-05 09:37 /dev/ptmx
>
> That's char major 5, minor 2.
>
> 5 char Alternate TTY devices
> 0 = /dev/tty Current TTY device
> 1 = /dev/console System console
> 2 = /dev/ptmx PTY master multiplex
>
> Check in /proc/devices:
>
> Character devices:
> 1 mem
> 2 pty
> 3 ttyp
> 4 /dev/vc/0
> 4 tty
> 4 ttyS
> 5 /dev/tty
> 5 /dev/console
> 5 /dev/ptmx
>
> The char. major number should really go by what your kernel assigned
> it, athough I can't imagine a situation where it wouldn't be the
> traditional 5, as above.
>
> mknod /dev/ptmx c 5 2
> chmod 666 /dev/ptmx
> chown root.tty /dev/ptmx
>
> You might want to look thru devices.txt and make sure you have any
> other device files you might need. Some special hardware will
> sometimes need you to make a /dev/ entry for it. I have a modem like
> this.
>
> 3. (Re)compile the kernel to include CONFIG_UNIX98_PTYS (and anything that it depends on)
>
> config UNIX98_PTYS
> bool "Unix98 PTY support" if EMBEDDED
> default y
> ---help---
> A pseudo terminal (PTY) is a software device consisting of two
> halves: a master and a slave. The slave device behaves identical to
> a physical terminal; the master device is used by a process to
> read data from and write data to the slave, thereby emulating a
> terminal. Typical programs for the master side are telnet servers
> and xterms.
>
> Linux has traditionally used the BSD-like names /dev/ptyxx for
> masters and /dev/ttyxx for slaves of pseudo terminals. This scheme
> has a number of problems. The GNU C library glibc 2.1 and later,
> however, supports the Unix98 naming standard: in order to acquire a
> pseudo terminal, a process opens /dev/ptmx; the number of the pseudo
> terminal is then made available to the process and the pseudo
> terminal slave can be accessed as /dev/pts/<number>. What was
> traditionally /dev/ttyp2 will then be /dev/pts/2, for example.
>
> All modern Linux systems use the Unix98 ptys. Say Y unless
> you're on an embedded system and want to conserve memory.
>
> 4. Mount the pseudo-filesystem on /dev/pts:
>
> mount -t devpts -o uid=0,gid=5,mode=620 devpts /dev/pts
>
> (I'm giving this command from memory from about 2 years ago, so
> hopefully it's correct. If not, try moving the options around, it
> should be very similar. Once you have the /etc/fstab entry, the system
> startup scritps will mount it automatically when mount -a is called.)
>
> 5. I think that's all.../dev/pts should now fill 'by itself' with entires when needed.
>
> /dev/pts:
>
> drwxr-xr-x 2 root root 0 2007-04-30 02:09 ./
> drwxr-xr-x 17 root root 40K 2007-05-05 05:00 ../
> crw--w---- 1 root tty 136, 3 2007-04-30 18:19 3
>
> > Is there a way of finding out where CONFIG_UNIX98_XXX are configured -
> > if it is supposed to be compiled into the kernel?

>
> Yes, I put this in the kernel.
>
> CONFIG_UNIX98_PTYS=y
>
> When you 'make menuconfig' or 'make gconfig' or whatever you use to
> configure your kernel, you set this.
>
> You also need devpts support. This is the filesystem that mounts on
> top of the /dev/pts. Its /etc/fstab entry:
>
> # file system mount point vsftype options dump fsck-order
> /dev/hda1 / ext2 defaults 1 1
> /dev/hda2 swap swap defaults 0 0
> proc /proc proc defaults 0 0
> sysfs /sys sysfs defaults 0 0
> securityfs /sys/kernel/security securityfs defaults 0 0
> configfs /config configfs defaults 0 0
> devpts /dev/pts devpts gid=5,mode=620 0 0
> shm /dev/shm tmpfs defaults 0 0
> usbfs /proc/bus/usb usbfs defaults 0 0
>
> Running mount will show something like:
>
> /dev/hda1 on / type ext2 (rw)
> proc on /proc type proc (rw)
> configfs on /config type configfs (rw)
> devpts on /dev/pts type devpts (rw,gid=5,mode=620)
> shm on /dev/shm type tmpfs (rw)
> usbfs on /proc/bus/usb type usbfs (rw)
> sysfs on /sys type sysfs (rw)
> securityfs on /sys/kernel/security type securityfs (rw)
>
> The line is here:
>
> devpts on /dev/pts type devpts (rw,gid=5,mode=620)
>
> note gid=5, is that of my "tty" user group.
>
> # getent group | grep tty
> tty:x:5:
>
> From the mount manpage,
>
> Mount options for devpts
> The devpts file system is a pseudo file system, traditionally mounted on /dev/pts. In order to acquire a
> pseudo terminal, a process opens /dev/ptmx; the number of the pseudo terminal is then made available to the
> process and the pseudo terminal slave can be accessed as /dev/pts/<number>.
>
> uid=value and gid=value
> This sets the owner or the group of newly created PTYs to the specified values. When nothing is spec-
> ified, they will be set to the UID and GID of the creating process. For example, if there is a tty
> group with GID 5, then gid=5 will cause newly created PTYs to belong to the tty group.
>
> mode=value
> Set the mode of newly created PTYs to the specified value. The default is 0600. A value of mode=620
> and gid=5 makes "mesg y" the default on newly created PTYs.
>
> The file system type is 'devpts', but for some reason I can't remember
> the kernel option to enable this...(might be bundled in with CONFIG_UNIX98*,
> or on by default.)
>
> If you see 'devpts' in /proc/filesystems, you should be OK.
>
> /proc/filesystems
>
> nodev sysfs
> nodev rootfs
> nodev bdev
> nodev proc
> nodev securityfs
> nodev sockfs
> nodev usbfs
> nodev pipefs
> nodev futexfs
> nodev tmpfs
> nodev eventpollfs
> nodev devpts
> ext2
> nodev ramfs
> msdos
> vfat
> iso9660
> nodev mqueue
> nodev configfs


Thanks for this fairly detailed guide. I got round my problem my
installing a new image, but I will take the time to see how this works
later.

It is a problem I have come across more often than I would like.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:17 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com