Skip to content

systemd "Failed to set up mount namespacing" #4127

@avsdev-cw

Description

@avsdev-cw

This is less of a bug, more of an "Information for others with the same problem".

Recently I've been upgrading all our containers from debian Buster to debian Bullseye and a whole load of systemd services started failing, for example:

May 31 10:02:27 hostyhost systemd[474]: logrotate.service: Failed to set up mount namespacing: /run/systemd/unit-root/proc: Permission denied
May 31 10:02:27 hostyhost systemd[474]: logrotate.service: Failed at step NAMESPACE spawning /usr/sbin/logrotate: Permission denied

After plenty of googling, it seems that the consensus is "Allow nesting in the container" which for various reasons I don't want to do. After my own tinkering I finally found that in the new containers there is a file (/etc/systemd/system-generators/lxc). Copying this file (chmod 755) fixes all the service issues.

For anyone interested in the file, I've placed it in a gist: https://gist.github.com/avsdev-cw/37de3dfbe0b369ba60efac7c5f680bb0

The file is generated by lxc/distrobuilder (https://github.com/lxc/distrobuilder/blob/db120181f69811c4b9aabe7e0842d9100dc13ad9/distrobuilder/main.go#L540-L766)

If anyone with inside knowledge wants to expand, please do!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions