Error on trying to run a simple RPC program

27,794

Solution 1

First you check that portmapper is working or not, use rpcinfo to check it. If you get any error then install portmap

Solution 2

Check whether the service is running using rpcinfo. Here's what I get.

$ rpcinfo 
   program version netid     address                service    owner
    100000    4    tcp6      ::.0.111               portmapper superuser
    100000    3    tcp6      ::.0.111               portmapper superuser
    100000    4    udp6      ::.0.111               portmapper superuser
    100000    3    udp6      ::.0.111               portmapper superuser
    100000    4    tcp       0.0.0.0.0.111          portmapper superuser
    100000    3    tcp       0.0.0.0.0.111          portmapper superuser
    100000    2    tcp       0.0.0.0.0.111          portmapper superuser
    100000    4    udp       0.0.0.0.0.111          portmapper superuser
    100000    3    udp       0.0.0.0.0.111          portmapper superuser
    100000    2    udp       0.0.0.0.0.111          portmapper superuser
    100000    4    local     /run/rpcbind.sock      portmapper superuser
    100000    3    local     /run/rpcbind.sock      portmapper superuser
        24    5    udp       0.0.0.0.3.99           -          superuser
        24    5    tcp       0.0.0.0.3.100          -          superuser

If the service is not running, you have to start it with rpcbind. On Ubuntu I needed root privileges to run the service.

Solution 3

There is a bug/feature in recent Linux releases of rpcbind - it is now not active/running after system boot, but should somehow be "socket activated" according to systemctl configuration rpcbind.service file in /usr/lib/systemd/system/:

[Install] 
Also=rpcbind.socket

Check this thread on same bug/feature caused Ubuntu issues (https://bugs.launchpad.net/ubuntu/+source/rpcbind/+bug/1558196).

The short answer to yours (ours) issue with rpcbind is - in order to run the RPC server code, do this amendment to systemctrl configuration of your system:

sudo systemctl add-wants multi-user.target rpcbind

Now, the intended way to set rpcbind running is to somehow access /var/run/rpcbind.sock, I would owe much to some Unix/Linux guru that may enlighten me on what RPC server application code shall do in order to achieve this rpcbind "socket activation" effect.

Solution 4

The problem arises due to unavailability of utility like portmap or rpcbind. Install either of them to solve the problem.

Solution 5

How to install rpcgen

Type this command on the terminal.

sudo apt-get install rpcbind

but at sometimes the above code won't help you to install rpcgen.

enter image description here

At that time you have to follow these steps.Then you can easily install it. you should follow this step by step

sudo apt-get update  
sudo apt-get install rpcbind

Finally you can check it by using this command rpcinfo

enter image description here

Share:
27,794
arkiver
Author by

arkiver

just another g33k.

Updated on July 09, 2022

Comments

  • arkiver
    arkiver almost 2 years

    I am trying to run a simple RPC program which I have created using rpcgen. Its a simple factorial program. This is my first RPC program. The make works fine.Executables are also created. But when trying to run the executables, I get this error:

    $sudo ./fact_server 
    Cannot register service: RPC: Unable to receive; errno = Connection refused
    unable to register (FACTPROGRAM, FACTVERSION, udp).
    

    I tried running the same program on another pc with the same OS (ubuntu). It runs perfect there.

  • serup
    serup over 7 years
    I had this issue after restart and your last line helped - thanks
  • vleo
    vleo about 7 years
    @serup: You mean 'sudo systemctl .... ' line? Since my very last paragraph is a question, I don't know the answer to still. How to achieve that 'socket activation' - since trying to use rpc service does not do it.
  • serup
    serup about 7 years
    yes after running last line and restart of system, then issues where gone
  • Hami
    Hami over 4 years
    Welcome ot stackoverflow! Are you sure this will help? It seems the person already marked another answer as accepted about 8 years ago.
  • Ali
    Ali over 4 years
    Yeah. sure. Because, this way will deviate without relying on rpcbind. You can easily try out this by stopping the rcpbind or uninstalling the rcpbind
  • Hami
    Hami over 4 years
    Okay, I have no experience at all, just wanted to to have a bit more information on your answer :) Thanks!
  • Ali
    Ali about 4 years