google / google/gvisor

ttyname: Inappropriate ioctl for device

Open
#11,582 6 comments 0 reactions 0 assignees View on GitHub
stale-issue type: bug
Dominant language
Go
Stars
19.3k
Forks
2k
Avg merge
3d 5h
Merged PRs (30d)
264

Description

### Description

If I call `ttyname(0)` in C, it gives an `Inappropriate ioctl for device` error.

### Steps to reproduce

If I compile this code to `a.out`:

```c
#include
#include

int main() {
char *name = ttyname(0);
if (!name) {
perror("ttyname");
return 1;
}
printf("ttyname = %s\n", name);
return 0;
}
```

With runsc, it fails:

```
$ podman run --rm -ti -v $PWD/a.out:/a.out:ro --runtime=runsc --runtime-flag=ignore-cgroups --runtime-flag=network=none debian:testing /a.out
ttyname: Inappropriate ioctl for device
```

With runc, it works:

```
$ podman run --rm -ti -v $PWD/a.out:/a.out:ro --runtime=runc debian:testing /a.out
ttyname = /dev/pts/0
```

Note that in both cases, I gave it the [`-t` flag](https://docs.podman.io/en/latest/markdown/podman-run.1.html#tty-t).

### runsc version

```shell
runsc version 0.0~20240729.0
spec: 1.2.0
```

### docker version (if using docker)

```shell
$ podman version
Client: Podman Engine
Version: 5.4.0
API Version: 5.4.0
Go Version: go1.24.0
Built: Sun Feb 16 08:51:11 2025
OS/Arch: linux/amd64
```

### uname

Linux solaria 6.12.12-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.12-1 (2025-02-02) x86_64 GNU/Linux

### kubectl (if using Kubernetes)

```shell

```

### repo state (if built from source)

_No response_

### runsc debug logs (if available)

```shell

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.