Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error on trying to run a simple RPC program

Tags:

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.

like image 854
arkiver Avatar asked May 04 '12 12:05

arkiver


3 Answers

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

like image 72
rekenerd Avatar answered Oct 02 '22 19:10

rekenerd


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.

like image 40
Muneeb Avatar answered Oct 02 '22 18:10

Muneeb


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.

like image 22
vleo Avatar answered Oct 02 '22 18:10

vleo