Bug 9926

Summary: systemd-resolved.service: Failed at step NAMESPACE (systemd 233)
Product: buildroot Reporter: Michael Nosthoff <buildroot>
Component: OtherAssignee: Yann E. MORIN <yann.morin.1998>
Status: RESOLVED FIXED    
Severity: normal CC: buildroot, yann.morin.1998
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Michael Nosthoff 2017-06-01 15:35:35 UTC
Hi,

I have a system based on systemd and bash (no busybox).

My systemd package selection is attached under [2].
With buildroot 2017.02.2 everything was working fine.

I updated my build process to use buildroot 2017.05 which bumps systemd from 232 to 233.
Since this these units fail on boot:

systemd-hostnamed.service                                                                                                                      systemd-resolved.service
systemd-timesyncd.service

The Error Message is always the same:

systemd-resolved.service: Failed at step NAMESPACE spawning /lib/systemd/systemd-resolved: No such file or directory
systemd-resolved.service: Main process exited, code=exited, status=226/NAMESPACE

The Problem was mentioned before on the ML in 2014 [0]. I don't know how it was fixed in the end. 

When I remove the /var/tmp symlink and create a directory instead it works.
Another workaround is setting PrivateTmp=no in the service file.
(These approaches basically follow the instructions at [1])

Since I had no problem with a symlinked /var/tmp in buildroot 2017.02.2 it seems like something has changed in systemd 233.

(I tried disabling systemd-tmpfiles but it changed nothing)

Any ideas?


Regards,
Michael

[0] http://lists.busybox.net/pipermail/buildroot/2014-August/104055.html
[1] https://help.directadmin.com/item.php?id=614
[2]:
BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS=y
BR2_PACKAGE_SYSTEMD=y
# BR2_PACKAGE_SYSTEMD_JOURNAL_GATEWAY is not set
# BR2_PACKAGE_SYSTEMD_BACKLIGHT is not set
# BR2_PACKAGE_SYSTEMD_BINFMT is not set
# BR2_PACKAGE_SYSTEMD_COREDUMP is not set
# BR2_PACKAGE_SYSTEMD_FIRSTBOOT is not set
# BR2_PACKAGE_SYSTEMD_HIBERNATE is not set
BR2_PACKAGE_SYSTEMD_HOSTNAMED=y
BR2_PACKAGE_SYSTEMD_HWDB=y
# BR2_PACKAGE_SYSTEMD_IMPORTD is not set
# BR2_PACKAGE_SYSTEMD_LOCALED is not set
# BR2_PACKAGE_SYSTEMD_LOGIND is not set
# BR2_PACKAGE_SYSTEMD_MACHINED is not set
BR2_PACKAGE_SYSTEMD_MYHOSTNAME=y
BR2_PACKAGE_SYSTEMD_NETWORKD=y
# BR2_PACKAGE_SYSTEMD_POLKIT is not set
# BR2_PACKAGE_SYSTEMD_QUOTACHECK is not set
# BR2_PACKAGE_SYSTEMD_RANDOMSEED is not set
BR2_PACKAGE_SYSTEMD_RESOLVED=y
# BR2_PACKAGE_SYSTEMD_RFKILL is not set
# BR2_PACKAGE_SYSTEMD_SMACK_SUPPORT is not set
# BR2_PACKAGE_SYSTEMD_SYSUSERS is not set
BR2_PACKAGE_SYSTEMD_TIMEDATED=y
BR2_PACKAGE_SYSTEMD_TIMESYNCD=y
BR2_PACKAGE_SYSTEMD_TMPFILES=y
BR2_PACKAGE_SYSTEMD_VCONSOLE=y
# BR2_PACKAGE_SYSTEMD_BOOTCHART is not set
Comment 1 Michael Nosthoff 2017-06-02 08:47:57 UTC
On the ML Mike points out that this might be Kernel related (for some reason his response is not showing up on bugzilla).

I build my Kernel outside of buildroot. So I use an identical Kernel with both buildroot versions. Of course this doesn't mean a kernel configuration might not be the issue, but it wasn't an issue with BR 2017.02.2.

The cgroup configuration looks like this:

CONFIG_CGROUPS=y
CONFIG_PAGE_COUNTER=y
CONFIG_MEMCG=y
CONFIG_MEMCG_SWAP=y
CONFIG_MEMCG_SWAP_ENABLED=y
CONFIG_BLK_CGROUP=y
# CONFIG_DEBUG_BLK_CGROUP is not set
CONFIG_CGROUP_WRITEBACK=y
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
# CONFIG_CFS_BANDWIDTH is not set
# CONFIG_RT_GROUP_SCHED is not set
CONFIG_CGROUP_PIDS=y
# CONFIG_CGROUP_FREEZER is not set
CONFIG_CPUSETS=y
CONFIG_PROC_PID_CPUSET=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
# CONFIG_CGROUP_PERF is not set
# CONFIG_CGROUP_DEBUG is not set
# CONFIG_CHECKPOINT_RESTORE is not set
Comment 2 Thomas Petazzoni 2017-06-02 08:52:40 UTC
When Buildroot builds the kernel itself, and systemd is enabled, it makes sure a number of options are enabled. From linux/linux.mk:

        $(if $(BR2_PACKAGE_SYSTEMD),
                $(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS,$(@D)/.config)
                $(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER,$(@D)/.config)
                $(call KCONFIG_ENABLE_OPT,CONFIG_FHANDLE,$(@D)/.config)
                $(call KCONFIG_ENABLE_OPT,CONFIG_AUTOFS4_FS,$(@D)/.config)
                $(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_POSIX_ACL,$(@D)/.config)
                $(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_POSIX_XATTR,$(@D)/.config))

Can you check if you have all those options enabled in your kernel configuration?
Comment 3 Michael Nosthoff 2017-06-02 09:04:25 UTC
I just verified all these options are set.


Sidenote: The option TMPFS_POSIX_XATTR is not exisiting in my kernel (4.9) tree. Googling for it only yields buildroot related result. I guess this should be TMPFS_XATTR which is in fs/Kconfig right after TMPFS_POSIX_ACL.
Comment 4 Yann E. MORIN 2017-06-04 09:40:41 UTC
Michael, All,

> The option TMPFS_POSIX_XATTR is not exisiting in my kernel

Indeed, this is an error.

If we look at the commit that introduced this line, we can see that the
help for systemd was also updated, and that it indeed references the
correct value:

    https://git.buildroot.org/buildroot/commit/?id=4c10eedc103ba9648f73439f1ab5d801da9d2ed7

Thanks for the report!
I'll send a fix.

Regards,
Yann E. MORIN.
Comment 5 Yann E. MORIN 2017-08-06 16:25:19 UTC
Mihcael, All,

I am not able to reproduce this issue with current master, with
the fiollowing defconfig (which enables the same set of systemd
options as those you listed):

    BR2_arm=y
    BR2_cortex_a9=y
    BR2_ARM_ENABLE_NEON=y
    BR2_ARM_ENABLE_VFP=y
    BR2_TOOLCHAIN_EXTERNAL=y
    BR2_INIT_SYSTEMD=y
    BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
    BR2_SYSTEM_DHCP="eth0"
    BR2_LINUX_KERNEL=y
    BR2_LINUX_KERNEL_CUSTOM_VERSION=y
    BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11.3"
    BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
    BR2_LINUX_KERNEL_DTS_SUPPORT=y
    BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
    BR2_PACKAGE_SYSTEMD_VCONSOLE=y
    BR2_TARGET_ROOTFS_EXT2=y
    # BR2_TARGET_ROOTFS_TAR is not set

Note that master contains a full rework of the skeleton to
cope with systemd.

Could you please retry on your use-case to confirm that the
bug still exists (or not!) for you with current master?

In the meantime, I am closing it. Just re-open it if you can
reproduce, in which case please attach the complete defconfig
you are using:

    $ make BR2_DEFCONFIG=$(pwd)/defconfig savedefconfig
    $ cat defconfig

Thanks!

Regards,
Yann E. MORIN.
Comment 6 Michael Nosthoff 2017-09-08 07:07:06 UTC
Hi,

thanks for the update!
I tried with Release 2017.08 and the issue seems to be fixed.

Best Regards,
Michael