-
Notifications
You must be signed in to change notification settings - Fork 10
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
Jessie container with systemd fails to start with DebOps default configuration #15
Comments
Hi everyone I found the answer of the LXC mounting error in Re: [systemd-devel] logind vs CAP_SYS_ADMIN-lessness. There is a mount option With the follwoing additional entries in
Also make sure, that you have the following line in your
Otherwise the container start will fail with the following error:
|
After merging #16 setting up a jessie container on a jessie LXC host should now work out of the box. |
Looks like this issue can be closed? |
Well, nobody else raised any issues, so I guess this can be closed. :-) |
Sorry to re-open this, but the issue came back with linux kernel 4.6. None of the workarounds except for "Don't drop 'cap_sys_admin' in your container" works. Reverting to kernel 4.5, everything works as expected. This might have to do with the addition of cgroup namespace support in the kernel, see this (and consecutive) pull request: http://lkml.iu.edu/hypermail/linux/kernel/1603.2/02432.html Do you guys know any workaround here? |
@kartoffelheinz Unfortunately I haven't heard yet anything about this issue. If you find a solution, it would be great to hear it. Thanks for the heads up, I reopened the issue in case anybody else is interested. |
hi, if can help you... from kernel >=4.6 cgroup api/features are been rewrited. As describe on gentoo wiki root #mkdir -p /sys/fs/cgroup/systemd root #mount -t cgroup -o none,name=systemd systemd /sys/fs/cgroup/systemd I tested this with kernel 4.8 and 4.9. |
@geaaru method worked for me, if you don't use systemd in the host you can add these lines to fstab
perhaps I'm stil unable to mount with name=systemd option |
This issue is still a major PITA. As of now, it is impossible to run privileged containers without sys_admin capability in latest Debian stable using the 4.9 Kernel with systemd present in both host and guest. System will not load and you can see the following errors in console / logfile.
None of the workarounds (adding cap_sys is not a workaround anybody should consider) change that, the only way to make it work is to use the old Debian Jessie 3.16 Kernel. |
Previously, mounts were added inside the lxc configuration files. Now, the normal filesystem (bind)mounts are made in /etc/fstab in the host instead, which is allowed by making /containers a "shared" mountpoint (meaning that any bindmounts / clones of /containers retain all submounts). This means that, unlike before, extra mountpoints can be added later, without restarting the container and without giving the container cap_sys_admin (e.g. mount permissions). Also, some additional special filesystems are now mounted through the lxc configuration files. These files are normally mounted by systemd on startup, but without cap_sys_admin, these mounts would fail. By making sure the mounts are already there, systemd will not try to mount them and it will not fail (some additional configuration is needed for systemd too, coming up next). As an additional side effect, /etc/skel is actually mounted read-only now. Due to a limitation of mount (worked around by using a systemd generator in the host), this bindmount was previously read-write in all containers. The /proc and /sys mounts now use the lxc.mount.auto directive (which is effectively the same, just a bit shorter). Finally, the global lxc.conf is modified to create all cgroups, which is apparently needed to support the cgroup mounting for systemd. See also debops/ansible-lxc#15 and https://s3hh.wordpress.com/2011/09/22/sharing-mounts-with-a-container/
Note in case someone else runs into this. Just updated lxc host to debian 11/bullseye and had some issues with old containers (config not managed by debops). I only had to add the following lines to each of the node's /var/lib/lxc//config file to get them to start.
symptom was
|
Altough this was already discussed in IRC I allow myself to open an issue to track the problem and progress with this issue.
Starting position
Create Debian Jessie container on a Jessie LXC host with debops:
This will install systemd by default.
Error
When trying to start the container, the following error appears:
Reason
'cap_sys_admin' is dropped in
/var/lib/lxc/jessie01/config
as defined in defaults/main.yml and therefore preventssystemd
to mount some required file systems:Known Work-Arounds
lxc.autodev = 1
andlxc.kmesg = 0
must be removed from the container configuration to make this work.systemd
to fully work without furtherconfiguration. NOTE: This has a huge negative security impact.
Unsuccessful Work-Around
I also tried to drop 'cap_sys_admin' and make LXC mount the required file systems without
systemd
involvement. For this I added:Unfortunately this fails with the message that
/run/lock
doesn't exist:Bugs
journald
to forward messages to syslog in case 'cap_sys_admin' is dropped. This is only fixed insystemd_218-4
in experimental now.As I could live with the mentioned systemd bug, I'm still trying to find a way to run it without 'cap_sys_admin'. The challenges then are:
/run/lock
before actually mounting it?systemd
to not mount a separate file system for/run/lock
?If there are some other possible work-arounds or any hints regarding my open questions, please let me know. I'll update once I found out more
The text was updated successfully, but these errors were encountered: