How to mimic a VM kernel on a Container?

torontob

Active Member
Oct 18, 2010
40
0
26
I want to run FreePBX distro on LXC container and not VM. This container must have the right headers and kernel because if it doesn't then yum update won't work.

This is what i want on container:
2.6.32-504.8.1.el6.i686 #1 SMP Wed Jan 28 18:25:26 UTC 2015 i686 i686 i386 GNU/Linux

This is what I have on container:
4.4.6-1-pve #1 SMP Thu Apr 21 11:25:40 CEST 2016 i686 i686 i386 GNU/Linux

Is it possible to make them the same at all or the technology doesn't work that way?
 

wolfgang

Proxmox Staff Member
Staff member
Oct 1, 2014
6,497
470
103
LXC use always the host kernel so there is no way to change the kernel.
 

torontob

Active Member
Oct 18, 2010
40
0
26
Thanks for the reply.
So the only way to work this is use VM?

Is there no automated way of changing a VM into Container with proper headers?
 
Last edited:

wolfgang

Proxmox Staff Member
Staff member
Oct 1, 2014
6,497
470
103
So the only way to work this is use VM?
Yes or fix the build file.

Is there no automated way of changing a VM into Container with proper headers?
The Headers have always be the same as the kernel.
If you would compile in the VM and the migrate to a CT the program will not start because the kernel an other.
 

torontob

Active Member
Oct 18, 2010
40
0
26
Yes or fix the build file.

What do you mean by "fix the build file"? This is a distro (an .iso) and I am not using vanilla CentOS + install manually. Do you mean install on the container? (that would not be possible :( - this is a petty.

What is the technical reason behind not being able to match regular kernels?
 

LnxBil

Famous Member
Feb 21, 2015
5,482
609
133
Germany
Is there no automated way of changing a VM into Container with proper headers?

Point and click automation? No, but you can always live boot a new KVM-VM with a Live Linux, rsync the files, install a kernel and bootloader and test. This can be done in a few minutes (assuming you do not have TBs of files).
 

torontob

Active Member
Oct 18, 2010
40
0
26
Point and click automation? No, but you can always live boot a new KVM-VM with a Live Linux, rsync the files, install a kernel and bootloader and test. This can be done in a few minutes (assuming you do not have TBs of files).

Thanks for the feedback LnxBill. This is a FreePBX *Distro* running on a CentOS 6.6. Using your mentioned method once an LXC container is made would the yum update see the container kernel / headers exactly same as it saw it when it was in KVM mode? if not then this will break updates.

If Yes, please explain what you mean by "Live Linux" and what is the process to install a kernel and bootloader? Are you saying I should find an LXC template of CentOS 6.6 and make some changes?

This is what I like to see when I do: uname -a on my final LXC container product - is this possible?
2.6.32-504.8.1.el6.i686 #1 SMP Wed Jan 28 18:25:26 UTC 2015 i686 i686 i386 GNU/Linux
 

LnxBil

Famous Member
Feb 21, 2015
5,482
609
133
Germany
PBX is often better off in a "real" VM. Sometimes, there are kernel modules to be compiled and they cannot be loaded from a container.

This is what I like to see when I do: uname -a on my final LXC container product - is this possible?
2.6.32-504.8.1.el6.i686 #1 SMP Wed Jan 28 18:25:26 UTC 2015 i686 i686 i386 GNU/Linux

No. And hopefully not i386. This is only possible for a KVM-based VM, not for a container.
 

torontob

Active Member
Oct 18, 2010
40
0
26
No. And hopefully not i386. This is only possible for a KVM-based VM, not for a container.

Thanks for the reply again. This is just a sample system and we are doing 64 bit anyway.
So, therefore, there is no way but to solve Yum update issues one by one each time there is a new update and hope things work? How do other systems work this well? for example a centos template is always upgradeable - I don't think CentOS community puts out an LXC version - or they do?
 

LnxBil

Famous Member
Feb 21, 2015
5,482
609
133
Germany
You just need to do a yum update. Normally there should not be a kernel and kernel headers in an LXC system, so they should not get updated. If you have packages that rely on a kernel or headers, this is a good indication that they'll not going to play well with an LXC abstraction.

PBX is a special use case (special timing requirements etc.) and LXC is maybe not that good that, so you should stick with a KVM based VM. Everything else should work fine in an LXC container.
 

torontob

Active Member
Oct 18, 2010
40
0
26
You just need to do a yum update. Normally there should not be a kernel and kernel headers in an LXC system, so they should not get updated. If you have packages that rely on a kernel or headers, this is a good indication that they'll not going to play well with an LXC abstraction.

We have been running PBX on containers for long time and they are proven to work with timing not being an issue.

Yes, the yum update break and complain because of headers/kernels...I think I expected a lot more from LXC and maybe I should lower my expectations. Was this the same when VZ was around? I think I remember updating some stuff and they worked well back then.
 

LnxBil

Famous Member
Feb 21, 2015
5,482
609
133
Germany
You couldn't use your own kernel with OpenVZ either. Both are more-or-less a lightweight virtualisation, so no extra kernel is involved.

Just try to deinstall kernel and headers and see what packages will be removed because of their dependency.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE and Proxmox Mail Gateway. We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!