-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify wording for terminal setting and /dev/console #518
Conversation
@@ -85,7 +85,7 @@ See links for details about [mountvol](http://ss64.com/nt/mountvol.html) and [Se | |||
|
|||
## Process configuration | |||
|
|||
* **`terminal`** (bool, optional) specifies whether you want a terminal attached to that process. Defaults to false. | |||
* **`terminal`** (bool, optional) specifies whether a terminal is allocated for and attached to that process. Defaults to false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is still too vague. Who allocates the terminal? It sounds like runC expects the runtime-caller to already have a slave, although ccon uses this setting to have the container process opens the pair with posix_openpt
. See also #494.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wking I think that both approaches are valid and we shouldn't add language to support one but not the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Wed, Jul 20, 2016 at 12:10:26PM -0700, Mrunal Patel wrote:
-*
terminal
(bool, optional) specifies whether you want a terminal attached to that process. Defaults to false.
+*terminal
(bool, optional) specifies whether a terminal is allocated for and attached to that process. Defaults to false.@wking I think that both approaches are valid and we shouldn't add
language to support one but not the other.
I'm ok with being vague in config.md as long as it gets spelled out in
the command-line API specs. Otherwise this is going to be hard to
compliance-test. If we're trying to focus just on the
inside-the-container view here, how about:
If true, the container process's standard streams will all be
attached to a terminal. Defaults to false.
If we're not going into detail about who allocates the terminal, I'd
rather not mention “allocate” at all.
I didn't record an entry for this in the meeting log, but I remember $ ccon … --pseudoterminal-socket PATH will connect to the Unix socket listening at PATH, and pass the master
But it should be sufficient for folks who want to kick the tires of |
0e24a1c
to
527cee0
Compare
Rebased and updated. |
@@ -90,7 +90,9 @@ See links for details about [mountvol](http://ss64.com/nt/mountvol.html) and [Se | |||
|
|||
## Process configuration | |||
|
|||
* **`terminal`** (bool, optional) specifies whether you want a terminal attached to that process, defaults to false. | |||
* **`terminal`** (bool, optional) specifies whether a terminal is attached to that process, defaults to false. | |||
On Linux, a psuedo-terminal pair is allocated for the container process and the standard streams are duped to the pty slave. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For extra clarity (and to match “Atomically duplicate 'oldfd' on 'newfd'” wording in dup(2) and “pseudoterminal” in pts(4)), I'd recommend:
On Linux, a psuedoterminal pair is allocated for the container process and the psuedoterminal slave is duplicated on the container process's standard streams.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
687c22c
to
437ff74
Compare
* **`terminal`** (bool, optional) specifies whether you want a terminal attached to that process, defaults to false. | ||
* **`terminal`** (bool, optional) specifies whether a terminal is attached to that process, defaults to false. | ||
On Linux, a psuedoterminal pair is allocated for the container process and the psuedoterminal slave is duplicated on the container process's [standard streams][stdin.3]. | ||
Also, the psuedoterminal slave is bind mounted at /dev/console. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think “bind mounted” is overly specific. Ccon does not bind mount /dev/console
, it relies on the container's posix_openpt
and the kernel/libc implementation to get the appropriate console device behavior. In this case, I suggest we lead with the ocitools implementation of the test (how do you validate proper /dev/console handling?) and then figure out the wording after we have ocitools tests we like. I expect the test will be something like “container writes to /dev/console and test harness ensures it reads that string out of the pseudoterminal master”, but we may want other tests in addition (I'm not familiar enough with /dev/console to know).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, /dev/console looks like a different beast from the psuedoterminal. Why link them at all?
d789654
to
c871e4a
Compare
@@ -147,7 +147,7 @@ In addition to any devices configured with this setting, the runtime MUST also s | |||
* [`/dev/random`][random.4] | |||
* [`/dev/urandom`][random.4] | |||
* [`/dev/tty`][tty.4] | |||
* [`/dev/console`][console.4] | |||
* [`/dev/console`][console.4] is setup if terminal is enabled in the config by bind mounting the psuedoterminal slave to /dev/console. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think /dev/console
can be a common terminal and not just pseudoterminal, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hqhq For container runtimes, it is the pseudoterminal slave. I haven't seen a use case or setup otherwise.
This is ready for review. ping @opencontainers/runtime-spec-maintainers |
@@ -147,7 +147,7 @@ In addition to any devices configured with this setting, the runtime MUST also s | |||
* [`/dev/random`][random.4] | |||
* [`/dev/urandom`][random.4] | |||
* [`/dev/tty`][tty.4] | |||
* [`/dev/console`][console.4] | |||
* [`/dev/console`][console.4] is setup if terminal is enabled in the config by bind mounting the pseudoterminal slave to /dev/console. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think:
- We want
/dev/console
unconditionally. - We don't want to require bind-mounting the slave over this. Let the runtime point
/dev/console
to a place it considers appropriate for logging system messages, which may not be the pseudoterminal slave. In fact, I'd expect the validation for/dev/console
to be “Is the major 5, the minor 1, and the type ‘char’?”, which is not going to be satisfied by bind-mounting the slave.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to require bind-mounting the slave over this. Let the runtime point /dev/console to a place it considers appropriate for logging system messages, which may not be the pseudoterminal slave. In fact, I'd expect the validation for /dev/console to be “Is the major 5, the minor 1, and the type ‘char’?”, which is not going to be satisfied by bind-mounting the slave.
That validation does not work inside containers. That particular major and minor number is reserved for consoles that are created as part of initial bootup (think physical console) on Linux. I think that it is entirely sufficient to just state that /dev/console
should be a valid place to log system messages (which is what you suggested).
@cyphar According to the new console rewrite in runc, any thoughts about how should we define |
On Thu, Sep 29, 2016 at 01:49:00AM -0700, Aleksa Sarai wrote:
It can work inside containers: $ unshare -Urm file /dev/console All of the logged messages will end up in the host console, but maybe
If we allow devices other than c5/1 at that path, I think we need to |
Sure, that validation /could/ work. But what you've done in your example is just use the parent's |
Yeah I think |
On Thu, Sep 29, 2016 at 08:15:03PM -0700, Qiang Huang wrote:
I'm fine with that (although I'd also be fine with a console device If you don't care about TIOCCONS you can mount another pseudoterminal |
@wking Again, I never said that using I also maintain that "somewhere to dump system messages" is sufficient restriction / definition for users. If someone wants to use something specialised like |
On Fri, Sep 30, 2016 at 04:04:14AM -0700, Aleksa Sarai wrote:
So the spec entry should be something like:
|
@wking I think this is what we should put:
Footnotes the same as your comment. I'm not sure about the terminal restriction to be completely honest. But I'd consider using your wording if you can give a good example of how a misreading of the spec could result in something we shouldn't allow happening. |
On Wed, Oct 05, 2016 at 12:59:48PM -0700, Qiang Huang wrote:
I am not aware of any others, but I like your more conservative |
In today's meeting there was more discussion on whether /dev/console |
If you're willing to test a VERY large amount of software with that change, then I would accept removing the requirement. However, that would just be time consuming and i would prefer that we have the requirement and then drop it in later versions of the spec. This PR (and all of the other PRs for terminal) have dragged on for months and months and it's starting to get quite aggravating TBH. While it might be true that |
On Tue, Oct 18, 2016 at 01:51:25AM -0700, Aleksa Sarai wrote:
I think that “provide something we're not sure we need, since we can While we're working out when /dev/console is actually needed, folks |
Wouldn't that be non-backwards-compatible? Since we'd be adding a new restriction to runtimes? Or would that be fine for 1.1?
Remove the
Again, |
On Tue, Oct 18, 2016 at 03:43:25AM -0700, Aleksa Sarai wrote:
Both major and minor bumps add new restrictions to runtimes. The
“Somebody else has already picked this direction” isn't a good
GitHub searching turns up many, many links to kernel docs ;). I
Agreed. Mounting c5/1 is just one of several options for providing |
Poking around trying to find /dev/console consumers turned up syslog rsyslogd has _PATH_CONSOLE defaulting to /dev/console (at The “syslog may be configured to write to /dev/console” seems |
systemd uses it |
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Rebased. |
On Wed, Oct 19, 2016 at 10:09AM -0700, Michael Crosby wrote: Ah, thanks :). In that issue, Lennart links to 1 which has: If you write a container solution, please consider supporting the Execution Environment …
The “single shell on /dev/console” bit is similar to the kernel's “on So I recommend we add a new console boolean (linux.console? Maybe
Does that sound workable? |
@wking You mentioned in the weekly call that you'd put a summary of the discussion here? Would you mind doing so? |
On Fri, Oct 21, 2016 at 10:19:14AM -0700, Aleksa Sarai wrote:
Sorry, GitHub seems to be eating my emailed comments. Posted summary was for #513, and I just re-posted via the web-UI here. |
@cyphar is the wording in this PR accurate in your opinion, or should it be adjusted? IMO it sounds like it's an improvement over current |
Yeah, this is overall an improvement. This overall LGTM, we can deal with whether we should remove some of the restrictions later. |
This happened in c35cf57 (config: Replace "optional" with "OPTIONAL", 2016-09-17, opencontainers#574) but was accidentally rolled back in 52f3cde (Clarify wording for terminal setting and /dev/console, 2016-07-18, opencontainers#518). Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Mrunal Patel mrunalp@gmail.com