Skip to content
This repository was archived by the owner on Sep 24, 2020. It is now read-only.

backport: "nspawn: let's mount(/tmp) inside the user namespace (#4340)"#76

Merged
crawford merged 1 commit intocoreos:v231-coreosfrom
s-urbaniak:backport-tmpmount
Jan 17, 2017
Merged

backport: "nspawn: let's mount(/tmp) inside the user namespace (#4340)"#76
crawford merged 1 commit intocoreos:v231-coreosfrom
s-urbaniak:backport-tmpmount

Conversation

@s-urbaniak
Copy link

#71 introduced a regression in coreos/systemd systemd-nspawn when user namespaces are enabled using the --private-users option. Upstream is not affected. coreos/systemd was missing another backport commit, namely systemd@8492849.

This was found in the functional tests with USER_NS enabled in rkt when bumping the "coreos stage1" image: rkt/rkt#3535.

That also unfortunately means that in CoreOS 1284.2.0 the systemd-nspawn --private-users ... functionality is broken failing with a failed tmpfs mount error like this (strace output):

$ sudo strace systemd-nspawn --private-users ...
...
[pid 27787] mount("tmpfs", "/tmp", "tmpfs", MS_STRICTATIME, "mode=1777,uid=1174339584,gid=1174339584") = -1 EINVAL (Invalid argument)

Note that when using "regular" systemd-nspawn without user namespaces enabled, there is no regression.

/cc @crawford Can you advice how many use cases for systemd-nspawn --private-users are out there? It would be great if we could land this in the next Alpha release this week.

Thanks in advance!

/cc @lucab

Fixes:
host# systemd-nspawn -D ... -U -b systemd.unit=multi-user.target
...
$ grep /tmp /proc/self/mountinfo
154 145 0:41 / /tmp rw - tmpfs tmpfs rw,seclabel,uid=1036124160,gid=1036124160

$ umount /tmp
umount: /root/tmp: not mounted

$ systemctl poweroff
...
[FAILED] Failed unmounting Temporary Directory.
@crawford crawford merged commit f449f99 into coreos:v231-coreos Jan 17, 2017
@s-urbaniak
Copy link
Author

Just for reference; this does not need to be backported to v232 since it is already in there.

@evverx
Copy link

evverx commented Jan 23, 2017

@s-urbaniak , this part of the systemd@8492849 is right, but see systemd#4824

@s-urbaniak
Copy link
Author

@evverx thanks a lot for the follow-up, I was wondering if I was missing yet another backport. This one seems definitely legit to be brough, I'll retest locally and submit a PR against coreos/systemd.

Thanks a lot for the notification.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants