Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
container console access #1129
Comments
|
There are currently no plans for it. Most LXD images actually don't spawn gettys whenever possible to save pts devices and cpu/memory resources. It's also not a concept which maps particularly well across different operating systems so the API design for this may be tricky. So it's not out of the question that we'd grow support for attaching to /dev/console (probably not for the other ttys though as we don't even set those up at all with LXD) but we'd need a very good use case for this feature that can't be covered with exec. |
|
Wel, the only reasonable use case would be to troubleshoot container startup and shutdown issues or tot centrally serve up consoles like the VPS providers do. Other then these I have nog found a usecase yet. |
stgraber
added
Feature
Documentation
labels
Sep 28, 2015
stgraber
added this to the later milestone
Sep 28, 2015
|
Couldn't this be customized by using aliases like: #1395 |
|
An alias to execute a shell inside the container namespace is not the same as actual console access using /dev/console. I dont like the console name in the alias example as it is very different. 'shell' would be a better name. |
|
Seems like the denominations 'shell', 'console' and 'terminal' are blurring. |
stgraber
added
the
API
label
Apr 27, 2016
candlerb
commented
Apr 28, 2016
|
I have a use case for this: a virtual networking lab, where lxd containers are routers and/or simulated end-user PCs. You want to provide the students with out-of-band access to each container so that they can configure its network interfaces and debug problems. If vncterm works, that may actually be a better solution. |
candlerb
commented
Apr 28, 2016
|
I have been trying this out further. I am using Ubuntu 14.04 with the lxd PPA ( lxc-consolei.e. access to emulated serial console.
It would indeed be very nice if lxd could support this. (Redirecting a character stream over HTTP perhaps would be best done with websockets?) Aside: inside the container, I can see there is a single getty process running.
In the old lxc, apparently you could set lxc.tty to get more ttys. But I can't see a corresponding setting for lxd profiles. Is it possible? vnctermi.e. access to emulated text console: a memory buffer of NxM characters. In ubuntu, I believe this is the tool 'linuxvnc' from the package also called 'linuxvnc'. @jsimonetti: how did you get this to work? Running directly on the outer host it's fine: But inside a guest lxd container, there are no As far as I can tell, even if I were able to set Also, for my purposes I would need to run linuxvnc on the host and attach it to the console in the guest. This is so that linuxvnc uses a port on the host's own IP address, and is reachable even if the guest's networking is broken. (If the guest had sufficient networking to run linuxvnc inside it, then I could just as well ssh into the guest) Unfortunately, I can't see any way to use vncterm to share anything other than one of the host's own virtual consoles. |
candlerb
commented
Apr 28, 2016
|
And of course,
is something completely different - it's just running a command directly inside the container and exposing its stdin/stdout to the client. I don't have a two-host test rig so I haven't found out if this works interactively to a remote host or not. |
lxc exec works remotely. |
candlerb
commented
Apr 28, 2016
|
Thanks - I see that now. In that case, most of what's needed for a remote console is probably already there; but I suspect most people will be happy just to have remote exec. |
|
Iirc I used vncterm from Proxmox (https://git.proxmox.com/?p=vncterm.git;a=summary), which has some heavy modifications. It still needs to be run on the host though. Op 28 apr. 2016 12:56, bij 12:56, Brian Candler notifications@github.com schreef:
|
stgraber
added
the
Maybe
label
Jul 5, 2016
|
The use case for this would be to extend the claims of being "just like virtual machines" Since, in its current state, it's not quite like a virtual machine, and LXD covers maybe only half the use cases for VMs (such as running non-gui services), but it doesn't cover things such as certain types of analysis and research, and user desktop sessions |
Could you be more specific on that?
Impossible right now with the current infrastructure? |
|
@srkunze I'll have to followup with more details, but for the user desktop sessions, something along the lines of:
Currently, that isn't possible(?), but I would love to be completely wrong about that |
|
@stgraber Is this possible? |
|
Console access wouldn't help you at all to run a desktop inside a container as what we've been calling console access here is about a tty, so a text-only interface. To run a desktop inside a container you either need a privileged container with a bunch of bind-mounts to have raw access to the host tty devices, dri kernel interface and any GPU endpoint (for nvidia/amd ones). Or you need to run the X server outside the container on the host and then pass /tmp/.X11-unix to the container as a bind-mount and tweak the X ACL on the host to allow connections from within the container (if you don't care "xhost +" disables all ACLs). |
|
Some resources (from docker): https://blog.docker.com/2013/07/docker-desktop-your-desktop-over-ssh-running-inside-of-a-docker-container/ They use xpra. @naisanza Does this help somehow? @stgraber Is it worth making this easier for LXD users? |
|
We've been trying to keep LXD pretty generic as far as the OS it runs on as Linux isn't the only platform that supports containers. Now that there also are several display managers on Linux alone, I really wouldn't want to have any of this show up in the LXD API. There is also the small snag that this will effectively only work on machines where the LXD client and daemon are on the same box, which would further reduce its use. Especially as running X applications (including a full desktop if you so wish) is pretty straightforward:
|
hieuit7
commented
Sep 22, 2016
|
I found docs for contaner exec command here: https://github.com/lxc/lxd/blob/master/doc/rest-api.md#10containersnameexec I used it for my project and use request to call api. I can't wait for websocket connection. How to get it? I want execute command via api with websocket connection! |
alexforster
commented
Dec 4, 2016
•
|
For anyone who hits this issue from Google like I did, you can access an LXD container's console device like this– ~# lxc profile device show default
# (...sic...)
console:
path: /dev/console
type: unix-char
tty:
path: /dev/tty
type: unix-char
tty0:
path: /dev/tty0
type: unix-char
ttyS0:
path: /dev/ttyS0
type: unix-charAdd with:
Open console with:
I use an
|
veselins
commented
Jan 10, 2017
•
|
I am playing with LXD for couple of months and managed to set up really good Desktop Environment experience inside LXC/LXD container. However, I have some problems and any advice or solution will be appreciate. To run desktop environment I am using xdummy driver (didn't test Xpra, but I think it will provide better experince). This allows me to connect and interact with container as headless machine via vnc. I personally prefer it instead However, if you look for closed to 'as Virtual Machine' experience, than I thing the solution mention from Stéphane Graber ( @stgraber ) is good one. Install X server on host and link it to LXD container. He got really nice article about it. But I do have some problems and look for any advice or solutions:
@stgraber may you help with next problem: Any comment or advice will be appreciate I am really blocked.
However when I linked the gpu to container, and running above commands I have:
What might be the problem there, why modinfo can't access i915 driver? And I was wondering, let's say that GPU device will be linked to 2 containers and on both containers we have install xserver, how the synchronization will be take place when both X servers try to access same gpu hardware? Is there any legible case to share same GPU to more than one container ? Thanks |
|
Likely because |
jmdelafe
referenced this issue
in OpenNebula/addon-lxdone
May 12, 2017
Closed
Single VNC per node #6
FlorianHeigl
commented
Jun 3, 2017
|
since @alexforster showed this is actually solvable, it would be wonderful to have a bit less pushback against having console access. What are the things that need to be solved to get it in acceptable quality? (excluding the "running a window manager on it" part though, Xvfb should be good enough?) |
stgraber
removed
the
Maybe
label
Oct 12, 2017
stgraber
modified the milestones:
later,
lxd-2.19
Oct 12, 2017
stgraber
assigned
brauner
Oct 12, 2017
|
@brauner assigned this one to you. The current plan is to implement a "lxc console NAME" which attaches to /dev/console.
All LXD containers should then be configured to write the console output to a file. When attaching interactively LXD should return whatever is in the buffer and then truncate the buffer. |
|
This should ideally support multiple connections to the same container's console. |
stgraber
assigned
albertodonato
and unassigned
brauner
Oct 12, 2017
|
Moving this to @albertodonato so @brauner can take the SR-IOV one :) |
|
Lets split that work a bit and make the first pass be only about attaching to the console (without any backlog). The backlog handling is a bit tricky to do because of disk usage concerns as well as knowing what to replay to the connecting user. I think we'll want that particular feature under a config option. |
stgraber
modified the milestones:
lxd-2.19,
lxd-2.20
Oct 17, 2017
|
Can this interface be generic enough to also forward local sockets/connections? |
|
no, that feature is directly interfacing with low level liblxc and does things like low level tty handling |
sreisenb14
commented
Oct 28, 2017
•
|
how is this implemented on https://linuxcontainers.org/lxd/try-it/ ? |
|
@sreisenb14 that's using the exec API, spawning bash in the container. |
sreisenb14
commented
Oct 31, 2017
•
|
@stgraber thx for that info the docu seems a bit strange, i try:
then i'll get this answer: and the assembled url for websocket: returns 404 - any ideas? |
|
In your case, I think you want wait-for-websocket to be true, otherwise I'd expect bash to start, notice that stdin doesn't exist and just exit immediately, causing the operation to be garbage collected and explaining your 404. |
|
Also, note that when connecting over websocket, you need to use the URL with ?secret=SECRET where the secret is one of the strings you get from the initial POST. There is one secret per fd that's part of the exec session. So it usually looks like (for interactive):
|
added a commit
to brauner/lxd
that referenced
this issue
Nov 8, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 8, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 8, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 8, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 8, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 8, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 8, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 8, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 8, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 8, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 8, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 8, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 11, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 11, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 11, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 11, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 12, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 13, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
added a commit
to brauner/lxd
that referenced
this issue
Nov 14, 2017
stgraber
closed this
in
d505b22
Nov 14, 2017
|
Why |
|
That's how we call all the internal subcommands of the daemon. |
|
I see. It is for daemon.. |
jsimonetti commentedSep 23, 2015
Currently there is no way to connect to the console of a container using lxd/lxc.
The lxc-console command from lxc-tools works on lxd locally started containers if you add the -P parameter to point to /var/lib/lxd/containers.
It would be awesome if lxd would allow acces to a containers' console or tty over the network.
lxc attach remote:containername <console|ttyX>
Or something similar...
Are there any plans to do this, and if so is there allready a specification for it?