Systemd-hostnamed.service: Failed at step NAMESPACE spawning /lib/systemd/systemd-hostnamed: Invalid argument

I’m running Ubuntu Xenial LXC container on Arch Linux host:

$ uname -a
Linux yuri 4.19.4-arch1-1-ARCH #1 SMP PREEMPT Fri Nov 23 09:06:58 UTC 2018 x86_64 GNU/Linux

hostnamectl doesn’t work inside the container (outputs nothing, exit code 1). In the log I see:

Jan 09 14:37:03 c1 dbus[744]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Jan 09 14:37:03 c1 systemd[1]: Starting Hostname Service...                                         
Jan 09 14:37:03 c1 systemd[945]: systemd-hostnamed.service: Failed at step NAMESPACE spawning /lib/systemd/systemd-hostnamed: Invalid argument
Jan 09 14:37:03 c1 systemd[1]: systemd-hostnamed.service: Main process exited, code=exited, status=226/NAMESPACE
Jan 09 14:37:03 c1 systemd[1]: Failed to start Hostname Service.                                    
Jan 09 14:37:03 c1 systemd[1]: systemd-hostnamed.service: Unit entered failed state.                
Jan 09 14:37:03 c1 systemd[1]: systemd-hostnamed.service: Failed with result 'exit-code'.           
Jan 09 14:37:28 c1 dbus[744]: [system] Failed to activate service 'org.freedesktop.hostname1': timed out

When I change PrivateDevices in /lib/systemd/system/systemd-hostnamed.service to no, and do systemctl daemon-reload, it starts working.

Can’t reproduce with Ubuntu Bionic.

Can you explain what’s happening here?

Possibly related: https://ubuntuforums.org/showthread.php?t=2393310

Recently updated systemd on the host from version 239.370 to 240.0?

@n8v8r Nope, I’ve got systemd-239.303 on the host.