Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#610373: kbd: openvt -e fails with ioctl TIOCSCTTY: Operation not permitted

102 views
Skip to first unread message

Daniel Kahn Gillmor

unread,
Jan 17, 2011, 9:30:02 PM1/17/11
to
Package: kbd
Version: 1.15.2-2
Severity: normal

Running the following simple command fails (returns 1):

openvt -e true

And it prints the following message on the allocated vt:

ioctl TIOCSCTTY: Operation not permitted

Attached is an strace dump.

Thanks for maintaining kbd in debian!

--dkg

-- System Information:
Debian Release: 6.0
APT prefers testing
APT policy: (500, 'testing'), (1, 'experimental')
Architecture: powerpc (ppc)

Kernel: Linux 2.6.32-5-powerpc
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages kbd depends on:
ii console-setup 1.67 console font and keymap setup prog
ii libc6 2.11.2-7 Embedded GNU C Library: Shared lib
ii lsb-base 3.2-23.2squeeze1 Linux Standard Base 3.2 init scrip

Versions of packages kbd recommends:
ii console-setup 1.67 console font and keymap setup prog

kbd suggests no packages.

-- no debconf information

openvt.strace

Michael Schutte

unread,
Jan 18, 2011, 4:40:02 PM1/18/11
to
Hi Daniel!

On Mon, Jan 17, 2011 at 09:23:29PM -0500, Daniel Kahn Gillmor wrote:
> Running the following simple command fails (returns 1):
>
> openvt -e true
>
> And it prints the following message on the allocated vt:
>
> ioctl TIOCSCTTY: Operation not permitted
>
> Attached is an strace dump.
>
> Thanks for maintaining kbd in debian!

And thank you for your report, I can confirm the problem. The issue in
a nutshell is that without forking, openvt cannot create a session
because it already is a process group leader; this prohibits it from
using TIOCSCTTY. I’ll have a closer look at how to fix this as soon as
I can.

Cheers,
--
Michael Schutte | michi@{uiae.at,debian.org}
Innsbruck, Austria | happily accepting encrypted mail
OpenPGP: 0x16fb 517b a866 c3f6 8f11 1485 f3e4 122f 1D8C 261A

signature.asc

Michael Schutte

unread,
Jan 22, 2011, 6:10:01 PM1/22/11
to
Daniel,

On Tue, Jan 18, 2011 at 10:28:38PM +0100, Michael Schutte wrote:
> On Mon, Jan 17, 2011 at 09:23:29PM -0500, Daniel Kahn Gillmor wrote:
> > And it prints the following message on the allocated vt:
> >
> > ioctl TIOCSCTTY: Operation not permitted
>

> And thank you for your report, I can confirm the problem. The issue in
> a nutshell is that without forking, openvt cannot create a session
> because it already is a process group leader; this prohibits it from
> using TIOCSCTTY. I’ll have a closer look at how to fix this as soon as
> I can.

As far as I can tell, this behavior is intentional: openvt spawns as a
session leader if it is started by init, and this appears to be the
intended use case according to the manpage. If you need “openvt -e” in
another context (say, because you need the PID of the program you want
to exec), you can use fork() and setsid() (or setsid(2)).

Is this an acceptable workaround for you? Fixing openvt to make the -e
option work all the time would be a little ugly (it would have to fork a
helper process to take over as the process group leader), so I’d prefer
to solve this bug by explaining the situation in the man page.

All the best,

signature.asc
0 new messages