Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

241.1 test-mountpoint-util test fails inside a sandbox #127

Closed
kensington opened this Issue Mar 16, 2019 · 7 comments

Comments

Projects
None yet
2 participants
@kensington
Copy link
Collaborator

commented Mar 16, 2019

While bumping 241.1 in Gentoo, I ran into this test failure. This only occurs in portage's sandboxed environment, it passes fine otherwise.

21/177 test-mountpoint-util                    FAIL     0.01 s (killed by signal 6 SIGABRT)

--- command ---
PATH='/var/tmp/portage/sys-auth/elogind-241.1/work/elogind-241.1-build:/usr/lib/portage/python3.6/ebuild-helpers/xattr:/usr/lib/portage/python3.6/ebuild-helpers:/usr/lib/llvm/6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin' /var/tmp/portage/sys-auth/elogind-241.1/work/elogind-241.1-build/test-mountpoint-util
--- stderr ---
Failed to read $container of PID 1, ignoring: Permission denied
Found container virtualization none.
/* test_mnt_id */
mountinfo: / → 56
mountinfo: /usr → 59
mountinfo: /dev → 60
mountinfo: /dev/pts → 61
mountinfo: /dev/shm → 62
mountinfo: /dev/mqueue → 63
mountinfo: /proc → 64
mountinfo: /proc/sys/fs/binfmt_misc → 65
mountinfo: /sys → 66
mountinfo: /sys/kernel/security → 67
mountinfo: /sys/fs/fuse/connections → 68
mountinfo: /sys/firmware/efi/efivars → 69
mountinfo: /sys/fs/cgroup → 70
mountinfo: /sys/fs/cgroup/openrc → 71
mountinfo: /sys/fs/cgroup/unified → 72
mountinfo: /sys/fs/cgroup/cpuset → 73
mountinfo: /sys/fs/cgroup/cpu → 74
mountinfo: /sys/fs/cgroup/cpuacct → 75
mountinfo: /sys/fs/cgroup/freezer → 76
mountinfo: /sys/fs/cgroup/portage → 77
mountinfo: /run → 78
mountinfo: /run/user/1000 → 79
mountinfo: /home → 80
mountinfo: /var → 81
mountinfo: /var/tmp/portage → 82
mountinfo: /tmp → 83
mountinfo: /proc → 86
mnt ids of /dev/pts are 61, 61
mnt ids of /dev are 60, 60
mnt ids of /sys/fs/cgroup/cpuacct are 75, 75
mnt ids of /dev/mqueue are 63, 63
mnt ids of /usr are 59, 59
mnt ids of /sys/fs/cgroup/cpuset are 73, 73
mnt ids of /sys/fs/cgroup are 70, 70
mnt ids of /sys/fs/cgroup/freezer are 76, 76
mnt ids of /proc are 86, 86
mnt ids of /sys/fs/cgroup/openrc are 71, 71
mnt ids of /home are 80, 80
mnt ids of /var are 81, 81
mnt ids of /tmp are 83, 83
mnt ids of /proc/sys/fs/binfmt_misc are 65, 86
the other path for mnt id 86 is /proc
Assertion 'path_equal(p, t)' failed at ../elogind-241.1/src/test/test-mountpoint-util.c:87, function test_mnt_id(). Aborting.

@Yamakuzure Yamakuzure self-assigned this Mar 16, 2019

@Yamakuzure Yamakuzure added the bug label Mar 16, 2019

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

commented Mar 16, 2019

I am not entirely sure that we need all these tests. I will look further into them in the next week.

There have been some enhancements for musl-libc compatibility, so I guess a v241.2 isn't far away.

One more thing: As elogind now supports being interrupted without tearing everything down, I have adapted the init file to make use of that.
Please have a look here:
https://gitweb.gentoo.org/user/seden.git/tree/sys-auth/elogind/files/elogind.init

The docs patch had to be adapted, too. But I guess you already covered that, haven't you?

Thank you very much!

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

commented Mar 20, 2019

This is really weird...

Mountinfo says, that /proc/sys/fs/binfmt_misc has the mount_id 65. But when opened, /proc/self/fdinfo/ says it is 86, which is in fact /proc...

/proc is also mounted as ID 64. Is that a bind mount?

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

commented Mar 21, 2019

The mountinfo is stored in a hash, so the earlier
/proc → 64
is later overwritten by
/proc → 86
which is okay, because that is the mount in your chroot.

Further mountinfo says that
/proc/sys/fs/binfmt_misc → 65
which is a mount in your outside /proc, which is not available inside your chroot.
Therefore, when trying to open it from inside your chroot, the system has to use your inside /proc and that has the mount id 86.

So you either have to mount /proc/sys/fs/binfmt_misc inside your chroot, too, or have to unmount it outside the chroot so /proc/self/fdinfo/ won't get filled with the inside /proc info.

But that won't be the final solution. In such a case it can be assumed, that if the path to the first id begins with the path of the second id, then everything was in order indeed. The assertion might be just too narrow here.

Yamakuzure added a commit that referenced this issue Mar 21, 2019

Fix test-mountpoint-util for chroots with incomplete mounts (#127)
Assume that
  /foo
is mounted both inside and outside a chroot.
Further the path
  /foo/bar
is mounted outside the chroot only, as it is not relevant for the
work done inside the chroot.

The test-mountpoint-util now reads the latter from
/proc/self/mountinfo and tries to open this path. But as we are
inside a chroot here, the resulting entry in /proc/self/fdinfo points
to `/foo`, as that is what is reachable.

This patch tries to work around this by not failing if the test is
run from inside a chroot, and the investigated path starts with the
found path.

Bug: #127
Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

commented Mar 21, 2019

@kensington Could you please test whether commit faeb66b fixes the issue?

@kensington

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 25, 2019

Tests pass now with that commit. Thanks!

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

commented Mar 26, 2019

I am very happy to hear that!

This change seems to be worth to be PR'd towards systemd, as using a build chroot isn't that uncommon.

Thank you very much for your work on the gentoo ebuild! 👍

Yamakuzure added a commit that referenced this issue Mar 27, 2019

Version 242.2 Release
This is the second release of the elogind-241 series, updated to
systemd-stable commit c1f8ff8d0d.

Fixes:
  * Fix some elogind masking issues in the man page xml files
  * Fix building against musl-libc
  * Fix test-mountpoint-util for chroots with incomplete mounts (#127)
  * Fix some errors in the new systemd-journal related man pages

Changes / Additions:
  * Allow fb devices to become master of seat on HyperV and on
    systems started with nomodeset kernel option.

Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

commented Mar 27, 2019

@kensington : I have released v242.2 including this fix. Further compatibility with musl-libc is restored and I fixed some idiotic errors in the man pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.