LXC: How to deal with /lib/modules


New Member
Jul 16, 2019
I have created some LXC containers based on Debian 9 which needed access to /lib/modules. Since the hypervisor handles kernel stuff, i have mounted the hypervisor's /lib/modules to the container's /lib/modules as read-only. This worked quite well, until recently Debian has some updates about the linux-headers package, which tries to modify /lib/modules - which is mounted as read-only. So for now, each apt upgrade in each LXC container fails.

How should i handle this situation? I cannot set /lib/modules to rw, since it will break the host, i fear, and i also cannot uninstall linux-headers in the containers at all, since there are packages installed which have this package as a dependency, so they would be uninstalled by apt as well. Has anyone an idea?
I have created some LXC containers based on Debian 9 which needed access to /lib/modules.
what exactly does the container need from the hosts /lib/modules ?
I had Docker installed in the LXC container. One could argue that it isn't a good idea, but i tried it - it's not a productive system. And sometimes Docker crashed due to some files in /lib/modules not available.


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, 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 yours easily in our online shop.

Buy now!