apt install gitlab-ce したらエラーになった。
* execute[load sysctl conf kernel.sem] action run [execute] * Applying /etc/sysctl.d/90-omnibus-gitlab-kernel.sem.conf ... * Applying /etc/sysctl.d/90-omnibus-gitlab-kernel.shmall.conf ... * Applying /etc/sysctl.d/90-omnibus-gitlab-kernel.shmmax.conf ... sysctl: permission denied on key 'kernel.sem' sysctl: permission denied on key 'kernel.shmall' sysctl: permission denied on key 'kernel.shmmax' sysctl: permission denied on key 'fs.protected_hardlinks' sysctl: permission denied on key 'fs.protected_symlinks' * Applying /etc/sysctl.d/99-sysctl.conf ... * Applying /etc/sysctl.d/protect-links.conf ... * Applying /etc/sysctl.conf ... ================================================================================ Error executing action `run` on resource 'execute[load sysctl conf kernel.sem]' ================================================================================
エラーになる。
Running handlers: There was an error running gitlab-ctl reconfigure: gitlab_sysctl[kernel.sem] (postgresql::enable line 81) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[load sysctl conf kernel.sem] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/gitlab_sysctl.rb line 46) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '255' ---- Begin output of sysctl -e --system ---- STDOUT: * Applying /etc/sysctl.d/90-omnibus-gitlab-kernel.sem.conf ... * Applying /etc/sysctl.d/90-omnibus-gitlab-kernel.shmall.conf ... * Applying /etc/sysctl.d/90-omnibus-gitlab-kernel.shmmax.conf ... * Applying /etc/sysctl.d/99-sysctl.conf ... * Applying /etc/sysctl.d/protect-links.conf ... * Applying /etc/sysctl.conf ... STDERR: sysctl: permission denied on key 'kernel.sem' sysctl: permission denied on key 'kernel.shmall' sysctl: permission denied on key 'kernel.shmmax' sysctl: permission denied on key 'fs.protected_hardlinks' sysctl: permission denied on key 'fs.protected_symlinks' ---- End output of sysctl -e --system ---- Ran sysctl -e --system returned 255
sysctl の値がおかしい。
つまり、 lxc 内部から、sysctl を実行できないことに起因するっぽい
LXC のゲストとホストがあり、インストールをした直後の LXC ホストにLXCゲストを入れてて gitlab を apt install しようとしたら起動する
root@lxc-container $ exit root@lxc-host# sysctl -e --system root@lxc-host# lxc console lxc-container root@lxc-container $ sudo gitlab-ctl reconfigure
他にも sysctl 関連で次のようなエラーが出る。
execute[load sysctl conf net.core.somaxconn] action run [execute] * Applying /etc/sysctl.d/90-omnibus-gitlab-kernel.sem.conf ... * Applying /etc/sysctl.d/90-omnibus-gitlab-kernel.shmall.conf ... * Applying /etc/sysctl.d/90-omnibus-gitlab-kernel.shmmax.conf ... sysctl: permission denied on key 'kernel.sem' sysctl: permission denied on key 'kernel.shmall' sysctl: permission denied on key 'kernel.shmmax' sysctl: permission denied on key 'fs.protected_hardlinks' sysctl: permission denied on key 'fs.protected_symlinks' * Applying /etc/sysctl.d/99-sysctl.conf ... * Applying /etc/sysctl.d/protect-links.conf ... * Applying /etc/sysctl.conf ... ================================================================================ Error executing action `run` on resource 'execute[load sysctl conf net.core.somaxconn]' ================================================================================
他の対処法があったり
lxc のゲストに自身の sys 設定を許可する設定をするとか
$ lxc config set container-name security.privileged true $ lxc config set container-name raw.lxc "lxc.mount.auto=sys:rw proc:rw cgroup:mixed" $ lxc config get container-name raw.lxc lxc.mount.auto=sys:rw proc:rw cgroup:mixed $ lxc start container-name $ lxc exec container-name 'sysctl -w kernel.shmmax=17179869184'
privileged で特権を入れてあげても良いかもしれない。
LXC のホスト側から sysctl をガッツリ変えたものをシェアするとか
/etc/sysctl.conf /etc/sysctl.d/*.conf | sysctl -e -p -
lxc つかうとこういう事が起きるんですね。
最終的に
ホスト側に sysctl で次の値を設定して
takuya@m75q-1:~$ sudo sysctl -p kernel.shmall = 4194304 kernel.shmmax = 17179869184 kernel.shmall = 4194304 kernel.sem = 250 32000 32 262 net.core.somaxconn = 1024 kernel.shmmax = 17179869184
ゲスト側に privellege と read/write を仕込んで無事動きましたね。
ただ、gitlab の更新が来たら、また動かくなったので
LXCで動かすのは不可能だと思いました。
関連資料
https://askubuntu.com/questions/831481/how-to-set-lxc-mount-auto-in-lxd
https://forum.proxmox.com/threads/installing-gitlab-into-lxc-container-sysctl-kernel-shmmax.49388/