Bug 140952

Summary: Konsole crashes on start-up with "Konsole is unable to open a PTY"
Product: [Applications] konsole Reporter: Ace Frehley <afrehley>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED WORKSFORME    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Ace Frehley 2007-01-31 14:52:57 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Debian testing/unstable Packages
OS:                Linux

When I try to start a konsole by clicking on the Konsole icon in the taskbar, the konsole wiondow opens, immediately follwed by a popup that gives the message:  Konsole is unable to open a PTY (pseudo teletype). It is likely that this is due to an incorrect configuration of the PTY devices. Konsole needs to have read/write access to the PTY devices.

When I click on the popup's OK button, the konsole disappears.

This happens irrespective of whether I'm logged in as a normal user or as root.
Comment 1 Robert Knight 2007-01-31 20:47:12 UTC
Can you try running konsole from the command-line like this:

konsole -e $SHELL

And let me know what output you get.
Comment 2 Ace Frehley 2007-02-01 07:23:59 UTC
By command-line I assume you mean Alt-F2.

Running konsole -e $SHELL gives the same result as when I click on the konsole icon:  The konsole opens and the error pop-up follows immediately with the same message as before.

If I try the command from Ctl-Alt-F1 it returns the message: konsole:  cannot connect to X server
Comment 3 Robert Knight 2007-02-01 13:44:06 UTC
> By command-line I assume you mean Alt-F2. 

Ah, not quite.
 
Start the 'xterm' program, by pressing Alt+F2 and running "xterm".  Then type in 'konsole' and press return.

Konsole should print a number of debugging messages in the xterm window.  Could you select them and paste them here?
Comment 4 Ace Frehley 2007-02-01 14:24:18 UTC
Oops.

Ok, I pressed Alt-F2, typed in xterm and hit enter.  Nothing happened.  No xterm opened.  Is there a log that I can check for the debugging messages?
Comment 5 Robert Knight 2007-02-01 16:11:58 UTC
Okay, another option is to start Konsole from the text terminal, and then switch to the display.

1.  Type Ctrl+Alt+F1 to switch to the text terminal and log in
2.  Run 'DISPLAY=:0 konsole'

This should avoid the "Cannot connect to X server" message.  The Konsole window will appear on the main display (Ctrl+Alt+F7 to switch to it)

3.  Let me know what output you get.  You can cat it to a file like so:

DISPLAY=:0 konsole 2> log_file
Comment 6 Philip Rodrigues 2007-02-02 00:04:43 UTC
Perhaps this is a useful data point (perhaps not :-):

You can get the same error and behaviour by running, eg;
konsole -e 'ls ..'
It should of course be:
konsole -e ls ..

But perhaps knowing this is useful
Comment 7 Ace Frehley 2007-02-02 07:20:12 UTC
#5 Did as you suggested.  When switching back to Ctl-Alt-F7, the konsole window appears as before, the error message pops up and when I click the OK button on the error message, the konsole window disappears.

The file to which I (try to) cat the output is empty.

On Ctl-Alt-F1, the following appears:
kdecore (Kprocess):  Warning Can't open a pseudo teletype!
konsole: WARNING: Unable to open a pseudo teletype
Uh oh.. Can't get terminal attributes

#6  I tried to run konsole -e ls .. from Alt-F2 but nothing visible happened.

When I try it from Ctl-Alt-F1, the same thing as described for #5 above happens.
Comment 8 Robert Knight 2007-02-03 04:22:18 UTC
Hello Ace,

Can you try to find out whether any other Debian users running the same KDE 3.5.5 packages also experience the same problem?
Comment 9 Ace Frehley 2007-02-03 08:13:29 UTC
Sure, I'll post a message on the Debian forum and let you know.

On 3 Feb 2007 03:22:19 -0000, Robert Knight <robertknight@gmail.com> wrote:
[bugs.kde.org quoted mail]
Sure, I&#39;ll post a message on the Debian forum and let you know.<br><br><div><span class="gmail_quote">On 3 Feb 2007 03:22:19 -0000, <b class="gmail_sendername">Robert Knight</b> &lt;<a href="mailto:robertknight@gmail.com">
robertknight@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">------- You are receiving this mail because: -------
<br>You reported the bug, or are watching the reporter.<br><br><a href="http://bugs.kde.org/show_bug.cgi?id=140952">http://bugs.kde.org/show_bug.cgi?id=140952</a><br><br><br><br><br>------- Additional Comments From robertknight gmail com&nbsp;&nbsp;2007-02-03 04:22 -------
<br>Hello Ace,<br><br>Can you try to find out whether any other Debian users running the same KDE 3.5.5 packages also experience the same problem?<br></blockquote></div><br>
Comment 10 Ace Frehley 2007-02-05 13:07:03 UTC
I've posted the error on the Debian Forum and the only reply received was from someone who has not experienced the problem and said "Kanotix != Debian, especially in this case, because the problem might be related to wrong permissions on pty device nodes (probably Kanotix specific)."

My posts on the Kanotix forum has not elicited any response either.  

Searching on Google has similarly not been helpful, except to show that this problem is (a) quite rare and (b) not limited to Debian.
Comment 11 Robert Knight 2007-02-05 14:34:52 UTC
Are you able to run xterm, rxvt or gnome-terminal?  Unfortunately the PTY error message is shown by Konsole for a variety of unrelated problems as well.

But if it is a PTY error, that can be debugged using the strace tool, which can be installed using "apt-get install strace" under debian.

If you are able to run xterm, then start it using Alt+F2 and run these commands from there:

strace -e trace=stat64 konsole 2> log
cat log | grep pts

Comment 12 Ace Frehley 2007-02-05 15:04:22 UTC
I cannot run xterm.  When I go Alt+F2 - xterm - enter, a konsole opens and the same PTY error message pops up.  

Is it possible to do the strace from Ctl-Alt-F1?
Comment 13 Ace Frehley 2007-02-07 08:41:41 UTC
I ran strace from Alt-F2 and it produced an output file of over 500K.  There were a number of PTY related messages, but they were all identical, as follows:

open("/dev/ptyp0", O_RDWR)              = -1 ENOENT (No such file or directory)
open("/dev/ptyp1", O_RDWR)              = -1 ENOENT (No such file or directory)
.
.
.
open("/dev/ptyoy", O_RDWR)              = -1 ENOENT (No such file or directory)
open("/dev/ptyoz", O_RDWR)              = -1 ENOENT (No such file or directory)

Are there other messages that I should look for or should I post the whole strace output file?
Comment 14 Ace Frehley 2007-02-07 08:46:54 UTC
Sorry, misinterpreted your earlier message (#11).  I reran strace as follows:  strace -e trace=stat64 konsole 2> /home/e-dua/msg1.txt  

It rpoduced an output file of 82K.  

There was one reference to pts (I include the two lines before and after):

stat64("/home/e-dua/.compose-cache/", 0xbf9e3b50) = -1 ENOENT (No such file or directory)
stat64(".", {st_mode=S_IFDIR|0775, st_size=7712, ...}) = 0
stat64("/dev/pts/0", 0xbf9e3b64)        = -1 ENOENT (No such file or directory)
stat64("/home/e-dua/.kde/share/config/", {st_mode=S_IFDIR|0755, st_size=5368, ...}) = 0
stat64("/home/e-dua/.kde/share/config/kdebugrc", 0x8158af8) = -1 ENOENT (No such file or directory)

Hope that helps.
Comment 15 Ace Frehley 2007-02-09 12:36:12 UTC
Seems to be solved.

I added a line to my fstab:

devpts   /dev/pts  devpts   gid=5,mode=620   0  0

and that did the trick.
Comment 16 Ace Frehley 2007-02-09 12:36:44 UTC
Marking it as resolved.
Comment 17 Alan Ezust 2007-06-14 22:08:45 UTC
I ran into this identical problem after upgrading from 2.6.18 to 2.6.21-686 using knoppix and debian package sources.

The error message is not good enough to help me resolve this issue. It indicates that there is a "konsole configuration problem" when actually, it is not related to Konsole at all, but more a general pty problem. I'm unable to start any X like terminals. When i try to start xterm, it says: "not enough ptys". 


Adding the line as shown in /etc/fstab did not fix my problem either.

I realize this is not exactly a Konsole bug, but does someone else have a suggestion as to what I should try next?

Comment 18 Alan Ezust 2007-06-14 22:13:06 UTC
oops. ignore previous message. after making the change to /etc/fstab, I had to reboot too.