ssh doesn't get pty; says "inappropriate ioctl for device"

Bug #1179344 reported by Todd A. Jacobs
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
openssh (Ubuntu)
Fix Released
High
Unassigned

Bug Description

## Versions

    $ lsb_release -rd
    Description: Ubuntu Saucy Salamander (development branch)
    Release: 13.10

    $ uname -a
    Linux emu 3.9.0-1-generic #5-Ubuntu SMP Wed May 8 20:52:16 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

    $ apt-show-versions -a openssh-server
    openssh-server 1:6.2p1-2 install ok installed
    openssh-server 1:6.2p1-2 saucy us.archive.ubuntu.com

## Problem

After a recent (accidental) upgrade to 13.10, recent updates to the kernel seem to make inbound SSH connections problematic. Specifically, the remote client is unable to connect to a login shell. This was extremely difficult to diagnose, because all the client says is:

    $ ssh emu
    Last login: Sun May 12 21:35:35 2013 from goldendelicious
    Shared connection to 192.168.1.127 closed.
    Connection to 192.168.1.127 closed by remote host.

Even with the verbose flag turned on (e.g. `-v` and `-vvv`) all you see is that you connect, then get "debug1: Exit status -1" for no discernable reason. The rest of the verbose output is completely uninteresting However, there are other ways to debug this, as shown below.

### SSH connection results in dumb terminal

    $ echo $TERM
    xterm-256color

    $ ssh emu /bin/echo \$TERM
    dumb

As you can see, openssh does not use the correct TERM environment variable. However, manually setting TERM (e.g. `export TERM=vt100`) doesn't solve the problem, because you don't actually have a pty. See next section.

### Non-login shells work...sort of

    $ ssh emu /bin/bash -i
    bash: cannot set terminal process group (-1): Inappropriate ioctl for device
    bash: no job control in this shell
    emu:~$ echo $TERM
    echodumb
     $TERM
    emu:~$ tty
    tty
    not a tty

As you can see here, openssh is unable to open a tty or pty. If you try to force it with `-t` or `-tt`, then it returns to the previous behavior of simply closing the connection without explanation.

## Temporary Work-Around

One way to work around this problem is to use X-Forwarding to launch an xterm as a login shell. For example:

    $ ssh emu xterm -e 'bash -l'

This works, assigns a pty, and otherwise results in a usable remote connection, but is certainly not a substitute for having a working non-X11 shell.

## Expected Behavior

1. OpenSSH should receive a pty on the remote host.
2. The TERM variable should be properly propogated.
3. There should be a more obvious way to debug this; openssh reports NOTHING of use in this situation, even with maximum verbosity.

ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: openssh-server 1:6.2p1-2
ProcVersionSignature: Ubuntu 3.9.0-1.5-generic 3.9.1
Uname: Linux 3.9.0-1-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.10-0ubuntu3
Architecture: amd64
Date: Sun May 12 21:40:41 2013
EcryptfsInUse: Yes
InstallationDate: Installed on 2011-10-15 (575 days ago)
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
MarkForUpload: True
SourcePackage: openssh
UpgradeStatus: Upgraded to saucy on 2013-05-06 (6 days ago)

Revision history for this message
Todd A. Jacobs (codegnome) wrote :
Changed in openssh (Ubuntu):
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Colin Watson (cjwatson) wrote :

You might find useful log information in /var/log/auth.log.

I suspect that this may be a consequence of bug 1179202.

Colin Watson (cjwatson)
Changed in openssh (Ubuntu):
importance: Low → High
Revision history for this message
Todd A. Jacobs (codegnome) wrote :

@cjwatson, you're correct that the bugs seem related. For example:

    May 13 09:45:42 emu sshd[12679]: Accepted publickey for codegnome from 192.168.1.127 port 50803 ssh2
    May 13 09:45:42 emu sshd[12679]: pam_unix(sshd:session): session opened for user codegnome by (uid=0)
    May 13 09:45:42 emu systemd-logind[1778]: New session c20 of user codegnome.
    May 13 09:45:42 emu sshd[12679]: fatal: monitor_read: unsupported request: 144
    May 13 09:45:42 emu sshd[12679]: pam_unix(sshd:session): session closed for user codegnome
    May 13 09:45:42 emu sshd[12822]: fatal: mm_request_send: write: Broken pipe

However, I think this bug report describes aspects of the problem that are not in the other ticket, which does not address any of the TERM, pty, or login shell issues directly. In other words, while I think they are related I don't think they are duplicates.

I am subscribed to the other bug too, so I will test again when the other bug has been closed and see if it closes this one as well. Thanks for pointing out the other bug!

Revision history for this message
Colin Watson (cjwatson) wrote :

Given that the nature of the other bug messes quite thoroughly with sshd's ability to communicate between bits of itself, including the protocol that allows it to set up a session properly, I don't think it's fair to consider the TERM/pty/login-shell issues as unrelated. If 1:6.2p1-3 fixes this then I would consider this bug a duplicate, even though the exact set of symptoms reported here is a bit different.

Revision history for this message
Todd A. Jacobs (codegnome) wrote :
Changed in openssh (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Colin Watson (cjwatson) wrote :

Thanks for the confirmation!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.