Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

default.conf isn't used if container config supplied on lxc >= 1.0.0-alpha3 #222

Closed
fpletz opened this issue Feb 13, 2014 · 7 comments
Closed
Milestone

Comments

@fpletz
Copy link
Contributor

fpletz commented Feb 13, 2014

We're using /etc/lxc/default.conf on our host machines to provision the network setup for each vagrant-lxc container. In newer vagrant-lxc versions, the template container config from the basebox is supplied to lxc-create with -f.

In lxc versions >= 1.0.0-alpha3 due to commit lxc/lxc@6c6892b instead of using save_config() which would seed the containers lxc.config with default.conf, lxc will now just load the supplied config file.

I'm not sure how to resolve this. Was it the intention of vagrant-lxc to use /etc/lxc/default.conf at all and should this behaviour be maintained on the vagrant-lxc side? Or should this actually be a bug in lxc itself because looking the commit message the behaviour was probably changed unintentionally?

We could use lxc.customize to add the network interface settings, but the config could differ depending on the host machine because we're not using the standard lxcbr0 interface. We would like to keep machine-dependent settings outside the Vagrantfile.

I've come up with a solution in fpletz@3b20795 that would append the template config in vagrant-lxc code, but it's not very pretty because root privileges are needed and I just wanted to get it working to find other issues with current lxc versions, hence no PR for now. 😄

@fgrehm
Copy link
Owner

fgrehm commented Feb 13, 2014

Damn... I need to think a bit more about it but regarding the use of lxc.customize per Vagrantfile, one thing that might work is to have that configuration on your $HOME/.vagrant.d/Vagrantfile so that it is used for all of the vagrant-lxc vms you use.

I'm not sure if that will play / merge well with other configs defined on the Vagrantfile of your projects but if it doesn't please lmk so I can fix the config merging logic from vagrant-lxc.

Would you be able to give that a spin?

Thanks!

@fpletz
Copy link
Contributor Author

fpletz commented Feb 13, 2014

One more thing I forgot to mention, which you probably already thought of, but which is important to stress: The default version of lxc in current Ubuntu versions also uses /etc/lxc/default.conf to provision the lxcbr0 for all containers. So even if you have a regular lxcbr0 and decide to use a newer lxc version and provide a template config to lxc-create, all new containers won't have any network interfaces configured.

The solution with $HOME/.vagrant.d/Vagrantfile could be interesting. Thanks! I will look into it.

@fgrehm fgrehm modified the milestones: v0.9.0, v0.8.0 Feb 23, 2014
@fgrehm fgrehm modified the milestones: v1.0.0, v0.9.0 Mar 7, 2014
@fgrehm
Copy link
Owner

fgrehm commented Mar 10, 2014

New base boxes won't have that -f parameter specified, I switched over to the lxc-download approach of appending the config provided with the box instead of passing in the whole file on GH-245 (I only tested that on lxc 1.0.0 and Ubuntu Saucy, so it might break on other combinations right now)

I'll provide more information on the PR about those new boxes before merging it in, so let's close this issue for now.

Please LMK if you are feeling adventurous and want to try that branch out so I can provide you more information ;-)

@fgrehm fgrehm closed this as completed Mar 10, 2014
@fpletz
Copy link
Contributor Author

fpletz commented Mar 11, 2014

Yup, the new base boxes fix this problem! Also, I like the new base box building scripts.

Awesome work, thanks! Much appreciated! 👍

If you ever find yourself in Munich, come by and drink some beer with us at @mayflower. 🍻

@fgrehm fgrehm modified the milestones: v0.9.0, v1.0.0 Mar 11, 2014
@fgrehm
Copy link
Owner

fgrehm commented Mar 11, 2014

Thanks for the feedback! I'm hoping that they will also make things easier and less "ubuntu specific" so we can have a broader distro support 😄 🍻

@hamann
Copy link
Contributor

hamann commented Aug 1, 2014

is there a chance to bypass /etc/lxc/default.conf and assign a special one, maybe by an environment variable or specific setting in vagrantfile? we need a special network configuration only for vagrant lxc guests, e.g. setting multiple ethernet addresses and so we have to create the whole network configuration in Vagrantfile, which isn't possible if default values from /etc/lxc/default.conf are read in

@fgrehm
Copy link
Owner

fgrehm commented Aug 9, 2014

@hamann The only way I can think of skipping the default configs would be to pass in a blank file to the -f parameter for lxc-create, which should be possible by packaging a box with a blank lxc.conf in it

If that doesn't work, please create a new issue so we can discuss that!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants