gliderlabs / gliderlabs/docker-alpine

sh: can't access tty; job control turned off

Open
#85 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Shell
Stars
5.7k
Forks
530
PR merge metrics
No merged PRs in 30d

Description

Trying to launch alpine container on CoreOS via [toolbox](https://github.com/coreos/toolbox/blob/bc6a8c4754c14e66c26fa21a48134a90a0592e9d/toolbox) and getting `sh: can't access tty; job control turned off` warning. I've read about it in BusyBox [FAQ](http://www.busybox.net/FAQ.html#job_control), which didn't work for me, and tried [this](http://superuser.com/a/418557/384955), also without any luck.

CoreOS uses systemd-nspawn to launch the container, so this is **not** happening with Docker. I thought this might be related to nspawn itself, but it does work fine with other images like fedora and ubuntu, guys over there not sure this is caused by nspawn – systemd/systemd/issues/1431. I use CoreOS [766.4](https://coreos.com/releases/#766.4.0), systemd version 222 (also tried alpha / 225). From what I see [here](https://github.com/coreos/toolbox/blob/bc6a8c4754c14e66c26fa21a48134a90a0592e9d/toolbox#L31-L38), CoreOS launches it with nspawn like this:

``` sh
sudo systemd-nspawn \
--directory="${machinepath}" \
--capability=all \
--share-system \
--bind=/:/media/root \
--bind=/usr:/media/root/usr \
--bind=/run:/media/root/run \
--user="${TOOLBOX_USER}" "$@"
```

I pass only `--quiet` option to suppress the noise. This happens without specifying any command to the container or when specifying `sh`. If I run Python, for example, it doesn't complain and works perfectly.

``` sh
$ toolbox --quiet
-sh: can't access tty; job control turned off
ip-10-1-1-254:~#
```

Bash also doesn't work smoothly (after installing it).

``` sh
$ toolbox --quiet
-bash: cannot set terminal process group (-1): Not a tty
-bash: no job control in this shell
ip-10-1-1-254:~#
```

I did have some luck with passing `--quiet sh -c 'exec sh /dev/console 2>&1'`, but didn't find a way how to amend my image to make this a default command (the one that nspawn calls automatically or one configured to be the default command in Alpine). Besides, this doesn't seem to load ash profile, or something wrong happens with it.

``` sh
$ toolbox --quiet sh -c 'exec sh /dev/console 2>&1'
/ #
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.