Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't change kernel.shmmax in lxd container #1372

Closed
ackerleytng opened this issue Dec 4, 2015 · 8 comments

Comments

6 participants
@ackerleytng
Copy link

commented Dec 4, 2015

I'm trying to install gitlab in an lxd container.

It's failing because postgresql requires a higher shmmax than the allocated 33554432 that the lxd container has.

How do I increase kernel.shmmax for the container?

I've tried running the container as privileged (I'm not sure what effect this has, since after doing

lxc config set gitlab security.privileged true

I don't seem to see any differences in my experience with the container (ssh, etc all the same))

When I try to set kernel.shmmax in the container, I get this

$ sudo sysctl -w kernel.shmmax 335544320
sysctl: setting key "kernel.shmmax": Read-only file system
@tomposmiko

This comment has been minimized.

Copy link

commented Dec 4, 2015

You can set it on the host machine.

@ackerleytng

This comment has been minimized.

Copy link
Author

commented Dec 4, 2015

How do I set it in the host machine? The value for kernel.shmmax in the host machine is some large value that I don't remember, but it's definitely greater than 33554432.

@tomposmiko

This comment has been minimized.

Copy link

commented Dec 4, 2015

Hmm, what about if you use unconfined container?

@ackerleytng

This comment has been minimized.

Copy link
Author

commented Dec 4, 2015

I should set lxc.aa_profile = unconfined, right? Any idea where that config should go or how to set it?

Anyway, I just tried on https://linuxcontainers.org/lxd/try-it/. The container (first) there has the same kernel.shmmax as the host (18446744073692774399). Any idea why that is the case? How might I set the container to have the same kernel.shmmax as the host on my own lxd? (To set up first on that trial thing, I followed the steps on that page, didn't do anything special)

@srkunze

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2015

You can set it on the host machine.

Maybe, it's just me, but I got the feeling that containers should not influence the kernel of the host.

@ak5

This comment has been minimized.

Copy link

commented Dec 6, 2015

I have the same issue here #1351

Was also trying to install Gitlab.

Changing the host settings do not influence the container ones.

@stgraber

This comment has been minimized.

Copy link
Member

commented Dec 10, 2015

Duplicate of #1351, closing.

@stgraber stgraber closed this Dec 10, 2015

@oerdnj

This comment has been minimized.

Copy link

commented Apr 19, 2017

On Debian/Ubuntu system do this before upgrade:

dpkg-divert --local --divert /opt/gitlab/embedded/cookbooks/gitlab/definitions/sysctl.rb.gitlab --add /opt/gitlab/embedded/cookbooks/gitlab/definitions/sysctl.rb
sed -e 's,command "cat.*",command "/bin/true",' < /opt/gitlab/embedded/cookbooks/gitlab/definitions/sysctl.rb.gitlab > /opt/gitlab/embedded/cookbooks/gitlab/definitions/sysctl.rb

The only downside is that you need to monitor the changes there, and update the sysctl.rb with the contents of sysctl.rb.gitlab if it has changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.