-
Notifications
You must be signed in to change notification settings - Fork 931
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
security.privileged + ubuntu-daily:noble doesn't work - systemd services fail to start #12967
Comments
@mihalicyn is this related to the known issue with apparmor parser bug + LXD's workaround apparmor profile and recent versions of systemd? |
Hi @peat-psuwit! Thanks a lot for your report. Yes, we are aware of some issues with AppArmor in case when privileged container is used. We strongly recommend to always use unprivileged containers as it's safer and also way more stable. As a workaround, I can suggest you to do: This should help to start Ubuntu Noble. Let's be in touch on this. And thanks again for reporting! Kind regards, |
@mihalicyn do you have a link to the reported apparmor issue from 2016? |
@mihalicyn my understanding is that we can address this issue once LXD's snap has a newer apparmor rule parser, which will occur when we switch the base snap to core24. I'll mark this as "later" for now. |
Hi @mihalicyn The Our script [1], which was written some time ago, specifically asks for privileged container if LXD is detected to be a snap, presumably because it won't read host's [1] If it rings anyone's bell, this is Crossbuilder. |
I did some additional investigation and found, than systemd these days want's even more than just changing a mount propagation flags. It also wants to rbind Patch example (only for experimental use!):
That's a perfectly valid example of usage for privileged containers. In any other case it's strongly recommended to use unprivileged ones. Just for the future reference, when debugging cases like that it usually makes sense to check:
@tomponline bug link is https://bugs.launchpad.net/apparmor/+bug/1597017 |
Images with newer Systemd (e.g. Ubuntu Noble) doesn't work as a privileged container unless nesting is also enabled, so we have to enable it. This weakens the security, but since this is a development setup anyway, I reckon it's fine. See canonical/lxd#12967
This issue is a real pain. Because as it was said above, systemd now created mount namespaces by default and performs recursive bindmount of See, for example:
If attacker wants to bypass this and can do recursive bindmount, then he/she can:
That's a reason why |
Images with newer Systemd (e.g. Ubuntu Noble) doesn't work as a privileged container unless nesting is also enabled, so we have to enable it. This weakens the security, but since this is a development setup anyway, I reckon it's fine. See canonical/lxd#12967
@peat-psuwit as using privileged containers with Ubuntu Noble is becoming unviable due to apparmor restrictions and demands from more recent systemd versions, please can you advise what you are doing with containers that needs privilege containers? We are interested in knowing the use cases so we can look at additional functionality for unprivileged containers. Thanks |
We're using LXD container as a development container similar to devcontainer.json spec, where we have to mount a directory from the host to the container. https://github.com/ubports/crossbuilder We used to modify Reading the LXD documentation, I guess we're better served by disk device's |
Yes using See https://documentation.ubuntu.com/lxd/en/latest/reference/devices_disk/ |
Images with newer Systemd (e.g. Ubuntu Noble) doesn't work as a privileged container unless nesting is also enabled, so we have to enable it. This weakens the security, but since this is a development setup anyway, I reckon it's fine. See canonical/lxd#12967
Required information
The output of "lxc info"
Issue description
Setting
security.privileged = true
config to a container ofubuntu-daily:noble
will make it "fails to start". By fail to start, I mean lot of services will not start, includingsystemd-tmpfiles-setup-dev.service
,systemd-resolved.service
andsystemd-networkd.service
. The errors include "systemd-resolved.service: Failed to set up credentials: Protocol error" and "systemd-networkd.service: Failed to set up mount namespacing: Permission denied".This may be related to lxc/lxc#4402 and seems to be related to AppArmor.
Steps to reproduce
lxc init ubuntu-daily:noble noble-test
lxc config set noble-test security.privileged true
lxc start noble-test
lxc exec noble-test -- journalctl --boot
-- sees a lot of failures.Information to attach
dmesg
): dmesg.loglxc info NAME --show-log
)Container configuration (
lxc config show NAME --expanded
): container-config.yml.txtMain daemon log (at /var/log/lxd/lxd.log or /var/snap/lxd/common/lxd/logs/lxd.log)
lxc monitor
while reproducing the issue): lxd-lxc-monitor.logThe text was updated successfully, but these errors were encountered: