2
votes

I am trying to setup lxc container in Centos 7. I have installed minimal Centos 7. And I have made sure cgconfig and cgred services are running. When I use lxc-attach command and go to lxc-container machine, even ls command is not working. I am not sure what am I missing.. Is there any way I can debug control group services are running fine? Or I am missing something else?

Thanks,

Vishnu Ganth

2
I amhaving this same issue. I installed lxc by following the steps from here: tecmint.com/install-create-run-lxc-linux-containers-on-centos I am able to create containers using ubuntu by using: lxc-create commands. But when I do: lxc-ls it just doesnt workgrimmjow_sms

2 Answers

2
votes

I just solved, it seems that lxc-ls is not part of linux containers by default, It seems that you need extra packages, run:

yum whatprovides /usr/bin/lxc-ls

To check which packages are missing, then simply:

yum install package_name

In my case, it was:

yum install lxc-extra-1.0.11-1.el7.x86_64

Source: BugZilla: RedHat

cheers

1
votes

I had same problem with Ubuntu in LXC container. Some time ago i wanted to ask you if you found solution, but now i have about 50% of it. Do the following after lxc-attach:

source /etc/environment

It will load /etc/environment file (only for the current session) which will update $PATH environment variable adding some missing paths. I can't find how this file should be loaded and which program handle this (bash or...?). You can add command above (. (dot) instead of source also works; they are synonyms) to your .bashrc or global rc file for bash. Also all commands will work with their absolute path, /bin/ls for example.