[LXD 4.1] command to quit after "lxc console" connection

Hello :wave:

I looking for a command to quit a “lxc console local:container-name” and to return to the host process.
Is there a way to do that without stopping the container?

It should say at the top how to quit when you first launch lxc console, its <ctrl>+a q

Yes. But I looking for a command to do that.

ctrl+a-q is the only way out of it.

There can’t be a command you run inside of a console which disconnects you, that’s not how consoles work. lxc console works the same way as you connecting over a good old serial console cable to a machine would.

What are you trying to achieve? There is ‘lxc exec’ to run a command.

Ok. I thought a script could run the “lxc console” command in another process and wait for that process to finish to resume. And so I was looking for a clean method to end the process of “lxc console” so as not to stop the container.

But it’s just out of curiosity. I’m not sure it ever makes sense

@tomp. I am using “lxc console” here because I have trouble using sudo manually without password with “lxc exec”. And I don’t want to install and use ssh just for an error like that (sudo : no tty present and no askpass program specified). I’m just doing little hands-on tests like testing the bash script on different operating systems without using cloud-init or some other way like ansible. …

No really serious things that need a solution. Later, I’ll have a decent build process like cloud-init to do it. :wink: