0

I am using a vagrant to run centos7 now. I created a lxc container which also base centos7 inside this vagrant os.

I can start the lxc but can't use lxc-console. Like this:

$ sudo lxc-create -n centos -t centos
$ sudo lxc-start -n centos -d
$ sudo lxc-ls --active
centos
$ sudo lxc-console -n centos
Connected to tty 1
Type <Ctrl+a q> to exit the console, <Ctrl+a Ctrl+a> to enter Ctrl+a itself

Then nothing to go, only waiting...

It seems like the centos7's problem. How to fix it?

0

Yep came across this one eventually figured it out. Getty isn't starting because /dev/tty0 is not created in the lxc instance.

You simply need to do the following:

  1. Create your own copy of the getty@.service

    cp /lib/systemd/system/getty@.service /etc/systemd/system
    
  2. Comment out the line ConditionPathExists=/dev/tty0 in the copied getty@.service

Note you edit the copied version so any future updates to getty stuff don't blow away your edits. You'll just have to check to see if things need changing in the future if getty updates for whatever reason.. Now you should be able to start the lxc instance as a daemon and then use lxc-console to access it

I had noted that getty was borking just didn't know how to work around it myself until I discoverred the original instructions here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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