Skip to content

JoinsNamespaceOf not working until reboot #17485

@ian-kelling

Description

@ian-kelling

systemd version the issue has been seen with

246.6-2~bpo10+1

Used distribution

Debian 10 + backports

Linux kernel version used (uname -a)

5.8.0-0.bpo.2-amd64

CPU architecture issue was seen on

amd64

Expected behaviour you didn't see

The service's process having the same network namespace

Unexpected behaviour you saw

It has its own new namespace.

Steps to reproduce the problem

# this unit was enabled and running on startup:
cat /etc/systemd/system/mailnn.service 
[Unit]
Description=Network Namespace for mailvpn.service
After=syslog.target network-online.target
Wants=network-online.target

[Service]
Type=simple
PrivateNetwork=true
ExecStart=/bin/sleep infinity

[Install]
WantedBy=multi-user.target

systemctl start mailnn
systemctl enable mailnn

cat >/etc/systemd/system/exim4.service.d/nn.conf
[Unit]
JoinsNamespaceOf=mailnn.service

[Service]
PrivateNetwork=true
EOF
systemctl daemon-reload
systemctl restart exim4
systemctl status exim4
# copy a pid of exim4 daemon, replace PID in the following command
ls -la /proc/PID/ns/net
systemctl status mailnn
# copy a pid of mailnn
ls -la /proc/PID/ns/net

Result: different network namespaces, also both different from the default namespace. Then, reboot with mailnn and exim4 enabled. Check which network namespace mailnn and exim4 are in, they are the same as they should have been before reboot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions