On my bionic Containers, systemd-hostnamed is unable to start
root@test:~# systemctl status systemd-hostnamed
● systemd-hostnamed.service - Hostname Service
Loaded: loaded (/lib/systemd/system/systemd-hostnamed.service; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-05-07 23:23:23 CEST; 2min 30s ago
Docs: man:systemd-hostnamed.service(8)
man:hostname(5)
man:machine-info(5)
https://www.freedesktop.org/wiki/Software/systemd/hostnamed
Process: 120 ExecStart=/lib/systemd/systemd-hostnamed (code=exited, status=225/NETWORK)
Main PID: 120 (code=exited, status=225/NETWORK)
May 07 23:23:23 test systemd[1]: systemd-hostnamed.service: Failed to reset devices.list: Operation not permitted
May 07 23:23:23 test systemd[1]: Starting Hostname Service...
May 07 23:23:23 test systemd[120]: systemd-hostnamed.service: Failed to set up network namespacing: Permission denied
May 07 23:23:23 test systemd[120]: systemd-hostnamed.service: Failed at step NETWORK spawning /lib/systemd/systemd-hostnamed: Permission denied
May 07 23:23:23 test systemd[1]: systemd-hostnamed.service: Main process exited, code=exited, status=225/NETWORK
May 07 23:23:23 test systemd[1]: systemd-hostnamed.service: Failed with result 'exit-code'.
May 07 23:23:23 test systemd[1]: Failed to start Hostname Service.
PrivateNetwork should just create a new network namespace which should be possible. So this looks like AppArmor. Can you try to start the same container with:
lxc config set <container-name> raw.lxc "lxc.apparmor.profile ="
If AA doesn’t support it, there is a way to tell systemd that netnamespaces are not available?
Or there are just some missing AA profiles?
In case of AA doesn’t support this scenario systemd tries to detect if netnamespaces available. Looking at ns_type_supported show me that systemd checks if /proc/self/ns/net exists.
It’s maybe possible to hide /proc/self/ns/net with lxcfs?