Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm working with lxc in Ubuntu 12.04, and it's really great. However, I am unable to disconnect from a lxc-console session after I've connected. I read somewhere that Ctrl-aq will disconnect me from the console but it doesn't seem to work.

Should I be running lxc-console via screen instead?

share|improve this question

3 Answers 3

up vote 23 down vote accepted

Yes, Ctrl-aq, should work by default, however no, lxc-console does not actually use screen to accomplish its console behavior. In fact, you might be encountering a conflict if you are using screen since it also uses Ctrl-a as a prefix. If you're inside screen but don't realize it then you'll need to type Ctrl-a a q since the default behavior of screen is that you have to type Ctrl-a a to actually send ^a to the shell running inside of it. You can change the prefix for escape by passing the -e or --escape=PREFIX option to lxc-console.

Also, it appears there may be a bug in lxc-start so that if it immediately goes into console mode when you start the container you can't using Ctrl-a q to escape-- in fact, all the control characters seem to be screwed up and print to the screen instead of behaving the way you expect. One workaround is to run it with the -d or --daemon option so that it doesn't immediately start a console, and the connect to it by hand:

lxc-start -d -n container-name
lxc-console -n container-name
share|improve this answer
    
<kbd>Ctrl-a q</kdb> does not have any effect on a connected console with lxc version 0.9.0 –  Jay Taylor Aug 30 '13 at 20:43

Doesn't it connect via screen? Ctrl-a d should get you out of it.

The Ubuntu LXC page has more information.

share|improve this answer
    
No, this does not work. I've been using screen so that I can disconnect from lxc-console. Also, the link that you posted does not have any information about this problem. –  robbyt Aug 6 '12 at 3:02
    
"Detach screen: C-a d or C-a C-d" - help.ubuntu.com/community/LXC#Mini_screen_how-to; not sure what to do if that's not working. –  El Yobo Aug 6 '12 at 23:34
    
@ElYobo No, lxc-console does not actually use screen, it just has similar behavior and by default actually uses a key that conflicts with screen's as described here. –  aculich Oct 16 '12 at 8:21

When you are done working with some application you can usually terminate it witch CTR+C. If that doesn't do the trick, there is always the quit command: CTRL+.

CTRL+D, on the other hand means "END OF FILE", and works usually to stop some program from reading the keyboard. You can log out of regular shell with CTRL+D.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.