Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1427806

Summary: Rpcbind fails in the systemd container
Product: Red Hat Enterprise Linux 7 Reporter: Mohamed Ashiq <mliyazud>
Component: rpcbindAssignee: Steve Dickson <steved>
Status: CLOSED NOTABUG QA Contact: Filesystem QE <fs-qe>
Severity: urgent Docs Contact:
Priority: high    
Version: 7.3CC: amurdaca, dwalsh, eguan, hchiramm, jhonce, jiyin, julim, kramdoss, lsm5, mliyazud, pprakash, rcyriac, swhiteho, tsweeney, xzhou, yoyang, zlang
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-07 16:31:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1422090    
Attachments:
Description Flags
Strace without Enabling rpcbind on host
none
Strace after Enabling rpcbind on host none

Description Mohamed Ashiq 2017-03-01 09:48:47 UTC
Description of problem:
RPCBind is failing as rpcbind.socket in release rpcbind-0.2.0-38.el7.x86_64, explicitly binds to IP's port 111 on host. 
In previous release it was binding only on request.

Version-Release number of selected component (if applicable):
rpcbind-0.2.0-38.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
Start a systemd container with rpcbind enabled and --net=host.

Additional info:
We currently disable rpcbind in the container but we need rpcbind running inside the container for future releases.

Comment 2 Ju Lim 2017-03-01 15:49:18 UTC
This is part of the Container Native Storage (CNS) initiative for OpenShift.  rpcbind is needed in order for Gluster to provide NFS.  Note: NFS is a common use scenario for Gluster storage, and this rpcbind issue will need to be resolved in order for containerized Gluster to provide NFS capabilities.

Comment 3 Ju Lim 2017-03-10 15:31:41 UTC
Relates to Gluster BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1422090

Comment 4 Daniel Walsh 2017-03-10 16:00:07 UTC
What is the docker command you are using to start the rpcbind container?  Are you doing this in a --privileged container?

Comment 5 Mohamed Ashiq 2017-04-11 05:16:36 UTC
(In reply to Daniel Walsh from comment #4)
> What is the docker command you are using to start the rpcbind container? 
> Are you doing this in a --privileged container?

Yeah, we are using privileged and --net=host.

Comment 6 Daniel Walsh 2017-04-11 12:31:16 UTC
Can you strace the rpcbind to see what is failing?

Comment 7 Mohamed Ashiq 2017-06-15 08:00:45 UTC
Created attachment 1287946 [details]
Strace without Enabling rpcbind on host

Comment 8 Mohamed Ashiq 2017-06-15 08:01:19 UTC
Created attachment 1287947 [details]
Strace after Enabling rpcbind on host

Comment 10 Mohamed Ashiq 2017-06-15 08:07:18 UTC
(In reply to Daniel Walsh from comment #6)
> Can you strace the rpcbind to see what is failing?

Sorry for the delay. I have attached the requested.

Comment 11 Mohamed Ashiq 2017-06-15 08:59:47 UTC
# docker run -d -v /var/run/rpcbind.sock:/var/run/rpcbind.sock --privileged --net=host -v /sys/fs/cgroup:/sys/fs/cgroup:ro rpcbind-test
c8df62a911deef21129f2ea5a008e60fada3095b03eadd15959df55f2dfa437e


# docker exec -it c8df62a911deef21129f2ea5a008e60fada3095b03eadd15959df55f2dfa437e bash
rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"process_linux.go:75: starting setns process caused \\\"fork/exec /proc/self/exe: no such file or directory\\\"\"\n"

Comment 12 Daniel Walsh 2017-06-15 15:22:36 UTC
Tom can you take a look at this one?  Not sure what is going wrong with it.  But I would like to see if we can get this running  with oci-systemd-hook.  I think eliminating the mounting of /sys/fs/cgroup and the volume /sys/fs/cgroup inside of the image would be the first steps.

Comment 13 Tom Sweeney 2017-06-15 16:45:33 UTC
I'll see what I can do with it this afternoon.

Comment 14 Tom Sweeney 2017-06-16 21:58:00 UTC
Hi Mohamed,

I'd some trouble with using your Dockerfile from your example.  I'd to change the FROM to:

FROM rhel:7.3

I also had a little difficulty figuring out exactly what you were doing in your example in comment #9.  Below are the steps that I used with the latest and greatest oci-systemd-hook in play.  As Dan suggested, I also removed the '/sys/fs/cgroup:/sys/fs/cgroup:ro' parameter from your docker run command.

I think things are running ok, but again, I'm not 100% sure if I missed a step or I did something on the container that should have been done on the host.  If I've messed something up or you'd like me to test other twists, please let me know.


1)
# On Host
# systemctl disable rpcbind
Removed symlink /etc/systemd/system/sockets.target.wants/rpcbind.socket.
# systemctl disable rpcbind.socket
# docker run -d -v /tmp/rpcbind:/root:z --privileged --net=host rpcbind-test
# docker exec -it 69e24dd93f9e bash

# On Container
# systemctl start rpcbind                                                                                                                                
# systemctl start rpcbind.socket

2)
# On Host
# systemctl enable rpcbind
Created symlink from /etc/systemd/system/sockets.target.wants/rpcbind.socket to /usr/lib/systemd/system/rpcbind.socket.
# systemctl enable rpcbind.socket

#On Container
# systemctl status rpcbind
● rpcbind.service - RPC bind service
   Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; indirect; vendor preset: enabled)
   Active: active (running) since Fri 2017-06-16 21:45:08 UTC; 3min 43s ago
  Process: 67 ExecStart=/sbin/rpcbind -w $RPCBIND_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 68 (rpcbind)
   CGroup: /system.slice/docker-69e24dd93f9e302b2b6494288f3a9d4b8f6b67243f44261f337ac2d7443f1b52.scope/system.slice/rpcbind.service
           └─68 /sbin/rpcbind -w

Jun 16 21:45:08 rhelbz.localdomain systemd[1]: Starting RPC bind service...
Jun 16 21:45:08 rhelbz.localdomain systemd[1]: Started RPC bind service.

# systemctl status rpcbind.socket
● rpcbind.socket - RPCbind Server Activation Socket
   Loaded: loaded (/usr/lib/systemd/system/rpcbind.socket; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2017-06-16 21:43:19 UTC; 5min ago
   Listen: /var/run/rpcbind.sock (Stream)
           [::]:111 (Stream)
           0.0.0.0:111 (Stream)

Jun 16 21:43:19 rhelbz.localdomain systemd[1]: Listening on RPCbind Server Activation Socket.
Jun 16 21:43:19 rhelbz.localdomain systemd[1]: Starting RPCbind Server Activation Socket.

# journalctl -u rpcbind
-- Logs begin at Fri 2017-06-16 21:43:19 UTC, end at Fri 2017-06-16 21:45:11 UTC. --
Jun 16 21:45:08 rhelbz.localdomain systemd[1]: Starting RPC bind service...
Jun 16 21:45:08 rhelbz.localdomain systemd[1]: Started RPC bind service.

# journalctl -u rpcbind.socket
-- Logs begin at Fri 2017-06-16 21:43:19 UTC, end at Fri 2017-06-16 21:45:11 UTC. --
Jun 16 21:43:19 rhelbz.localdomain systemd[1]: Listening on RPCbind Server Activation Socket.
Jun 16 21:43:19 rhelbz.localdomain systemd[1]: Starting RPCbind Server Activation Socket.

Comment 15 Mohamed Ashiq 2017-06-27 13:32:41 UTC
(In reply to Tom Sweeney from comment #14)
> Hi Mohamed,
> 
> I'd some trouble with using your Dockerfile from your example.  I'd to
> change the FROM to:
> 
> FROM rhel:7.3
> 
> I also had a little difficulty figuring out exactly what you were doing in
> your example in comment #9.  Below are the steps that I used with the latest
> and greatest oci-systemd-hook in play.  As Dan suggested, I also removed the
> '/sys/fs/cgroup:/sys/fs/cgroup:ro' parameter from your docker run command.
> 
> I think things are running ok, but again, I'm not 100% sure if I missed a
> step or I did something on the container that should have been done on the
> host.  If I've messed something up or you'd like me to test other twists,
> please let me know.
> 
> 
> 1)
> # On Host
> # systemctl disable rpcbind
> Removed symlink /etc/systemd/system/sockets.target.wants/rpcbind.socket.
> # systemctl disable rpcbind.socket
> # docker run -d -v /tmp/rpcbind:/root:z --privileged --net=host rpcbind-test
> # docker exec -it 69e24dd93f9e bash
> 
> # On Container
> # systemctl start rpcbind                                                   
> 
This should have been started as per my testing too.

> # systemctl start rpcbind.socket
> 
> 2)
> # On Host
> # systemctl enable rpcbind
> Created symlink from /etc/systemd/system/sockets.target.wants/rpcbind.socket
> to /usr/lib/systemd/system/rpcbind.socket.
> # systemctl enable rpcbind.socket
> 
enable does not start the rpcbind right? can you try rpcbind start? then try to start in the container.

> #On Container
> # systemctl status rpcbind
> ● rpcbind.service - RPC bind service
>    Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; indirect; vendor
> preset: enabled)
>    Active: active (running) since Fri 2017-06-16 21:45:08 UTC; 3min 43s ago
>   Process: 67 ExecStart=/sbin/rpcbind -w $RPCBIND_ARGS (code=exited,
> status=0/SUCCESS)
>  Main PID: 68 (rpcbind)
>    CGroup:
> /system.slice/docker-
> 69e24dd93f9e302b2b6494288f3a9d4b8f6b67243f44261f337ac2d7443f1b52.scope/
> system.slice/rpcbind.service
>            └─68 /sbin/rpcbind -w
> 
> Jun 16 21:45:08 rhelbz.localdomain systemd[1]: Starting RPC bind service...
> Jun 16 21:45:08 rhelbz.localdomain systemd[1]: Started RPC bind service.
> 
> # systemctl status rpcbind.socket
> ● rpcbind.socket - RPCbind Server Activation Socket
>    Loaded: loaded (/usr/lib/systemd/system/rpcbind.socket; enabled; vendor
> preset: enabled)
>    Active: active (running) since Fri 2017-06-16 21:43:19 UTC; 5min ago
>    Listen: /var/run/rpcbind.sock (Stream)
>            [::]:111 (Stream)
>            0.0.0.0:111 (Stream)
> 
> Jun 16 21:43:19 rhelbz.localdomain systemd[1]: Listening on RPCbind Server
> Activation Socket.
> Jun 16 21:43:19 rhelbz.localdomain systemd[1]: Starting RPCbind Server
> Activation Socket.
> 
> # journalctl -u rpcbind
> -- Logs begin at Fri 2017-06-16 21:43:19 UTC, end at Fri 2017-06-16 21:45:11
> UTC. --
> Jun 16 21:45:08 rhelbz.localdomain systemd[1]: Starting RPC bind service...
> Jun 16 21:45:08 rhelbz.localdomain systemd[1]: Started RPC bind service.
> 
> # journalctl -u rpcbind.socket
> -- Logs begin at Fri 2017-06-16 21:43:19 UTC, end at Fri 2017-06-16 21:45:11
> UTC. --
> Jun 16 21:43:19 rhelbz.localdomain systemd[1]: Listening on RPCbind Server
> Activation Socket.
> Jun 16 21:43:19 rhelbz.localdomain systemd[1]: Starting RPCbind Server
> Activation Socket.

Comment 16 Tom Sweeney 2017-06-29 23:47:30 UTC
(In reply to Tom Sweeney from comment #14)
> Hi Mohamed,
> 
> I'd some trouble with using your Dockerfile from your example.  I'd to
> change the FROM to:
> 
> FROM rhel:7.3
> 
> I also had a little difficulty figuring out exactly what you were doing in
> your example in comment #9.  Below are the steps that I used with the latest
> and greatest oci-systemd-hook in play.  As Dan suggested, I also removed the
> '/sys/fs/cgroup:/sys/fs/cgroup:ro' parameter from your docker run command.
> 
> I think things are running ok, but again, I'm not 100% sure if I missed a
> step or I did something on the container that should have been done on the
> host.  If I've messed something up or you'd like me to test other twists,
> please let me know.
> 
> 
> 1)
> # On Host
> # systemctl disable rpcbind
> Removed symlink /etc/systemd/system/sockets.target.wants/rpcbind.socket.
> # systemctl disable rpcbind.socket
  # docker build -t rpcbind-test . #Didn't include this is previous reply.
> # docker run -d -v /tmp/rpcbind:/root:z --privileged --net=host rpcbind-test
> # docker exec -it 69e24dd93f9e bash
> 
> # On Container
> # systemctl start rpcbind                                                   
> 
>This should have been started as per my testing too.

Thanks for the verification.

> # systemctl start rpcbind.socket
> 
> 2)
> # On Host
> # systemctl enable rpcbind
> Created symlink from /etc/systemd/system/sockets.target.wants/rpcbind.socket
> to /usr/lib/systemd/system/rpcbind.socket.
> # systemctl enable rpcbind.socket
> 
>enable does not start the rpcbind right? can you try rpcbind start? then try to start in the container.

On the host I did this:
# systemctl enable rpcbind
# systemctl enable rpcbind.socket
# systemctl start rpcbind
# systemctl start rpcbind.socket

and I received a failure on the start.  journalctl 

Jun 29 19:37:26 rhelbz.localdomain systemd[1]: Starting RPCbind Server Activation Socket.
-- Subject: Unit rpcbind.socket has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rpcbind.socket has begun starting up.
Jun 29 19:37:26 rhelbz.localdomain polkitd[654]: Unregistered Authentication Agent for unix-process:5082:924233 (system bus name :1.150, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.utf8) (disconnected from bus)
Jun 29 19:40:01 rhelbz.localdomain systemd[1]: Started Session 22 of user root.
-- Subject: Unit session-22.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit session-22.scope has finished starting up.
-- 
-- The start-up result is done.


If I stop rpcbind and rpcbind.socket in the container and then try again on the host it starts right up.  At this point if I try to start them again in the container, it fails there and I see this error in the journalctl

-- Unit rpcbind.socket has begun shutting down.
Jun 29 23:42:34 rhelbz.localdomain systemd[1]: Cannot add dependency job for unit sys-fs-fuse-connections.mount, ignoring: Unit is masked.
Jun 29 23:42:35 rhelbz.localdomain systemd[1]: rpcbind.socket failed to listen on sockets: Address already in use
Jun 29 23:42:35 rhelbz.localdomain systemd[1]: Failed to listen on RPCbind Server Activation Socket.
-- Subject: Unit rpcbind.socket has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rpcbind.socket has failed.
-- 
-- The result is failed.
Jun 29 23:42:35 rhelbz.localdomain systemd[1]: Dependency failed for RPC bind service.
-- Subject: Unit rpcbind.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rpcbind.service has failed.
-- 
-- The result is dependency.

So is this the behaviour that you were seeing and were concerned about Mohamed?  It does look like the rpcbind on both the host and the container are trying to bind on the same socket.  Dan any thoughts/suggestions?  I'll chase this further but as a heads up I'll be out next week on PTO and might not make progress on this until after I return.



> #On Container
> # systemctl status rpcbind
> ● rpcbind.service - RPC bind service
>    Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; indirect; vendor
> preset: enabled)
>    Active: active (running) since Fri 2017-06-16 21:45:08 UTC; 3min 43s ago
>   Process: 67 ExecStart=/sbin/rpcbind -w $RPCBIND_ARGS (code=exited,
> status=0/SUCCESS)
>  Main PID: 68 (rpcbind)
>    CGroup:
> /system.slice/docker-
> 69e24dd93f9e302b2b6494288f3a9d4b8f6b67243f44261f337ac2d7443f1b52.scope/
> system.slice/rpcbind.service
>            └─68 /sbin/rpcbind -w
> 
> Jun 16 21:45:08 rhelbz.localdomain systemd[1]: Starting RPC bind service...
> Jun 16 21:45:08 rhelbz.localdomain systemd[1]: Started RPC bind service.
> 
> # systemctl status rpcbind.socket
> ● rpcbind.socket - RPCbind Server Activation Socket
>    Loaded: loaded (/usr/lib/systemd/system/rpcbind.socket; enabled; vendor
> preset: enabled)
>    Active: active (running) since Fri 2017-06-16 21:43:19 UTC; 5min ago
>    Listen: /var/run/rpcbind.sock (Stream)
>            [::]:111 (Stream)
>            0.0.0.0:111 (Stream)
> 
> Jun 16 21:43:19 rhelbz.localdomain systemd[1]: Listening on RPCbind Server
> Activation Socket.
> Jun 16 21:43:19 rhelbz.localdomain systemd[1]: Starting RPCbind Server
> Activation Socket.
> 
> # journalctl -u rpcbind
> -- Logs begin at Fri 2017-06-16 21:43:19 UTC, end at Fri 2017-06-16 21:45:11
> UTC. --
> Jun 16 21:45:08 rhelbz.localdomain systemd[1]: Starting RPC bind service...
> Jun 16 21:45:08 rhelbz.localdomain systemd[1]: Started RPC bind service.
> 
> # journalctl -u rpcbind.socket
> -- Logs begin at Fri 2017-06-16 21:43:19 UTC, end at Fri 2017-06-16 21:45:11
> UTC. --
> Jun 16 21:43:19 rhelbz.localdomain systemd[1]: Listening on RPCbind Server
> Activation Socket.
> Jun 16 21:43:19 rhelbz.localdomain systemd[1]: Starting RPCbind Server
> Activation Socket.

Comment 17 Daniel Walsh 2017-06-30 15:31:31 UTC
Is this still our issue or an issue with rpcbind?

Comment 18 Tom Sweeney 2017-06-30 16:55:00 UTC
I'm not 100% sure, but I think this is an rpcbind issue, not ours.  In short rpcbind can only start up in a container if it is not already started on the host and vice versa.  It would be good to have one of the rpcbind folks take a look at this to weigh in if there's an issue.

Comment 19 Daniel Walsh 2017-07-02 10:17:10 UTC
That does not sound like a bug to me, since there is only one NFS system, on a host.  rpcbind is probably tied to the kernel and having two managing the same kernel is likely to cause conflicts.  But i have changed the ownership to see if they have better ideas.

Comment 20 Mohamed Ashiq 2017-07-14 08:04:09 UTC
Is there a way we can use rpcbind inside the container environment? 
Our process depends on the rpcbind and if it started on the host it doesn't start in container(I understand this is by design). 
Is there any way around? or some option that we can use?

Stopping the rpcbind.socket on host doesn't seem to solve the problem when I start the container I see the rpcbind.socket being triggered on the host.

It would be really helpful If can make this work.

Thanks,
Mohamed Ashiq

Comment 21 Mohamed Ashiq 2017-07-14 08:30:49 UTC
(In reply to Daniel Walsh from comment #19)
> That does not sound like a bug to me, since there is only one NFS system, on
> a host.  rpcbind is probably tied to the kernel and having two managing the
> same kernel is likely to cause conflicts.  But i have changed the ownership
> to see if they have better ideas.

Thanks for the update. I am able to use rpcbind of host in the container. The problem was having the service depend on the rpcbind process. I removed the requires from service file of my package then It worked fine. able to use the service from container to bind to a port. Thanks a lot for the updates and responses.

Thanks,
Ashiq.

Comment 22 Tom Sweeney 2017-07-14 11:42:07 UTC
Hi Mohamed,

You should be able to use rpcbind inside the container as long as it is not also running on the host that the container is on.  To do this, this should work for you:

# cat Dockerfile 
FROM rhel:7.3

ENV container docker

RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

RUN yum-config-manager --add=http://pulp-read.dist.stage.ext.phx2.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os/

RUN yum --nogpgcheck -y update; yum install -y strace rpcbind; yum clean all;

VOLUME [ "/sys/fs/cgroup/" ]

RUN rpm -e gpg-pubkey-2fa658e0-45700c69
RUN rpm -e gpg-pubkey-fd431d51-4ae0493b

RUN systemctl enable rpcbind.service

CMD ["/usr/sbin/init"]



> 1)
> # On Host
> # systemctl disable rpcbind
> Removed symlink /etc/systemd/system/sockets.target.wants/rpcbind.socket.
> # systemctl disable rpcbind.socket
  # docker build -t rpcbind-test . #Didn't include this is previous reply.
> # docker run -d -v /tmp/rpcbind:/root:z --privileged --net=host rpcbind-test
> # docker exec -it 69e24dd93f9e bash
> 
> # On Container
> # systemctl start rpcbind   


Based on your last response I think you've cobbled stuff together and have it working as you wanted.  If so, please close this bugzilla.  

Thanks for the updates!

Comment 23 Daniel Walsh 2017-07-14 11:56:59 UTC
I would also state that obviously you can only run 1 rpcbind on with the host network...

I am not sure what would happen if you ran multiple rpmcbinds with different networks, but I am pretty sure NFS would not like it.