RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2144541 - [container-tools:rhel8/toolbox] 'init-container' fails when /var/lib/flatpak, /var/lib/systemd/coredump or /var/log/journal on the host are mounted with nodev, noexec or nosuid
Summary: [container-tools:rhel8/toolbox] 'init-container' fails when /var/lib/flatpak,...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: toolbox
Version: 8.7
Hardware: x86_64
OS: Linux
medium
high
Target Milestone: rc
: ---
Assignee: Debarshi Ray
QA Contact: Petr Schindler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-11-21 15:37 UTC by Christophe GRENIER
Modified: 2023-11-14 16:19 UTC (History)
7 users (show)

Fixed In Version: toolbox-0.0.99.4-5.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-14 15:27:28 UTC
Type: Bug
Target Upstream Version:
Embargoed:
vraghave: needinfo-
vraghave: needinfo-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github containers toolbox issues 1084 0 None open "invalid entry point PID of container" when /var/lib/flatpak is mounted nosuid and/or nodev 2023-06-29 15:51:14 UTC
Github containers toolbox issues 911 0 None open Toolboxes fail to start when `/var/log` is a mountpoint 2023-06-29 16:06:20 UTC
Red Hat Issue Tracker RHELPLAN-140052 0 None None None 2022-11-21 15:53:08 UTC
Red Hat Product Errata RHSA-2023:6939 0 None None None 2023-11-14 15:28:44 UTC

Description Christophe GRENIER 2022-11-21 15:37:56 UTC
Description of problem:
Failed to bind /var/lib/systemd/coredump to /run/host/var/lib/systemd/coredump


Version-Release number of selected component (if applicable):
toolbox-0.0.99.3-0.6.module_el8.6.0+3070+1510fbd1.x86_64

How reproducible:
Always

Steps to Reproduce:
1. toolbox create --image quay.io/toolbx-images/almalinux-toolbox:8
2. toolbox enter almalinux-toolbox-8

Actual results:
Error: invalid entry point PID of container almalinux-toolbox-8

podman start --attach  almalinux-toolbox-8
...
level=debug msg="Binding /var/lib/systemd/coredump to /run/host/var/lib/systemd/coredump"
mount: /var/lib/systemd/coredump: filesystem was mounted, but any subsequent operation failed: Unknown error 5005.
Error: failed to bind /var/lib/systemd/coredump to /run/host/var/lib/systemd/coredump


Expected results:
Being able to use the container

Comment 3 Debarshi Ray 2023-06-29 15:21:24 UTC
I apologize for the late response.  This one fell through the cracks.  Sorry about that.

> podman start --attach  almalinux-toolbox-8
> ...
> level=debug msg="Binding /var/lib/systemd/coredump to
>     /run/host/var/lib/systemd/coredump"
> mount: /var/lib/systemd/coredump: filesystem was mounted,
>     but any subsequent operation failed: Unknown error 5005.
> Error: failed to bind /var/lib/systemd/coredump to /run/host/var/lib/systemd/coredump

Thanks a lot for the `podman start` logs!  This is the all important line:
  mount: /var/lib/systemd/coredump: filesystem was mounted,
      but any subsequent operation failed: Unknown error 5005.

It's coming from the container's entry point attempting this inside it's mount and user namespace:

  # mount --rbind -o ro /run/host/var/lib/systemd/coredump
      /var/lib/systemd/coredump
  mount: /var/lib/systemd/coredump: filesystem was mounted,
      but any subsequent operation failed: Unknown error 5005.

Looking at the util-linux code [1] it becomes clear that 5005 is MNT_ERR_APPLYFLAGS.

I suspect that on the host /var/lib/systemd/coredump is mounted with some restricted flags beyond 'ro' (like 'nodev', 'nosuid', 'noexec', etc.), and the kernel is unhappy that they are not being used inside the container's mount and user namespace.  This wouldn't have failed if it was attempted inside the host's namespace.

[1] https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/

Comment 4 Debarshi Ray 2023-06-29 15:27:19 UTC
Christophe, could you please show me the results from:

  $ df --output=target /var/lib/systemd/coredump
  Mounted on
  <mount-point>

  $ findmnt --output OPTIONS,PROPAGATION <mount-point>
  OPTIONS       PROPAGATION
  ...           ...

Comment 5 Christophe GRENIER 2023-06-29 17:02:25 UTC
Yes, /var is using nosuid

Please find the requested information

$ rpm -q toolbox
toolbox-0.0.99.3-7.module_el8.8.0+3470+252b1910.x86_64
$ df --output=target /var/lib/systemd/coredump
Mounted on
/var
$ findmnt --output OPTIONS,PROPAGATION /var
OPTIONS                    PROPAGATION
rw,nosuid,noatime,seclabel shared

Comment 6 Debarshi Ray 2023-07-13 10:50:30 UTC
For what it's worth, I sent a pull request to get mount(8) to show a better error message:
https://github.com/util-linux/util-linux/pull/2376

Comment 7 Debarshi Ray 2023-07-13 13:10:27 UTC
Toolbx pull request: https://github.com/containers/toolbox/pull/1340

Comment 9 Debarshi Ray 2023-07-13 17:50:04 UTC
(In reply to Debarshi Ray from comment #7)
> Toolbx pull request: https://github.com/containers/toolbox/pull/1340

Christophe, would it be possible for you to test this pull request?  Thanks for your patience and persistence.

Comment 13 Christophe GRENIER 2023-07-15 17:08:26 UTC
Where can I found the RPM for this pull request for RHEL/CentOS 8 ?

Comment 15 Tomas Popela 2023-07-17 07:33:23 UTC
(In reply to Christophe GRENIER from comment #13)
> Where can I found the RPM for this pull request for RHEL/CentOS 8 ?

You should be able to get them in https://kojihub.stream.centos.org/koji/taskinfo?taskID=2488636 (please keep in mind that these are only test builds)

Comment 16 Christophe GRENIER 2023-07-17 09:20:23 UTC
Thanks. With the new rpm, "toolbox enter almalinux-toolbox-8" now works correctly.
I have also tested successfully
  toolbox create --image quay.io/toolbx-images/almalinux-toolbox:9
  toolbox enter almalinux-toolbox-9

Comment 18 Debarshi Ray 2023-08-11 16:20:36 UTC
Let's use this bug for the 'rolling' stream of the container-tools module in RHELL 8.  I filed bug 2231464 as the 4.0 stream counterpart.

Comment 25 errata-xmlrpc 2023-11-14 15:27:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: container-tools:rhel8 security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6939


Note You need to log in before you can comment on or make changes to this bug.